tailwind-merge 0.8.1 → 1.1.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.
Files changed (65) hide show
  1. package/README.md +267 -27
  2. package/dist/_virtual/_rollupPluginBabelHelpers.mjs +20 -0
  3. package/dist/_virtual/_rollupPluginBabelHelpers.mjs.map +1 -0
  4. package/dist/index.d.ts +8 -0
  5. package/dist/index.js +5 -2005
  6. package/dist/index.mjs +9 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/{types → lib}/class-utils.d.ts +0 -0
  9. package/dist/lib/class-utils.mjs +132 -0
  10. package/dist/lib/class-utils.mjs.map +1 -0
  11. package/dist/{types → lib}/config-utils.d.ts +0 -0
  12. package/dist/lib/config-utils.mjs +12 -0
  13. package/dist/lib/config-utils.mjs.map +1 -0
  14. package/dist/{types → lib}/create-tailwind-merge.d.ts +0 -0
  15. package/dist/lib/create-tailwind-merge.mjs +55 -0
  16. package/dist/lib/create-tailwind-merge.mjs.map +1 -0
  17. package/dist/{types → lib}/default-config.d.ts +508 -184
  18. package/dist/{index.module.js → lib/default-config.mjs} +598 -570
  19. package/dist/lib/default-config.mjs.map +1 -0
  20. package/dist/{types → lib}/extend-tailwind-merge.d.ts +0 -0
  21. package/dist/lib/extend-tailwind-merge.mjs +16 -0
  22. package/dist/lib/extend-tailwind-merge.mjs.map +1 -0
  23. package/dist/lib/from-theme.d.ts +2 -0
  24. package/dist/lib/from-theme.mjs +11 -0
  25. package/dist/lib/from-theme.mjs.map +1 -0
  26. package/dist/{types → lib}/lru-cache.d.ts +0 -0
  27. package/dist/lib/lru-cache.mjs +17 -0
  28. package/dist/lib/lru-cache.mjs.map +1 -0
  29. package/dist/{types → lib}/merge-classlist.d.ts +0 -0
  30. package/dist/lib/merge-classlist.mjs +66 -0
  31. package/dist/lib/merge-classlist.mjs.map +1 -0
  32. package/dist/{types → lib}/merge-configs.d.ts +0 -0
  33. package/dist/lib/merge-configs.mjs +39 -0
  34. package/dist/lib/merge-configs.mjs.map +1 -0
  35. package/dist/lib/tailwind-merge.d.ts +1 -0
  36. package/dist/lib/tailwind-merge.mjs +7 -0
  37. package/dist/lib/tailwind-merge.mjs.map +1 -0
  38. package/dist/{types → lib}/types.d.ts +12 -2
  39. package/dist/lib/validators.d.ts +11 -0
  40. package/dist/lib/validators.mjs +79 -0
  41. package/dist/lib/validators.mjs.map +1 -0
  42. package/dist/{index.cjs → tailwind-merge.cjs.development.js} +725 -264
  43. package/dist/tailwind-merge.cjs.development.js.map +1 -0
  44. package/dist/tailwind-merge.cjs.production.min.js +2 -0
  45. package/dist/tailwind-merge.cjs.production.min.js.map +1 -0
  46. package/package.json +31 -24
  47. package/src/index.ts +8 -10
  48. package/src/{class-utils.ts → lib/class-utils.ts} +52 -9
  49. package/src/{config-utils.ts → lib/config-utils.ts} +0 -0
  50. package/src/{create-tailwind-merge.ts → lib/create-tailwind-merge.ts} +0 -0
  51. package/src/{default-config.ts → lib/default-config.ts} +561 -228
  52. package/src/{extend-tailwind-merge.ts → lib/extend-tailwind-merge.ts} +0 -0
  53. package/src/lib/from-theme.ts +9 -0
  54. package/src/{lru-cache.ts → lib/lru-cache.ts} +0 -0
  55. package/src/{merge-classlist.ts → lib/merge-classlist.ts} +1 -1
  56. package/src/{merge-configs.ts → lib/merge-configs.ts} +0 -0
  57. package/src/lib/tailwind-merge.ts +4 -0
  58. package/src/{types.ts → lib/types.ts} +12 -3
  59. package/src/lib/validators.ts +86 -0
  60. package/dist/index.cjs.map +0 -1
  61. package/dist/index.js.map +0 -1
  62. package/dist/index.module.js.map +0 -1
  63. package/dist/types/index.d.ts +0 -8
  64. package/dist/types/validators.d.ts +0 -5
  65. package/src/validators.ts +0 -41
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <div align="center">
2
2
  <br />
