tailwind_merge 1.4.0 → 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 +6 -0
- data/lib/tailwind_merge/config.rb +44 -0
- data/lib/tailwind_merge/validators.rb +6 -0
- 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,9 @@
|
|
|
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
|
|
1
7
|
# [v1.4.0] - 22-02-2026
|
|
2
8
|
## What's Changed
|
|
3
9
|
* Support Tailwind v4.2 by @gjtorikian in https://github.com/gjtorikian/tailwind_merge/pull/73
|
|
@@ -248,6 +248,18 @@ module TailwindMerge
|
|
|
248
248
|
##
|
|
249
249
|
"container" => ["container"],
|
|
250
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
|
+
##
|
|
251
263
|
# Columns
|
|
252
264
|
# @see https://tailwindcss.com/docs/columns
|
|
253
265
|
##
|
|
@@ -1020,6 +1032,11 @@ module TailwindMerge
|
|
|
1020
1032
|
##
|
|
1021
1033
|
"indent" => [{ "indent" => SCALE_UNAMBIGUOUS_SPACING.call }],
|
|
1022
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
|
+
##
|
|
1023
1040
|
# Vertical Alignment
|
|
1024
1041
|
# @see https://tailwindcss.com/docs/vertical-align
|
|
1025
1042
|
##
|
|
@@ -1965,6 +1982,11 @@ module TailwindMerge
|
|
|
1965
1982
|
# @see https://tailwindcss.com/docs/translate
|
|
1966
1983
|
##
|
|
1967
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] }],
|
|
1968
1990
|
|
|
1969
1991
|
###############
|
|
1970
1992
|
# Interactivity
|
|
@@ -2061,6 +2083,26 @@ module TailwindMerge
|
|
|
2061
2083
|
##
|
|
2062
2084
|
"scroll-behavior" => [{ "scroll" => ["auto", "smooth"] }],
|
|
2063
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
|
+
##
|
|
2064
2106
|
# Scroll Margin
|
|
2065
2107
|
# @see https://tailwindcss.com/docs/scroll-margin
|
|
2066
2108
|
##
|
|
@@ -2266,6 +2308,7 @@ module TailwindMerge
|
|
|
2266
2308
|
"forced-color-adjust" => [{ "forced-color-adjust" => ["auto", "none"] }],
|
|
2267
2309
|
},
|
|
2268
2310
|
conflicting_class_groups: {
|
|
2311
|
+
"container-named" => ["container-type"],
|
|
2269
2312
|
"overflow" => ["overflow-x", "overflow-y"],
|
|
2270
2313
|
"overscroll" => ["overscroll-x", "overscroll-y"],
|
|
2271
2314
|
"inset" => ["inset-x", "inset-y", "start", "end", "inset-bs", "inset-be", "top", "right", "bottom", "left"],
|
|
@@ -2383,6 +2426,7 @@ module TailwindMerge
|
|
|
2383
2426
|
conflicting_class_group_modifiers: {
|
|
2384
2427
|
"font-size" => ["leading"],
|
|
2385
2428
|
},
|
|
2429
|
+
postfix_lookup_class_groups: ["container-type"],
|
|
2386
2430
|
order_sensitive_modifiers: [
|
|
2387
2431
|
"*",
|
|
2388
2432
|
"**",
|
|
@@ -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.
|