tailwind_merge 1.4.0 → 1.5.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/lib/tailwind_merge/config.rb +48 -2
- 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: 2be310d25aa48823e2782965b3d44202a26986ad59aaaf5672867e432c06dc15
|
|
4
|
+
data.tar.gz: 17e4ef04d443ab193c6b5b468008f2e0d1a9db1aaa6c37533e296531505c6bea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 260b41ff06162e8b0b25f65f269f978f3d947b19f418b2d77d8b6fc760a684826a3a7a9246aae0c86aae6791a21e87fef46961eae552e3a88bd495699eef057e
|
|
7
|
+
data.tar.gz: 46e891d347c8d5e73af2d3a92f6f4bb8e7c1e0b63b6fb32305183c7d36834cc8870a7b7e0f1dfb8c529ab0726ecf92d5fb2c24620b6a0320bd035fc60980056c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [v1.5.1] - 18-05-2026
|
|
2
|
+
## What's Changed
|
|
3
|
+
* Fix memory leak when passing in config by @ibrahima in https://github.com/gjtorikian/tailwind_merge/pull/77
|
|
4
|
+
|
|
5
|
+
## New Contributors
|
|
6
|
+
* @ibrahima made their first contribution in https://github.com/gjtorikian/tailwind_merge/pull/77
|
|
7
|
+
|
|
8
|
+
**Full Changelog**: https://github.com/gjtorikian/tailwind_merge/compare/v1.5.0...v1.5.1
|
|
9
|
+
# [v1.5.0] - 11-05-2026
|
|
10
|
+
## What's Changed
|
|
11
|
+
* Add TW 4.3 features by @gjtorikian in https://github.com/gjtorikian/tailwind_merge/pull/75
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
**Full Changelog**: https://github.com/gjtorikian/tailwind_merge/compare/v1.4.0...v1.5.0
|
|
1
15
|
# [v1.4.0] - 22-02-2026
|
|
2
16
|
## What's Changed
|
|
3
17
|
* 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
|
"**",
|
|
@@ -2401,17 +2445,19 @@ module TailwindMerge
|
|
|
2401
2445
|
|
|
2402
2446
|
def merge_config(incoming_config)
|
|
2403
2447
|
extended_config = TailwindMerge::Config::DEFAULTS.dup
|
|
2448
|
+
extended_config[:theme] = TailwindMerge::Config::DEFAULTS[:theme].dup
|
|
2404
2449
|
|
|
2405
|
-
incoming_theme = incoming_config.
|
|
2450
|
+
incoming_theme = incoming_config.fetch(:theme, nil) || {}
|
|
2406
2451
|
# if the incoming config has a theme, we...
|
|
2407
2452
|
incoming_theme.each_pair do |key, scales|
|
|
2408
2453
|
# ...add new scales to the existing ones
|
|
2454
|
+
extended_config[:theme][key] = extended_config[:theme][key].dup
|
|
2409
2455
|
extended_config[:theme][key] << ->(klass) {
|
|
2410
2456
|
scales.include?(klass)
|
|
2411
2457
|
}
|
|
2412
2458
|
end
|
|
2413
2459
|
|
|
2414
|
-
extended_config.merge(incoming_config)
|
|
2460
|
+
extended_config.merge(incoming_config.reject { |key, _| key == :theme })
|
|
2415
2461
|
end
|
|
2416
2462
|
end
|
|
2417
2463
|
end
|
|
@@ -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.1
|
|
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.1
|
|
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.1
|
|
81
|
+
source_code_uri: https://github.com/gjtorikian/tailwind_merge/tree/v1.5.1
|
|
82
|
+
changelog_uri: https://github.com/gjtorikian/tailwind_merge/blob/v1.5.1/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.1
|
|
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.10
|
|
102
102
|
specification_version: 4
|
|
103
103
|
summary: Utility function to efficiently merge Tailwind CSS classes without style
|
|
104
104
|
conflicts.
|