tailwind-merge 1.9.0 → 1.9.1

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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <br />
3
3
  <a href="https://github.com/dcastil/tailwind-merge">
4
4
  <!-- AUTOGENERATED VERSION START -->
5
- <img src="https://github.com/dcastil/tailwind-merge/raw/v1.9.0/assets/logo.svg" alt="tailwind-merge" height="150px" />
5
+ <img src="https://github.com/dcastil/tailwind-merge/raw/v1.9.1/assets/logo.svg" alt="tailwind-merge" height="150px" />
6
6
  <!-- AUTOGENERATED END -->
7
7
  </a>
8
8
  </div>
@@ -27,14 +27,14 @@ twMerge('px-2 py-1 bg-red hover:bg-dark-red', 'p-3 bg-[#B91C1C]')
27
27
 
28
28
  <!-- AUTOGENERATED VERSION START -->
29
29
 
30
- - [What is it for](https://github.com/dcastil/tailwind-merge/tree/v1.9.0/docs/what-is-it-for.md)
31
- - [Features](https://github.com/dcastil/tailwind-merge/tree/v1.9.0/docs/features.md)
32
- - [Configuration](https://github.com/dcastil/tailwind-merge/tree/v1.9.0/docs/configuration.md)
33
- - [Recipes](https://github.com/dcastil/tailwind-merge/tree/v1.9.0/docs/recipes.md)
34
- - [API reference](https://github.com/dcastil/tailwind-merge/tree/v1.9.0/docs/api-reference.md)
35
- - [Writing plugins](https://github.com/dcastil/tailwind-merge/tree/v1.9.0/docs/writing-plugins.md)
36
- - [Versioning](https://github.com/dcastil/tailwind-merge/tree/v1.9.0/docs/versioning.md)
37
- - [Contributing](https://github.com/dcastil/tailwind-merge/tree/v1.9.0/.github/CONTRIBUTING.md)
38
- - [Similar packages](https://github.com/dcastil/tailwind-merge/tree/v1.9.0/docs/similar-packages.md)
30
+ - [What is it for](https://github.com/dcastil/tailwind-merge/tree/v1.9.1/docs/what-is-it-for.md)
31
+ - [Features](https://github.com/dcastil/tailwind-merge/tree/v1.9.1/docs/features.md)
32
+ - [Configuration](https://github.com/dcastil/tailwind-merge/tree/v1.9.1/docs/configuration.md)
33
+ - [Recipes](https://github.com/dcastil/tailwind-merge/tree/v1.9.1/docs/recipes.md)
34
+ - [API reference](https://github.com/dcastil/tailwind-merge/tree/v1.9.1/docs/api-reference.md)
35
+ - [Writing plugins](https://github.com/dcastil/tailwind-merge/tree/v1.9.1/docs/writing-plugins.md)
36
+ - [Versioning](https://github.com/dcastil/tailwind-merge/tree/v1.9.1/docs/versioning.md)
37
+ - [Contributing](https://github.com/dcastil/tailwind-merge/tree/v1.9.1/.github/CONTRIBUTING.md)
38
+ - [Similar packages](https://github.com/dcastil/tailwind-merge/tree/v1.9.1/docs/similar-packages.md)
39
39
 
40
40
  <!-- AUTOGENERATED END -->
@@ -1,29 +1,29 @@
1
- import { isAny, isArbitraryLength, isArbitraryNumber, isArbitraryPosition, isArbitraryShadow, isArbitrarySize, isArbitraryUrl, isArbitraryValue, isInteger, isLength, isTshirtSize } from './validators';
1
+ import { isAny, isArbitraryLength, isArbitraryNumber, isArbitraryPosition, isArbitraryShadow, isArbitrarySize, isArbitraryUrl, isArbitraryValue, isInteger, isLength, isNumber, isTshirtSize } from './validators';
2
2
  export declare function getDefaultConfig(): {
3
3
  readonly cacheSize: 500;
4
4
  readonly theme: {
5
5
  readonly colors: readonly [typeof isAny];
6
6
  readonly spacing: readonly [typeof isLength];
7
7
  readonly blur: readonly ["none", "", typeof isTshirtSize, typeof isArbitraryLength];
8
- readonly brightness: readonly [typeof isInteger];
8
+ readonly brightness: (typeof isNumber)[];
9
9
  readonly borderColor: readonly [import("./types").ThemeGetter];
10
10
  readonly borderRadius: readonly ["none", "", "full", typeof isTshirtSize, typeof isArbitraryLength];
11
11
  readonly borderSpacing: readonly [import("./types").ThemeGetter];
12
12
  readonly borderWidth: readonly ["", typeof isLength];
13
- readonly contrast: readonly [typeof isInteger];
13
+ readonly contrast: (typeof isNumber)[];
14
14
  readonly grayscale: readonly ["", "0", typeof isArbitraryValue];
15
- readonly hueRotate: readonly [typeof isInteger];
15
+ readonly hueRotate: (typeof isNumber)[];
16
16
  readonly invert: readonly ["", "0", typeof isArbitraryValue];
17
17
  readonly gap: readonly [import("./types").ThemeGetter];
18
18
  readonly gradientColorStops: readonly [import("./types").ThemeGetter];
19
19
  readonly inset: readonly ["auto", import("./types").ThemeGetter];
20
20
  readonly margin: readonly ["auto", import("./types").ThemeGetter];
21
- readonly opacity: readonly [typeof isInteger];
21
+ readonly opacity: (typeof isNumber)[];
22
22
  readonly padding: readonly [import("./types").ThemeGetter];
23
- readonly saturate: readonly [typeof isInteger];
24
- readonly scale: readonly [typeof isInteger];
23
+ readonly saturate: (typeof isNumber)[];
24
+ readonly scale: (typeof isNumber)[];
25
25
  readonly sepia: readonly ["", "0", typeof isArbitraryValue];
26
- readonly skew: readonly [typeof isInteger, typeof isArbitraryValue];
26
+ readonly skew: (typeof isNumber)[];
27
27
  readonly space: readonly [import("./types").ThemeGetter];
28
28
  readonly translate: readonly [import("./types").ThemeGetter];
29
29
  };
@@ -226,7 +226,7 @@ export declare function getDefaultConfig(): {
226
226
  * @see https://tailwindcss.com/docs/z-index
227
227
  */
228
228
  readonly z: readonly [{
229
- readonly z: readonly [typeof isInteger];
229
+ readonly z: readonly ["auto", typeof isInteger];
230
230
  }];
231
231
  /**
232
232
  * Flex Basis
@@ -291,21 +291,21 @@ export declare function getDefaultConfig(): {
291
291
  readonly 'col-start-end': readonly [{
292
292
  readonly col: readonly ["auto", {
293
293
  readonly span: readonly [typeof isInteger];
294
- }];
294
+ }, typeof isArbitraryValue];
295
295
  }];
296
296
  /**
297
297
  * Grid Column Start
298
298
  * @see https://tailwindcss.com/docs/grid-column
299
299
  */
300
300
  readonly 'col-start': readonly [{
301
- readonly 'col-start': readonly ["auto", typeof isInteger];
301
+ readonly 'col-start': readonly ["auto", typeof isNumber, typeof isArbitraryValue];
302
302
  }];
303
303
  /**
304
304
  * Grid Column End
305
305
  * @see https://tailwindcss.com/docs/grid-column
306
306
  */
307
307
  readonly 'col-end': readonly [{
308
- readonly 'col-end': readonly ["auto", typeof isInteger];
308
+ readonly 'col-end': readonly ["auto", typeof isNumber, typeof isArbitraryValue];
309
309
  }];
310
310
  /**
311
311
  * Grid Template Rows
@@ -321,21 +321,21 @@ export declare function getDefaultConfig(): {
321
321
  readonly 'row-start-end': readonly [{
322
322
  readonly row: readonly ["auto", {
323
323
  readonly span: readonly [typeof isInteger];
324
- }];
324
+ }, typeof isArbitraryValue];
325
325
  }];
326
326
  /**
327
327
  * Grid Row Start
328
328
  * @see https://tailwindcss.com/docs/grid-row
329
329
  */
330
330
  readonly 'row-start': readonly [{
331
- readonly 'row-start': readonly ["auto", typeof isInteger];
331
+ readonly 'row-start': readonly ["auto", typeof isNumber, typeof isArbitraryValue];
332
332
  }];
333
333
  /**
334
334
  * Grid Row End
335
335
  * @see https://tailwindcss.com/docs/grid-row
336
336
  */
337
337
  readonly 'row-end': readonly [{
338
- readonly 'row-end': readonly ["auto", typeof isInteger];
338
+ readonly 'row-end': readonly ["auto", typeof isNumber, typeof isArbitraryValue];
339
339
  }];
340
340
  /**
341
341
  * Grid Auto Flow
@@ -1412,7 +1412,7 @@ export declare function getDefaultConfig(): {
1412
1412
  * @see https://tailwindcss.com/docs/transition-duration
1413
1413
  */
1414
1414
  readonly duration: readonly [{
1415
- readonly duration: readonly [typeof isInteger];
1415
+ readonly duration: (typeof isNumber)[];
1416
1416
  }];
1417
1417
  /**
1418
1418
  * Transition Timing Function
@@ -1426,7 +1426,7 @@ export declare function getDefaultConfig(): {
1426
1426
  * @see https://tailwindcss.com/docs/transition-delay
1427
1427
  */
1428
1428
  readonly delay: readonly [{
1429
- readonly delay: readonly [typeof isInteger];
1429
+ readonly delay: (typeof isNumber)[];
1430
1430
  }];
1431
1431
  /**
1432
1432
  * Animation
@@ -1,5 +1,5 @@
1
1
  import { fromTheme } from './from-theme.mjs';
2
- import { isAny, isLength, isTshirtSize, isArbitraryLength, isInteger, isArbitraryValue, isArbitraryNumber, isArbitraryPosition, isArbitrarySize, isArbitraryUrl, isArbitraryShadow } from './validators.mjs';
2
+ import { isAny, isLength, isTshirtSize, isArbitraryLength, isArbitraryValue, isInteger, isArbitraryNumber, isArbitraryPosition, isArbitrarySize, isArbitraryUrl, isArbitraryShadow, isNumber } from './validators.mjs';
3
3
 
4
4
  function getDefaultConfig() {
5
5
  var colors = fromTheme('colors');
@@ -38,8 +38,8 @@ function getDefaultConfig() {
38
38
  var getLengthWithEmpty = function getLengthWithEmpty() {
39
39
  return ['', isLength];
40
40
  };
41
- var getIntegerWithAuto = function getIntegerWithAuto() {
42
- return ['auto', isInteger];
41
+ var getNumberWithAutoAndArbitrary = function getNumberWithAutoAndArbitrary() {
42
+ return ['auto', isNumber, isArbitraryValue];
43
43
  };
44
44
  var getPositions = function getPositions() {
45
45
  return ['bottom', 'center', 'left', 'left-bottom', 'left-top', 'right', 'right-bottom', 'right-top', 'top'];
@@ -59,31 +59,37 @@ function getDefaultConfig() {
59
59
  var getBreaks = function getBreaks() {
60
60
  return ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column'];
61
61
  };
62
+ var getNumber = function getNumber() {
63
+ return [isNumber, isArbitraryNumber];
64
+ };
65
+ var getNumberAndArbitrary = function getNumberAndArbitrary() {
66
+ return [isNumber, isArbitraryValue];
67
+ };
62
68
  return {
63
69
  cacheSize: 500,
64
70
  theme: {
65
71
  colors: [isAny],
66
72
  spacing: [isLength],
67
73
  blur: ['none', '', isTshirtSize, isArbitraryLength],
68
- brightness: [isInteger],
74
+ brightness: getNumber(),
69
75
  borderColor: [colors],
70
76
  borderRadius: ['none', '', 'full', isTshirtSize, isArbitraryLength],
71
77
  borderSpacing: [spacing],
72
78
  borderWidth: getLengthWithEmpty(),
73
- contrast: [isInteger],
79
+ contrast: getNumber(),
74
80
  grayscale: getZeroAndEmpty(),
75
- hueRotate: [isInteger],
81
+ hueRotate: getNumberAndArbitrary(),
76
82
  invert: getZeroAndEmpty(),
77
83
  gap: [spacing],
78
84
  gradientColorStops: [colors],
79
85
  inset: getSpacingWithAuto(),
80
86
  margin: getSpacingWithAuto(),
81
- opacity: [isInteger],
87
+ opacity: getNumber(),
82
88
  padding: [spacing],
83
- saturate: [isInteger],
84
- scale: [isInteger],
89
+ saturate: getNumber(),
90
+ scale: getNumber(),
85
91
  sepia: getZeroAndEmpty(),
86
- skew: [isInteger, isArbitraryValue],
92
+ skew: getNumberAndArbitrary(),
87
93
  space: [spacing],
88
94
  translate: [spacing]
89
95
  },
@@ -287,7 +293,7 @@ function getDefaultConfig() {
287
293
  * @see https://tailwindcss.com/docs/z-index
288
294
  */
289
295
  z: [{
290
- z: [isInteger]
296
+ z: ['auto', isInteger]
291
297
  }],
292
298
  // Flexbox and Grid
293
299
  /**
@@ -353,21 +359,21 @@ function getDefaultConfig() {
353
359
  'col-start-end': [{
354
360
  col: ['auto', {
355
361
  span: [isInteger]
356
- }]
362
+ }, isArbitraryValue]
357
363
  }],
358
364
  /**
359
365
  * Grid Column Start
360
366
  * @see https://tailwindcss.com/docs/grid-column
361
367
  */
362
368
  'col-start': [{
363
- 'col-start': getIntegerWithAuto()
369
+ 'col-start': getNumberWithAutoAndArbitrary()
364
370
  }],
365
371
  /**
366
372
  * Grid Column End
367
373
  * @see https://tailwindcss.com/docs/grid-column
368
374
  */
369
375
  'col-end': [{
370
- 'col-end': getIntegerWithAuto()
376
+ 'col-end': getNumberWithAutoAndArbitrary()
371
377
  }],
372
378
  /**
373
379
  * Grid Template Rows
@@ -383,21 +389,21 @@ function getDefaultConfig() {
383
389
  'row-start-end': [{
384
390
  row: ['auto', {
385
391
  span: [isInteger]
386
- }]
392
+ }, isArbitraryValue]
387
393
  }],
388
394
  /**
389
395
  * Grid Row Start
390
396
  * @see https://tailwindcss.com/docs/grid-row
391
397
  */
392
398
  'row-start': [{
393
- 'row-start': getIntegerWithAuto()
399
+ 'row-start': getNumberWithAutoAndArbitrary()
394
400
  }],
395
401
  /**
396
402
  * Grid Row End
397
403
  * @see https://tailwindcss.com/docs/grid-row
398
404
  */
399
405
  'row-end': [{
400
- 'row-end': getIntegerWithAuto()
406
+ 'row-end': getNumberWithAutoAndArbitrary()
401
407
  }],
402
408
  /**
403
409
  * Grid Auto Flow
@@ -1483,7 +1489,7 @@ function getDefaultConfig() {
1483
1489
  * @see https://tailwindcss.com/docs/transition-duration
1484
1490
  */
1485
1491
  duration: [{
1486
- duration: [isInteger]
1492
+ duration: getNumberAndArbitrary()
1487
1493
  }],
1488
1494
  /**
1489
1495
  * Transition Timing Function
@@ -1497,7 +1503,7 @@ function getDefaultConfig() {
1497
1503
  * @see https://tailwindcss.com/docs/transition-delay
1498
1504
  */
1499
1505
  delay: [{
1500
- delay: [isInteger]
1506
+ delay: getNumberAndArbitrary()
1501
1507
  }],
1502
1508
  /**
1503
1509
  * Animation