tailwind_merge 1.3.2 → 1.4.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: c68866007d409f90232114a3954cc9df8b852bf8cabaf719c778cb5074ff4ee9
4
- data.tar.gz: d8c11eccbfb6fccfc78d03f7d7e5c0aba582b8cae3d37da4978a4d3b3ca8186f
3
+ metadata.gz: c92f465b5aa6ea57a71afc60b37c61b05986667919ff88754a97b846921e191c
4
+ data.tar.gz: e83db43c20ac8b867dd8c2dfb0450c6e5a5de3a6c03dc37563bc787b4f71f0e3
5
5
  SHA512:
6
- metadata.gz: e2a806dee8941c3a6e203cc57c7c72245bdd6402b08859e6575fb7dc3626a56a16caf78252c363adc31e241ef0b796e5eab97f87392838ba7361862695e5da61
7
- data.tar.gz: 00154a1c2915432a42eb6cd2e26fc23b0159a1e78e1e5fbaa86bc16c9db3130527f1d278d6a6207c36f1765fd736c78656214a07ec25ef0bbb026cf550aa7617
6
+ metadata.gz: 3ab5af9395abec32b81c841db1e2a5a54b6b96456167fae54d5792264cb2effcc3605ab1ee3a33ca84e45262267839ff70846caf09786aab284e5cdfda330fc8
7
+ data.tar.gz: e91081abf6c23662126192a2c2431497bbcda86e95bd25be166ecde54fa2a447cf664300d190af4e424cb1af1428e086730aba557fc826e6d71b77d10a83293e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # [v1.4.0] - 22-02-2026
2
+ ## What's Changed
3
+ * Support Tailwind v4.2 by @gjtorikian in https://github.com/gjtorikian/tailwind_merge/pull/73
4
+
5
+
6
+ **Full Changelog**: https://github.com/gjtorikian/tailwind_merge/compare/v1.3.3...v1.4.0
7
+ # [v1.3.3] - 31-01-2026
8
+ ## What's Changed
9
+ * 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
10
+ * prevent arbitrary font-family and font-weight from merging by @gjtorikian in https://github.com/gjtorikian/tailwind_merge/pull/71
11
+
12
+
13
+ **Full Changelog**: https://github.com/gjtorikian/tailwind_merge/compare/v1.3.2...v1.3.3
1
14
  # [v1.3.2] - 26-12-2025
2
15
  ## What's Changed
3
16
  * Bump actions/checkout from 4 to 5 by @dependabot[bot] in https://github.com/gjtorikian/tailwind_merge/pull/64
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gemspec
7
7
 
8
8
  gem "rake", "~> 13.0"
9
9
 
10
- gem "minitest", "~> 5.0"
10
+ gem "minitest", "~> 6.0"
11
11
 
12
12
  gem "rubocop", "~> 1.21"
13
13
 
@@ -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"]] }
@@ -359,12 +388,22 @@ module TailwindMerge
359
388
  # Start
360
389
  # @see https://tailwindcss.com/docs/top-right-bottom-left
361
390
  #
362
- "start" => [{ "start" => [SCALE_INSET] }],
391
+ "start" => [{ "inset-s" => [SCALE_INSET], "start" => [SCALE_INSET] }],
363
392
  #
364
393
  # End
365
394
  # @see https://tailwindcss.com/docs/top-right-bottom-left
366
395
  #
367
- "end" => [{ "end" => [SCALE_INSET] }],
396
+ "end" => [{ "inset-e" => [SCALE_INSET], "end" => [SCALE_INSET] }],
397
+ #
398
+ # Inset Block Start
399
+ # @see https://tailwindcss.com/docs/top-right-bottom-left
400
+ #
401
+ "inset-bs" => [{ "inset-bs" => [SCALE_INSET] }],
402
+ #
403
+ # Inset Block End
404
+ # @see https://tailwindcss.com/docs/top-right-bottom-left
405
+ #
406
+ "inset-be" => [{ "inset-be" => [SCALE_INSET] }],
368
407
  ##
369
408
  # Top
370
409
  # @see https://tailwindcss.com/docs/top-right-bottom-left
@@ -593,6 +632,16 @@ module TailwindMerge
593
632
  # @see https://tailwindcss.com/docs/padding
594
633
  #
595
634
  "pe" => [{ "pe" => SCALE_UNAMBIGUOUS_SPACING.call }],
635
+ #
636
+ # Padding Block Start
637
+ # @see https://tailwindcss.com/docs/padding
638
+ #
639
+ "pbs" => [{ "pbs" => SCALE_UNAMBIGUOUS_SPACING.call }],
640
+ #
641
+ # Padding Block End
642
+ # @see https://tailwindcss.com/docs/padding
643
+ #
644
+ "pbe" => [{ "pbe" => SCALE_UNAMBIGUOUS_SPACING.call }],
596
645
  ##
