tailwind_merge 0.5.1 → 0.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a91c2b0d982a08fffeb7f7a7de91124c386db75de621884d8dbe8370cba39943
4
- data.tar.gz: 8f8ddc04bb758faf1f051ac90f3c5fb5020b1d54c1d87aedbfaf6c3eb6eb81f5
3
+ metadata.gz: b9f76007fe9bc9eb3a01775ddfbc29e400884058373a9baeb001ccfff21ef9a7
4
+ data.tar.gz: 4d97ba3be89af9227c4b2aa6f38fc8e9926886b6c33225881630356d72576f3d
5
5
  SHA512:
6
- metadata.gz: aec2902cd4796a3170b2806316cbbb8fb33f5d08a3bd8d9f34bbcdaec71b336ef9cd4c7404d8b307dd65c6db3501902bc17f65d651c0069cc08f44358fd92e7e
7
- data.tar.gz: 8d8d0953a43e780061d462962cca27a4ade00fba4d19be6d23e299704173e3676db47c0cfb369c35dcd07a0f480a3a968916209a6f747609990d19042d2ba989
6
+ metadata.gz: 28794887eeb6e5f73ac74768cad06e52b4d5463e5ea436661e07d61a316f1e4a41b1a6607600746153f0b5464004472c1b98982d7770ca947ea03eb714e0f141
7
+ data.tar.gz: 88e8f3ab1bb6f2173a1f5aceca7416d8c1c1b4d73608ed78ed97b364f67560792996dcd72e5bcca1f81327bf8fd7aaef318aaab55011772019e9e677fa03f667
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.6.0](https://github.com/gjtorikian/tailwind_merge/tree/v0.6.0) (2023-03-29)
4
+
5
+ [Full Changelog](https://github.com/gjtorikian/tailwind_merge/compare/v0.5.2...v0.6.0)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Support 3.3 [\#9](https://github.com/gjtorikian/tailwind_merge/pull/9) ([gjtorikian](https://github.com/gjtorikian))
10
+
11
+ ## [v0.5.2](https://github.com/gjtorikian/tailwind_merge/tree/v0.5.2) (2023-02-21)
12
+
13
+ [Full Changelog](https://github.com/gjtorikian/tailwind_merge/compare/v0.5.1...v0.5.2)
14
+
15
+ **Merged pull requests:**
16
+
17
+ - support for container query length units [\#8](https://github.com/gjtorikian/tailwind_merge/pull/8) ([gjtorikian](https://github.com/gjtorikian))
18
+
3
19
  ## [v0.5.1](https://github.com/gjtorikian/tailwind_merge/tree/v0.5.1) (2023-02-05)
4
20
 
5
21
  [Full Changelog](https://github.com/gjtorikian/tailwind_merge/compare/v0.5.0...v0.5.1)
data/Gemfile CHANGED
@@ -15,5 +15,5 @@ gem "github_changelog_generator", "~> 1.16"
15
15
 
16
16
  gem "rubocop-standard"
17
17
 
18
- gem "amazing_print"
19
- gem "debug"
18
+ gem "amazing_print", require: false
19
+ gem "debug", require: false
data/README.md CHANGED
@@ -266,6 +266,7 @@ In the Tailwind config you can modify theme scales. `tailwind_merge` follows the
266
266
  - `invert`
267
267
  - `gap`
268
268
  - `gradientColorStops`
269
+ - `gradientColorStopPositions`
269
270
  - `inset`
270
271
  - `margin`
271
272
  - `opacity`
@@ -286,6 +287,7 @@ Here's a brief summary for each validator:
286
287
  - `IS_LENGTH` checks whether a class part is a number (`3`, `1.5`), a fraction (`3/4`), a arbitrary length (`[3%]`, `[4px]`, `[length:var(--my-var)]`), or one of the strings `px`, `full` or `screen`.
287
288
  - `IS_ARBITRARY_LENGTH` checks for arbitrary length values (`[3%]`, `[4px]`, `[length:var(--my-var)]`).
288
289
  - `IS_INTEGER` checks for integer values (`3`) and arbitrary integer values (`[3]`).
290
+ - `IS_PERCENT` checks for percent values (`12.5%`) which is used for color stop positions.
289
291
  - `IS_ARBITRARY_VALUE` checks whether the class part is enclosed in brackets (`[something]`)
290
292
  - `IS_TSHIRT_SIZE`checks whether class part is a T-shirt size (`sm`, `xl`), optionally with a preceding number (`2xl`).
291
293
  - `IS_ARBITRARY_SIZE` checks whether class part is an arbitrary value which starts with `size:` (`[size:200px_100px]`) which is necessary for background-size classNames.
@@ -39,10 +39,12 @@ module TailwindMerge
39
39
  class_rest = class_parts.join(CLASS_PART_SEPARATOR)
40
40
 
41
41
  result = class_part_object[:validators].find do |v|
42
- if from_theme?(v[:validator])
43
- v[:validator].call(@config)
42
+ validator = v[:validator]
43
+
44
+ if from_theme?(validator)
45
+ validator.call(@config)
44
46
  else
45
- v[:validator].call(class_rest)
47
+ validator.call(class_rest)
46
48
  end
47
49
  end
48
50
 
@@ -22,6 +22,7 @@ module TailwindMerge
22
22
  INVERT = ->(config) { FROM_THEME.call(config, "invert") }
23
23
  GAP = ->(config) { FROM_THEME.call(config, "gap") }
24
24
  GRADIENT_COLOR_STOPS = ->(config) { FROM_THEME.call(config, "gradient-color-stops") }
25
+ GRADIENT_COLOR_STOP_POSITIONS = ->(config) { FROM_THEME.call(config, "gradient-color-stop-positions") }
25
26
  INSET = ->(config) { FROM_THEME.call(config, "inset") }
26
27
  MARGIN = ->(config) { FROM_THEME.call(config, "margin") }
27
28
  OPACITY = ->(config) { FROM_THEME.call(config, "opacity") }
@@ -48,6 +49,7 @@ module TailwindMerge
48
49
  INVERT.object_id,
49
50
  GAP.object_id,
50
51
  GRADIENT_COLOR_STOPS.object_id,
52
+ GRADIENT_COLOR_STOP_POSITIONS.object_id,
51
53
  INSET.object_id,
52
54
  MARGIN.object_id,
53
55
  OPACITY.object_id,
@@ -100,7 +102,7 @@ module TailwindMerge
100
102
  "plus-lighter",
101
103
  ]
102
104
  }
103
- ALIGN = -> { ["start", "end", "center", "between", "around", "evenly"] }
105
+ ALIGN = -> { ["start", "end", "center", "between", "around", "evenly", "stretch"] }
104
106
  ZERO_AND_EMPTY = -> { ["", "0", IS_ARBITRARY_VALUE] }
105
107
  BREAKS = -> { ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"] }
106
108
  NUMBER = -> { [IS_NUMBER, IS_ARBITRARY_NUMBER] }
@@ -124,6 +126,7 @@ module TailwindMerge
124
126
  "invert" => ZERO_AND_EMPTY.call,
125
127
  "gap" => [SPACING],
126
128
  "gradient-color-stops" => [COLORS],
129
+ "gradient-color-stop-positions" => [IS_PERCENT, IS_ARBITRARY_LENGTH],
127
130
  "inset" => SPACING_WITH_AUTO.call,
128
131
  "margin" => SPACING_WITH_AUTO.call,
129
132
  "opacity" => NUMBER.call,
@@ -135,7 +138,7 @@ module TailwindMerge
135
138
  "space" => [SPACING],
136
139
  "translate" => [SPACING],
137
140
  },
138
- class_groups: {
141
+ class_groups: { # rubocop:disable Metrics/CollectionLiteralLength
139
142
  # Layout
140
143
  ##
141
144
  # Aspect Ratio
@@ -279,6 +282,16 @@ module TailwindMerge
279
282
  # @see https://tailwindcss.com/docs/top-right-bottom-left
280
283
  ##
281
284
  "inset-y" => [{ "inset-y" => [INSET] }],
285
+ #
286
+ # Start
287
+ # @see https://tailwindcss.com/docs/top-right-bottom-left
288
+ #
289
+ "start" => [{ "start" => [INSET] }],
290
+ #
291
+ # End
292
+ # @see https://tailwindcss.com/docs/top-right-bottom-left
293
+ #
294
+ "end" => [{ "end" => [INSET] }],
282
295
  ##
283
296
  # Top
284
297
  # @see https://tailwindcss.com/docs/top-right-bottom-left
@@ -419,7 +432,7 @@ module TailwindMerge
419
432
  # Justify Content
420
433
  # @see https://tailwindcss.com/docs/justify-content
421
434
  ##
422
- "justify-content" => [{ "justify" => ALIGN.call }],
435
+ "justify-content" => [{ "justify" => ["normal", *ALIGN.call] }],
423
436
  ##
424
437
  # Justify Items
425
438
  # @see https://tailwindcss.com/docs/justify-items
@@ -434,7 +447,7 @@ module TailwindMerge
434
447
  # Align Content
435
448
  # @see https://tailwindcss.com/docs/align-content
436
449
  ##
437
- "align-content" => [{ content: [*ALIGN.call, "baseline"] }],
450
+ "align-content" => [{ "content" => ["normal", *ALIGN.call, "baseline"] }],
438
451
  ##
439
452
  # Align Items
440
453
  # @see https://tailwindcss.com/docs/align-items
@@ -449,7 +462,7 @@ module TailwindMerge
449
462
  # Place Content
450
463
  # @see https://tailwindcss.com/docs/place-content
451
464
  ##
452
- "place-content" => [{ "place-content" => [*ALIGN.call, "baseline", "stretch"] }],
465
+ "place-content" => [{ "place-content" => [*ALIGN.call, "baseline"] }],
453
466
  ##
454
467
  # Place Items
455
468
  # @see https://tailwindcss.com/docs/place-items
@@ -476,6 +489,16 @@ module TailwindMerge
476
489
  # @see https://tailwindcss.com/docs/padding
477
490
  ##
478
491
  "py" => [{ "py" => [PADDING] }],
492
+ #
493
+ # Padding Start
494
+ # @see https://tailwindcss.com/docs/padding
495
+ #
496
+ "ps" => [{ "ps" => [PADDING] }],
497
+ #
498
+ # Padding End
499
+ # @see https://tailwindcss.com/docs/padding
500
+ #
501
+ "pe" => [{ "pe" => [PADDING] }],
479
502
  ##
480
503
  # Padding Top
481
504
  # @see https://tailwindcss.com/docs/padding
@@ -511,6 +534,16 @@ module TailwindMerge
511
534
  # @see https://tailwindcss.com/docs/margin
512
535
  ##
513
536
  "my" => [{ "my" => [MARGIN] }],
537
+ #
538
+ # Margin Start
539
+ # @see https://tailwindcss.com/docs/margin
540
+ #
541
+ "ms" => [{ "ms" => [MARGIN] }],
542
+ #
543
+ # Margin End
544
+ # @see https://tailwindcss.com/docs/margin
545
+ #
546
+ "me" => [{ "me" => [MARGIN] }],
514
547
  ##
515
548
  # Margin Top
516
549
  # @see https://tailwindcss.com/docs/margin
@@ -683,8 +716,13 @@ module TailwindMerge
683
716
  "widest",
684
717
  IS_ARBITRARY_LENGTH,
685
718
  ],
686
- },
719
+ }, # rubocop:enable Metrics/CollectionLiteralLength
687
720
  ],
721
+ #
722
+ # Line Clamp
723
+ # @see https://tailwindcss.com/docs/line-clamp
724
+ #
725
+ "line-clamp" => [{ "line-clamp" => ["none", IS_NUMBER, IS_ARBITRARY_NUMBER] }],
688
726
  ##
689
727
  # Line Height
690
728
  # @see https://tailwindcss.com/docs/line-height
@@ -692,6 +730,11 @@ module TailwindMerge
692
730
  "leading" => [
693
731
  { "leading" => ["none", "tight", "snug", "normal", "relaxed", "loose", IS_LENGTH] },
694
732
  ],
733
+ #
734
+ # List Style Image
735
+ # @see https://tailwindcss.com/docs/list-style-image
736
+ #
737
+ "list-image" => [{ "list-image" => ["none", IS_ARBITRARY_VALUE] }],
695
738
  ##
696
739
  # List Style Type
697
740
  # @see https://tailwindcss.com/docs/list-style-type
@@ -791,12 +834,17 @@ module TailwindMerge
791
834
  # Whitespace
792
835
  # @see https://tailwindcss.com/docs/whitespace
793
836
  ##
794
- "whitespace" => [{ "whitespace" => ["normal", "nowrap", "pre", "pre-line", "pre-wrap"] }],
837
+ "whitespace" => [{ "whitespace" => ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces"] }],
795
838
  ##
796
839
  # Word Break
797
840
  # @see https://tailwindcss.com/docs/word-break
798
841
  ##
799
842
  "break" => [{ "break" => ["normal", "words", "all", "keep"] }],
843
+ #
844
+ # Hyphens
845
+ # @see https://tailwindcss.com/docs/hyphens
846
+ #
847
+ "hyphens" => [{ "hyphens" => ["none", "manual", "auto"] }],
800
848
  ##
801
849
  # Content
802
850
  # @see https://tailwindcss.com/docs/content
@@ -857,6 +905,21 @@ module TailwindMerge
857
905
  # @see https://tailwindcss.com/docs/background-color
858
906
  ##
859
907
  "bg-color" => [{ "bg" => [COLORS] }],
908
+ #
909
+ # Gradient Color Stops From Position
910
+ # @see https://tailwindcss.com/docs/gradient-color-stops
911
+ #
912
+ "gradient-from-pos" => [{ "from" => [GRADIENT_COLOR_STOP_POSITIONS] }],
913
+ #
914
+ # Gradient Color Stops Via Position
915
+ # @see https://tailwindcss.com/docs/gradient-color-stops
916
+ #
917
+ "gradient-via-pos" => [{ "via" => [GRADIENT_COLOR_STOP_POSITIONS] }],
918
+ #
919
+ # Gradient Color Stops To Position
920
+ # @see https://tailwindcss.com/docs/gradient-color-stops
921
+ #
922
+ "gradient-to-pos" => [{ "to" => [GRADIENT_COLOR_STOP_POSITIONS] }],
860
923
  ##
861
924
  # Gradient Color Stops From
862
925
  # @see https://tailwindcss.com/docs/gradient-color-stops
@@ -878,6 +941,16 @@ module TailwindMerge
878
941
  # @see https://tailwindcss.com/docs/border-radius
879
942
  ##
880
943
  "rounded" => [{ "rounded" => [BORDER_RADIUS] }],
944
+ #
945
+ # Border Radius Start
946
+ # @see https://tailwindcss.com/docs/border-radius
947
+ #
948
+ "rounded-s" => [{ "rounded-s" => [BORDER_RADIUS] }],
949
+ #
950
+ # Border Radius End
951
+ # @see https://tailwindcss.com/docs/border-radius
952
+ #
953
+ "rounded-e" => [{ "rounded-e" => [BORDER_RADIUS] }],
881
954
  ##
882
955
  # Border Radius Top
883
956
  # @see https://tailwindcss.com/docs/border-radius
@@ -898,6 +971,26 @@ module TailwindMerge
898
971
  # @see https://tailwindcss.com/docs/border-radius
899
972
  ##
900
973
  "rounded-l" => [{ "rounded-l" => [BORDER_RADIUS] }],
974
+ #
975
+ # Border Radius Start Start
976
+ # @see https://tailwindcss.com/docs/border-radius
977
+ #
978
+ "rounded-ss" => [{ "rounded-ss" => [BORDER_RADIUS] }],
979
+ #
980
+ # Border Radius Start End
981
+ # @see https://tailwindcss.com/docs/border-radius
982
+ #
983
+ "rounded-se" => [{ "rounded-se" => [BORDER_RADIUS] }],
984
+ #
985
+ # Border Radius End End
986
+ # @see https://tailwindcss.com/docs/border-radius
987
+ #
988
+ "rounded-ee" => [{ "rounded-ee" => [BORDER_RADIUS] }],
989
+ #
990
+ # Border Radius End Start
991
+ # @see https://tailwindcss.com/docs/border-radius
992
+ #
993
+ "rounded-es" => [{ "rounded-es" => [BORDER_RADIUS] }],
901
994
  ##
902
995
  # Border Radius Top Left
903
996
  # @see https://tailwindcss.com/docs/border-radius
@@ -933,6 +1026,16 @@ module TailwindMerge
933
1026
  # @see https://tailwindcss.com/docs/border-width
934
1027
  ##
935
1028
  "border-w-y" => [{ "border-y" => [BORDER_WIDTH] }],
1029
+ #
1030
+ # Border Width Start
1031
+ # @see https://tailwindcss.com/docs/border-width
1032
+ #
1033
+ "border-w-s" => [{ "border-s" => [BORDER_WIDTH] }],
1034
+ #
1035
+ # Border Width End
1036
+ # @see https://tailwindcss.com/docs/border-width
1037
+ #
1038
+ "border-w-e" => [{ "border-e" => [BORDER_WIDTH] }],
936
1039
  ##
937
1040
  # Border Width Top
938
1041
  # @see https://tailwindcss.com/docs/border-width
@@ -1238,6 +1341,11 @@ module TailwindMerge
1238
1341
  # @see https://tailwindcss.com/docs/table-layout
1239
1342
  ##
1240
1343
  "table-layout" => [{ "table" => ["auto", "fixed"] }],
1344
+ #
1345
+ # Caption Side
1346
+ # @see https://tailwindcss.com/docs/caption-side
1347
+ #
1348
+ "caption" => [{ "caption" => ["top", "bottom"] }],
1241
1349
  # Transitions and Animation
1242
1350
  ##
1243
1351
  # Tranisition Property
@@ -1261,7 +1369,7 @@ module TailwindMerge
1261
1369
  # Transition Duration
1262
1370
  # @see https://tailwindcss.com/docs/transition-duration
1263
1371
  ##
1264
- "duration" => [{ "duration" => [NUMBER_AND_ARBITRARY] }],
1372
+ "duration" => [{ "duration" => NUMBER_AND_ARBITRARY.call }],
1265
1373
  ##
1266
1374
  # Transition Timing Function
1267
1375
  # @see https://tailwindcss.com/docs/transition-timing-function
@@ -1271,7 +1379,7 @@ module TailwindMerge
1271
1379
  # Transition Delay
1272
1380
  # @see https://tailwindcss.com/docs/transition-delay
1273
1381
  ##
1274
- "delay" => [{ "delay" => [NUMBER_AND_ARBITRARY] }],
1382
+ "delay" => [{ "delay" => NUMBER_AND_ARBITRARY.call }],
1275
1383
  ##
1276
1384
  # Animation
1277
1385
  # @see https://tailwindcss.com/docs/animation
@@ -1436,6 +1544,16 @@ module TailwindMerge
1436
1544
  # @see https://tailwindcss.com/docs/scroll-margin
1437
1545
  ##
1438
1546
  "scroll-my" => [{ "scroll-my" => [SPACING] }],
1547
+ #
1548
+ # Scroll Margin Start
1549
+ # @see https://tailwindcss.com/docs/scroll-margin
1550
+ #
1551
+ "scroll-ms" => [{ "scroll-ms" => [SPACING] }],
1552
+ #
1553
+ # Scroll Margin End
1554
+ # @see https://tailwindcss.com/docs/scroll-margin
1555
+ #
1556
+ "scroll-me" => [{ "scroll-me" => [SPACING] }],
1439
1557
  ##
1440
1558
  # Scroll Margin Top
1441
1559
  # @see https://tailwindcss.com/docs/scroll-margin
@@ -1471,6 +1589,16 @@ module TailwindMerge
1471
1589
  # @see https://tailwindcss.com/docs/scroll-padding
1472
1590
  ##
1473
1591
  "scroll-py" => [{ "scroll-py" => [SPACING] }],
1592
+ #
1593
+ # Scroll Padding Start
1594
+ # @see https://tailwindcss.com/docs/scroll-padding
1595
+ #
1596
+ "scroll-ps" => [{ "scroll-ps" => [SPACING] }],
1597
+ #
1598
+ # Scroll Padding End
1599
+ # @see https://tailwindcss.com/docs/scroll-padding
1600
+ #
1601
+ "scroll-pe" => [{ "scroll-pe" => [SPACING] }],
1474
1602
  ##
1475
1603
  # Scroll Padding Top
1476
1604
  # @see https://tailwindcss.com/docs/scroll-padding
@@ -1564,15 +1692,15 @@ module TailwindMerge
1564
1692
  conflicting_class_groups: {
1565
1693
  "overflow" => ["overflow-x", "overflow-y"],
1566
1694
  "overscroll" => ["overscroll-x", "overscroll-y"],
1567
- "inset" => ["inset-x", "inset-y", "top", "right", "bottom", "left"],
1695
+ "inset" => ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
1568
1696
  "inset-x" => ["right", "left"],
1569
1697
  "inset-y" => ["top", "bottom"],
1570
1698
  "flex" => ["basis", "grow", "shrink"],
1571
1699
  "gap" => ["gap-x", "gap-y"],
1572
- "p" => ["px", "py", "pt", "pr", "pb", "pl"],
1700
+ "p" => ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
1573
1701
  "px" => ["pr", "pl"],
1574
1702
  "py" => ["pt", "pb"],
1575
- "m" => ["mx", "my", "mt", "mr", "mb", "ml"],
1703
+ "m" => ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
1576
1704
  "mx" => ["mr", "ml"],
1577
1705
  "my" => ["mt", "mb"],
1578
1706
  "font-size" => ["leading"],
@@ -1589,21 +1717,36 @@ module TailwindMerge
1589
1717
  "fvn-spacing" => ["fvn-normal"],
1590
1718
  "fvn-fraction" => ["fvn-normal"],
1591
1719
  "rounded" => [
1720
+ "rounded-s",
1721
+ "rounded-e",
1592
1722
  "rounded-t",
1593
1723
  "rounded-r",
1594
1724
  "rounded-b",
1595
1725
  "rounded-l",
1726
+ "rounded-ss",
1727
+ "rounded-se",
1728
+ "rounded-ee",
1729
+ "rounded-es",
1596
1730
  "rounded-tl",
1597
1731
  "rounded-tr",
1598
1732
  "rounded-br",
1599
1733
  "rounded-bl",
1600
1734
  ],
1735
+ "rounded-s" => ["rounded-ss", "rounded-es"],
1736
+ "rounded-e" => ["rounded-se", "rounded-ee"],
1601
1737
  "rounded-t" => ["rounded-tl", "rounded-tr"],
1602
1738
  "rounded-r" => ["rounded-tr", "rounded-br"],
1603
1739
  "rounded-b" => ["rounded-br", "rounded-bl"],
1604
1740
  "rounded-l" => ["rounded-tl", "rounded-bl"],
1605
1741
  "border-spacing" => ["border-spacing-x", "border-spacing-y"],
1606
- "border-w" => ["border-w-t", "border-w-r", "border-w-b", "border-w-l"],
1742
+ "border-w" => [
1743
+ "border-w-s",
1744
+ "border-w-e",
1745
+ "border-w-t",
1746
+ "border-w-r",
1747
+ "border-w-b",
1748
+ "border-w-l",
1749
+ ],
1607
1750
  "border-w-x" => ["border-w-r", "border-w-l"],
1608
1751
  "border-w-y" => ["border-w-t", "border-w-b"],
1609
1752
  "border-color" => [
@@ -1617,6 +1760,8 @@ module TailwindMerge
1617
1760
  "scroll-m" => [
1618
1761
  "scroll-mx",
1619
1762
  "scroll-my",
1763
+ "scroll-ms",
1764
+ "scroll-me",
1620
1765
  "scroll-mt",
1621
1766
  "scroll-mr",
1622
1767
  "scroll-mb",
@@ -1627,6 +1772,8 @@ module TailwindMerge
1627
1772
  "scroll-p" => [
1628
1773
  "scroll-px",
1629
1774
  "scroll-py",
1775
+ "scroll-ps",
1776
+ "scroll-pe",
1630
1777
  "scroll-pt",
1631
1778
  "scroll-pr",
1632
1779
  "scroll-pb",
@@ -27,7 +27,7 @@ module TailwindMerge
27
27
 
28
28
  ARBITRARY_VALUE_REGEX = /^\[(?:([a-z-]+):)?(.+)\]$/i
29
29
  FRACTION_REGEX = %r{^\d+/\d+$}
30
- LENGTH_UNIT_REGEX = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh)/
30
+ LENGTH_UNIT_REGEX = /\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))/
31
31
  TSHIRT_UNIT_REGEX = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/
32
32
  # Shadow always begins with x and y offset separated by underscore
33
33
  SHADOW_REGEX = /^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/
@@ -85,6 +85,10 @@ module TailwindMerge
85
85
  is_number.call(value)
86
86
  }
87
87
 
88
+ IS_PERCENT = ->(value) {
89
+ value.end_with?("%") && is_number.call(value[0..-2])
90
+ }
91
+
88
92
  IS_INTEGER = ->(value) {
89
93
  is_integer_only.call(value) || arbitrary_value?(value, "number", is_integer_only)
90
94
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TailwindMerge
4
- VERSION = "0.5.1"
4
+ VERSION = "0.6.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tailwind_merge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen J. Torikian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-05 00:00:00.000000000 Z
11
+ date: 2023-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lru_redux