tailwind_merge 0.12.2 → 0.13.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: 7bd029b3106698874b67142336e597f9369c92664531879ad22eedd0cba6645b
4
- data.tar.gz: 5389d8adf19d10d5f4edd08bff8cfd94f23e8ce65f6893400b0a8416de629faa
3
+ metadata.gz: 963bec3ea5a28c6f2e282b5836fd2b1bb317aafee92a6c65872b1b52919bca3a
4
+ data.tar.gz: 8b86c7e251064a52b8a591933bb09dcdf5e72efba0edc508066d0bcbf3bf3cfa
5
5
  SHA512:
6
- metadata.gz: 2236d20be8ac16e9fb1ee61682c00d8cc00a8102a1f12ef6ab2d56bd9829a041feb08e5448ebcf09e7940a43b3d6ca512ce0f381bdd006275302167c245700b1
7
- data.tar.gz: aa34f52e7f697c8b1c01d3bead20a4868393f054dfbf9dbb7595d842d3883c26c23e1039dc6b14cd309671b198f6751181465478f246f5b609acf628694de861
6
+ metadata.gz: f980fb0cb733e00de99e109fa12c36a125af360f62ee471ec49da0c2aaa4d57590dcd2957cb3531ab4ebb25bf197ca8e3ccd85b679c140e0dcecb5b38b96324d
7
+ data.tar.gz: 7327cef609f7617f99196d2ef8dd2f98190e7eaf90dc7af0305b5eb4062bc3c8887b5653ce13be427602b9665671745c788a57fa8fa4b1775253b4784ed7bbee
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [v0.13.0] - 29-08-2024
2
+ ## What's Changed
3
+ * Add theme support by @gjtorikian in https://github.com/gjtorikian/tailwind_merge/pull/32
4
+
5
+
6
+ **Full Changelog**: https://github.com/gjtorikian/tailwind_merge/compare/v0.12.2...v0.13.0
1
7
  # [v0.12.2] - 18-08-2024
2
8
  ## What's Changed
3
9
  * remove spurious debug statement by @gjtorikian in https://github.com/gjtorikian/tailwind_merge/pull/28
data/README.md CHANGED
@@ -310,7 +310,18 @@ In the Tailwind config you can modify theme scales. `tailwind_merge` follows the
310
310
  - `space`
311
311
  - `translate`
312
312
 
313
- If you modified one of these theme scales in your Tailwind config, you can add all your keys right here and tailwind-merge will take care of the rest. If you modified other theme scales, you need to figure out the class group to modify in the [default config](#getdefaultconfig).
313
+ If you modified one of these theme scales in your Tailwind config, you can add all your keys right here and tailwind-merge will take care of the rest. For example, to add custom spaces and margin, you would provide the following `theme`:
314
+
315
+ ```ruby
316
+ merger = TailwindMerge::Merger.new(config: {
317
+ theme: {
318
+ "spacing" => ["my-space"],
319
+ "margin" => ["my-margin"],
320
+ },
321
+ })
322
+ ```
323
+
324
+ If you modified other theme scales, you need to figure out the class group to modify in the [default config](#getdefaultconfig).
314
325
 
315
326
  ### Validators
316
327
 
@@ -4,8 +4,8 @@ module TailwindMerge
4
4
  module Config
5
5
  include Validators
6
6
 
7
- FROM_THEME = ->(config, theme) {
8
- config.fetch(:theme, {}).fetch(theme, nil)
7
+ FROM_THEME = ->(config, key) {
8
+ config[:theme].fetch(key, nil)
9
9
  }
10
10
 
11
11
  COLORS = ->(config) { FROM_THEME.call(config, "colors") }
@@ -1840,10 +1840,13 @@ module TailwindMerge
1840
1840
  def merge_configs(extension_config)
1841
1841
  config = TailwindMerge::Config::DEFAULTS
1842
1842
  [:theme].each do |type|
1843
- extension_config.fetch(type, {}).each_pair do |key, value|
1844
- config[type][value] = ->(config) { FROM_THEME.call(config, key) }
1843
+ extension_config.fetch(type, {}).each_pair do |key, scales|
1844
+ config[type][key] << ->(klass) {
1845
+ scales.include?(klass)
1846
+ }
1845
1847
  end
1846
1848
  end
1849
+
1847
1850
  config
1848
1851
  end
1849
1852
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TailwindMerge
4
- VERSION = "0.12.2"
4
+ VERSION = "0.13.0"
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.12.2
4
+ version: 0.13.0
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: 2024-08-18 00:00:00.000000000 Z
11
+ date: 2024-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lru_redux