Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make types of available keys more strict and configurable through generics #279

Merged
merged 15 commits into from
Aug 20, 2023

Conversation

kachkaev
Copy link
Contributor

@kachkaev kachkaev commented Aug 10, 2023

Edit from @dcastil:

Closes #293


A couple of weeks ago I happily configured font sizes inside extendTailwindMerge:

Screenshot 2023-08-10 at 12 00 34

As it turned out, fontSize was not supported by the theme object which was not obvious from the start. Discovering this was a bit painful and took our team some energy and time. After searching for similar issues with fontSize, I found a few folks falling into the same trap: #274, #250, etc.

This PR slightly improves the DX by flagging the trap I have fallen into:

Screenshot 2023-08-10 at 11 58 19 Screenshot 2023-08-10 at 11 58 24

Stricter typings will hopefully make it easier for other teams to configure tailwind-merge faster and with fewer errors. They also enable autocompletion:

Screenshot 2023-08-10 at 12 18 26

For those who are here from search, the right config for fontSize in my case was this:

const mergeTailwindClasses = extendTailwindMerge({
  theme: {
    borderRadius: figmaSpacingUnits,
    borderWidth: figmaSpacingUnits,
    spacing: figmaSpacingUnits,
  },
  classGroups: {
    'font-size': [{ text: ['tiny', 'okay-ish', 'enormous'] }], // names are fake, avoid these if you can 😂
  },
});

PS: Great lib @dcastil 💯

PPS: Apologies for unexpected reviews – I shared this PR with colleagues and they thought it was against our repo 😅

@dcastil
Copy link
Owner

dcastil commented Aug 10, 2023

Hey @kachkaev! 👋

Thanks for the PR (and the reviews haha 😁).

The partial support for theme collections is really a pain in tailwind-merge, sorry for the energy you had to spend on this.

However, narrowing the type of possible keys in the config would be a breaking change, I'm afraid we can't merge this as-is.

It is currently possible to expand the available theme keys yourself and use those in the config which is important in the context of plugins. It's not so well documented at the moment, but you'll find the info here: https://github.com/dcastil/tailwind-merge/blob/v1.14.0/docs/api-reference.md#fromtheme

E.g. you can define your font-size scale like this:

import { extendTailwindMerge, fromTheme } from 'tailwind-merge'

const mergeTailwindClasses = extendTailwindMerge({
  theme: {
    // …rest of definition
    fontSize: ['tiny', 'okay-ish', 'enormous']
  },
  classGroups: {
    'font-size': [{ text: [fromTheme('fontSize')] }],
  },
});

It's a really tricky problem:

  • I can't remove the theme keys that exist because otherwise adding a custom value to the spacing scale would require changes in a lot of places. Generally I added theme keys for any scale that is used in more than a single classGroup.
  • I can't add all the theme keys to tailwind-merge since that would disproportionally increase the size of the library. I don't remember so well but I think I tripled the size when I tested adding all of them.
  • I can't make TypeScript more strict because users need to be able to add their own theme keys

I think the only option available at the moment is to improve the documentation and make it easier to understand how to configure it (less reading, get to results quicker).

@kachkaev
Copy link
Contributor Author

kachkaev commented Aug 11, 2023

Hi @dcastil, thanks for sharing the details of this problem, it’s quite deep indeed! I can see the flaws in the proposed solution now.

The docs of tailwind-merge are great already, the problem with them (like with any docs) is that they are out of sight when a mistake is being made. The trap with fontSize was to do with me not having expected feedback in the IDE when I was adding font sizes. When working on the first PR, I configured everything but font sizes and I checked the docs back then. The list of theme fields looked long so I remembered it as ‘everything is supported’. When working on a follow-up PR (font sizes alone), I just relied on this inaccurate knowledge, did not get any feedback in CI, did not notice a clash between text-xs and text-red-500 and chucked the PR in. It turned out that our custom text-xs just matched the standard font size, which fooled me together with the lack of squiggly lines in the editor.

