tailwind-merge 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +41 -21
  2. package/dist/_virtual/_rollupPluginBabelHelpers.mjs +40 -3
  3. package/dist/_virtual/_rollupPluginBabelHelpers.mjs.map +1 -1
  4. package/dist/lib/class-utils.d.ts +1 -1
  5. package/dist/lib/class-utils.mjs +7 -7
  6. package/dist/lib/class-utils.mjs.map +1 -1
  7. package/dist/lib/config-utils.d.ts +1 -1
  8. package/dist/lib/config-utils.mjs.map +1 -1
  9. package/dist/lib/create-tailwind-merge.mjs.map +1 -1
  10. package/dist/lib/default-config.d.ts +28 -5
  11. package/dist/lib/default-config.mjs +31 -4
  12. package/dist/lib/default-config.mjs.map +1 -1
  13. package/dist/lib/extend-tailwind-merge.mjs.map +1 -1
  14. package/dist/lib/from-theme.mjs.map +1 -1
  15. package/dist/lib/lru-cache.d.ts +4 -4
  16. package/dist/lib/lru-cache.mjs +41 -7
  17. package/dist/lib/lru-cache.mjs.map +1 -1
  18. package/dist/lib/merge-classlist.mjs +74 -17
  19. package/dist/lib/merge-classlist.mjs.map +1 -1
  20. package/dist/lib/merge-configs.mjs.map +1 -1
  21. package/dist/lib/validators.mjs +1 -1
  22. package/dist/lib/validators.mjs.map +1 -1
  23. package/dist/tailwind-merge.cjs.development.js +192 -43
  24. package/dist/tailwind-merge.cjs.development.js.map +1 -1
  25. package/dist/tailwind-merge.cjs.production.min.js +1 -1
  26. package/dist/tailwind-merge.cjs.production.min.js.map +1 -1
  27. package/dist/{index.mjs → tailwind-merge.mjs} +1 -1
  28. package/dist/tailwind-merge.mjs.map +1 -0
  29. package/package.json +21 -23
  30. package/src/lib/class-utils.ts +8 -8
  31. package/src/lib/config-utils.ts +1 -1
  32. package/src/lib/default-config.ts +22 -3
  33. package/src/lib/lru-cache.ts +43 -10
  34. package/src/lib/merge-classlist.ts +74 -24
  35. package/src/lib/validators.ts +1 -1
  36. package/dist/index.mjs.map +0 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <div align="center">
2
2
  <br />
3
3
  <a href="https://github.com/dcastil/tailwind-merge">
4
- <!-- AUTOGENERATED START logo-image --><img src="https://github.com/dcastil/tailwind-merge/raw/v1.2.0/assets/logo.svg" alt="tailwind-merge" width="221px" /><!-- AUTOGENERATED END -->
4
+ <!-- AUTOGENERATED VERSION START --><img src="https://github.com/dcastil/tailwind-merge/raw/v1.4.0/assets/logo.svg" alt="tailwind-merge" width="221px" /><!-- AUTOGENERATED END -->
5
5
  </a>
6
6
  </div>
7
7
 
@@ -16,7 +16,7 @@ twMerge('px-2 py-1 bg-red hover:bg-dark-red', 'p-3 bg-[#B91C1C]')
16
16
  // → 'hover:bg-dark-red p-3 bg-[#B91C1C]'
17
17
  ```
18
18
 
19
- - Supports Tailwind v3.0 (if you use Tailwind v2, use [tailwind-merge v0.9.0](https://github.com/dcastil/tailwind-merge/tree/v0.9.0))
19
+ - Supports Tailwind v3.0 up to v3.1 (if you use Tailwind v2, use [tailwind-merge v0.9.0](https://github.com/dcastil/tailwind-merge/tree/v0.9.0))
20
20
  - Works in Node >=12 and all modern browsers
21
21
  - Fully typed
22
22
  - [Check bundle size on Bundlephobia](https://bundlephobia.com/package/tailwind-merge)
@@ -114,6 +114,19 @@ twMerge('[padding:1rem] p-8') // → '[padding:1rem] p-8'
114
114
 
115
115
  Watch out for mixing arbitrary properties which could be expressed as Tailwind classes. tailwind-merge does not resolve conflicts between arbitrary properties and their matching Tailwind classes to keep the bundle size small.
116
116
 
117
+ ### Supports arbitrary variants
118
+
119
+ ```ts
120
+ twMerge('[&:nth-child(3)]:py-0 [&:nth-child(3)]:py-4') // → '[&:nth-child(3)]:py-4'
121
+ twMerge('dark:hover:[&:nth-child(3)]:py-0 hover:dark:[&:nth-child(3)]:py-4')
122
+ // → 'hover:dark:[&:nth-child(3)]:py-4'
123
+
124
+ // Don't do this!
125
+ twMerge('[&:focus]:ring focus:ring-4') // → '[&:focus]:ring focus:ring-4'
126
+ ```
127
+
128
+ Similarly to arbitrary properties, tailwind-merge does not resolve conflicts between arbitrary variants and their matching predefined modifiers for bundle size reasons.
129
+
117
130
  ### Supports important modifier
118
131
 
119
132
  ```ts
@@ -147,14 +160,14 @@ If you're using Tailwind CSS without any extra config, you can use [`twMerge`](#
147
160
 
148
161
  If you're using a custom Tailwind config, you may need to configure tailwind-merge as well to merge classes properly.
149
162
 
