tailwind_merge 0.9.1 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 671c8c7c69b02946b8df9ffa5a07211e5a00ad564aefc81927d5653a5b77e9a3
4
- data.tar.gz: 890d2ed86cb560af7245b40efb9275fc4eefa6b3458dd46170dfc4e41263e5fb
3
+ metadata.gz: eb9ce33e9e3b1376a95325263d7e3091edbc8ee077f0d3fb023b8e9494345f99
4
+ data.tar.gz: c1548d94345b50b51074dc54534357d5415ce8feebd2666162840a06a7f6c29b
5
5
  SHA512:
6
- metadata.gz: 58ddfe25ea801d1a480aebc2c065ee1cf74886b2e2c37a1a1c1ade85d0c88ff11500650152b7e0bb8591736f87493ee99f0e34ae1001244b824c6670e60fbf2f
7
- data.tar.gz: 181f01df6b0f03e8ec24545c3d2397420c5a8872f3fc0ac7b3522a632b55dd75afdd144f329444dd75fe52cf97e4cca47e5bf0a78301b2c36d7b09e762b04623
6
+ metadata.gz: 3af858c685680c51fb0b53eed278b12f42005be6d776aa9795a0757cee0dad204523fc7524f95958843588150356c8e9066f577ccf30a47ea31640b3c0f3d40e
7
+ data.tar.gz: 12dba99eb0c963292e860378faf0bb57d60a8ad9f4231e7965b26dc3c60ed32f7704554d0b616548108450418c69c18b526f7d69000bcdcf3768b44413f067d0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [v0.10.0] - 23-12-2023
2
+ ## What's Changed
3
+ * Support Tailwind 3.4 by @gjtorikian in https://github.com/gjtorikian/tailwind_merge/pull/23
4
+
5
+
6
+ **Full Changelog**: https://github.com/gjtorikian/tailwind_merge/compare/v0.9.1...v0.10.0
7
+ ## [v0.9.1] - 20-11-2023
8
+ ## What's Changed
9
+ * Fix display removal when preceding line-clamp by @gjtorikian in https://github.com/gjtorikian/tailwind_merge/pull/22
10
+
11
+
12
+ **Full Changelog**: https://github.com/gjtorikian/tailwind_merge/compare/v0.9.0...v0.9.1
1
13
  ## [v0.9.0] - 04-11-2023
2
14
  ## What's Changed
3
15
  * Updates by @gjtorikian in https://github.com/gjtorikian/tailwind_merge/pull/21
@@ -212,12 +212,12 @@ module TailwindMerge
212
212
  # Floats
213
213
  # @see https://tailwindcss.com/docs/float
214
214
  ##
215
- "float" => [{ "float" => ["right", "left", "none"] }],
215
+ "float" => [{ "float" => ["right", "left", "none", "start", "end"] }],
216
216
  ##
217
217
  # Clear
218
218
  # @see https://tailwindcss.com/docs/clear
219
219
  ##
220
- "clear" => [{ "clear" => ["left", "right", "both", "none"] }],
220
+ "clear" => [{ "clear" => ["left", "right", "both", "none", "start", "end"] }],
221
221
  ##
222
222
  # Isolation
223
223
  # @see https://tailwindcss.com/docs/isolation
@@ -591,12 +591,24 @@ module TailwindMerge
591
591
  # Width
592
592
  # @see https://tailwindcss.com/docs/width
593
593
  ##
594
- "w" => [{ "w" => ["auto", "min", "max", "fit", IS_ARBITRARY_VALUE, SPACING] }],
594
+ "w" => [{
595
+ "w" => [
596
+ "auto",
597
+ "min",
598
+ "max",
599
+ "fit",
600
+ "svw",
601
+ "lvw",
602
+ "dvw",
603
+ IS_ARBITRARY_VALUE,
604
+ SPACING,
605
+ ],
606
+ }],
595
607
  ##
596
608
  # Min-Width
597
609
  # @see https://tailwindcss.com/docs/min-width
598
610
  ##
599
- "min-w" => [{ "min-w" => ["min", "max", "fit", IS_ARBITRARY_VALUE, IS_LENGTH] }],
611
+ "min-w" => [{ "min-w" => [IS_ARBITRARY_VALUE, SPACING, "min", "max", "fit"] }],
600
612
  ##
601
613
  # Max-Width
602
614
  # @see https://tailwindcss.com/docs/max-width
@@ -604,7 +616,8 @@ module TailwindMerge
604
616
  "max-w" => [
605
617
  {
606
618
  "max-w" => [
607
- "0",
619
+ IS_ARBITRARY_VALUE,
620
+ SPACING,
608
621
  "none",
609
622
  "full",
610
623
  "min",
@@ -613,7 +626,6 @@ module TailwindMerge
613
626
  "prose",
614
627
  { "screen" => [IS_TSHIRT_SIZE] },
615
628
  IS_TSHIRT_SIZE,
616
- IS_ARBITRARY_VALUE,
617
629
  ],
618
630
  },
619
631
  ],
@@ -621,17 +633,22 @@ module TailwindMerge
621
633
  # Height
622
634
  # @see https://tailwindcss.com/docs/height
623
635
  ##