With the potential use of fromTheme, WDYT of this facade?

type CustomThemeKey = 'fontSize' | 'somethingElse';

const mergeTailwindClasses = extendTailwindMerge<ExtraThemeKey>({
  theme: {
    // …rest of definition
    fontSize: ['tiny', 'okay-ish', 'enormous'], // works
    somethingElse: ['foo', 'bar'], // works
    oops: ['hello'], // typescript error
  },
  classGroups: {
    'font-size': [{ text: [fromTheme<CustomThemeKey>('fontSize')] }],
  },
});

It will be a breaking change indeed, but only in the TS land. I have seen other libraries releasing tighter typings in minor versions, so that’s a potential option too. For those who do want to upgrade but have no time to configure new typings, all they’d need to do is:

- const mergeTailwindClasses = extendTailwindMerge({
+ const mergeTailwindClasses = extendTailwindMerge<string>({

Making string a default type would probably defeat the purpose of the change. People will keep falling into a trap with fontSize and other unsupported theme objects. However, if you are hesitant about TS breaking changes in a minor release, another option is:

  1. Introduce CustomThemeKey as a generic type arg, default it to string; release semver-minor
  2. Change string to an empty set, release semver-major

WDYT?

@dcastil
Copy link
Owner

dcastil commented Aug 12, 2023

With the potential use of fromTheme, WDYT of this facade?

Oh I never considered to use generics. This is a really nice idea! This could also be useful to make the classGroup keys more strict to prevent accidental use of non-existent class groups and to make finding class group keys easier. E.g. the API could look like this:

extendTailwindMerge<ThemeKeys, ClassGroupKeys>()

// This would enable the same behavior as currently
extendTailwindMerge<string, string>()

It will be a breaking change indeed, but only in the TS land.

Lots of tailwind-merge users are using TypeScript and it would break a lot of build pipelines when a breaking change in types only would be introduced. I think this would be unexpected to most of those people in a minor version change, so I'd only ship this in a major version.

But I'm already looking at a potential v2 release (you can check the list of changes I want to make in the v2 milestone). Introducing the generic defaulting to string right now and making it more strict in v2 seems like a good option to me.

Would you want to do the non-breaking change in this PR? Then you could solve this problem in your team right away and I could solve this for everyone else in v2. This would also give me some time to learn whether there is a way to make the API even better.

@dcastil
Copy link
Owner

dcastil commented Aug 20, 2023

@kachkaev I'm going to use this PR to implement #293 on top of the changes you already made. Let me know if you object. 😁

@kachkaev
Copy link
Contributor Author

Great, thanks! Feel free to close this PR if needed 👍

@dcastil dcastil changed the title Improve ThemeObject key type Make types of available keys more strict and configurable through generics Aug 20, 2023
@dcastil
Copy link
Owner

dcastil commented Aug 20, 2023

This turned out to be quite the change with a bit of more involved TypeScripting. I hope it'll all work as expected. 😅

@dcastil dcastil merged commit 034751a into dcastil:main Aug 20, 2023
3 checks passed
@dcastil
Copy link
Owner

dcastil commented Aug 20, 2023

Adding size info since the bot for it didn't run here:

size-limit report 📦

Path Size
dist/bundle-mjs.mjs 6.70 kB (-0.15% 🔽)
dist/bundle-cjs.js 6.82 KB (-0.15% 🔽)
dist/es5/bundle-mjs.mjs 6.99 KB (-0.57% 🔽)
dist/es5/bundle-cjs.js 7.17 KB (-0.55% 🔽)

@kachkaev kachkaev deleted the theme-object-type branch August 20, 2023 20:46
@dcastil dcastil added feature Is new feature breaking Is breaking change labels Aug 26, 2023
@github-actions
Copy link

This was addressed in release v2.0.0.

diegohaz referenced this pull request in ariakit/ariakit Oct 29, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [tailwind-merge](https://togithub.com/dcastil/tailwind-merge) |
[`1.14.0` ->
`2.0.0`](https://renovatebot.com/diffs/npm/tailwind-merge/1.14.0/2.0.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/tailwind-merge/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/tailwind-merge/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/tailwind-merge/1.14.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/tailwind-merge/1.14.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>dcastil/tailwind-merge (tailwind-merge)</summary>

###
[`v2.0.0`](https://togithub.com/dcastil/tailwind-merge/releases/tag/v2.0.0)

[Compare
Source](https://togithub.com/dcastil/tailwind-merge/compare/v1.14.0...v2.0.0)

The tailwind-merge v2 release has been sitting here almost finished for
2 months already. But the timing was never quite right, especially
thinking about the increased support needed after the release. In the
meantime, the product of the company I work at [launched in public
beta](https://medium.com/@&#8203;risecal/meet-rise-the-calendar-that-works-for-you-were-launching-the-public-beta-today-bc07555a2191)
and I married. Thank you for your patience.

This release focuses on making it easier to configure the library for
new users. Check out the [migration guide](./v1-to-v2-migration.md) and
if you have any questions, feel free to [create an
issue](https://togithub.com/dcastil/tailwind-merge/issues/new/choose).

##### Breaking Changes

- Fix `background-image` and `background-position` being merged
incorrectly by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/300](https://togithub.com/dcastil/tailwind-merge/pull/300)
- Values for `background-position` and `background-size` can look very
similar and Tailwind CSS uses the same `bg-` prefix for both groups.
This results in some [limitations](../limitations.md) for
tailwind-merge.
- Make types of available keys more strict and configurable through
generics by [@&#8203;kachkaev](https://togithub.com/kachkaev) in
[https://github.com/dcastil/tailwind-merge/pull/279](https://togithub.com/dcastil/tailwind-merge/pull/279)
- Make it possible to override elements with `extendTailwindMerge` by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/294](https://togithub.com/dcastil/tailwind-merge/pull/294)
- Separate validators better by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/292](https://togithub.com/dcastil/tailwind-merge/pull/292)
- Make `conflictingClassGroupModifiers` in config non-optional by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/291](https://togithub.com/dcastil/tailwind-merge/pull/291)
- Move separator to config by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/290](https://togithub.com/dcastil/tailwind-merge/pull/290)
- Remove `module` field from package.json by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/289](https://togithub.com/dcastil/tailwind-merge/pull/289)
- Remove deprecated exports by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/288](https://togithub.com/dcastil/tailwind-merge/pull/288)
- Transpile lib to more modern JS by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/287](https://togithub.com/dcastil/tailwind-merge/pull/287)

##### New Features

- Make types of available keys more strict and configurable through
generics by [@&#8203;kachkaev](https://togithub.com/kachkaev) in
[https://github.com/dcastil/tailwind-merge/pull/279](https://togithub.com/dcastil/tailwind-merge/pull/279)
- Make it possible to override elements with `extendTailwindMerge` by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/294](https://togithub.com/dcastil/tailwind-merge/pull/294)
- Separate validators better by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/292](https://togithub.com/dcastil/tailwind-merge/pull/292)
- Make `conflictingClassGroupModifiers` in config non-optional by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/291](https://togithub.com/dcastil/tailwind-merge/pull/291)
- Move separator to config by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/290](https://togithub.com/dcastil/tailwind-merge/pull/290)
- Remove `module` field from package.json by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/289](https://togithub.com/dcastil/tailwind-merge/pull/289)
- Remove deprecated exports by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/288](https://togithub.com/dcastil/tailwind-merge/pull/288)
- Transpile lib to more modern JS by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/287](https://togithub.com/dcastil/tailwind-merge/pull/287)
- Add ES5 bundle by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/286](https://togithub.com/dcastil/tailwind-merge/pull/286)

##### Bug Fixes

- Fix touch action classes overriding each other incorrectly by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/313](https://togithub.com/dcastil/tailwind-merge/pull/313)
- Fix `background-image` and `background-position` being merged
incorrectly by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/300](https://togithub.com/dcastil/tailwind-merge/pull/300)
- Fix number validators accidentally returning `true` for empty strings
by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/295](https://togithub.com/dcastil/tailwind-merge/pull/295)
- Rename lazy-initializaton.test.ts to lazy-initialization.test.ts by
[@&#8203;CrutchTheClutch](https://togithub.com/CrutchTheClutch) in
[https://github.com/dcastil/tailwind-merge/pull/284](https://togithub.com/dcastil/tailwind-merge/pull/284)

##### Documentation

- Explain limitations of arbitrary values in `bg-size` and `bg-position`
class groups in docs by [@&#8203;dcastil](https://togithub.com/dcastil)
in
[https://github.com/dcastil/tailwind-merge/pull/328](https://togithub.com/dcastil/tailwind-merge/pull/328)

**Full Changelog**:
dcastil/tailwind-merge@v1.14.0...v2.0.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/ariakit/ariakit).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMS41IiwidXBkYXRlZEluVmVyIjoiMzcuMzEuNSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@dcastil dcastil added the context-v2 Related to tailwind-merge v2 label Oct 30, 2023
sebald referenced this pull request in sebald/pattern-analyzer Nov 10, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [tailwind-merge](https://togithub.com/dcastil/tailwind-merge) |
[`1.14.0` ->
`2.0.0`](https://renovatebot.com/diffs/npm/tailwind-merge/1.14.0/2.0.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/tailwind-merge/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/tailwind-merge/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/tailwind-merge/1.14.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/tailwind-merge/1.14.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>dcastil/tailwind-merge (tailwind-merge)</summary>

###
[`v2.0.0`](https://togithub.com/dcastil/tailwind-merge/releases/tag/v2.0.0)

[Compare
Source](https://togithub.com/dcastil/tailwind-merge/compare/v1.14.0...v2.0.0)

The tailwind-merge v2 release has been sitting here almost finished for
2 months already. But the timing was never quite right, especially
thinking about the increased support needed after the release. In the
meantime, the product of the company I work at [launched in public
beta](https://medium.com/@&#8203;risecal/meet-rise-the-calendar-that-works-for-you-were-launching-the-public-beta-today-bc07555a2191)
and I married. Thank you for your patience.

This release focuses on making it easier to configure the library for
new users. Check out the [migration
guide](https://togithub.com/dcastil/tailwind-merge/blob/v2.0.0/docs/changelog/v1-to-v2-migration.md)
and if you have any questions, feel free to [create an
issue](https://togithub.com/dcastil/tailwind-merge/issues/new/choose).

##### Breaking Changes

- Fix `background-image` and `background-position` being merged
incorrectly by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/300](https://togithub.com/dcastil/tailwind-merge/pull/300)
- Values for `background-position` and `background-size` can look very
similar and Tailwind CSS uses the same `bg-` prefix for both groups.
This results in some
[limitations](https://togithub.com/dcastil/tailwind-merge/blob/v2.0.0/docs/limitations.md)
for tailwind-merge. If you use background position or background size
with arbitrary values, please read [this
section](https://togithub.com/dcastil/tailwind-merge/blob/v2.0.0/docs/limitations.md#you-need-to-use-label-in-arbitrary-background-position-and-background-size-classes)
about how to use them.
- Make types of available keys more strict and configurable through
generics by [@&#8203;kachkaev](https://togithub.com/kachkaev) in
[https://github.com/dcastil/tailwind-merge/pull/279](https://togithub.com/dcastil/tailwind-merge/pull/279)
- Make it possible to override elements with `extendTailwindMerge` by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/294](https://togithub.com/dcastil/tailwind-merge/pull/294)
- Separate validators better by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/292](https://togithub.com/dcastil/tailwind-merge/pull/292)
- Make `conflictingClassGroupModifiers` in config non-optional by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/291](https://togithub.com/dcastil/tailwind-merge/pull/291)
- Move separator to config by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/290](https://togithub.com/dcastil/tailwind-merge/pull/290)
- Remove `module` field from package.json by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/289](https://togithub.com/dcastil/tailwind-merge/pull/289)
- Remove deprecated exports by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/288](https://togithub.com/dcastil/tailwind-merge/pull/288)
- Transpile lib to more modern JS by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/287](https://togithub.com/dcastil/tailwind-merge/pull/287)

##### New Features

- Make types of available keys more strict and configurable through
generics by [@&#8203;kachkaev](https://togithub.com/kachkaev) in
[https://github.com/dcastil/tailwind-merge/pull/279](https://togithub.com/dcastil/tailwind-merge/pull/279)
- Make it possible to override elements with `extendTailwindMerge` by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/294](https://togithub.com/dcastil/tailwind-merge/pull/294)
- Separate validators better by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/292](https://togithub.com/dcastil/tailwind-merge/pull/292)
- Make `conflictingClassGroupModifiers` in config non-optional by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/291](https://togithub.com/dcastil/tailwind-merge/pull/291)
- Move separator to config by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/290](https://togithub.com/dcastil/tailwind-merge/pull/290)
- Remove `module` field from package.json by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/289](https://togithub.com/dcastil/tailwind-merge/pull/289)
- Remove deprecated exports by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/288](https://togithub.com/dcastil/tailwind-merge/pull/288)
- Transpile lib to more modern JS by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/287](https://togithub.com/dcastil/tailwind-merge/pull/287)
- Add ES5 bundle by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/286](https://togithub.com/dcastil/tailwind-merge/pull/286)

##### Bug Fixes

- Fix touch action classes overriding each other incorrectly by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/313](https://togithub.com/dcastil/tailwind-merge/pull/313)
- Fix `background-image` and `background-position` being merged
incorrectly by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/300](https://togithub.com/dcastil/tailwind-merge/pull/300)
- Fix number validators accidentally returning `true` for empty strings
by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/295](https://togithub.com/dcastil/tailwind-merge/pull/295)
- Rename lazy-initializaton.test.ts to lazy-initialization.test.ts by
[@&#8203;CrutchTheClutch](https://togithub.com/CrutchTheClutch) in
[https://github.com/dcastil/tailwind-merge/pull/284](https://togithub.com/dcastil/tailwind-merge/pull/284)

##### Documentation

- Explain limitations of arbitrary values in `bg-size` and `bg-position`
class groups in docs by [@&#8203;dcastil](https://togithub.com/dcastil)
in
[https://github.com/dcastil/tailwind-merge/pull/328](https://togithub.com/dcastil/tailwind-merge/pull/328)

**Full Changelog**:
dcastil/tailwind-merge@v1.14.0...v2.0.0

Thanks to [@&#8203;quezlatch](https://togithub.com/quezlatch),
[@&#8203;brandonmcconnell](https://togithub.com/brandonmcconnell),
[@&#8203;manavm1990](https://togithub.com/manavm1990) and
[@&#8203;ErwinAI](https://togithub.com/ErwinAI) for sponsoring
tailwind-merge! ❤️

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the
month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/sebald/pattern-analyzer).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40Ni4wIiwidXBkYXRlZEluVmVyIjoiMzcuNDYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
kharann referenced this pull request in dotkom/monoweb Nov 11, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [tailwind-merge](https://togithub.com/dcastil/tailwind-merge) |
[`^1.14.0` ->
`^2.0.0`](https://renovatebot.com/diffs/npm/tailwind-merge/1.14.0/2.0.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/tailwind-merge/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/tailwind-merge/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/tailwind-merge/1.14.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/tailwind-merge/1.14.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>dcastil/tailwind-merge (tailwind-merge)</summary>

###
[`v2.0.0`](https://togithub.com/dcastil/tailwind-merge/releases/tag/v2.0.0)

[Compare
Source](https://togithub.com/dcastil/tailwind-merge/compare/v1.14.0...v2.0.0)

The tailwind-merge v2 release has been sitting here almost finished for
2 months already. But the timing was never quite right, especially
thinking about the increased support needed after the release. In the
meantime, the product of the company I work at [launched in public
beta](https://medium.com/@&#8203;risecal/meet-rise-the-calendar-that-works-for-you-were-launching-the-public-beta-today-bc07555a2191)
and I married. Thank you for your patience.

This release focuses on making it easier to configure the library for
new users. Check out the [migration
guide](https://togithub.com/dcastil/tailwind-merge/blob/v2.0.0/docs/changelog/v1-to-v2-migration.md)
and if you have any questions, feel free to [create an
issue](https://togithub.com/dcastil/tailwind-merge/issues/new/choose).

##### Breaking Changes

- Fix `background-image` and `background-position` being merged
incorrectly by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/300](https://togithub.com/dcastil/tailwind-merge/pull/300)
- Values for `background-position` and `background-size` can look very
similar and Tailwind CSS uses the same `bg-` prefix for both groups.
This results in some
[limitations](https://togithub.com/dcastil/tailwind-merge/blob/v2.0.0/docs/limitations.md)
for tailwind-merge. If you use background position or background size
with arbitrary values, please read [this
section](https://togithub.com/dcastil/tailwind-merge/blob/v2.0.0/docs/limitations.md#you-need-to-use-label-in-arbitrary-background-position-and-background-size-classes)
about how to use them.
- Make types of available keys more strict and configurable through
generics by [@&#8203;kachkaev](https://togithub.com/kachkaev) in
[https://github.com/dcastil/tailwind-merge/pull/279](https://togithub.com/dcastil/tailwind-merge/pull/279)
- Make it possible to override elements with `extendTailwindMerge` by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/294](https://togithub.com/dcastil/tailwind-merge/pull/294)
- Separate validators better by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/292](https://togithub.com/dcastil/tailwind-merge/pull/292)
- Make `conflictingClassGroupModifiers` in config non-optional by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/291](https://togithub.com/dcastil/tailwind-merge/pull/291)
- Move separator to config by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/290](https://togithub.com/dcastil/tailwind-merge/pull/290)
- Remove `module` field from package.json by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/289](https://togithub.com/dcastil/tailwind-merge/pull/289)
- Remove deprecated exports by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/288](https://togithub.com/dcastil/tailwind-merge/pull/288)
- Transpile lib to more modern JS by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/287](https://togithub.com/dcastil/tailwind-merge/pull/287)

##### New Features

- Make types of available keys more strict and configurable through
generics by [@&#8203;kachkaev](https://togithub.com/kachkaev) in
[https://github.com/dcastil/tailwind-merge/pull/279](https://togithub.com/dcastil/tailwind-merge/pull/279)
- Make it possible to override elements with `extendTailwindMerge` by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/294](https://togithub.com/dcastil/tailwind-merge/pull/294)
- Separate validators better by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/292](https://togithub.com/dcastil/tailwind-merge/pull/292)
- Make `conflictingClassGroupModifiers` in config non-optional by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/291](https://togithub.com/dcastil/tailwind-merge/pull/291)
- Move separator to config by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/290](https://togithub.com/dcastil/tailwind-merge/pull/290)
- Remove `module` field from package.json by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/289](https://togithub.com/dcastil/tailwind-merge/pull/289)
- Remove deprecated exports by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/288](https://togithub.com/dcastil/tailwind-merge/pull/288)
- Transpile lib to more modern JS by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/287](https://togithub.com/dcastil/tailwind-merge/pull/287)
- Add ES5 bundle by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/286](https://togithub.com/dcastil/tailwind-merge/pull/286)

##### Bug Fixes

- Fix touch action classes overriding each other incorrectly by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/313](https://togithub.com/dcastil/tailwind-merge/pull/313)
- Fix `background-image` and `background-position` being merged
incorrectly by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/300](https://togithub.com/dcastil/tailwind-merge/pull/300)
- Fix number validators accidentally returning `true` for empty strings
by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/295](https://togithub.com/dcastil/tailwind-merge/pull/295)
- Rename lazy-initializaton.test.ts to lazy-initialization.test.ts by
[@&#8203;CrutchTheClutch](https://togithub.com/CrutchTheClutch) in
[https://github.com/dcastil/tailwind-merge/pull/284](https://togithub.com/dcastil/tailwind-merge/pull/284)

##### Documentation

- Explain limitations of arbitrary values in `bg-size` and `bg-position`
class groups in docs by [@&#8203;dcastil](https://togithub.com/dcastil)
in
[https://github.com/dcastil/tailwind-merge/pull/328](https://togithub.com/dcastil/tailwind-merge/pull/328)

**Full Changelog**:
dcastil/tailwind-merge@v1.14.0...v2.0.0

Thanks to [@&#8203;quezlatch](https://togithub.com/quezlatch),
[@&#8203;brandonmcconnell](https://togithub.com/brandonmcconnell),
[@&#8203;manavm1990](https://togithub.com/manavm1990) and
[@&#8203;ErwinAI](https://togithub.com/ErwinAI) for sponsoring
tailwind-merge! ❤️

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/dotkom/monoweb).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMS41IiwidXBkYXRlZEluVmVyIjoiMzcuNDYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
kkrishguptaa referenced this pull request in kkrishguptaa/study-web3 Nov 18, 2023
[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [tailwind-merge](https://togithub.com/dcastil/tailwind-merge) |
[`^1.13.2` ->
`^2.0.0`](https://renovatebot.com/diffs/npm/tailwind-merge/1.14.0/2.0.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/tailwind-merge/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/tailwind-merge/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/tailwind-merge/1.14.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/tailwind-merge/1.14.0/2.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>dcastil/tailwind-merge (tailwind-merge)</summary>

###
[`v2.0.0`](https://togithub.com/dcastil/tailwind-merge/releases/tag/v2.0.0)

[Compare
Source](https://togithub.com/dcastil/tailwind-merge/compare/v1.14.0...v2.0.0)

The tailwind-merge v2 release has been sitting here almost finished for
2 months already. But the timing was never quite right, especially
thinking about the increased support needed after the release. In the
meantime, the product of the company I work at [launched in public
beta](https://medium.com/@&#8203;risecal/meet-rise-the-calendar-that-works-for-you-were-launching-the-public-beta-today-bc07555a2191)
and I married. Thank you for your patience.

This release focuses on making it easier to configure the library for
new users. Check out the [migration
guide](https://togithub.com/dcastil/tailwind-merge/blob/v2.0.0/docs/changelog/v1-to-v2-migration.md)
and if you have any questions, feel free to [create an
issue](https://togithub.com/dcastil/tailwind-merge/issues/new/choose).

##### Breaking Changes

- Fix `background-image` and `background-position` being merged
incorrectly by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/300](https://togithub.com/dcastil/tailwind-merge/pull/300)
- Values for `background-position` and `background-size` can look very
similar and Tailwind CSS uses the same `bg-` prefix for both groups.
This results in some
[limitations](https://togithub.com/dcastil/tailwind-merge/blob/v2.0.0/docs/limitations.md)
for tailwind-merge. If you use background position or background size
with arbitrary values, please read [this
section](https://togithub.com/dcastil/tailwind-merge/blob/v2.0.0/docs/limitations.md#you-need-to-use-label-in-arbitrary-background-position-and-background-size-classes)
about how to use them.
- Make types of available keys more strict and configurable through
generics by [@&#8203;kachkaev](https://togithub.com/kachkaev) in
[https://github.com/dcastil/tailwind-merge/pull/279](https://togithub.com/dcastil/tailwind-merge/pull/279)
- Make it possible to override elements with `extendTailwindMerge` by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/294](https://togithub.com/dcastil/tailwind-merge/pull/294)
- Separate validators better by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/292](https://togithub.com/dcastil/tailwind-merge/pull/292)
- Make `conflictingClassGroupModifiers` in config non-optional by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/291](https://togithub.com/dcastil/tailwind-merge/pull/291)
- Move separator to config by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/290](https://togithub.com/dcastil/tailwind-merge/pull/290)
- Remove `module` field from package.json by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/289](https://togithub.com/dcastil/tailwind-merge/pull/289)
- Remove deprecated exports by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/288](https://togithub.com/dcastil/tailwind-merge/pull/288)
- Transpile lib to more modern JS by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/287](https://togithub.com/dcastil/tailwind-merge/pull/287)

##### New Features

- Make types of available keys more strict and configurable through
generics by [@&#8203;kachkaev](https://togithub.com/kachkaev) in
[https://github.com/dcastil/tailwind-merge/pull/279](https://togithub.com/dcastil/tailwind-merge/pull/279)
- Make it possible to override elements with `extendTailwindMerge` by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/294](https://togithub.com/dcastil/tailwind-merge/pull/294)
- Separate validators better by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/292](https://togithub.com/dcastil/tailwind-merge/pull/292)
- Make `conflictingClassGroupModifiers` in config non-optional by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/291](https://togithub.com/dcastil/tailwind-merge/pull/291)
- Move separator to config by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/290](https://togithub.com/dcastil/tailwind-merge/pull/290)
- Remove `module` field from package.json by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/289](https://togithub.com/dcastil/tailwind-merge/pull/289)
- Remove deprecated exports by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/288](https://togithub.com/dcastil/tailwind-merge/pull/288)
- Transpile lib to more modern JS by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/287](https://togithub.com/dcastil/tailwind-merge/pull/287)
- Add ES5 bundle by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/286](https://togithub.com/dcastil/tailwind-merge/pull/286)

##### Bug Fixes

- Fix touch action classes overriding each other incorrectly by
[@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/313](https://togithub.com/dcastil/tailwind-merge/pull/313)
- Fix `background-image` and `background-position` being merged
incorrectly by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/300](https://togithub.com/dcastil/tailwind-merge/pull/300)
- Fix number validators accidentally returning `true` for empty strings
by [@&#8203;dcastil](https://togithub.com/dcastil) in
[https://github.com/dcastil/tailwind-merge/pull/295](https://togithub.com/dcastil/tailwind-merge/pull/295)
- Rename lazy-initializaton.test.ts to lazy-initialization.test.ts by
[@&#8203;CrutchTheClutch](https://togithub.com/CrutchTheClutch) in
[https://github.com/dcastil/tailwind-merge/pull/284](https://togithub.com/dcastil/tailwind-merge/pull/284)

##### Documentation

- Explain limitations of arbitrary values in `bg-size` and `bg-position`
class groups in docs by [@&#8203;dcastil](https://togithub.com/dcastil)
in
[https://github.com/dcastil/tailwind-merge/pull/328](https://togithub.com/dcastil/tailwind-merge/pull/328)

**Full Changelog**:
dcastil/tailwind-merge@v1.14.0...v2.0.0

Thanks to [@&#8203;quezlatch](https://togithub.com/quezlatch),
[@&#8203;brandonmcconnell](https://togithub.com/brandonmcconnell),
[@&#8203;manavm1990](https://togithub.com/manavm1990) and
[@&#8203;ErwinAI](https://togithub.com/ErwinAI) for sponsoring
tailwind-merge! ❤️

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/xkrishguptaa/study-web3).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMS41IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Is breaking change context-v2 Related to tailwind-merge v2 feature Is new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make available key types in extendTailwindMerge more strict
4 participants