tailwind_merge 1.5.2 → 1.5.4

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: aadbe94d7d509ee795a2b34277fa7195f443d83081d2adaf88a11c07d2918302
4
- data.tar.gz: a6b99aea1b699341b88d7052f7e7c6b588326d74decca79a3c0caaf256042107
3
+ metadata.gz: 0c8e3fe7605ec55fd88225d16bcc919092e3710a81ee581ded2fa09e0bb06013
4
+ data.tar.gz: 71053feef40855a9f240bf7e9e32945239adcb36206b570e137fc6ec99d2044f
5
5
  SHA512:
6
- metadata.gz: bfadf225da1834890e98ee7b89202db8714b954c8cc077ad33eabdc1731f5617c85747aa1cd8641d659ea45b95f61b8ea9e0c00d1b852d3cc4b99ae4210850f4
7
- data.tar.gz: c5b300134da62796aaa0697e7ad341bd223139cb07a5b51a556de469692271c2750ad52d1c1ec032968dcc50f295c4e68d5c7ef502c81452ab0b4ec23baf214d
6
+ metadata.gz: 643732e00316338a5fbf76e146eceed8dfead1bf5aa779c01766778e345824068014632a30096b0ea14a4a2fe17a65d6a0f1dd4900d65e524cf3e32f165b4419
7
+ data.tar.gz: 5e7f29df21553b91c046b57781006a7673f06b24a29718a17aaca6ebe98b851f0481eaebb46299a8756d4aec823a82ee1844d31715d258ea783b5958699422bd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## [1.5.4](https://github.com/gjtorikian/tailwind_merge/compare/v1.5.3...v1.5.4) (2026-08-13)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **config:** axis shorthands override logical sides ([#87](https://github.com/gjtorikian/tailwind_merge/pull/87))
6
+
7
+
8
+ ## [1.5.3](https://github.com/gjtorikian/tailwind_merge/compare/v1.5.2...v1.5.3) (2026-08-11)
9
+
10
+ ### Bug Fixes
11
+
12
+ * **config:** classify shadow-inner into the shadow class group ([99bccc2](https://github.com/gjtorikian/tailwind_merge/commit/99bccc2b66d5a6e94735515676102534a3f29e37))
13
+
14
+ ### Performance Improvements
15
+
16
+ * **parse:** skip modifiers array alloc for no-modifier classes ([0ee620e](https://github.com/gjtorikian/tailwind_merge/commit/0ee620e7e464074fb490fd363afaa5b404a4faf4))
17
+
18
+ ### Miscellaneous Chores
19
+
20
+ * trigger release-please run ([65e80ae](https://github.com/gjtorikian/tailwind_merge/commit/65e80ae41d08e813c0d6ce9317aa235454bfc935))
21
+ * **config:** deep-freeze DEFAULTS to prevent global-state mutation ([9bf4778](https://github.com/gjtorikian/tailwind_merge/commit/9bf47789b778b4d1e0503e9b69ce30d407826483))
22
+
23
+
1
24
  # [v1.5.2] - 06-07-2026
2
25
  ## What's Changed
3
26
  * fix: thread-safety of Merger's internal LRU cache by @svyatov in https://github.com/gjtorikian/tailwind_merge/pull/79
@@ -6,6 +6,19 @@ module TailwindMerge
6
6
  module Config
7
7
  include Validators
8
8
 
9
+ class << self
10
+ # Recursively freezes nested Hash/Array structures so shared config
11
+ # constants can't be mutated in place. Keys are strings/symbols and are
12
+ # already immutable, so only values need walking.
13
+ private def deep_freeze(object)
14
+ case object
15
+ when Hash then object.each_value { |value| deep_freeze(value) }
16
+ when Array then object.each { |value| deep_freeze(value) }
17
+ end
18
+ object.freeze
19
+ end
20
+ end
21
+
9
22
  THEME_KEYS = [
10
23
  "color",
11
24
  "font",
@@ -1432,6 +1445,8 @@ module TailwindMerge
1432
1445
  "shadow" => [
1433
1446
  # Deprecated since Tailwind CSS v4.0.0
1434
1447
  "",
1448
+ # Deprecated since Tailwind CSS v4.0.0
1449
+ "inner",
1435
1450
  "none",
1436
1451
  THEME_SHADOW,
1437
1452
  IS_ARBITRARY_VARIABLE_SHADOW,
@@ -2312,16 +2327,16 @@ module TailwindMerge
2312
2327
  "overflow" => ["overflow-x", "overflow-y"],
2313
2328
  "overscroll" => ["overscroll-x", "overscroll-y"],
2314
2329
  "inset" => ["inset-x", "inset-y", "start", "end", "inset-bs", "inset-be", "top", "right", "bottom", "left"],
2315
- "inset-x" => ["right", "left"],
2316
- "inset-y" => ["top", "bottom"],
2330
+ "inset-x" => ["start", "end", "right", "left"],
2331
+ "inset-y" => ["inset-bs", "inset-be", "top", "bottom"],
2317
2332
  "flex" => ["basis", "grow", "shrink"],
2318
2333
  "gap" => ["gap-x", "gap-y"],
2319
2334
  "p" => ["px", "py", "ps", "pe", "pbs", "pbe", "pt", "pr", "pb", "pl"],
2320
- "px" => ["pr", "pl"],
2321
- "py" => ["pt", "pb"],
2335
+ "px" => ["ps", "pe", "pr", "pl"],
2336
+ "py" => ["pbs", "pbe", "pt", "pb"],
2322
2337
  "m" => ["mx", "my", "ms", "me", "mbs", "mbe", "mt", "mr", "mb", "ml"],
2323
- "mx" => ["mr", "ml"],
2324
- "my" => ["mt", "mb"],
2338
+ "mx" => ["ms", "me", "mr", "ml"],
2339
+ "my" => ["mbs", "mbe", "mt", "mb"],
2325
2340
  "size" => ["w", "h"],
2326
2341
  "font-size" => ["leading"],
2327
2342
  "fvn-normal" => [
@@ -2372,8 +2387,8 @@ module TailwindMerge
2372
2387
  "border-w-b",
2373
2388
  "border-w-l",
2374
2389
  ],
2375
- "border-w-x" => ["border-w-r", "border-w-l"],
2376
- "border-w-y" => ["border-w-t", "border-w-b"],
2390
+ "border-w-x" => ["border-w-s", "border-w-e", "border-w-r", "border-w-l"],
2391
+ "border-w-y" => ["border-w-bs", "border-w-be", "border-w-t", "border-w-b"],
2377
2392
  "border-color" => [
2378
2393
  "border-color-x",
2379
2394
  "border-color-y",
@@ -2386,8 +2401,8 @@ module TailwindMerge
2386
2401
  "border-color-b",
2387
2402
  "border-color-l",
2388
2403
  ],
2389
- "border-color-x" => ["border-color-r", "border-color-l"],
2390
- "border-color-y" => ["border-color-t", "border-color-b"],
2404
+ "border-color-x" => ["border-color-s", "border-color-e", "border-color-r", "border-color-l"],
2405
+ "border-color-y" => ["border-color-bs", "border-color-be", "border-color-t", "border-color-b"],
2391
2406
  "translate" => ["translate-x", "translate-y", "translate-none"],
2392
2407
  "translate-none" => ["translate", "translate-x", "translate-y", "translate-z"],
2393
2408
  "scroll-m" => [
@@ -2402,8 +2417,8 @@ module TailwindMerge
2402
2417
  "scroll-mb",
2403
2418
  "scroll-ml",
2404
2419
  ],
2405
- "scroll-mx" => ["scroll-mr", "scroll-ml"],
2406
- "scroll-my" => ["scroll-mt", "scroll-mb"],
2420
+ "scroll-mx" => ["scroll-ms", "scroll-me", "scroll-mr", "scroll-ml"],
2421
+ "scroll-my" => ["scroll-mbs", "scroll-mbe", "scroll-mt", "scroll-mb"],
2407
2422
  "scroll-p" => [
2408
2423
  "scroll-px",
2409
2424
  "scroll-py",
@@ -2416,8 +2431,8 @@ module TailwindMerge
2416
2431
  "scroll-pb",
2417
2432
  "scroll-pl",
2418
2433
  ],
2419
- "scroll-px" => ["scroll-pr", "scroll-pl"],
2420
- "scroll-py" => ["scroll-pt", "scroll-pb"],
2434
+ "scroll-px" => ["scroll-ps", "scroll-pe", "scroll-pr", "scroll-pl"],
2435
+ "scroll-py" => ["scroll-pbs", "scroll-pbe", "scroll-pt", "scroll-pb"],
2421
2436
  "touch" => ["touch-x", "touch-y", "touch-pz"],
2422
2437
  "touch-x" => ["touch"],
2423
2438
  "touch-y" => ["touch"],
@@ -2441,7 +2456,8 @@ module TailwindMerge
2441
2456
  "placeholder",
2442
2457
  "selection",
2443
2458
  ],
2444
- }.freeze
2459
+ }
2460
+ deep_freeze(DEFAULTS)
2445
2461
 
2446
2462
  def merge_config(incoming_config)
2447
2463
  extended_config = TailwindMerge::Config::DEFAULTS.dup
@@ -6,6 +6,7 @@ module TailwindMerge
6
6
 
7
7
  module ParseClassName
8
8
  IMPORTANT_MODIFIER = "!"
9
+ EMPTY_MODIFIERS = [].freeze
9
10
  MODIFIER_SEPARATOR = ":"
10
11
  MODIFIER_SEPARATOR_LENGTH = MODIFIER_SEPARATOR.length
11
12
 
@@ -29,7 +30,7 @@ module TailwindMerge
29
30
  else
30
31
  return TailwindClass.new(
31
32
  is_external: true,
32
- modifiers: [],
33
+ modifiers: EMPTY_MODIFIERS,
33
34
  has_important_modifier: false,
34
35
  base_class_name: class_name,
35
36
  maybe_postfix_modifier_position: nil,
@@ -37,7 +38,9 @@ module TailwindMerge
37
38
  end
38
39
  end
39
40
 
40
- modifiers = []
41
+ # Stays nil until the first modifier separator, so the common no-modifier
42
+ # class (`px-2`, `block`) never allocates an array.
43
+ modifiers = nil
41
44
 
42
45
  bracket_depth = 0
43
46
  paren_depth = 0
@@ -55,7 +58,7 @@ module TailwindMerge
55
58
 
56
59
  if bracket_depth.zero? && paren_depth.zero?
57
60
  if byte == MODIFIER_SEPARATOR_BYTE
58
- modifiers << class_name.byteslice(modifier_start, index - modifier_start)
61
+ (modifiers ||= []) << class_name.byteslice(modifier_start, index - modifier_start)
59
62
  modifier_start = index + MODIFIER_SEPARATOR_LENGTH
60
63
  index += 1
61
64
  next
@@ -76,7 +79,7 @@ module TailwindMerge
76
79
  index += 1
77
80
  end
78
81
 
79
- base_class_name_with_important_modifier = modifiers.empty? ? class_name : class_name.byteslice(modifier_start, size - modifier_start)
82
+ base_class_name_with_important_modifier = modifiers ? class_name.byteslice(modifier_start, size - modifier_start) : class_name
80
83
 
81
84
  base_class_name, has_important_modifier = strip_important_modifier(base_class_name_with_important_modifier)
82
85
 
@@ -86,7 +89,7 @@ module TailwindMerge
86
89
 
87
90
  TailwindClass.new(
88
91
  is_external: false,
89
- modifiers:,
92
+ modifiers: modifiers || EMPTY_MODIFIERS,
90
93
  has_important_modifier:,
91
94
  base_class_name: base_class_name,
92
95
  maybe_postfix_modifier_position:,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TailwindMerge
4
- VERSION = "1.5.2"
4
+ VERSION = "1.5.4"
5
5
  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.5.2
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen J. Torikian
@@ -74,15 +74,15 @@ files:
74
74
  - lib/tailwind_merge/version.rb
75
75
  - script/test
76
76
  - tailwind_merge.gemspec
77
- homepage: https://github.com/gjtorikian/tailwind_merge/tree/v1.5.2
77
+ homepage: https://github.com/gjtorikian/tailwind_merge/tree/v1.5.4
78
78
  licenses:
79
79
  - MIT
80
80
  metadata:
81
- homepage_uri: https://github.com/gjtorikian/tailwind_merge/tree/v1.5.2
82
- source_code_uri: https://github.com/gjtorikian/tailwind_merge/tree/v1.5.2
83
- changelog_uri: https://github.com/gjtorikian/tailwind_merge/blob/v1.5.2/CHANGELOG.md
81
+ homepage_uri: https://github.com/gjtorikian/tailwind_merge/tree/v1.5.4
82
+ source_code_uri: https://github.com/gjtorikian/tailwind_merge/tree/v1.5.4
83
+ changelog_uri: https://github.com/gjtorikian/tailwind_merge/blob/v1.5.4/CHANGELOG.md
84
84
  bug_tracker_uri: https://github.com/gjtorikian/tailwind_merge/issues
85
- documentation_uri: https://rubydoc.info/gems/tailwind_merge/1.5.2
85
+ documentation_uri: https://rubydoc.info/gems/tailwind_merge/1.5.4
86
86
  funding_uri: https://github.com/sponsors/gjtorikian
87
87
  rubygems_mfa_required: 'true'
88
88
  rdoc_options: []