597
646
  # Padding Top
598
647
  # @see https://tailwindcss.com/docs/padding
@@ -638,6 +687,16 @@ module TailwindMerge
638
687
  # @see https://tailwindcss.com/docs/margin
639
688
  #
640
689
  "me" => [{ "me" => SCALE_MARGIN.call }],
690
+ #
691
+ # Margin Block Start
692
+ # @see https://tailwindcss.com/docs/margin
693
+ #
694
+ "mbs" => [{ "mbs" => SCALE_MARGIN.call }],
695
+ #
696
+ # Margin Block End
697
+ # @see https://tailwindcss.com/docs/margin
698
+ #
699
+ "mbe" => [{ "mbe" => SCALE_MARGIN.call }],
641
700
  ##
642
701
  # Margin Top
643
702
  # @see https://tailwindcss.com/docs/margin
@@ -688,6 +747,30 @@ module TailwindMerge
688
747
  # @see https://tailwindcss.com/docs/width#setting-both-width-and-height
689
748
  ##
690
749
  "size" => [{ "size" => SCALE_SIZING.call }],
750
+ ##
751
+ # Inline Size
752
+ ##
753
+ "inline-size" => [{ "inline" => ["auto", *SCALE_SIZING_INLINE.call] }],
754
+ ##
755
+ # Min Inline Size
756
+ ##
757
+ "min-inline-size" => [{ "min-inline" => ["auto", *SCALE_SIZING_INLINE.call] }],
758
+ ##
759
+ # Max Inline Size
760
+ ##
761
+ "max-inline-size" => [{ "max-inline" => ["none", *SCALE_SIZING_INLINE.call] }],
762
+ ##
763
+ # Block Size
764
+ ##
765
+ "block-size" => [{ "block" => ["auto", *SCALE_SIZING_BLOCK.call] }],
766
+ ##
767
+ # Min Block Size
768
+ ##
769
+ "min-block-size" => [{ "min-block" => ["auto", *SCALE_SIZING_BLOCK.call] }],
770
+ ##
771
+ # Max Block Size
772
+ ##
773
+ "max-block-size" => [{ "max-block" => ["none", *SCALE_SIZING_BLOCK.call] }],
691
774
  # Width
692
775
  # @see https://tailwindcss.com/docs/width
693
776
  ##
@@ -769,8 +852,8 @@ module TailwindMerge
769
852
  {
770
853
  "font" => [
771
854
  THEME_FONT_WEIGHT,
772
- IS_ARBITRARY_VARIABLE,
773
- IS_ARBITRARY_NUMBER,
855
+ IS_ARBITRARY_VARIABLE_WEIGHT,
856
+ IS_ARBITRARY_WEIGHT,
774
857
  ],
775
858
  },
776
859
  ],
@@ -799,7 +882,11 @@ module TailwindMerge
799
882
  # Font Family
800
883
  # @see https://tailwindcss.com/docs/font-family
801
884
  ##
802
- "font-family" => [{ "font" => [IS_ARBITRARY_VARIABLE_FAMILY_NAME, IS_ARBITRARY_VALUE, THEME_FONT] }],
885
+ "font-family" => [{ "font" => [IS_ARBITRARY_VARIABLE_FAMILY_NAME, IS_ARBITRARY_FAMILY_NAME, THEME_FONT] }],
886
+ ##
887
+ # Font Feature Settings
888
+ ##
889
+ "font-features" => [{ "font-features" => [IS_ARBITRARY_VALUE] }],
803
890
  ##
804
891
  # Font Variant Numeric
805
892
  # @see https://tailwindcss.com/docs/font-variant-numeric
@@ -1173,6 +1260,16 @@ module TailwindMerge
1173
1260
  # @see https://tailwindcss.com/docs/border-width
1174
1261
  #
1175
1262
  "border-w-e" => [{ "border-e" => SCALE_BORDER_WIDTH.call }],
1263
+ #
1264
+ # Border Width Block Start
1265
+ # @see https://tailwindcss.com/docs/border-width
1266
+ #
1267
+ "border-w-bs" => [{ "border-bs" => SCALE_BORDER_WIDTH.call }],
1268
+ #
1269
+ # Border Width Block End
1270
+ # @see https://tailwindcss.com/docs/border-width
1271
+ #
1272
+ "border-w-be" => [{ "border-be" => SCALE_BORDER_WIDTH.call }],
1176
1273
  ##
1177
1274
  # Border Width Top
1178
1275
  # @see https://tailwindcss.com/docs/border-width
@@ -1249,6 +1346,16 @@ module TailwindMerge
1249
1346
  # @see https://tailwindcss.com/docs/border-color
1250
1347
  ##