3
3
  <a href="https://github.com/dcastil/tailwind-merge">
4
- <!-- AUTOGENERATED START logo-image --><img src="https://github.com/dcastil/tailwind-merge/raw/v0.8.1/assets/logo.svg" alt="tailwind-merge" width="221px" /><!-- AUTOGENERATED END -->
4
+ <!-- AUTOGENERATED START logo-image --><img src="https://github.com/dcastil/tailwind-merge/raw/v1.1.0/assets/logo.svg" alt="tailwind-merge" width="221px" /><!-- AUTOGENERATED END -->
5
5
  </a>
6
6
  </div>
7
7
 
@@ -16,16 +16,10 @@ twMerge('px-2 py-1 bg-red hover:bg-dark-red', 'p-3 bg-[#B91C1C]')
16
16
  // → 'hover:bg-dark-red p-3 bg-[#B91C1C]'
17
17
  ```
18
18
 
19
- - Supports Tailwind v2.0 up to v2.2, support for newer versions will be added continuously
19
+ - Supports Tailwind v3.0 (if you use Tailwind v2, use [tailwind-merge v0.9.0](https://github.com/dcastil/tailwind-merge/tree/v0.9.0))
20
20
  - Works in Node >=12 and all modern browsers
21
21
  - Fully typed
22
- - [<!-- AUTOGENERATED START package-gzip-size -->4.8 kB<!-- AUTOGENERATED END --> minified + gzipped](https://bundlephobia.com/package/tailwind-merge) (<!-- AUTOGENERATED START package-composition -->96.5% self, 3.5% hashlru<!-- AUTOGENERATED END -->)
23
-
24
- ## Early development
25
-
26
- This library is in an early pre-v1 development stage and might have some bugs and inconveniences here and there. I use the library in production and intend it to be sufficient for production use, as long as you're fine with some potential breaking changes in minor releases until v1 (lock the version range to patch releases with `~` in your `package.json` to prevent accidental breaking changes).
27
-
28
- I want to keep the library on v0 until I feel confident enough that there aren't any major bugs or flaws in its API and implementation. If you find a bug or something you don't like, please [submit an issue](https://github.com/dcastil/tailwind-merge/issues/new) or a pull request. I'm happy about any kind of feedback!
22
+ - [Check bundle size on Bundlephobia](https://bundlephobia.com/package/tailwind-merge)
29
23
 
30
24
  ## What is it for
31
25
 
@@ -100,13 +94,26 @@ twMerge('hover:p-2 hover:p-4') // → 'hover:p-4'
100
94
  twMerge('hover:focus:p-2 focus:hover:p-4') // → 'focus:hover:p-4'
101
95
  ```
102
96
 
103
- ### Supports custom values
97
+ ### Supports arbitrary values
104
98
 
105
99
  ```ts
106
100
  twMerge('bg-black bg-[color:var(--mystery-var)]') // → 'bg-[color:var(--mystery-var)]'
107
101
  twMerge('grid-cols-[1fr,auto] grid-cols-2') // → 'grid-cols-2'
108
102
  ```
109
103
 
