tailwind_merge 1.3.3 → 1.5.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 +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/tailwind_merge/config.rb +184 -5
- data/lib/tailwind_merge/validators.rb +7 -1
- data/lib/tailwind_merge/version.rb +1 -1
- data/lib/tailwind_merge.rb +24 -2
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1a99d9ee4d20e83c9f5c87005378fd99952a6f4b252e4f31d4ab7adc2ae2e02a
|
|
4
|
+
data.tar.gz: 51292822b8b1fa87e90706a46b5c7f6a6d8e754f9062eefdcf12638e04aa908d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f3df7fdc21a39f75890c1130fb911abc8a236666fafd469c1d1463ea2620286ad46fe8d8355410ae605325834d472da3c534e1b43a9d42da7f262297e2fc8649
|
|
7
|
+
data.tar.gz: 3929d56d319c52a5631baefbee50ad6e25c055757a60ee5f9c2cff1f2d2c65898db3426b66b42ffcface6b17ee44edc401a378ff967ea08fe6c5c7df8d8fc8e0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [v1.5.0] - 11-05-2026
|
|
2
|
+
## What's Changed
|
|
3
|
+
* Add TW 4.3 features by @gjtorikian in https://github.com/gjtorikian/tailwind_merge/pull/75
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
**Full Changelog**: https://github.com/gjtorikian/tailwind_merge/compare/v1.4.0...v1.5.0
|
|
7
|
+
# [v1.4.0] - 22-02-2026
|
|
8
|
+
## What's Changed
|
|
9
|
+
* Support Tailwind v4.2 by @gjtorikian in https://github.com/gjtorikian/tailwind_merge/pull/73
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
**Full Changelog**: https://github.com/gjtorikian/tailwind_merge/compare/v1.3.3...v1.4.0
|
|
1
13
|
# [v1.3.3] - 31-01-2026
|
|
2
14
|
## What's Changed
|
|
3
15
|
* Update minitest requirement from ~> 5.6 to ~> 6.0 in the bundler-dependencies group by @dependabot[bot] in https://github.com/gjtorikian/tailwind_merge/pull/70
|
|
@@ -102,6 +102,35 @@ module TailwindMerge
|
|
|
102
102
|
*SCALE_UNAMBIGUOUS_SPACING.call,
|
|
103
103
|
]
|
|
104
104
|
}
|
|
105
|
+
SCALE_SIZING_INLINE = -> {
|
|
106
|
+
[
|
|
107
|
+
IS_FRACTION,
|
|
108
|
+
"screen",
|
|
109
|
+
"full",
|
|
110
|
+
"dvw",
|
|
111
|
+
"lvw",
|
|
112
|
+
"svw",
|
|
113
|
+
"min",
|
|
114
|
+
"max",
|
|
115
|
+
"fit",
|
|
116
|
+
*SCALE_UNAMBIGUOUS_SPACING.call,
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
SCALE_SIZING_BLOCK = -> {
|
|
120
|
+
[
|
|
121
|
+
IS_FRACTION,
|
|
122
|
+
"screen",
|
|
123
|
+
"full",
|
|
124
|
+
"lh",
|
|
125
|
+
"dvh",
|
|
126
|
+
"lvh",
|
|
127
|
+
"svh",
|
|
128
|
+
"min",
|
|
129
|
+
"max",
|
|
130
|
+
"fit",
|
|
131
|
+
*SCALE_UNAMBIGUOUS_SPACING.call,
|
|
132
|
+
]
|
|
133
|
+
}
|
|
105
134
|
SCALE_COLOR = -> { [THEME_COLOR, IS_ARBITRARY_VARIABLE, IS_ARBITRARY_VALUE] }
|
|
106
135
|
SCALE_BG_POSITION = -> { [*SCALE_POSITION.call, IS_ARBITRARY_VARIABLE_POSITION, IS_ARBITRARY_POSITION, "position" => [IS_ARBITRARY_VARIABLE, IS_ARBITRARY_VALUE]] }
|
|
107
136
|
SCALE_BG_REPEAT = -> { ["no-repeat", "repeat" => ["", "x", "y", "space", "round"]] }
|
|
@@ -219,6 +248,18 @@ module TailwindMerge
|
|
|
219
248
|
##
|
|
220
249
|
"container" => ["container"],
|
|
221
250
|
##
|
|
251
|
+
# Container Type
|
|
252
|
+
# @see https://tailwindcss.com/docs/responsive-design#container-queries
|
|
253
|
+
##
|
|
254
|
+
"container-type" => [
|
|
255
|
+
{ "@container" => ["", "normal", "size", IS_ARBITRARY_VARIABLE, IS_ARBITRARY_VALUE] },
|
|
256
|
+
],
|
|
257
|
+
##
|
|
258
|
+
# Container Name
|
|
259
|
+
# @see https://tailwindcss.com/docs/responsive-design#named-containers
|
|
260
|
+
##
|
|
261
|
+
"container-named" => [IS_NAMED_CONTAINER_QUERY],
|
|
262
|
+
##
|
|
222
263
|
# Columns
|
|
223
264
|
# @see https://tailwindcss.com/docs/columns
|
|
224
265
|
##
|
|
@@ -359,12 +400,22 @@ module TailwindMerge
|
|
|
359
400
|
# Start
|
|
360
401
|
# @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
361
402
|
#
|
|
362
|
-
"start" => [{ "start" => [SCALE_INSET] }],
|
|
403
|
+
"start" => [{ "inset-s" => [SCALE_INSET], "start" => [SCALE_INSET] }],
|
|
363
404
|
#
|
|
364
405
|
# End
|
|
365
406
|
# @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
366
407
|
#
|
|
367
|
-
"end" => [{ "end" => [SCALE_INSET] }],
|
|
408
|
+
"end" => [{ "inset-e" => [SCALE_INSET], "end" => [SCALE_INSET] }],
|
|
409
|
+
#
|
|
410
|
+
# Inset Block Start
|
|
411
|
+
# @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
412
|
+
#
|
|
413
|
+
"inset-bs" => [{ "inset-bs" => [SCALE_INSET] }],
|
|
414
|
+
#
|
|
415
|
+
# Inset Block End
|
|
416
|
+
# @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
417
|
+
#
|
|
418
|
+
"inset-be" => [{ "inset-be" => [SCALE_INSET] }],
|
|
368
419
|
##
|
|
369
420
|
# Top
|
|
370
421
|
# @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
@@ -593,6 +644,16 @@ module TailwindMerge
|
|
|
593
644
|
# @see https://tailwindcss.com/docs/padding
|
|
594
645
|
#
|
|
595
646
|
"pe" => [{ "pe" => SCALE_UNAMBIGUOUS_SPACING.call }],
|
|
647
|
+
#
|
|
648
|
+
# Padding Block Start
|
|
649
|
+
# @see https://tailwindcss.com/docs/padding
|
|
650
|
+
#
|
|
651
|
+
"pbs" => [{ "pbs" => SCALE_UNAMBIGUOUS_SPACING.call }],
|
|
652
|
+
#
|
|
653
|
+
# Padding Block End
|
|
654
|
+
# @see https://tailwindcss.com/docs/padding
|
|
655
|
+
#
|
|
656
|
+
"pbe" => [{ "pbe" => SCALE_UNAMBIGUOUS_SPACING.call }],
|
|
596
657
|
##
|
|
597
658
|
# Padding Top
|
|
598
659
|
# @see https://tailwindcss.com/docs/padding
|
|
@@ -638,6 +699,16 @@ module TailwindMerge
|
|
|
638
699
|
# @see https://tailwindcss.com/docs/margin
|
|
639
700
|
#
|
|
640
701
|
"me" => [{ "me" => SCALE_MARGIN.call }],
|
|
702
|
+
#
|
|
703
|
+
# Margin Block Start
|
|
704
|
+
# @see https://tailwindcss.com/docs/margin
|
|
705
|
+
#
|
|
706
|
+
"mbs" => [{ "mbs" => SCALE_MARGIN.call }],
|
|
707
|
+
#
|
|
708
|
+
# Margin Block End
|
|
709
|
+
# @see https://tailwindcss.com/docs/margin
|
|
710
|
+
#
|
|
711
|
+
"mbe" => [{ "mbe" => SCALE_MARGIN.call }],
|
|
641
712
|
##
|
|
642
713
|
# Margin Top
|
|
643
714
|
# @see https://tailwindcss.com/docs/margin
|
|
@@ -688,6 +759,30 @@ module TailwindMerge
|
|
|
688
759
|
# @see https://tailwindcss.com/docs/width#setting-both-width-and-height
|
|
689
760
|
##
|
|
690
761
|
"size" => [{ "size" => SCALE_SIZING.call }],
|
|
762
|
+
##
|
|
763
|
+
# Inline Size
|
|
764
|
+
##
|
|
765
|
+
"inline-size" => [{ "inline" => ["auto", *SCALE_SIZING_INLINE.call] }],
|
|
766
|
+
##
|
|
767
|
+
# Min Inline Size
|
|
768
|
+
##
|
|
769
|
+
"min-inline-size" => [{ "min-inline" => ["auto", *SCALE_SIZING_INLINE.call] }],
|
|
770
|
+
##
|
|
771
|
+
# Max Inline Size
|
|
772
|
+
##
|
|
773
|
+
"max-inline-size" => [{ "max-inline" => ["none", *SCALE_SIZING_INLINE.call] }],
|
|
774
|
+
##
|
|
775
|
+
# Block Size
|
|
776
|
+
##
|
|
777
|
+
"block-size" => [{ "block" => ["auto", *SCALE_SIZING_BLOCK.call] }],
|
|
778
|
+
##
|
|
779
|
+
# Min Block Size
|
|
780
|
+
##
|
|
781
|
+
"min-block-size" => [{ "min-block" => ["auto", *SCALE_SIZING_BLOCK.call] }],
|
|
782
|
+
##
|
|
783
|
+
# Max Block Size
|
|
784
|
+
##
|
|
785
|
+
"max-block-size" => [{ "max-block" => ["none", *SCALE_SIZING_BLOCK.call] }],
|
|
691
786
|
# Width
|
|
692
787
|
# @see https://tailwindcss.com/docs/width
|
|
693
788
|
##
|
|
@@ -801,6 +896,10 @@ module TailwindMerge
|
|
|
801
896
|
##
|
|
802
897
|
"font-family" => [{ "font" => [IS_ARBITRARY_VARIABLE_FAMILY_NAME, IS_ARBITRARY_FAMILY_NAME, THEME_FONT] }],
|
|
803
898
|
##
|
|
899
|
+
# Font Feature Settings
|
|
900
|
+
##
|
|
901
|
+
"font-features" => [{ "font-features" => [IS_ARBITRARY_VALUE] }],
|
|
902
|
+
##
|
|
804
903
|
# Font Variant Numeric
|
|
805
904
|
# @see https://tailwindcss.com/docs/font-variant-numeric
|
|
806
905
|
##
|
|
@@ -933,6 +1032,11 @@ module TailwindMerge
|
|
|
933
1032
|
##
|
|
934
1033
|
"indent" => [{ "indent" => SCALE_UNAMBIGUOUS_SPACING.call }],
|
|
935
1034
|
##
|
|
1035
|
+
# Tab Size
|
|
1036
|
+
# @see https://tailwindcss.com/docs/tab-size
|
|
1037
|
+
##
|
|
1038
|
+
"tab-size" => [{ "tab" => [IS_INTEGER, IS_ARBITRARY_VARIABLE, IS_ARBITRARY_VALUE] }],
|
|
1039
|
+
##
|
|
936
1040
|
# Vertical Alignment
|
|
937
1041
|
# @see https://tailwindcss.com/docs/vertical-align
|
|
938
1042
|
##
|
|
@@ -1173,6 +1277,16 @@ module TailwindMerge
|
|
|
1173
1277
|
# @see https://tailwindcss.com/docs/border-width
|
|
1174
1278
|
#
|
|
1175
1279
|
"border-w-e" => [{ "border-e" => SCALE_BORDER_WIDTH.call }],
|
|
1280
|
+
#
|
|
1281
|
+
# Border Width Block Start
|
|
1282
|
+
# @see https://tailwindcss.com/docs/border-width
|
|
1283
|
+
#
|
|
1284
|
+
"border-w-bs" => [{ "border-bs" => SCALE_BORDER_WIDTH.call }],
|
|
1285
|
+
#
|
|
1286
|
+
# Border Width Block End
|
|
1287
|
+
# @see https://tailwindcss.com/docs/border-width
|
|
1288
|
+
#
|
|
1289
|
+
"border-w-be" => [{ "border-be" => SCALE_BORDER_WIDTH.call }],
|
|
1176
1290
|
##
|
|
1177
1291
|
# Border Width Top
|
|
1178
1292
|
# @see https://tailwindcss.com/docs/border-width
|
|
@@ -1249,6 +1363,16 @@ module TailwindMerge
|
|
|
1249
1363
|
# @see https://tailwindcss.com/docs/border-color
|
|
1250
1364
|
##
|
|
1251
1365
|
"border-color-e" => [{ "border-e" => SCALE_COLOR.call }],
|
|
1366
|
+
#
|
|
1367
|
+
# Border Color Block Start
|
|
1368
|
+
# @see https://tailwindcss.com/docs/border-color
|
|
1369
|
+
#
|
|
1370
|
+
"border-color-bs" => [{ "border-bs" => SCALE_COLOR.call }],
|
|
1371
|
+
#
|
|
1372
|
+
# Border Color Block End
|
|
1373
|
+
# @see https://tailwindcss.com/docs/border-color
|
|
1374
|
+
#
|
|
1375
|
+
"border-color-be" => [{ "border-be" => SCALE_COLOR.call }],
|
|
1252
1376
|
##
|
|
1253
1377
|
# Border Color Top
|
|
1254
1378
|
# @see https://tailwindcss.com/docs/border-color
|
|
@@ -1858,6 +1982,11 @@ module TailwindMerge
|
|
|
1858
1982
|
# @see https://tailwindcss.com/docs/translate
|
|
1859
1983
|
##
|
|
1860
1984
|
"translate-none" => ["translate-none"],
|
|
1985
|
+
##
|
|
1986
|
+
# Zoom
|
|
1987
|
+
# @see https://tailwindcss.com/docs/zoom
|
|
1988
|
+
##
|
|
1989
|
+
"zoom" => [{ "zoom" => [IS_INTEGER, IS_ARBITRARY_VARIABLE, IS_ARBITRARY_VALUE] }],
|
|
1861
1990
|
|
|
1862
1991
|
###############
|
|
1863
1992
|
# Interactivity
|
|
@@ -1954,6 +2083,26 @@ module TailwindMerge
|
|
|
1954
2083
|
##
|
|
1955
2084
|
"scroll-behavior" => [{ "scroll" => ["auto", "smooth"] }],
|
|
1956
2085
|
##
|
|
2086
|
+
# Scrollbar Thumb Color
|
|
2087
|
+
# @see https://tailwindcss.com/docs/scrollbar-color
|
|
2088
|
+
##
|
|
2089
|
+
"scrollbar-thumb-color" => [{ "scrollbar-thumb" => SCALE_COLOR.call }],
|
|
2090
|
+
##
|
|
2091
|
+
# Scrollbar Track Color
|
|
2092
|
+
# @see https://tailwindcss.com/docs/scrollbar-color
|
|
2093
|
+
##
|
|
2094
|
+
"scrollbar-track-color" => [{ "scrollbar-track" => SCALE_COLOR.call }],
|
|
2095
|
+
##
|
|
2096
|
+
# Scrollbar Gutter
|
|
2097
|
+
# @see https://tailwindcss.com/docs/scrollbar-gutter
|
|
2098
|
+
##
|
|
2099
|
+
"scrollbar-gutter" => [{ "scrollbar-gutter" => ["auto", "stable", "both"] }],
|
|
2100
|
+
##
|
|
2101
|
+
# Scrollbar Width
|
|
2102
|
+
# @see https://tailwindcss.com/docs/scrollbar-width
|
|
2103
|
+
##
|
|
2104
|
+
"scrollbar-w" => [{ "scrollbar" => ["auto", "thin", "none"] }],
|
|
2105
|
+
##
|
|
1957
2106
|
# Scroll Margin
|
|
1958
2107
|
# @see https://tailwindcss.com/docs/scroll-margin
|
|
1959
2108
|
##
|
|
@@ -1978,6 +2127,16 @@ module TailwindMerge
|
|
|
1978
2127
|
# @see https://tailwindcss.com/docs/scroll-margin
|
|
1979
2128
|
#
|
|
1980
2129
|
"scroll-me" => [{ "scroll-me" => SCALE_UNAMBIGUOUS_SPACING.call }],
|
|
2130
|
+
#
|
|
2131
|
+
# Scroll Margin Block Start
|
|
2132
|
+
# @see https://tailwindcss.com/docs/scroll-margin
|
|
2133
|
+
#
|
|
2134
|
+
"scroll-mbs" => [{ "scroll-mbs" => SCALE_UNAMBIGUOUS_SPACING.call }],
|
|
2135
|
+
#
|
|
2136
|
+
# Scroll Margin Block End
|
|
2137
|
+
# @see https://tailwindcss.com/docs/scroll-margin
|
|
2138
|
+
#
|
|
2139
|
+
"scroll-mbe" => [{ "scroll-mbe" => SCALE_UNAMBIGUOUS_SPACING.call }],
|
|
1981
2140
|
##
|
|
1982
2141
|
# Scroll Margin Top
|
|
1983
2142
|
# @see https://tailwindcss.com/docs/scroll-margin
|
|
@@ -2023,6 +2182,16 @@ module TailwindMerge
|
|
|
2023
2182
|
# @see https://tailwindcss.com/docs/scroll-padding
|
|
2024
2183
|
#
|
|
2025
2184
|
"scroll-pe" => [{ "scroll-pe" => SCALE_UNAMBIGUOUS_SPACING.call }],
|
|
2185
|
+
#
|
|
2186
|
+
# Scroll Padding Block Start
|
|
2187
|
+
# @see https://tailwindcss.com/docs/scroll-padding
|
|
2188
|
+
#
|
|
2189
|
+
"scroll-pbs" => [{ "scroll-pbs" => SCALE_UNAMBIGUOUS_SPACING.call }],
|
|
2190
|
+
#
|
|
2191
|
+
# Scroll Padding Block End
|
|
2192
|
+
# @see https://tailwindcss.com/docs/scroll-padding
|
|
2193
|
+
#
|
|
2194
|
+
"scroll-pbe" => [{ "scroll-pbe" => SCALE_UNAMBIGUOUS_SPACING.call }],
|
|
2026
2195
|
##
|
|
2027
2196
|
# Scroll Padding Top
|
|
2028
2197
|
# @see https://tailwindcss.com/docs/scroll-padding
|
|
@@ -2139,17 +2308,18 @@ module TailwindMerge
|
|
|
2139
2308
|
"forced-color-adjust" => [{ "forced-color-adjust" => ["auto", "none"] }],
|
|
2140
2309
|
},
|
|
2141
2310
|
conflicting_class_groups: {
|
|
2311
|
+
"container-named" => ["container-type"],
|
|
2142
2312
|
"overflow" => ["overflow-x", "overflow-y"],
|
|
2143
2313
|
"overscroll" => ["overscroll-x", "overscroll-y"],
|
|
2144
|
-
"inset" => ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
|
|
2314
|
+
"inset" => ["inset-x", "inset-y", "start", "end", "inset-bs", "inset-be", "top", "right", "bottom", "left"],
|
|
2145
2315
|
"inset-x" => ["right", "left"],
|
|
2146
2316
|
"inset-y" => ["top", "bottom"],
|
|
2147
2317
|
"flex" => ["basis", "grow", "shrink"],
|
|
2148
2318
|
"gap" => ["gap-x", "gap-y"],
|
|
2149
|
-
"p" => ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
|
|
2319
|
+
"p" => ["px", "py", "ps", "pe", "pbs", "pbe", "pt", "pr", "pb", "pl"],
|
|
2150
2320
|
"px" => ["pr", "pl"],
|
|
2151
2321
|
"py" => ["pt", "pb"],
|
|
2152
|
-
"m" => ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
|
|
2322
|
+
"m" => ["mx", "my", "ms", "me", "mbs", "mbe", "mt", "mr", "mb", "ml"],
|
|
2153
2323
|
"mx" => ["mr", "ml"],
|
|
2154
2324
|
"my" => ["mt", "mb"],
|
|
2155
2325
|
"size" => ["w", "h"],
|
|
@@ -2195,6 +2365,8 @@ module TailwindMerge
|
|
|
2195
2365
|
"border-w-y",
|
|
2196
2366
|
"border-w-s",
|
|
2197
2367
|
"border-w-e",
|
|
2368
|
+
"border-w-bs",
|
|
2369
|
+
"border-w-be",
|
|
2198
2370
|
"border-w-t",
|
|
2199
2371
|
"border-w-r",
|
|
2200
2372
|
"border-w-b",
|
|
@@ -2207,6 +2379,8 @@ module TailwindMerge
|
|
|
2207
2379
|
"border-color-y",
|
|
2208
2380
|
"border-color-s",
|
|
2209
2381
|
"border-color-e",
|
|
2382
|
+
"border-color-bs",
|
|
2383
|
+
"border-color-be",
|
|
2210
2384
|
"border-color-t",
|
|
2211
2385
|
"border-color-r",
|
|
2212
2386
|
"border-color-b",
|
|
@@ -2221,6 +2395,8 @@ module TailwindMerge
|
|
|
2221
2395
|
"scroll-my",
|
|
2222
2396
|
"scroll-ms",
|
|
2223
2397
|
"scroll-me",
|
|
2398
|
+
"scroll-mbs",
|
|
2399
|
+
"scroll-mbe",
|
|
2224
2400
|
"scroll-mt",
|
|
2225
2401
|
"scroll-mr",
|
|
2226
2402
|
"scroll-mb",
|
|
@@ -2233,6 +2409,8 @@ module TailwindMerge
|
|
|
2233
2409
|
"scroll-py",
|
|
2234
2410
|
"scroll-ps",
|
|
2235
2411
|
"scroll-pe",
|
|
2412
|
+
"scroll-pbs",
|
|
2413
|
+
"scroll-pbe",
|
|
2236
2414
|
"scroll-pt",
|
|
2237
2415
|
"scroll-pr",
|
|
2238
2416
|
"scroll-pb",
|
|
@@ -2248,6 +2426,7 @@ module TailwindMerge
|
|
|
2248
2426
|
conflicting_class_group_modifiers: {
|
|
2249
2427
|
"font-size" => ["leading"],
|
|
2250
2428
|
},
|
|
2429
|
+
postfix_lookup_class_groups: ["container-type"],
|
|
2251
2430
|
order_sensitive_modifiers: [
|
|
2252
2431
|
"*",
|
|
2253
2432
|
"**",
|
|
@@ -34,7 +34,7 @@ module TailwindMerge
|
|
|
34
34
|
|
|
35
35
|
ARBITRARY_VALUE_REGEX = /^\[(?:(\w[\w-]*):)?(.+)\]$/i
|
|
36
36
|
ARBITRARY_VARIABLE_REGEX = /^\((?:(\w[\w-]*):)?(.+)\)$/i
|
|
37
|
-
FRACTION_REGEX = %r{^\d
|
|
37
|
+
FRACTION_REGEX = %r{^\d+(?:\.\d+)?/\d+(?:\.\d+)?$}
|
|
38
38
|
TSHIRT_UNIT_REGEX = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/
|
|
39
39
|
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))|\b(calc|min|max|clamp)\(.+\)|^0$/
|
|
40
40
|
COLOR_FUNCTION_REGEX = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/
|
|
@@ -86,6 +86,12 @@ module TailwindMerge
|
|
|
86
86
|
!IS_ARBITRARY_VALUE.call(value) && !IS_ARBITRARY_VARIABLE.call(value)
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
NAMED_CONTAINER_QUERY_REGEX = %r{\A@container(?:-size|-normal)?/.+\z}
|
|
90
|
+
|
|
91
|
+
IS_NAMED_CONTAINER_QUERY = ->(value) {
|
|
92
|
+
NAMED_CONTAINER_QUERY_REGEX.match?(value)
|
|
93
|
+
}
|
|
94
|
+
|
|
89
95
|
IS_ARBITRARY_SIZE = ->(value) {
|
|
90
96
|
arbitrary_value?(value, IS_LABEL_SIZE, IS_NEVER)
|
|
91
97
|
}
|
data/lib/tailwind_merge.rb
CHANGED
|
@@ -25,6 +25,7 @@ module TailwindMerge
|
|
|
25
25
|
@config[:important_modifier] = @config[:important_modifier].to_s
|
|
26
26
|
@class_utils = TailwindMerge::ClassGroupUtils.new(@config)
|
|
27
27
|
@cache = LruRedux::Cache.new(@config[:cache_size], @config[:ignore_empty_cache])
|
|
28
|
+
@postfix_lookup_class_group_ids = build_postfix_lookup_class_group_ids(@config[:postfix_lookup_class_groups])
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
def merge(classes)
|
|
@@ -62,8 +63,21 @@ module TailwindMerge
|
|
|
62
63
|
end
|
|
63
64
|
|
|
64
65
|
has_postfix_modifier = maybe_postfix_modifier_position ? true : false
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
|
|
67
|
+
if has_postfix_modifier
|
|
68
|
+
base_class_name_without_postfix = base_class_name[0...maybe_postfix_modifier_position]
|
|
69
|
+
class_group_id = @class_utils.class_group_id(base_class_name_without_postfix)
|
|
70
|
+
|
|
71
|
+
if class_group_id && @postfix_lookup_class_group_ids[class_group_id]
|
|
72
|
+
class_group_id_with_postfix = @class_utils.class_group_id(base_class_name)
|
|
73
|
+
if class_group_id_with_postfix && class_group_id_with_postfix != class_group_id
|
|
74
|
+
class_group_id = class_group_id_with_postfix
|
|
75
|
+
has_postfix_modifier = false
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
else
|
|
79
|
+
class_group_id = @class_utils.class_group_id(base_class_name)
|
|
80
|
+
end
|
|
67
81
|
|
|
68
82
|
unless class_group_id
|
|
69
83
|
unless has_postfix_modifier
|
|
@@ -103,5 +117,13 @@ module TailwindMerge
|
|
|
103
117
|
|
|
104
118
|
merged_classes.reverse.join(" ")
|
|
105
119
|
end
|
|
120
|
+
|
|
121
|
+
private def build_postfix_lookup_class_group_ids(class_group_ids)
|
|
122
|
+
lookup = {}
|
|
123
|
+
return lookup unless class_group_ids
|
|
124
|
+
|
|
125
|
+
class_group_ids.each { |id| lookup[id] = true }
|
|
126
|
+
lookup
|
|
127
|
+
end
|
|
106
128
|
end
|
|
107
129
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tailwind_merge
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Garen J. Torikian
|
|
@@ -73,15 +73,15 @@ files:
|
|
|
73
73
|
- lib/tailwind_merge/version.rb
|
|
74
74
|
- script/test
|
|
75
75
|
- tailwind_merge.gemspec
|
|
76
|
-
homepage: https://github.com/gjtorikian/tailwind_merge/tree/v1.
|
|
76
|
+
homepage: https://github.com/gjtorikian/tailwind_merge/tree/v1.5.0
|
|
77
77
|
licenses:
|
|
78
78
|
- MIT
|
|
79
79
|
metadata:
|
|
80
|
-
homepage_uri: https://github.com/gjtorikian/tailwind_merge/tree/v1.
|
|
81
|
-
source_code_uri: https://github.com/gjtorikian/tailwind_merge/tree/v1.
|
|
82
|
-
changelog_uri: https://github.com/gjtorikian/tailwind_merge/blob/v1.
|
|
80
|
+
homepage_uri: https://github.com/gjtorikian/tailwind_merge/tree/v1.5.0
|
|
81
|
+
source_code_uri: https://github.com/gjtorikian/tailwind_merge/tree/v1.5.0
|
|
82
|
+
changelog_uri: https://github.com/gjtorikian/tailwind_merge/blob/v1.5.0/CHANGELOG.md
|
|
83
83
|
bug_tracker_uri: https://github.com/gjtorikian/tailwind_merge/issues
|
|
84
|
-
documentation_uri: https://rubydoc.info/gems/tailwind_merge/1.
|
|
84
|
+
documentation_uri: https://rubydoc.info/gems/tailwind_merge/1.5.0
|
|
85
85
|
funding_uri: https://github.com/sponsors/gjtorikian
|
|
86
86
|
rubygems_mfa_required: 'true'
|
|
87
87
|
rdoc_options: []
|
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
98
98
|
- !ruby/object:Gem::Version
|
|
99
99
|
version: '0'
|
|
100
100
|
requirements: []
|
|
101
|
-
rubygems_version: 4.0.
|
|
101
|
+
rubygems_version: 4.0.6
|
|
102
102
|
specification_version: 4
|
|
103
103
|
summary: Utility function to efficiently merge Tailwind CSS classes without style
|
|
104
104
|
conflicts.
|