1251
1348
  "border-color-e" => [{ "border-e" => SCALE_COLOR.call }],
1349
+ #
1350
+ # Border Color Block Start
1351
+ # @see https://tailwindcss.com/docs/border-color
1352
+ #
1353
+ "border-color-bs" => [{ "border-bs" => SCALE_COLOR.call }],
1354
+ #
1355
+ # Border Color Block End
1356
+ # @see https://tailwindcss.com/docs/border-color
1357
+ #
1358
+ "border-color-be" => [{ "border-be" => SCALE_COLOR.call }],
1252
1359
  ##
1253
1360
  # Border Color Top
1254
1361
  # @see https://tailwindcss.com/docs/border-color
@@ -1978,6 +2085,16 @@ module TailwindMerge
1978
2085
  # @see https://tailwindcss.com/docs/scroll-margin
1979
2086
  #
1980
2087
  "scroll-me" => [{ "scroll-me" => SCALE_UNAMBIGUOUS_SPACING.call }],
2088
+ #
2089
+ # Scroll Margin Block Start
2090
+ # @see https://tailwindcss.com/docs/scroll-margin
2091
+ #
2092
+ "scroll-mbs" => [{ "scroll-mbs" => SCALE_UNAMBIGUOUS_SPACING.call }],
2093
+ #
2094
+ # Scroll Margin Block End
2095
+ # @see https://tailwindcss.com/docs/scroll-margin
2096
+ #
2097
+ "scroll-mbe" => [{ "scroll-mbe" => SCALE_UNAMBIGUOUS_SPACING.call }],
1981
2098
  ##
1982
2099
  # Scroll Margin Top
1983
2100
  # @see https://tailwindcss.com/docs/scroll-margin
@@ -2023,6 +2140,16 @@ module TailwindMerge
2023
2140
  # @see https://tailwindcss.com/docs/scroll-padding
2024
2141
  #
2025
2142
  "scroll-pe" => [{ "scroll-pe" => SCALE_UNAMBIGUOUS_SPACING.call }],
2143
+ #
2144
+ # Scroll Padding Block Start
2145
+ # @see https://tailwindcss.com/docs/scroll-padding
2146
+ #
2147
+ "scroll-pbs" => [{ "scroll-pbs" => SCALE_UNAMBIGUOUS_SPACING.call }],
2148
+ #
2149
+ # Scroll Padding Block End
2150
+ # @see https://tailwindcss.com/docs/scroll-padding
2151
+ #
2152
+ "scroll-pbe" => [{ "scroll-pbe" => SCALE_UNAMBIGUOUS_SPACING.call }],
2026
2153
  ##
2027
2154
  # Scroll Padding Top
2028
2155
  # @see https://tailwindcss.com/docs/scroll-padding
@@ -2141,15 +2268,15 @@ module TailwindMerge
2141
2268
  conflicting_class_groups: {
2142
2269
  "overflow" => ["overflow-x", "overflow-y"],
2143
2270
  "overscroll" => ["overscroll-x", "overscroll-y"],
2144
- "inset" => ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
2271
+ "inset" => ["inset-x", "inset-y", "start", "end", "inset-bs", "inset-be", "top", "right", "bottom", "left"],
2145
2272
  "inset-x" => ["right", "left"],
2146
2273
  "inset-y" => ["top", "bottom"],
2147
2274
  "flex" => ["basis", "grow", "shrink"],
2148
2275
  "gap" => ["gap-x", "gap-y"],
2149
- "p" => ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
2276
+ "p" => ["px", "py", "ps", "pe", "pbs", "pbe", "pt", "pr", "pb", "pl"],
2150
2277
  "px" => ["pr", "pl"],
2151
2278
  "py" => ["pt", "pb"],
2152
- "m" => ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
2279
+ "m" => ["mx", "my", "ms", "me", "mbs", "mbe", "mt", "mr", "mb", "ml"],
2153
2280
  "mx" => ["mr", "ml"],
2154
2281
  "my" => ["mt", "mb"],
2155
2282
  "size" => ["w", "h"],
@@ -2195,6 +2322,8 @@ module TailwindMerge
2195
2322
  "border-w-y",
2196
2323
  "border-w-s",
2197
2324
  "border-w-e",
2325
+ "border-w-bs",
2326
+ "border-w-be",
2198
2327
  "border-w-t",
2199
2328
  "border-w-r",
2200
2329
  "border-w-b",
@@ -2207,6 +2336,8 @@ module TailwindMerge
2207
2336
  "border-color-y",
2208
2337
  "border-color-s",
2209
2338
  "border-color-e",
2339
+ "border-color-bs",
2340
+ "border-color-be",
2210
2341
  "border-color-t",
2211
2342
  "border-color-r",
2212
2343
  "border-color-b",
@@ -2221,6 +2352,8 @@ module TailwindMerge
2221
2352
  "scroll-my",
2222
2353
  "scroll-ms",
2223
2354
  "scroll-me",
2355
+ "scroll-mbs",
2356
+ "scroll-mbe",
2224
2357
  "scroll-mt",
2225
2358
  "scroll-mr",
2226
2359
  "scroll-mb",
@@ -2233,6 +2366,8 @@ module TailwindMerge
2233
2366
  "scroll-py",
2234
2367
  "scroll-ps",
2235
2368
  "scroll-pe",
2369
+ "scroll-pbs",
2370
+ "scroll-pbe",
2236
2371
  "scroll-pt",
2237
2372
  "scroll-pr",
2238
2373
  "scroll-pb",
@@ -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+/\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)\(.+\)$/
@@ -102,6 +102,14 @@ module TailwindMerge
102
102
  arbitrary_value?(value, IS_LABEL_NUMBER, IS_NUMBER)