104
+ ### Supports arbitrary properties
105
+
106
+ ```ts
107
+ twMerge('[mask-type:luminance] [mask-type:alpha]') // → '[mask-type:alpha]'
108
+ twMerge('[--scroll-offset:56px] lg:[--scroll-offset:44px]')
109
+ // → '[--scroll-offset:56px] lg:[--scroll-offset:44px]'
110
+
111
+ // Don't do this!
112
+ twMerge('[padding:1rem] p-8') // → '[padding:1rem] p-8'
113
+ ```
114
+
115
+ Watch out for mixing arbitrary properties which could be expressed as Tailwind classes. tailwind-merge does not resolve conflicts between arbitrary properties and their matching Tailwind classes to keep the bundle size small.
116
+
110
117
  ### Supports important modifier
111
118
 
112
119
  ```ts
@@ -132,6 +139,207 @@ twMerge('text-red text-secret-sauce') // → 'text-secret-sauce'
132
139
  twMerge('some-class', undefined, null, false) // → 'some-class'
133
140
  ```
134
141
 
142
+ ## Basic usage
143
+
144
+ If you're using Tailwind CSS without any extra config, you can use [`twMerge`](#twmerge) right away. You can safely stop reading the documentation here.
145
+
146
+ ## Usage with custom Tailwind config
147
+
148
+ If you're using a custom Tailwind config, you may need to configure tailwind-merge as well to merge classes properly.
149
+
150
+ The default [`twMerge`](#twmerge) function is configured in a way that you can still use it if all of the following points apply to your Tailwind config:
151
+
152
+ - Only using color names which don't clash with other Tailwind class names
153
+ - Only deviating by number values from number-based Tailwind classes
154
+ - Only using font-family classes which don't clash with default font-weight classes
155
+ - Sticking to default Tailwind config for everything else
156
+
157
+ If some of these points don't apply to you, you can test whether `twMerge` still works as intended with your custom classes. Otherwise you need create your own custom merge function by either extending the default tailwind-merge config or using a completely custom one.
158
+
159
+ The tailwind-merge config is different from the Tailwind config because it's expected to be shipped and run in the browser as opposed to the Tailwind config which is meant to run at build-time. Be careful in case you're using your Tailwind config directly to configure tailwind-merge in your client-side code because that could result in an unnecessarily large bundle size.
160
+
161
+ ### Shape of tailwind-merge config
162
+
163
+ The tailwind-merge config is an object with a few keys.
164
+
165
+ ```ts
166
+ const tailwindMergeConfig = {
167
+ // ↓ Set how many values should be stored in cache.
168
+ cacheSize: 500,
169
+ theme: {
170
+ // Theme scales are defined here
171
+ },
172
+ classGroups: {
173
+ // Class groups are defined here
174
+ },
175
+ conflictingClassGroups: {
176
+ // Conflcits between class groups are defined here
177
+ },
178
+ }
179
+ ```
180
+
181
+ ### Class groups
182
+
183
+ The library uses a concept of _class groups_ which is an array of Tailwind classes which all modify the same CSS property. E.g. here is the position class group.
184
+
185
+ ```ts
186
+ const positionClassGroup = ['static', 'fixed', 'absolute', 'relative', 'sticky']
187
+ ```
188
+
189
+ tailwind-merge resolves conflicts between classes in a class group and only keeps the last one passed to the merge function call.
190
+
191
+ ```ts
192
+ twMerge('static sticky relative') // → 'relative'
193
+ ```
194
+
195
+ Tailwind classes often share the beginning of the class name, so elements in a class group can also be an object with values of the same shape as a class group (yes, the shape is recursive). In the object each key is joined with all the elements in the corresponding array with a dash (`-`) in between.
196
+
197
+ E.g. here is the overflow class group which results in the classes `overflow-auto`, `overflow-hidden`, `overflow-visible` and `overflow-scroll`.
198
+
199
+ ```ts
200
+ const overflowClassGroup = [{ overflow: ['auto', 'hidden', 'visible', 'scroll'] }]
201
+ ```
202
+
203
+ Sometimes it isn't possible to enumerate all elements in a class group. Think of a Tailwind class which allows arbitrary values. In this scenario you can use a validator function which takes a _class part_ and returns a boolean indicating whether a class is part of a class group.
204
+
205
+ E.g. here is the fill class group.
206
+
207
+ ```ts
208
+ const isArbitraryValue = (classPart: string) => /^\[.+\]$/.test(classPart)
209
+ const fillClassGroup = [{ fill: ['current', isArbitraryValue] }]
210
+ ```
211
+
212
+ Because the function is under the `fill` key, it will only get called for classes which start with `fill-`. Also, the function only gets passed the part of the class name which comes after `fill-`, this way you can use the same function in multiple class groups. tailwind-merge exports its own [validators](#validators), so you don't need to recreate them.
213
+
214
+ You can use am empty string (`''`) as a class part if you want to indicate that the preceding part was the end. This is useful for defining elements which are marked as `DEFAULT` in the Tailwind config.
215
+
216
+ ```ts
217
+ // ↓ Resolves to filter and filter-none
218
+ const filterClassGroup = [{ filter: ['', 'none'] }]
219
+ ```
220
+
221
+ Each class group is defined under its ID in the `classGroups` object in the config. This ID is only used internally and the only thing that matters is that it is unique among all class groups.
222
+
223
+ ### Conflicting class groups
224
+
225
+ Sometimes there are conflicts across Tailwind classes which are more complex than "remove all those other classes when a class from this group is present in the class list string".
226
+
227
+ One example is the combination of the classes `px-3` (setting `padding-left` and `padding-right`) and `pr-4` (setting `padding-right`).
228
+
229
+ If they are passed to `twMerge` as `pr-4 px-3`, I think you most likely intend to apply `padding-left` and `padding-right` from the `px-3` class and want `pr-4` to be removed, indicating that both these classes should belong to a single class group.
230
+
231
+ But if they are passed to `twMerge` as `px-3 pr-4`, I assume you want to set the `padding-right` from `pr-4` but still want to apply the `padding-left` from `px-3`, so `px-3` shouldn't be removed when inserting the classes in this order, indicating they shouldn't be in the same class group.
232
+
233
+ To summarize, `px-3` should stand in conflict with `pr-4`, but `pr-4` should not stand in conflict with `px-3`. to achieve this we need to define asymetric conflicts across class groups.
234
+
235
+ This is what the `conflictingClassGroups` object in the tailwind-merge config is for. You define a key in it which is the ID of a class group which _creates_ a conflict and the value is an array of IDs of class group which _receive_ a conflict.
236
+
237
+ ```ts
238
+ const conflictingClassGroups = {
239
+ px: ['pr', 'pl'],
240
+ }
241
+ ```
242
+
243
+ If a class group _creates_ a conflict, it means that if it appears in a class list string passed to `twMerge`, all preceding class groups in the string which _rceive_ the conflict will be removed.
244
+
245
+ When we think of our example, the `px` class group creates a conflict which is received by the class groups `pr` and `pl`. This way `px-3` removes a preceding `pr-4`, but not the other way around.
246
+
247
+ ### Theme
248
+
249
+ In the Tailwind config you can modify theme scales. tailwind-merge follows the same keys for the theme scales, but doesn't support all of them. tailwind-merge only supports theme scales which are used in multiple class groups to save bundle size (more info to that in [PR 55](https://github.com/dcastil/tailwind-merge/pull/55)). At the moment these are:
250
+
251
+ - `colors`
252
+ - `spacing`
253
+ - `blur`
254
+ - `brightness`
255
+ - `borderColor`
256
+ - `borderRadius`
257
+ - `borderWidth`
258
+ - `contrast`
259
+ - `grayscale`
260
+ - `hueRotate`
261
+ - `invert`
262
+ - `gap`
263
+ - `gradientColorStops`
264
+ - `inset`
265
+ - `margin`
266
+ - `opacity`
267
+ - `padding`
268
+ - `saturate`
269
+ - `scale`
270
+ - `sepia`
271
+ - `skew`
272
+ - `space`
273
+ - `translate`
274
+
275
+ 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).
276
+
277
+ ### Extending the tailwind-merge config
278
+
279
+ If you only need to extend the default tailwind-merge config, [`extendTailwindMerge`](#extendtailwindmerge) is the easiest way to extend the config. You provide it a `configExtension` object which gets [merged](#mergeconfigs) with the default config. Therefore all keys here are optional.
280
+
281
+ ```ts
282
+ import { extendTailwindMerge } from 'tailwind-merge'
283
+
284
+ const customTwMerge = extendTailwindMerge({
285
+ // ↓ Add values to existing theme scale or create a new one
286
+ theme: {
287
+ spacing: ['sm', 'md', 'lg'],
288
+ },
289
+ // ↓ Add values to existing class groups or define new ones
290
+ classGroups: {
291
+ foo: ['foo', 'foo-2', { 'bar-baz': ['', '1', '2'] }],
292
+ bar: [{ qux: ['auto', (value) => Number(value) >= 1000] }],
293
+ },
294
+ // ↓ Here you can define additional conflicts across class groups
295
+ conflictingClassGroups: {
296
+ foo: ['bar'],
297
+ },
298
+ })
299
+ ```
300
+
301
+ ### Using completely custom tailwind-merge config
302
+
303
+ If you need to modify the tailwind-merge config and need more control than [`extendTailwindMerge`](#extendtailwindmerge) gives you or don't want to use the default config (and tree-shake it out of your bundle), you can use [`createTailwindMerge`](#createtailwindmerge).
304
+
305
+ The function takes a callback which returns the config you want to use and returns a custom `twMerge` function.
306
+
307
+ ```ts
308
+ import { createTailwindMerge } from 'tailwind-merge'
309
+
310
+ const customTwMerge = createTailwindMerge(() => ({
311
+ theme: {},
312
+ classGroups: {
313
+ foo: ['foo', 'foo-2', { 'bar-baz': ['', '1', '2'] }],
314
+ bar: [{ qux: ['auto', (value) => Number(value) >= 1000] }],
315
+ },
316
+ conflictingClassGroups: {
317
+ foo: ['bar'],
318
+ },
319
+ }))
320
+ ```
321
+
322
+ The callback passed to `createTailwindMerge` will be called when `customTwMerge` is called the first time, so you don't need to worry about the computations in it affecting app startup performance in case you aren't using tailwind-merge at app startup.
323
+
324
+ ### Using third-party tailwind-merge plugins
325
+
326
+ You can use both [`extendTailwindMerge`](#extendtailwindmerge) and [`createTailwindMerge`](#createtailwindmerge) with third-party plugins. Just add them as arguments after your config.
327
+
328
+ ```ts
329
+ import { extendTailwindMerge, createTailwindMerge } from 'tailwind-merge'
330
+ import { withMagic } from 'tailwind-merge-magic-plugin'
331
+ import { withMoreMagic } from 'tailwind-merge-more-magic-plugin'
332
+
333
+ // With your own config
334
+ const twMerge1 = extendTailwindMerge({ … }, withMagic, withMoreMagic)
335
+
336
+ // Only using plugin with default config
337
+ const twMerge2 = extendTailwindMerge(withMagic, withMoreMagic)
338
+
339
+ // Using `createTailwindMerge`
340
+ const twMerge3 = createTailwindMerge(() => ({ … }), withMagic, withMoreMagic)
341
+ ```
342
+
135
343
  ## API reference
136
344
 
137
345
  Reference to all exports of tailwind-merge.
@@ -142,14 +350,9 @@ Reference to all exports of tailwind-merge.
142
350
  function twMerge(...classLists: Array<string | undefined | null | false>): string
143
351
  ```
144
352
 
145
- Default function to use if you're using the default Tailwind config or are close enough to the default config. You can use this function if all of the following points apply to your Tailwind config:
146
-
147
- - Only using color names which don't clash with other Tailwind class names
148
- - Only deviating by number values from number-based Tailwind classes
149
- - Only using font-family classes which don't clash with default font-weight classes
150
- - Sticking to default Tailwind config for everything else
353
+ Default function to use if you're using the default Tailwind config or are close enough to the default config. Check out [basic usage](#basic-usage) for more info.
151
354
 
152
- If some of these points don't apply to you, it makes sense to test whether `twMerge` still works as intended with your custom classes. Otherwise, you can create your own custom merge function with [`extendTailwindMerge`](#extendtailwindmerge).
355
+ If `twMerge` doesn't work for you, you can create your own custom merge function with [`extendTailwindMerge`](#extendtailwindmerge).
153
356
 
154
357
  ### `getDefaultConfig`
155
358
 
@@ -159,6 +362,30 @@ function getDefaultConfig(): Config
159
362
 
160
363
  Function which returns the default config used by tailwind-merge. The tailwind-merge config is different from the Tailwind config. It is optimized for small bundle size and fast runtime performance because it is expected to run in the browser.
161
364
 
365
+ ### `fromTheme`
366
+
367
+ ```ts
368
+ function fromTheme(key: string): ThemeGetter
369
+ ```
370
+
371
+ Function to retrieve values from a theme scale, to be used in class groups.
372
+
373
+ `fromTheme` doesn't return the values from the theme scale but rather another function which is used by tailwind-merge internally to retrieve the theme values. tailwind-merge can differentiate the theme getter function from a validator because it has a `isThemeGetter` property set to `true`.
374
+
375
+ It can be used like this:
376
+
377
+ ```ts
378
+ extendTailwindMerge({
379
+ theme: {
380
+ 'my-scale': ['foo', 'bar']
381
+ },
382
+ classGroups: {
383
+ 'my-group': [{ 'my-group': [fromTheme('my-scale'), fromTheme('spacing')] }]
384
+ 'my-group-x': [{ 'my-group-x': [fromTheme('my-scale')] }]
385
+ }
386
+ })
387
+ ```
388
+
162
389
  ### `extendTailwindMerge`
163
390
 
164
391
  ```ts
@@ -176,9 +403,11 @@ You provide it a `configExtension` object which gets [merged](#mergeconfigs) wit
176
403
  ```ts
177
404
  const customTwMerge = extendTailwindMerge({
178
405
  cacheSize: 0, // ← Disabling cache
179
- prefixes: [
180
- 'my-custom-prefix', // Adding custom prefix
181
- ],
406
+ // ↓ Add values to existing theme scale or create a new one
407
+ // Not all theme keys form the Tailwind config are supported by default.
408
+ theme: {
409
+ spacing: ['sm', 'md', 'lg'],
410
+ },
182
411
  // ↓ Here you define class groups
183
412
  classGroups: {
184
413
  // ↓ The `foo` key here is the class group ID
@@ -230,7 +459,6 @@ const customTwMerge = createTailwindMerge(() => {
230
459
 
231
460
  return {
232
461
  cacheSize: 0,
233
- prefixes: [...defaultConfig.prefixes, 'my-custom-prefix'],
234
462
  classGroups: {
235
463
  ...defaultConfig.classGroups,
236
464
  foo: ['foo', 'foo-2', { 'bar-baz': ['', '1', '2'] }],
@@ -285,9 +513,15 @@ const customTwMerge = createTailwindMerge(getDefaultConfig, (config) =>
285
513
  ```ts
286
514
  interface Validators {
287
515
  isLength(classPart: string): boolean
288
- isCustomLength(classPart: string): boolean
516
+ isArbitraryLength(classPart: string): boolean
289
517
  isInteger(classPart: string): boolean
290
- isCustomValue(classPart: string): boolean
518
+ isArbitraryValue(classPart: string): boolean
519
+ isTshirtSize(classPart: string): boolean
520
+ isArbitrarySize(classPart: string): boolean
521
+ isArbitraryPosition(classPart: string): boolean
522
+ isArbitraryUrl(classPart: string): boolean
523
+ isArbitraryWeight(classPart: string): boolean
524
+ isArbitraryShadow(classPart: string): boolean
291
525
  isAny(classPart: string): boolean
292
526
  }
293
527
  ```
@@ -300,10 +534,16 @@ const paddingClassGroup = [{ p: [validators.isLength] }]
300
534
 
301
535
  A brief summary for each validator:
302
536
 
303
- - `isLength` checks whether a class part is a number (`3`, `1.5`), a fraction (`3/4`), a custom length (`[3%]`, `[4px]`, `[length:var(--my-var)]`), or one of the strings `px`, `full` or `screen`.
304
- - `isCustomLength` checks for custom length values (`[3%]`, `[4px]`, `[length:var(--my-var)]`).
305
- - `isInteger` checks for integer values (`3`) and custom integer values (`[3]`).
306
- - `isCustomValue` checks whether the class part is enclosed in brackets (`[something]`)
537
+ - `isLength` checks whether a class part is a number (`3`, `1.5`), a fraction (`3/4`), a arbitrary length (`[3%]`, `[4px]`, `[length:var(--my-var)]`), or one of the strings `px`, `full` or `screen`.
538
+ - `isArbitraryLength` checks for arbitrary length values (`[3%]`, `[4px]`, `[length:var(--my-var)]`).
539
+ - `isInteger` checks for integer values (`3`) and arbitrary integer values (`[3]`).
540
+ - `isArbitraryValue` checks whether the class part is enclosed in brackets (`[something]`)
541
+ - `isTshirtSize`checks whether class part is a T-shirt size (`sm`, `xl`), optionally with a preceding number (`2xl`).
542
+ - `isArbitrarySize` checks whether class part is arbitrary value which starts with with `size:` (`[size:200px_100px]`) which is necessary for background-size classNames.
543
+ - `isArbitraryPosition` checks whether class part is arbitrary value which starts with with `position:` (`[position:200px_100px]`) which is necessary for background-position classNames.
544
+ - `isArbitraryUrl` checks whether class part is arbitrary value which starts with `url:` or `url(` (`[url('/path-to-image.png')]`, `url:var(--maybe-a-url-at-runtime)]`) which is necessary for background-image classNames.
545
+ - `isArbitraryWeight` checks whether class part is arbitrary value whcih starts with `weight:` or is a number (`[weight:var(--value)]`, `[450]`) which is necessary for font-weight classNames.
546
+ - `isArbitraryShadow` checks whether class part is arbitrary value which starts with the same pattern as a shadow value (`[0_35px_60px_-15px_rgba(0,0,0,0.3)]`), namely with two lengths separated by a underscore.
307
547
  - `isAny` always returns true. Be careful with this validator as it might match unwanted classes. I use it primarily to match colors or when I'm ceertain there are no other class groups in a namespace.
308
548
 
309
549
  ### `Config`
@@ -0,0 +1,20 @@
1
+ function _extends() {
2
+ _extends = Object.assign || function (target) {
3
+ for (var i = 1; i < arguments.length; i++) {
4
+ var source = arguments[i];
5
+
6
+ for (var key in source) {
7
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
8
+ target[key] = source[key];
9
+ }
10
+ }
11
+ }
12
+
13
+ return target;
14
+ };
15
+
16
+ return _extends.apply(this, arguments);
17
+ }
18
+
19
+ export { _extends as extends };
20
+ //# sourceMappingURL=_rollupPluginBabelHelpers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_rollupPluginBabelHelpers.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ export { twMerge } from './lib/tailwind-merge';
2
+ export { getDefaultConfig } from './lib/default-config';
3
+ export { extendTailwindMerge } from './lib/extend-tailwind-merge';
4
+ export { createTailwindMerge } from './lib/create-tailwind-merge';
5
+ export type { Config } from './lib/types';
6
+ export * as validators from './lib/validators';
7
+ export { mergeConfigs } from './lib/merge-configs';
8
+ export { fromTheme } from './lib/from-theme';