150
- The default [`twMerge`](#twmerge) function is configured in a way that you can still use it if all of the following points apply to your Tailwind config:
163
+ The default [`twMerge`](#twmerge) function is configured in a way that you can still use it if all the following points apply to your Tailwind config:
151
164
 
152
165
  - Only using color names which don't clash with other Tailwind class names
153
166
  - Only deviating by number values from number-based Tailwind classes
154
167
  - Only using font-family classes which don't clash with default font-weight classes
155
168
  - Sticking to default Tailwind config for everything else
156
169
 
157
- If some of these points don't apply to you, you can test whether `twMerge` still works as intended with your custom classes. Otherwise you need create your own custom merge function by either extending the default tailwind-merge config or using a completely custom one.
170
+ If some of these points don't apply to you, you can test whether `twMerge` still works as intended with your custom classes. Otherwise, you need create your own custom merge function by either extending the default tailwind-merge config or using a completely custom one.
158
171
 
159
172
  The tailwind-merge config is different from the Tailwind config because it's expected to be shipped and run in the browser as opposed to the Tailwind config which is meant to run at build-time. Be careful in case you're using your Tailwind config directly to configure tailwind-merge in your client-side code because that could result in an unnecessarily large bundle size.
160
173
 
@@ -176,7 +189,7 @@ const tailwindMergeConfig = {
176
189
  // Class groups are defined here
177
190
  },
178
191
  conflictingClassGroups: {
179
- // Conflcits between class groups are defined here
192
+ // Conflicts between class groups are defined here
180
193
  },
181
194
  }
182
195
  ```
@@ -214,14 +227,14 @@ const fillClassGroup = [{ fill: ['current', isArbitraryValue] }]
214
227
 
215
228
  Because the function is under the `fill` key, it will only get called for classes which start with `fill-`. Also, the function only gets passed the part of the class name which comes after `fill-`, this way you can use the same function in multiple class groups. tailwind-merge exports its own [validators](#validators), so you don't need to recreate them.
216
229
 
217
- You can use am empty string (`''`) as a class part if you want to indicate that the preceding part was the end. This is useful for defining elements which are marked as `DEFAULT` in the Tailwind config.
230
+ You can use an empty string (`''`) as a class part if you want to indicate that the preceding part was the end. This is useful for defining elements which are marked as `DEFAULT` in the Tailwind config.
218
231
 
219
232
  ```ts
220
233
  // ↓ Resolves to filter and filter-none
221
234
  const filterClassGroup = [{ filter: ['', 'none'] }]
222
235
  ```
223
236
 
224
- Each class group is defined under its ID in the `classGroups` object in the config. This ID is only used internally and the only thing that matters is that it is unique among all class groups.
237
+ Each class group is defined under its ID in the `classGroups` object in the config. This ID is only used internally, and the only thing that matters is that it is unique among all class groups.
225
238
 
226
239
  ### Conflicting class groups
227
240
 
@@ -233,7 +246,7 @@ If they are passed to `twMerge` as `pr-4 px-3`, I think you most likely intend t
233
246
 
234
247
  But if they are passed to `twMerge` as `px-3 pr-4`, I assume you want to set the `padding-right` from `pr-4` but still want to apply the `padding-left` from `px-3`, so `px-3` shouldn't be removed when inserting the classes in this order, indicating they shouldn't be in the same class group.
235
248
 
236
- To summarize, `px-3` should stand in conflict with `pr-4`, but `pr-4` should not stand in conflict with `px-3`. to achieve this we need to define asymetric conflicts across class groups.
249
+ To summarize, `px-3` should stand in conflict with `pr-4`, but `pr-4` should not stand in conflict with `px-3`. To achieve this, we need to define asymmetric conflicts across class groups.
237
250
 
238
251
  This is what the `conflictingClassGroups` object in the tailwind-merge config is for. You define a key in it which is the ID of a class group which _creates_ a conflict and the value is an array of IDs of class group which _receive_ a conflict.
239
252
 
@@ -243,7 +256,7 @@ const conflictingClassGroups = {
243
256
  }
244
257
  ```
245
258
 
246
- If a class group _creates_ a conflict, it means that if it appears in a class list string passed to `twMerge`, all preceding class groups in the string which _rceive_ the conflict will be removed.
259
+ If a class group _creates_ a conflict, it means that if it appears in a class list string passed to `twMerge`, all preceding class groups in the string which _receive_ the conflict will be removed.
247
260
 
248
261
  When we think of our example, the `px` class group creates a conflict which is received by the class groups `pr` and `pl`. This way `px-3` removes a preceding `pr-4`, but not the other way around.
249
262
 
@@ -257,6 +270,7 @@ In the Tailwind config you can modify theme scales. tailwind-merge follows the s
257
270
  - `brightness`
258
271
  - `borderColor`
259
272
  - `borderRadius`
273
+ - `borderSpacing`
260
274
  - `borderWidth`
261
275
  - `contrast`
262
276
  - `grayscale`
@@ -279,7 +293,7 @@ If you modified one of these theme scales in your Tailwind config, you can add a
279
293
 
280
294
  ### Extending the tailwind-merge config
281
295
 
282
- If you only need to extend the default tailwind-merge config, [`extendTailwindMerge`](#extendtailwindmerge) is the easiest way to extend the config. You provide it a `configExtension` object which gets [merged](#mergeconfigs) with the default config. Therefore all keys here are optional.
296
+ If you only need to extend the default tailwind-merge config, [`extendTailwindMerge`](#extendtailwindmerge) is the easiest way to extend the config. You provide it a `configExtension` object which gets [merged](#mergeconfigs) with the default config. Therefore, all keys here are optional.
283
297
 
284
298
  ```ts
285
299
  import { extendTailwindMerge } from 'tailwind-merge'
@@ -374,7 +388,7 @@ function fromTheme(key: string): ThemeGetter
374
388
 
375
389
  Function to retrieve values from a theme scale, to be used in class groups.
376
390
 
377
- `fromTheme` doesn't return the values from the theme scale but rather another function which is used by tailwind-merge internally to retrieve the theme values. tailwind-merge can differentiate the theme getter function from a validator because it has a `isThemeGetter` property set to `true`.
391
+ `fromTheme` doesn't return the values from the theme scale, but rather another function which is used by tailwind-merge internally to retrieve the theme values. tailwind-merge can differentiate the theme getter function from a validator because it has a `isThemeGetter` property set to `true`.
378
392
 
379
393
  It can be used like this:
380
394
 
@@ -431,7 +445,7 @@ const customTwMerge = extendTailwindMerge({
431
445
  })
432
446
  ```
433
447
 
434
- Additionally you can pass multiple `createConfig` functions (more to that in [`createTailwindMerge`](#createtailwindmerge)) which is convenient if you want to combine your config with third-party plugins.
448
+ Additionally, you can pass multiple `createConfig` functions (more to that in [`createTailwindMerge`](#createtailwindmerge)) which is convenient if you want to combine your config with third-party plugins.
435
449
 
436
450
  ```ts
437
451
  const customTwMerge = extendTailwindMerge({ … }, withSomePlugin)
@@ -497,7 +511,7 @@ But don't merge configs like that. Use [`mergeConfigs`](#mergeconfigs) instead.
497
511
  function mergeConfigs(baseConfig: Config, configExtension: Partial<Config>): Config
498
512
  ```
499
513
 
500
- Helper function to merge multiple config objects. Objects are merged, arrays are concatenated, scalar values are overriden and `undefined` does nothing. The function assumes that both parameters are tailwind-merge config objects and shouldn't be used as a generic merge function.
514
+ Helper function to merge multiple config objects. Objects are merged, arrays are concatenated, scalar values are overridden and `undefined` does nothing. The function assumes that both parameters are tailwind-merge config objects and shouldn't be used as a generic merge function.
501
515
 
502
516
  ```ts
503
517
  const customTwMerge = createTailwindMerge(getDefaultConfig, (config) =>
@@ -543,12 +557,12 @@ A brief summary for each validator:
543
557
  - `isInteger` checks for integer values (`3`) and arbitrary integer values (`[3]`).
544
558
  - `isArbitraryValue` checks whether the class part is enclosed in brackets (`[something]`)
545
559
  - `isTshirtSize`checks whether class part is a T-shirt size (`sm`, `xl`), optionally with a preceding number (`2xl`).
546
- - `isArbitrarySize` checks whether class part is arbitrary value which starts with with `size:` (`[size:200px_100px]`) which is necessary for background-size classNames.
547
- - `isArbitraryPosition` checks whether class part is arbitrary value which starts with with `position:` (`[position:200px_100px]`) which is necessary for background-position classNames.
548
- - `isArbitraryUrl` checks whether class part is arbitrary value which starts with `url:` or `url(` (`[url('/path-to-image.png')]`, `url:var(--maybe-a-url-at-runtime)]`) which is necessary for background-image classNames.
549
- - `isArbitraryWeight` checks whether class part is arbitrary value whcih starts with `weight:` or is a number (`[weight:var(--value)]`, `[450]`) which is necessary for font-weight classNames.
550
- - `isArbitraryShadow` checks whether class part is arbitrary value which starts with the same pattern as a shadow value (`[0_35px_60px_-15px_rgba(0,0,0,0.3)]`), namely with two lengths separated by a underscore.
551
- - `isAny` always returns true. Be careful with this validator as it might match unwanted classes. I use it primarily to match colors or when I'm ceertain there are no other class groups in a namespace.
560
+ - `isArbitrarySize` checks whether class part is an arbitrary value which starts with `size:` (`[size:200px_100px]`) which is necessary for background-size classNames.
561
+ - `isArbitraryPosition` checks whether class part is an arbitrary value which starts with `position:` (`[position:200px_100px]`) which is necessary for background-position classNames.
562
+ - `isArbitraryUrl` checks whether class part is an arbitrary value which starts with `url:` or `url(` (`[url('/path-to-image.png')]`, `url:var(--maybe-a-url-at-runtime)]`) which is necessary for background-image classNames.
563
+ - `isArbitraryWeight` checks whether class part is an arbitrary value which starts with `number:` or is a number (`[number:var(--value)]`, `[450]`) which is necessary for font-weight classNames.
564
+ - `isArbitraryShadow` checks whether class part is an arbitrary value which starts with the same pattern as a shadow value (`[0_35px_60px_-15px_rgba(0,0,0,0.3)]`), namely with two lengths separated by a underscore.
565
+ - `isAny` always returns true. Be careful with this validator as it might match unwanted classes. I use it primarily to match colors or when I'm certain there are no other class groups in a namespace.
552
566
 
553
567
  ### `Config`
554
568
 
@@ -590,13 +604,13 @@ import { withMagic } from 'tailwind-merge-magic-plugin'
590
604
  const twMerge = extendTailwindMerge(withMagic)
591
605
  ```
592
606
 
593
- Also feel free to check out [tailwind-merge-rtl-plugin](https://github.com/vltansky/tailwind-merge-rtl-plugin) as a real example of a tailwind-merge plugin.
607
+ Also, feel free to check out [tailwind-merge-rtl-plugin](https://github.com/vltansky/tailwind-merge-rtl-plugin) as a real example of a tailwind-merge plugin.
594
608
 
595
609
  ## Versioning
596
610
 
597
611
  This package follows the [SemVer](https://semver.org) versioning rules. More specifically:
598
612
 
599
- - Patch version gets incremented when unintended behaviour is fixed which doesn't break any existing API. Note that bug fixes can still alter which styles are applied. E.g. a bug gets fixed in which the conflicting classes `inline` and `block` weren't merged correctly so that both would end up in the result.
613
+ - Patch version gets incremented when unintended behavior is fixed, which doesn't break any existing API. Note that bug fixes can still alter which styles are applied. E.g. a bug gets fixed in which the conflicting classes `inline` and `block` weren't merged correctly so that both would end up in the result.
600
614
 
601
615
  - Minor version gets incremented when additional features are added which don't break any existing API. However, a minor version update might still alter which styles are applied if you use Tailwind features not yet supported by tailwind-merge. E.g. a new Tailwind prefix `magic` gets added to this package which changes the result of `twMerge('magic:px-1 magic:p-3')` from `magic:px-1 magic:p-3` to `magic:p-3`.
602
616
 
@@ -606,4 +620,10 @@ This package follows the [SemVer](https://semver.org) versioning rules. More spe
606
620
 
607
621
  - Releases with major version 0 might introduce breaking changes on a minor version update.
608
622
 
623
+ - A non-production-ready version of every commit pushed to the main branch is released under the `dev` tag for testing purposes. It has the format `0.0.0-dev.<git SHA>`.
624
+
609
625
  - A changelog is documented in [GitHub Releases](https://github.com/dcastil/tailwind-merge/releases).
626
+
627
+ ## Contributing
628
+
629
+ Please see <!-- AUTOGENERATED VERSION START -->[CONTRIBUTING](https://github.com/dcastil/tailwind-merge/tree/v1.4.0/.github/CONTRIBUTING.md)<!-- AUTOGENERATED END --> for details.
@@ -1,5 +1,5 @@
1
1
  function _extends() {
2
- _extends = Object.assign || function (target) {
2
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
3
3
  for (var i = 1; i < arguments.length; i++) {
4
4
  var source = arguments[i];
5
5
 
@@ -12,9 +12,46 @@ function _extends() {
12
12
 
13
13
  return target;
14
14
  };
15
-
16
15
  return _extends.apply(this, arguments);
17
16
  }
18
17
 
19
- export { _extends as extends };
18
+ function _unsupportedIterableToArray(o, minLen) {
19
+ if (!o) return;
20
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
21
+ var n = Object.prototype.toString.call(o).slice(8, -1);
22
+ if (n === "Object" && o.constructor) n = o.constructor.name;
23
+ if (n === "Map" || n === "Set") return Array.from(o);
24
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
25
+ }
26
+
27
+ function _arrayLikeToArray(arr, len) {
28
+ if (len == null || len > arr.length) len = arr.length;
29
+
30
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
31
+
32
+ return arr2;
33
+ }
34
+
35
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
36
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
37
+ if (it) return (it = it.call(o)).next.bind(it);
38
+
39
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
40
+ if (it) o = it;
41
+ var i = 0;
42
+ return function () {
43
+ if (i >= o.length) return {
44
+ done: true
45
+ };
46
+ return {
47
+ done: false,
48
+ value: o[i++]
49
+ };
50
+ };
51
+ }
52
+
53
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
54
+ }
55
+
56
+ export { _arrayLikeToArray as arrayLikeToArray, _createForOfIteratorHelperLoose as createForOfIteratorHelperLoose, _extends as extends, _unsupportedIterableToArray as unsupportedIterableToArray };
20
57
  //# sourceMappingURL=_rollupPluginBabelHelpers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"_rollupPluginBabelHelpers.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"_rollupPluginBabelHelpers.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { ClassGroupId, Config, ClassValidator } from './types';
2
2
  export interface ClassPartObject {
3
- nextPart: Record<string, ClassPartObject>;
3
+ nextPart: Map<string, ClassPartObject>;
4
4
  validators: ClassValidatorObject[];
5
5
  classGroupId?: ClassGroupId;
6
6
  }
@@ -30,7 +30,7 @@ function getGroupRecursive(classParts, classPartObject) {
30
30
  }
31
31
 
32
32
  var currentClassPart = classParts[0];
33
- var nextClassPartObject = classPartObject.nextPart[currentClassPart];
33
+ var nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
34
34
  var classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : undefined;
35
35
 
36
36
  if (classGroupFromNextClassPart) {
@@ -70,7 +70,7 @@ function createClassMap(config) {
70
70
  var theme = config.theme,
71
71
  prefix = config.prefix;
72
72
  var classMap = {
73
- nextPart: {},
73
+ nextPart: new Map(),
74
74
  validators: []
75
75
  };
76
76
  var prefixedClassGroupEntries = getPrefixedClassGroupEntries(Object.entries(config.classGroups), prefix);
@@ -114,14 +114,14 @@ function processClassesRecursively(classGroup, classPartObject, classGroupId, th
114
114
  function getPart(classPartObject, path) {
115
115
  var currentClassPartObject = classPartObject;
116
116
  path.split(CLASS_PART_SEPARATOR).forEach(function (pathPart) {
117
- if (currentClassPartObject.nextPart[pathPart] === undefined) {
118
- currentClassPartObject.nextPart[pathPart] = {
119
- nextPart: {},
117
+ if (!currentClassPartObject.nextPart.has(pathPart)) {
118
+ currentClassPartObject.nextPart.set(pathPart, {
119
+ nextPart: new Map(),
120
120
  validators: []
121
- };
121
+ });
122
122
  }
123
123
 
124
- currentClassPartObject = currentClassPartObject.nextPart[pathPart];
124
+ currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
125
125
  });
126
126
  return currentClassPartObject;
127
127
  }
@@ -1 +1 @@
1
- {"version":3,"file":"class-utils.mjs","sources":["../../src/lib/class-utils.ts"],"sourcesContent":["import { ClassGroupId, Config, ClassGroup, ClassValidator, ThemeObject, ThemeGetter } from './types'\n\nexport interface ClassPartObject {\n nextPart: Record<string, ClassPartObject>\n validators: ClassValidatorObject[]\n classGroupId?: ClassGroupId\n}\n\ninterface ClassValidatorObject {\n classGroupId: ClassGroupId\n validator: ClassValidator\n}\n\nconst CLASS_PART_SEPARATOR = '-'\n\nexport function createClassUtils(config: Config) {\n const classMap = createClassMap(config)\n\n function getClassGroupId(className: string) {\n const classParts = className.split(CLASS_PART_SEPARATOR)\n\n // Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and remove it from classParts.\n if (classParts[0] === '' && classParts.length !== 1) {\n classParts.shift()\n }\n\n return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className)\n }\n\n function getConflictingClassGroupIds(classGroupId: ClassGroupId) {\n return config.conflictingClassGroups[classGroupId] || []\n }\n\n return {\n getClassGroupId,\n getConflictingClassGroupIds,\n }\n}\n\nfunction getGroupRecursive(\n classParts: string[],\n classPartObject: ClassPartObject\n): ClassGroupId | undefined {\n if (classParts.length === 0) {\n return classPartObject.classGroupId\n }\n\n const currentClassPart = classParts[0]!\n const nextClassPartObject = classPartObject.nextPart[currentClassPart]\n const classGroupFromNextClassPart = nextClassPartObject\n ? getGroupRecursive(classParts.slice(1), nextClassPartObject)\n : undefined\n\n if (classGroupFromNextClassPart) {\n return classGroupFromNextClassPart\n }\n\n if (classPartObject.validators.length === 0) {\n return undefined\n }\n\n const classRest = classParts.join(CLASS_PART_SEPARATOR)\n\n return classPartObject.validators.find(({ validator }) => validator(classRest))?.classGroupId\n}\n\nconst arbitraryPropertyRegex = /^\\[(.+)\\]$/\n\nfunction getGroupIdForArbitraryProperty(className: string) {\n if (arbitraryPropertyRegex.test(className)) {\n const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)![1]\n const property = arbitraryPropertyClassName?.substring(\n 0,\n arbitraryPropertyClassName.indexOf(':')\n )\n\n if (property) {\n // I use two dots here because one dot is used as prefix for class groups in plugins\n return 'arbitrary..' + property\n }\n }\n}\n\n/**\n * Exported for testing only\n */\nexport function createClassMap(config: Config) {\n const { theme, prefix } = config\n const classMap: ClassPartObject = {\n nextPart: {},\n validators: [],\n }\n\n const prefixedClassGroupEntries = getPrefixedClassGroupEntries(\n Object.entries(config.classGroups),\n prefix\n )\n\n prefixedClassGroupEntries.forEach(([classGroupId, classGroup]) => {\n processClassesRecursively(classGroup, classMap, classGroupId, theme)\n })\n\n return classMap\n}\n\nfunction processClassesRecursively(\n classGroup: ClassGroup,\n classPartObject: ClassPartObject,\n classGroupId: ClassGroupId,\n theme: ThemeObject\n) {\n classGroup.forEach((classDefinition) => {\n if (typeof classDefinition === 'string') {\n const classPartObjectToEdit =\n classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition)\n classPartObjectToEdit.classGroupId = classGroupId\n return\n }\n\n if (typeof classDefinition === 'function') {\n if (isThemeGetter(classDefinition)) {\n processClassesRecursively(\n classDefinition(theme),\n classPartObject,\n classGroupId,\n theme\n )\n return\n }\n\n classPartObject.validators.push({\n validator: classDefinition,\n classGroupId,\n })\n\n return\n }\n\n Object.entries(classDefinition).forEach(([key, classGroup]) => {\n processClassesRecursively(\n classGroup,\n getPart(classPartObject, key),\n classGroupId,\n theme\n )\n })\n })\n}\n\nfunction getPart(classPartObject: ClassPartObject, path: string) {\n let currentClassPartObject = classPartObject\n\n path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {\n if (currentClassPartObject.nextPart[pathPart] === undefined) {\n currentClassPartObject.nextPart[pathPart] = {\n nextPart: {},\n validators: [],\n }\n }\n\n currentClassPartObject = currentClassPartObject.nextPart[pathPart]!\n })\n\n return currentClassPartObject\n}\n\nfunction isThemeGetter(func: ClassValidator | ThemeGetter): func is ThemeGetter {\n return (func as ThemeGetter).isThemeGetter\n}\n\nfunction getPrefixedClassGroupEntries(\n classGroupEntries: Array<[classGroupId: string, classGroup: ClassGroup]>,\n prefix: string | undefined\n): Array<[classGroupId: string, classGroup: ClassGroup]> {\n if (!prefix) {\n return classGroupEntries\n }\n\n return classGroupEntries.map(([classGroupId, classGroup]) => {\n const prefixedClassGroup = classGroup.map((classDefinition) => {\n if (typeof classDefinition === 'string') {\n return prefix + classDefinition\n }\n\n if (typeof classDefinition === 'object') {\n return Object.fromEntries(\n Object.entries(classDefinition).map(([key, value]) => [prefix + key, value])\n )\n }\n\n return classDefinition\n })\n\n return [classGroupId, prefixedClassGroup]\n })\n}\n"],"names":["CLASS_PART_SEPARATOR","createClassUtils","config","classMap","createClassMap","getClassGroupId","className","classParts","split","length","shift","getGroupRecursive","getGroupIdForArbitraryProperty","getConflictingClassGroupIds","classGroupId","conflictingClassGroups","classPartObject","currentClassPart","nextClassPartObject","nextPart","classGroupFromNextClassPart","slice","undefined","validators","classRest","join","find","validator","arbitraryPropertyRegex","test","arbitraryPropertyClassName","exec","property","substring","indexOf","theme","prefix","prefixedClassGroupEntries","getPrefixedClassGroupEntries","Object","entries","classGroups","forEach","classGroup","processClassesRecursively","classDefinition","classPartObjectToEdit","getPart","isThemeGetter","push","key","path","currentClassPartObject","pathPart","func","classGroupEntries","map","prefixedClassGroup","fromEntries","value"],"mappings":"AAaA,IAAMA,oBAAoB,GAAG,GAA7B;SAEgBC,iBAAiBC;AAC7B,MAAMC,QAAQ,GAAGC,cAAc,CAACF,MAAD,CAA/B;;AAEA,WAASG,eAAT,CAAyBC,SAAzB;AACI,QAAMC,UAAU,GAAGD,SAAS,CAACE,KAAV,CAAgBR,oBAAhB,CAAnB;;AAGA,QAAIO,UAAU,CAAC,CAAD,CAAV,KAAkB,EAAlB,IAAwBA,UAAU,CAACE,MAAX,KAAsB,CAAlD,EAAqD;AACjDF,MAAAA,UAAU,CAACG,KAAX;AACH;;AAED,WAAOC,iBAAiB,CAACJ,UAAD,EAAaJ,QAAb,CAAjB,IAA2CS,8BAA8B,CAACN,SAAD,CAAhF;AACH;;AAED,WAASO,2BAAT,CAAqCC,YAArC;AACI,WAAOZ,MAAM,CAACa,sBAAP,CAA8BD,YAA9B,KAA+C,EAAtD;AACH;;AAED,SAAO;AACHT,IAAAA,eAAe,EAAfA,eADG;AAEHQ,IAAAA,2BAA2B,EAA3BA;AAFG,GAAP;AAIH;;AAED,SAASF,iBAAT,CACIJ,UADJ,EAEIS,eAFJ;;;AAII,MAAIT,UAAU,CAACE,MAAX,KAAsB,CAA1B,EAA6B;AACzB,WAAOO,eAAe,CAACF,YAAvB;AACH;;AAED,MAAMG,gBAAgB,GAAGV,UAAU,CAAC,CAAD,CAAnC;AACA,MAAMW,mBAAmB,GAAGF,eAAe,CAACG,QAAhB,CAAyBF,gBAAzB,CAA5B;AACA,MAAMG,2BAA2B,GAAGF,mBAAmB,GAC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,GAhBM,CAAP;AAiBH;;;;"}
1
+ {"version":3,"file":"class-utils.mjs","sources":["../../src/lib/class-utils.ts"],"sourcesContent":["import { ClassGroupId, Config, ClassGroup, ClassValidator, ThemeObject, ThemeGetter } from './types'\n\nexport interface ClassPartObject {\n nextPart: Map<string, ClassPartObject>\n validators: ClassValidatorObject[]\n classGroupId?: ClassGroupId\n}\n\ninterface ClassValidatorObject {\n classGroupId: ClassGroupId\n validator: ClassValidator\n}\n\nconst CLASS_PART_SEPARATOR = '-'\n\nexport function createClassUtils(config: Config) {\n const classMap = createClassMap(config)\n\n function getClassGroupId(className: string) {\n const classParts = className.split(CLASS_PART_SEPARATOR)\n\n // Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and remove it from classParts.\n if (classParts[0] === '' && classParts.length !== 1) {\n classParts.shift()\n }\n\n return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className)\n }\n\n function getConflictingClassGroupIds(classGroupId: ClassGroupId) {\n return config.conflictingClassGroups[classGroupId] || []\n }\n\n return {\n getClassGroupId,\n getConflictingClassGroupIds,\n }\n}\n\nfunction getGroupRecursive(\n classParts: string[],\n classPartObject: ClassPartObject\n): ClassGroupId | undefined {\n if (classParts.length === 0) {\n return classPartObject.classGroupId\n }\n\n const currentClassPart = classParts[0]!\n const nextClassPartObject = classPartObject.nextPart.get(currentClassPart)\n const classGroupFromNextClassPart = nextClassPartObject\n ? getGroupRecursive(classParts.slice(1), nextClassPartObject)\n : undefined\n\n if (classGroupFromNextClassPart) {\n return classGroupFromNextClassPart\n }\n\n if (classPartObject.validators.length === 0) {\n return undefined\n }\n\n const classRest = classParts.join(CLASS_PART_SEPARATOR)\n\n return classPartObject.validators.find(({ validator }) => validator(classRest))?.classGroupId\n}\n\nconst arbitraryPropertyRegex = /^\\[(.+)\\]$/\n\nfunction getGroupIdForArbitraryProperty(className: string) {\n if (arbitraryPropertyRegex.test(className)) {\n const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)![1]\n const property = arbitraryPropertyClassName?.substring(\n 0,\n arbitraryPropertyClassName.indexOf(':')\n )\n\n if (property) {\n // I use two dots here because one dot is used as prefix for class groups in plugins\n return 'arbitrary..' + property\n }\n }\n}\n\n/**\n * Exported for testing only\n */\nexport function createClassMap(config: Config) {\n const { theme, prefix } = config\n const classMap: ClassPartObject = {\n nextPart: new Map<string, ClassPartObject>(),\n validators: [],\n }\n\n const prefixedClassGroupEntries = getPrefixedClassGroupEntries(\n Object.entries(config.classGroups),\n prefix\n )\n\n prefixedClassGroupEntries.forEach(([classGroupId, classGroup]) => {\n processClassesRecursively(classGroup, classMap, classGroupId, theme)\n })\n\n return classMap\n}\n\nfunction processClassesRecursively(\n classGroup: ClassGroup,\n classPartObject: ClassPartObject,\n classGroupId: ClassGroupId,\n theme: ThemeObject\n) {\n classGroup.forEach((classDefinition) => {\n if (typeof classDefinition === 'string') {\n const classPartObjectToEdit =\n classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition)\n classPartObjectToEdit.classGroupId = classGroupId\n return\n }\n\n if (typeof classDefinition === 'function') {\n if (isThemeGetter(classDefinition)) {\n processClassesRecursively(\n classDefinition(theme),\n classPartObject,\n classGroupId,\n theme\n )\n return\n }\n\n classPartObject.validators.push({\n validator: classDefinition,\n classGroupId,\n })\n\n return\n }\n\n Object.entries(classDefinition).forEach(([key, classGroup]) => {\n processClassesRecursively(\n classGroup,\n getPart(classPartObject, key),\n classGroupId,\n theme\n )\n })\n })\n}\n\nfunction getPart(classPartObject: ClassPartObject, path: string) {\n let currentClassPartObject = classPartObject\n\n path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {\n if (!currentClassPartObject.nextPart.has(pathPart)) {\n currentClassPartObject.nextPart.set(pathPart, {\n nextPart: new Map(),\n validators: [],\n })\n }\n\n currentClassPartObject = currentClassPartObject.nextPart.get(pathPart)!\n })\n\n return currentClassPartObject\n}\n\nfunction isThemeGetter(func: ClassValidator | ThemeGetter): func is ThemeGetter {\n return (func as ThemeGetter).isThemeGetter\n}\n\nfunction getPrefixedClassGroupEntries(\n classGroupEntries: Array<[classGroupId: string, classGroup: ClassGroup]>,\n prefix: string | undefined\n): Array<[classGroupId: string, classGroup: ClassGroup]> {\n if (!prefix) {\n return classGroupEntries\n }\n\n return classGroupEntries.map(([classGroupId, classGroup]) => {\n const prefixedClassGroup = classGroup.map((classDefinition) => {\n if (typeof classDefinition === 'string') {\n return prefix + classDefinition\n }\n\n if (typeof classDefinition === 'object') {\n return Object.fromEntries(\n Object.entries(classDefinition).map(([key, value]) => [prefix + key, value])\n )\n }\n\n return classDefinition\n })\n\n return [classGroupId, prefixedClassGroup]\n })\n}\n"],"names":["CLASS_PART_SEPARATOR","createClassUtils","config","classMap","createClassMap","getClassGroupId","className","classParts","split","length","shift","getGroupRecursive","getGroupIdForArbitraryProperty","getConflictingClassGroupIds","classGroupId","conflictingClassGroups","classPartObject","currentClassPart","nextClassPartObject","nextPart","get","classGroupFromNextClassPart","slice","undefined","validators","classRest","join","find","validator","arbitraryPropertyRegex","test","arbitraryPropertyClassName","exec","property","substring","indexOf","theme","prefix","Map","prefixedClassGroupEntries","getPrefixedClassGroupEntries","Object","entries","classGroups","forEach","classGroup","processClassesRecursively","classDefinition","classPartObjectToEdit","getPart","isThemeGetter","push","key","path","currentClassPartObject","pathPart","has","set","func","classGroupEntries","map","prefixedClassGroup","fromEntries","value"],"mappings":"AAaA,IAAMA,oBAAoB,GAAG,GAA7B,CAAA;AAEM,SAAUC,gBAAV,CAA2BC,MAA3B,EAAyC;AAC3C,EAAA,IAAMC,QAAQ,GAAGC,cAAc,CAACF,MAAD,CAA/B,CAAA;;EAEA,SAASG,eAAT,CAAyBC,SAAzB,EAA0C;IACtC,IAAMC,UAAU,GAAGD,SAAS,CAACE,KAAV,CAAgBR,oBAAhB,CAAnB,CADsC;;AAItC,IAAA,IAAIO,UAAU,CAAC,CAAD,CAAV,KAAkB,EAAlB,IAAwBA,UAAU,CAACE,MAAX,KAAsB,CA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A6B,GAAA,KAAA,CAAA,CAAA,CAAA;AAAA,QAAf+B,UAAe,GAAA,KAAA,CAAA,CAAA,CAAA,CAAA;IACxD,IAAMgB,kBAAkB,GAAGhB,UAAU,CAACe,GAAX,CAAe,UAACb,eAAD,EAAoB;AAC1D,MAAA,IAAI,OAAOA,eAAP,KAA2B,QAA/B,EAAyC;QACrC,OAAOV,MAAM,GAAGU,eAAhB,CAAA;AACH,OAAA;;AAED,MAAA,IAAI,OAAOA,eAAP,KAA2B,QAA/B,EAAyC;QACrC,OAAON,MAAM,CAACqB,WAAP,CACHrB,MAAM,CAACC,OAAP,CAAeK,eAAf,CAAgCa,CAAAA,GAAhC,CAAoC,UAAA,KAAA,EAAA;AAAA,UAAA,IAAER,GAAF,GAAA,KAAA,CAAA,CAAA,CAAA;AAAA,cAAOW,KAAP,GAAA,KAAA,CAAA,CAAA,CAAA,CAAA;AAAA,UAAA,OAAkB,CAAC1B,MAAM,GAAGe,GAAV,EAAeW,KAAf,CAAlB,CAAA;AAAA,SAApC,CADG,CAAP,CAAA;AAGH,OAAA;;AAED,MAAA,OAAOhB,eAAP,CAAA;AACH,KAZ0B,CAA3B,CAAA;AAcA,IAAA,OAAO,CAACjC,YAAD,EAAe+C,kBAAf,CAAP,CAAA;AACH,GAhBM,CAAP,CAAA;AAiBH;;;;"}
@@ -3,5 +3,5 @@ export declare type ConfigUtils = ReturnType<typeof createConfigUtils>;
3
3
  export declare function createConfigUtils(config: Config): {
4
4
  getClassGroupId: (className: string) => string | undefined;
5
5
  getConflictingClassGroupIds: (classGroupId: string) => readonly string[];
6
- cache: import("./lru-cache").LruCache<string>;
6
+ cache: import("./lru-cache").LruCache<string, string>;
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"config-utils.mjs","sources":["../../src/lib/config-utils.ts"],"sourcesContent":["import { getLruCache } from './lru-cache'\nimport { Config } from './types'\nimport { createClassUtils } from './class-utils'\n\nexport type ConfigUtils = ReturnType<typeof createConfigUtils>\n\nexport function createConfigUtils(config: Config) {\n return {\n cache: getLruCache<string>(config.cacheSize),\n ...createClassUtils(config),\n }\n}\n"],"names":["createConfigUtils","config","cache","getLruCache","cacheSize","createClassUtils"],"mappings":";;;;SAMgBA,kBAAkBC;AAC9B;AACIC,IAAAA,KAAK,EAAEC,WAAW,CAASF,MAAM,CAACG,SAAhB;AADtB,KAEOC,gBAAgB,CAACJ,MAAD,CAFvB;AAIH;;;;"}
1
+ {"version":3,"file":"config-utils.mjs","sources":["../../src/lib/config-utils.ts"],"sourcesContent":["import { getLruCache } from './lru-cache'\nimport { Config } from './types'\nimport { createClassUtils } from './class-utils'\n\nexport type ConfigUtils = ReturnType<typeof createConfigUtils>\n\nexport function createConfigUtils(config: Config) {\n return {\n cache: getLruCache<string, string>(config.cacheSize),\n ...createClassUtils(config),\n }\n}\n"],"names":["createConfigUtils","config","cache","getLruCache","cacheSize","createClassUtils"],"mappings":";;;;AAMM,SAAUA,iBAAV,CAA4BC,MAA5B,EAA0C;AAC5C,EAAA,OAAA,QAAA,CAAA;AACIC,IAAAA,KAAK,EAAEC,WAAW,CAAiBF,MAAM,CAACG,SAAxB,CAAA;GACfC,EAAAA,gBAAgB,CAACJ,MAAD,CAFvB,CAAA,CAAA;AAIH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-tailwind-merge.mjs","sources":["../../src/lib/create-tailwind-merge.ts"],"sourcesContent":["import { createConfigUtils } from './config-utils'\nimport { Config } from './types'\nimport { mergeClassList } from './merge-classlist'\n\ntype CreateConfigFirst = () => Config\ntype CreateConfigSubsequent = (config: Config) => Config\ntype ClassLists = ClassListElement[]\ntype ClassListElement = string | undefined | null | false\ntype TailwindMerge = (...classLists: ClassLists) => 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 let classList = ''\n let temp: ClassListElement\n\n // Credits → https://github.com/lukeed/clsx/blob/v1.1.1/src/index.js\n for (let index = 0; index < arguments.length; index += 1) {\n if ((temp = arguments[index])) {\n classList && (classList += ' ')\n classList += temp\n }\n }\n\n return functionToCall(classList)\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","temp","index","arguments","length"],"mappings":";;;SAWgBA;oCACTC;AAAAA,IAAAA;;;AAEH,MAAIC,WAAJ;AACA,MAAIC,QAAJ;AACA,MAAIC,QAAJ;AACA,MAAIC,cAAc,GAAGC,iBAArB;;AAEA,WAASA,iBAAT,CAA2BC,SAA3B;AACI,QAAOC,iBAAP,GAAiDP,YAAjD;AAAA,QAA6BQ,gBAA7B,GAAiDR,YAAjD;AAEA,QAAMS,MAAM,GAAGD,gBAAgB,CAACE,MAAjB,CACX,UAACC,cAAD,EAAiBC,mBAAjB;AAAA,aAAyCA,mBAAmB,CAACD,cAAD,CAA5D;AAAA,KADW,EAEXJ,iBAAiB,EAFN,CAAf;AAKAN,IAAAA,WAAW,GAAGY,iBAAiB,CAACJ,MAAD,CAA/B;AACAP,IAAAA,QAAQ,GAAGD,WAAW,CAACa,KAAZ,CAAkBC,GAA7B;AACAZ,IAAAA,QAAQ,GAAGF,WAAW,CAACa,KAAZ,CAAkBE,GAA7B;AACAZ,IAAAA,cAAc,GAAGa,aAAjB;AAEA,WAAOA,aAAa,CAACX,SAAD,CAApB;AACH;;AAED,WAASW,aAAT,CAAuBX,SAAvB;AACI,QAAMY,YAAY,GAAGhB,QAAQ,CAACI,SAAD,CAA7B;;AAEA,QAAIY,YAAJ,EAAkB;AACd,aAAOA,YAAP;AACH;;AAED,QAAMC,MAAM,GAAGC,cAAc,CAACd,SAAD,EAAYL,WAAZ,CAA7B;AACAE,IAAAA,QAAQ,CAACG,SAAD,EAAYa,MAAZ,CAAR;AAEA,WAAOA,MAAP;AACH;;AAED,SAAO,SAASE,iBAAT;AACH,QAAIf,SAAS,GAAG,EAAhB;AACA,QAAIgB,IAAJ;;AAGA,SAAK,IAAIC,KAAK,GAAG,CAAjB,EAAoBA,KAAK,GAAGC,SAAS,CAACC,MAAtC,EAA8CF,KAAK,IAAI,CAAvD,EAA0D;AACtD,UAAKD,IAAI,GAAGE,SAAS,CAACD,KAAD,CAArB,EAA+B;AAC3BjB,QAAAA,SAAS,KAAKA,SAAS,IAAI,GAAlB,CAAT;AACAA,QAAAA,SAAS,IAAIgB,IAAb;AACH;AACJ;;AAED,WAAOlB,cAAc,CAACE,SAAD,CAArB;AACH,GAbD;AAcH;;;;"}
1
+ {"version":3,"file":"create-tailwind-merge.mjs","sources":["../../src/lib/create-tailwind-merge.ts"],"sourcesContent":["import { createConfigUtils } from './config-utils'\nimport { Config } from './types'\nimport { mergeClassList } from './merge-classlist'\n\ntype CreateConfigFirst = () => Config\ntype CreateConfigSubsequent = (config: Config) => Config\ntype ClassLists = ClassListElement[]\ntype ClassListElement = string | undefined | null | false\ntype TailwindMerge = (...classLists: ClassLists) => 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 let classList = ''\n let temp: ClassListElement\n\n // Credits → https://github.com/lukeed/clsx/blob/v1.1.1/src/index.js\n for (let index = 0; index < arguments.length; index += 1) {\n if ((temp = arguments[index])) {\n classList && (classList += ' ')\n classList += temp\n }\n }\n\n return functionToCall(classList)\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","temp","index","arguments","length"],"mappings":";;;AAWgB,SAAAA,mBAAA,GACqD;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,WAAJ,CAAA;AACA,EAA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,CAAjB,EAAoBA,KAAK,GAAGC,SAAS,CAACC,MAAtC,EAA8CF,KAAK,IAAI,CAAvD,EAA0D;AACtD,MAAA,IAAKD,IAAI,GAAGE,SAAS,CAACD,KAAD,CAArB,EAA+B;AAC3BjB,QAAAA,SAAS,KAAKA,SAAS,IAAI,GAAlB,CAAT,CAAA;AACAA,QAAAA,SAAS,IAAIgB,IAAb,CAAA;AACH,OAAA;AACJ,KAAA;;IAED,OAAOlB,cAAc,CAACE,SAAD,CAArB,CAAA;GAZJ,CAAA;AAcH;;;;"}
@@ -8,6 +8,7 @@ export declare function getDefaultConfig(): {
8
8
  readonly brightness: readonly [typeof isInteger];
9
9
  readonly borderColor: readonly [import("./types").ThemeGetter];
10
10
  readonly borderRadius: readonly ["none", "", "full", typeof isTshirtSize, typeof isArbitraryLength];
11
+ readonly borderSpacing: readonly [import("./types").ThemeGetter];
11
12
  readonly borderWidth: readonly ["", typeof isLength];
12
13
  readonly contrast: readonly [typeof isInteger];
13
14
  readonly grayscale: readonly ["", "0", typeof isArbitraryValue];
@@ -341,7 +342,7 @@ export declare function getDefaultConfig(): {
341
342
  * @see https://tailwindcss.com/docs/grid-auto-flow
342
343
  */
343
344
  readonly 'grid-flow': readonly [{
344
- readonly 'grid-flow': readonly ["row", "col", "row-dense", "col-dense"];
345
+ readonly 'grid-flow': readonly ["row", "col", "dense", "row-dense", "col-dense"];
345
346
  }];
346
347
  /**
347
348
  * Grid Auto Columns
@@ -568,7 +569,7 @@ export declare function getDefaultConfig(): {
568
569
  * @see https://tailwindcss.com/docs/width
569
570
  */
570
571
  readonly w: readonly [{
571
- readonly w: readonly ["auto", "min", "max", import("./types").ThemeGetter];
572
+ readonly w: readonly ["auto", "min", "max", "fit", import("./types").ThemeGetter];
572
573
  }];
573
574
  /**
574
575
  * Min-Width
@@ -716,7 +717,7 @@ export declare function getDefaultConfig(): {
716
717
  * @see https://tailwindcss.com/docs/text-align
717
718
  */
718
719
  readonly 'text-alignment': readonly [{
719
- readonly text: readonly ["left", "center", "right", "justify"];
720
+ readonly text: readonly ["left", "center", "right", "justify", "start", "end"];
720
721
  }];
721
722
  /**
722
723
  * Text Color
@@ -1213,14 +1214,14 @@ export declare function getDefaultConfig(): {
1213
1214
  * @see https://tailwindcss.com/docs/mix-blend-mode
1214
1215
  */
1215
1216
  readonly 'mix-blend': readonly [{
1216
- readonly 'mix-blend': readonly ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
1217
+ readonly 'mix-blend': readonly ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity", "plus-lighter"];
1217
1218
  }];
1218
1219
  /**
1219
1220
  * Background Blend Mode
1220
1221
  * @see https://tailwindcss.com/docs/background-blend-mode
1221
1222
  */
1222
1223
  readonly 'bg-blend': readonly [{
1223
- readonly 'bg-blend': readonly ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
1224
+ readonly 'bg-blend': readonly ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity", "plus-lighter"];
1224
1225
  }];
1225
1226
  /**
1226
1227
  * Filter
@@ -1371,6 +1372,27 @@ export declare function getDefaultConfig(): {
1371
1372
  readonly 'border-collapse': readonly [{
1372
1373
  readonly border: readonly ["collapse", "separate"];
1373
1374
  }];
1375
+ /**
1376
+ * Border Spacing
1377
+ * @see https://tailwindcss.com/docs/border-spacing
1378
+ */
1379
+ readonly 'border-spacing': readonly [{
1380
+ readonly 'border-spacing': readonly [import("./types").ThemeGetter];
1381
+ }];
1382
+ /**
1383
+ * Border Spacing X
1384
+ * @see https://tailwindcss.com/docs/border-spacing
1385
+ */
1386
+ readonly 'border-spacing-x': readonly [{
1387
+ readonly 'border-spacing-x': readonly [import("./types").ThemeGetter];
1388
+ }];
1389
+ /**
1390
+ * Border Spacing Y
1391
+ * @see https://tailwindcss.com/docs/border-spacing
1392
+ */
1393
+ readonly 'border-spacing-y': readonly [{
1394
+ readonly 'border-spacing-y': readonly [import("./types").ThemeGetter];
1395
+ }];
1374
1396
  /**
1375
1397
  * Table Layout
1376
1398
  * @see https://tailwindcss.com/docs/table-layout
@@ -1734,6 +1756,7 @@ export declare function getDefaultConfig(): {
1734
1756
  readonly 'rounded-r': readonly ["rounded-tr", "rounded-br"];
1735
1757
  readonly 'rounded-b': readonly ["rounded-br", "rounded-bl"];
1736
1758
  readonly 'rounded-l': readonly ["rounded-tl", "rounded-bl"];
1759
+ readonly 'border-spacing': readonly ["border-spacing-x", "border-spacing-y"];
1737
1760
  readonly 'border-w': readonly ["border-w-t", "border-w-r", "border-w-b", "border-w-l"];
1738
1761
  readonly 'border-w-x': readonly ["border-w-r", "border-w-l"];
1739
1762
  readonly 'border-w-y': readonly ["border-w-t", "border-w-b"];
@@ -8,6 +8,7 @@ function getDefaultConfig() {
8
8
  var brightness = fromTheme('brightness');
9
9
  var borderColor = fromTheme('borderColor');
10
10
  var borderRadius = fromTheme('borderRadius');
11
+ var borderSpacing = fromTheme('borderSpacing');
11
12
  var borderWidth = fromTheme('borderWidth');
12
13
  var contrast = fromTheme('contrast');
13
14
  var grayscale = fromTheme('grayscale');
@@ -55,7 +56,7 @@ function getDefaultConfig() {
55
56
  };
56
57
 
57
58
  var getBlendModes = function getBlendModes() {
58
- return ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'];
59
+ return ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity', 'plus-lighter'];
59
60
  };
60
61
 
61
62
  var getAlign = function getAlign() {
@@ -79,6 +80,7 @@ function getDefaultConfig() {
79
80
  brightness: [isInteger],
80
81
  borderColor: [colors],
81
82
  borderRadius: ['none', '', 'full', isTshirtSize, isArbitraryLength],
83
+ borderSpacing: [spacing],
82
84
  borderWidth: getLengthWithEmpty(),
83
85
  contrast: [isInteger],
84
86
  grayscale: getZeroAndEmpty(),
@@ -460,7 +462,7 @@ function getDefaultConfig() {
460
462
  * @see https://tailwindcss.com/docs/grid-auto-flow
461
463
  */
462
464
  'grid-flow': [{
463
- 'grid-flow': ['row', 'col', 'row-dense', 'col-dense']
465
+ 'grid-flow': ['row', 'col', 'dense', 'row-dense', 'col-dense']
464
466
  }],
465
467
 
466
468
  /**
@@ -722,7 +724,7 @@ function getDefaultConfig() {
722
724
  * @see https://tailwindcss.com/docs/width
723
725
  */
724
726
  w: [{
725
- w: ['auto', 'min', 'max', spacing]
727
+ w: ['auto', 'min', 'max', 'fit', spacing]
726
728
  }],
727
729
 
728
730
  /**
@@ -894,7 +896,7 @@ function getDefaultConfig() {
894
896
  * @see https://tailwindcss.com/docs/text-align
895
897
  */
896
898
  'text-alignment': [{
897
- text: ['left', 'center', 'right', 'justify']
899
+ text: ['left', 'center', 'right', 'justify', 'start', 'end']
898
900
  }],
899
901
 
900
902
  /**
@@ -1649,6 +1651,30 @@ function getDefaultConfig() {
1649
1651
  border: ['collapse', 'separate']
1650
1652
  }],
1651
1653
 
1654
+ /**
1655
+ * Border Spacing
1656
+ * @see https://tailwindcss.com/docs/border-spacing
1657
+ */
1658
+ 'border-spacing': [{
1659
+ 'border-spacing': [borderSpacing]
1660
+ }],
1661
+
1662
+ /**
1663
+ * Border Spacing X
1664
+ * @see https://tailwindcss.com/docs/border-spacing
1665
+ */
1666
+ 'border-spacing-x': [{
1667
+ 'border-spacing-x': [borderSpacing]
1668
+ }],
1669
+
1670
+ /**
1671
+ * Border Spacing Y
1672
+ * @see https://tailwindcss.com/docs/border-spacing
1673
+ */
1674
+ 'border-spacing-y': [{
1675
+ 'border-spacing-y': [borderSpacing]
1676
+ }],
1677
+
1652
1678
  /**
1653
1679
  * Table Layout
1654
1680
  * @see https://tailwindcss.com/docs/table-layout
@@ -2064,6 +2090,7 @@ function getDefaultConfig() {
2064
2090
  'rounded-r': ['rounded-tr', 'rounded-br'],
2065
2091
  'rounded-b': ['rounded-br', 'rounded-bl'],
2066
2092
  'rounded-l': ['rounded-tl', 'rounded-bl'],
2093
+ 'border-spacing': ['border-spacing-x', 'border-spacing-y'],
2067
2094
  'border-w': ['border-w-t', 'border-w-r', 'border-w-b', 'border-w-l'],
2068
2095
  'border-w-x': ['border-w-r', 'border-w-l'],
2069
2096
  'border-w-y': ['border-w-t', 'border-w-b'],