624
- "h" => [{ "h" => [IS_ARBITRARY_VALUE, SPACING, "auto", "min", "max", "fit"] }],
636
+ "h" => [{ "h" => [IS_ARBITRARY_VALUE, SPACING, "auto", "min", "max", "fit", "svh", "lvh", "dvh"] }],
625
637
  ##
626
638
  # Min-Height
627
639
  # @see https://tailwindcss.com/docs/min-height
628
640
  ##
629
- "min-h" => [{ "min-h" => ["min", "max", "fit", IS_LENGTH, IS_ARBITRARY_VALUE] }],
641
+ "min-h" => [{ "min-h" => [IS_ARBITRARY_VALUE, SPACING, "min", "max", "fit", "svh", "lvh", "dvh"] }],
630
642
  ##
631
643
  # Max-Height
632
644
  # @see https://tailwindcss.com/docs/max-height
633
645
  ##
634
- "max-h" => [{ "max-h" => [IS_ARBITRARY_VALUE, SPACING, "min", "max", "fit"] }],
646
+ "max-h" => [{ "max-h" => [IS_ARBITRARY_VALUE, SPACING, "min", "max", "fit", "svh", "lvh", "dvh"] }],
647
+ ##
648
+ # Size
649
+ # @see https://tailwindcss.com/docs/size
650
+ ##
651
+ "size" => [{ "size" => [IS_ARBITRARY_VALUE, SPACING, "auto", "min", "max", "fit"] }],
635
652
  # Typography
636
653
  ##
637
654
  # Font Size
@@ -809,6 +826,11 @@ module TailwindMerge
809
826
  ##
810
827
  "text-overflow" => ["truncate", "text-ellipsis", "text-clip"],
811
828
  ##
829
+ # Text Wrap
830
+ # @see https://tailwindcss.com/docs/text-wrap
831
+ ##
832
+ "text-wrap" => [{ "text" => ["wrap", "nowrap", "balance", "pretty"] }],
833
+ ##
812
834
  # Text Indent
813
835
  # @see https://tailwindcss.com/docs/text-indent
814
836
  ##
@@ -1463,7 +1485,7 @@ module TailwindMerge
1463
1485
  # Appearance
1464
1486
  # @see https://tailwindcss.com/docs/appearance
1465
1487
  ##
1466
- "appearance" => ["appearance-none"],
1488
+ "appearance" => [{ "appearance" => ["none", "auto"] }],
1467
1489
  ##
1468
1490
  # Cursor
1469
1491
  # @see https://tailwindcss.com/docs/cursor
@@ -1707,6 +1729,11 @@ module TailwindMerge
1707
1729
  # @see https://tailwindcss.com/docs/screen-readers
1708
1730
  ##
1709
1731
  "sr" => ["sr-only", "not-sr-only"],
1732
+ ##
1733
+ # Forced Color Adjust
1734
+ # @see https://tailwindcss.com/docs/forced-color-adjust
1735
+ ##
1736
+ "forced-color-adjust" => [{ "forced-color-adjust": ["auto", "none"] }],
1710
1737
  },
1711
1738
  conflicting_class_groups: {
1712
1739
  "overflow" => ["overflow-x", "overflow-y"],
@@ -1722,6 +1749,7 @@ module TailwindMerge
1722
1749
  "m" => ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
1723
1750
  "mx" => ["mr", "ml"],
1724
1751
  "my" => ["mt", "mb"],
1752
+ "size" => ["w", "h"],
1725
1753
  "font-size" => ["leading"],
1726
1754
  "fvn-normal" => [
1727
1755
  "fvn-ordinal",
@@ -31,6 +31,7 @@ module TailwindMerge
31
31
  FRACTION_REGEX = %r{^\d+/\d+$}
32
32
  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$/
33
33
  TSHIRT_UNIT_REGEX = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/
34
+ COLOR_FUNCTION_REGEX = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/
34
35
  # Shadow always begins with x and y offset separated by underscore
35
36
  SHADOW_REGEX = /^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/
36
37
  IMAGE_REGEX = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/
@@ -39,7 +40,10 @@ module TailwindMerge
39
40
  IMAGE_LABELS = Set.new(["image", "url"]).freeze
40
41
 
41
42
  is_length_only = ->(value) {
42
- LENGTH_UNIT_REGEX.match?(value)
43
+ # `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
44
+ # For example, `hsl(0 0% 0%)` would be classified as a length without this check.
45
+ # I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
46
+ LENGTH_UNIT_REGEX.match?(value) && !COLOR_FUNCTION_REGEX.match?(value)
43
47
  }
44
48
 
45
49
  is_never = ->(_) { false }
@@ -110,6 +114,6 @@ module TailwindMerge
110
114
  arbitrary_value?(value, "", is_shadow)
111
115
  }
112
116
 
113
- IS_ANY = ->(_) { return true }
117
+ IS_ANY = ->(_) { true }
114
118
  end
115
119
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TailwindMerge
4
- VERSION = "0.9.1"
4
+ VERSION = "0.10.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tailwind_merge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen J. Torikian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-20 00:00:00.000000000 Z
11
+ date: 2024-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lru_redux
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubygems_version: 3.4.22
102
+ rubygems_version: 3.5.5
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: Utility function to efficiently merge Tailwind CSS classes without style