103
103
  }
104
104
 
105
+ IS_ARBITRARY_WEIGHT = ->(value) {
106
+ arbitrary_value?(value, IS_LABEL_WEIGHT, IS_ANY)
107
+ }
108
+
109
+ IS_ARBITRARY_FAMILY_NAME = ->(value) {
110
+ arbitrary_value?(value, IS_LABEL_FAMILY_NAME, IS_NEVER)
111
+ }
112
+
105
113
  IS_ARBITRARY_POSITION = ->(value) {
106
114
  arbitrary_value?(value, IS_LABEL_POSITION, IS_NEVER)
107
115
  }
@@ -142,6 +150,10 @@ module TailwindMerge
142
150
  arbitrary_variable?(value, IS_LABEL_SHADOW, should_match_no_label: true)
143
151
  }
144
152
 
153
+ IS_ARBITRARY_VARIABLE_WEIGHT = ->(value) {
154
+ arbitrary_variable?(value, IS_LABEL_WEIGHT, should_match_no_label: true)
155
+ }
156
+
145
157
  ############
146
158
  # Labels
147
159
  ############
@@ -170,6 +182,10 @@ module TailwindMerge
170
182
  label == "family-name"
171
183
  }
172
184
 
185
+ IS_LABEL_WEIGHT = ->(label) {
186
+ label == "number" || label == "weight"
187
+ }
188
+
173
189
  IS_LABEL_SHADOW = ->(label) {
174
190
  label == "shadow"
175
191
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TailwindMerge
4
- VERSION = "1.3.2"
4
+ VERSION = "1.4.0"
5
5
  end
@@ -22,6 +22,8 @@ Gem::Specification.new do |spec|
22
22
  "rubygems_mfa_required" => "true",
23
23
  }
24
24
 
25
+ spec.required_ruby_version = [">= 3.2"]
26
+
25
27
  # Specify which files should be added to the gem when it is released.
26
28
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
29
  spec.files = Dir.chdir(__dir__) do
@@ -35,6 +37,6 @@ Gem::Specification.new do |spec|
35
37
 
36
38
  spec.add_dependency("sin_lru_redux", "~> 2.5")
37
39
 
38
- spec.add_development_dependency("minitest", "~> 5.6")
40
+ spec.add_development_dependency("minitest", "~> 6.0")
39
41
  spec.add_development_dependency("minitest-focus", "~> 1.1")
40
42
  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.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen J. Torikian
@@ -29,14 +29,14 @@ dependencies:
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.6'
32
+ version: '6.0'
33
33
  type: :development
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '5.6'
39
+ version: '6.0'
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: minitest-focus
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -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.3.2
76
+ homepage: https://github.com/gjtorikian/tailwind_merge/tree/v1.4.0
77
77
  licenses:
78
78
  - MIT
79
79
  metadata:
80
- homepage_uri: https://github.com/gjtorikian/tailwind_merge/tree/v1.3.2
81
- source_code_uri: https://github.com/gjtorikian/tailwind_merge/tree/v1.3.2
82
- changelog_uri: https://github.com/gjtorikian/tailwind_merge/blob/v1.3.2/CHANGELOG.md
80
+ homepage_uri: https://github.com/gjtorikian/tailwind_merge/tree/v1.4.0
81
+ source_code_uri: https://github.com/gjtorikian/tailwind_merge/tree/v1.4.0
82
+ changelog_uri: https://github.com/gjtorikian/tailwind_merge/blob/v1.4.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.3.2
84
+ documentation_uri: https://rubydoc.info/gems/tailwind_merge/1.4.0
85
85
  funding_uri: https://github.com/sponsors/gjtorikian
86
86
  rubygems_mfa_required: 'true'
87
87
  rdoc_options: []
@@ -91,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: '0'
94
+ version: '3.2'
95
95
  required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - ">="