tailwind-clamp 4.0.5 → 4.0.7

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.
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # Tailwind clamp
1
+ # [Tailwind clamp 🗜️](https://nicolas-cusan.github.io/tailwind-clamp/)
2
2
 
3
- Tailwind CSS plugin to use CSS `clamp` in your project. Enabling fluid interfaces using Tailwind syntax.
4
-
5
- The plugin is based on the formula presented in this [article](https://chriskirknielsen.com/blog/modern-fluid-typography-with-clamp/)
3
+ Leverage the the CSS `clamp` function in your [Tailwind CSS](https://tailwindcss.com/) project.
6
4
 
7
5
  ## Features
8
6
 
@@ -11,6 +9,7 @@ The plugin is based on the formula presented in this [article](https://chriskirk
11
9
  - Supports `px`, `rem` and `em` units.
12
10
  - Supports `text` values with multiple properties (`fontSize`, `lineHeight`, `letterSpacing`). If `lineHeight` is definded as a unitless number or a `calc()` function, the resulting value is calculated and converted to the `fontSize` unit.
13
11
  - Supports using Tailwind CSS theme values, arbitrary values or a combination.
12
+ - Supports container queries.
14
13
 
15
14
  ## Requirements
16
15
 
@@ -27,7 +26,7 @@ npm i tailwind-clamp
27
26
  Add the plugin in your main CSS file:
28
27
 
29
28
  ```css
30
- @import 'tailwindcss';
29
+ @import "tailwindcss";
31
30
  @plugin "tailwind-clamp";
32
31
  ```
33
32
 
@@ -35,36 +34,36 @@ Add the plugin in your main CSS file:
35
34
 
36
35
  The plugin allows two configuration options:
37
36
 
38
- | Name | Type | Description | Default value |
39
- | ---------------------- | ---------- | ------------------------------------- | ------------- |
40
- | **`minViewportWidth`** | `{string}` | Viewport size where the clamp starts. | `23.4375rem` |
41
- | **`maxViewportWidth`** | `{string}` | Viewport size where the clamp end. | `90rem` |
37
+ | Name | Type | Description | Default value |
38
+ | ------------- | ---------- | ------------------------------------- | ------------- |
39
+ | **`minSize`** | `{string}` | Viewport size where the clamp starts. | `23.4375rem` |
40
+ | **`maxSize`** | `{string}` | Viewport size where the clamp end. | `90rem` |
42
41
 
43
42
  Value should be a css length (`px`, `rem`, `em`). The unit for both options need to match.
44
43
 
45
44
  ```css
46
45
  @import "tailwindcss";
47
46
  @plugin "tailwind-clamp" {
48
- minViewportWidth: 25rem,
49
- maxViewportWidth: 80rem
47
+ minSize: 25rem,
48
+ maxSize: 80rem
50
49
  };
51
50
  ```
52
51
 
53
52
  ## Usage
54
53
 
55
- The plugin relies on the arbitrary values syntax `clamp-[...]`. You need to pass at least three arguments separated by commas without whitespace, optionally you can also pass the `minViewportWidth` and the `maxViewportWidth`:
54
+ The plugin relies on the arbitrary values syntax `clamp-[...]`. You need to pass at least three arguments separated by commas without whitespace, optionally you can also pass the `minSize` and the `maxSize`:
56
55
 
57
56
  ```
58
- clamp-[<property>,<start>,<end>,[minViewportWidth,maxViewportWidth]]
57
+ clamp-[<property>,<start>,<end>,[minSize,maxSize]]
59
58
  ```
60
59
 
61
60
  ### Arguments
62
61
 
63
- - `property`: Property that the value should be applied to. See a list of all supported properties below.
64
- - `start`: Value at `minViewportWidth` viewport size. It can be a key from your Tailwind CSS config file or a a css length (`px`, `rem`, `em`), the unit will need to match `end`.
65
- - `end`: Value at `maxViewportWidth` viewport size. It can be a key from your Tailwind CSS config file or a css length (`px`, `rem`, `em`), the unit will need to match `start`.
66
- - `[minViewportWidth=23.4375rem]`: Viewport size, where the clamp starts, defaults to `23.4375rem` (`375px`). It can be a breakpoint name from your theme or a css length (`px`, `rem`, `em`), the unit will need to match `maxViewportWidth` and be smaller than `maxViewportWidth`.
67
- - `[maxViewportWidth=90rem]`: Viewport size, where the clamp stops, defaults to `90rem` (`1440px`). It can be a breakpoint name from your theme or a css length (`px`, `rem`, `em`), the unit will need to match `minViewportWidth` and be be larger than `minViewportWidth`.
62
+ - **`property`** Property that the value should be applied to. See a list of all supported properties below.
63
+ - **`start`** Value at `minSize` viewport size. It can be a key from your Tailwind CSS config file or a a css length (`px`, `rem`, `em`), the unit will need to match `end`.
64
+ - **`end`** Value at `maxSize` viewport size. It can be a key from your Tailwind CSS config file or a css length (`px`, `rem`, `em`), the unit will need to match `start`.
65
+ - **`[minSize=23.4375rem]`** Viewport or container size, where the clamp starts, defaults to `23.4375rem` (`375px`). It can be a breakpoint or container size name from your theme or a css length (`px`, `rem`, `em`). Container size names _and values_ are prefixed with `@`. The unit will need to match `maxSize` and be smaller than `maxSize`.
66
+ - **`[maxSize=90rem]`** Viewport or container size, where the clamp stops, defaults to `90rem` (`1440px`). It can be a breakpoint or container size name from your theme or a css length (`px`, `rem`, `em`). Container size names _and values_ are prefixed with `@`. The unit will need to match `minSize` and be be larger than `minSize`.
68
67
 
69
68
  ### Examples
70
69
 
@@ -72,6 +71,12 @@ clamp-[<property>,<start>,<end>,[minViewportWidth,maxViewportWidth]]
72
71
  <div class="clamp-[px,20,40] clamp-[py,10,18]">
73
72
  Add some fluid padding here.
74
73
  </div>
74
+
75
+ <div class="@container">
76
+ <div class="clamp-[text,lg,3xl,@sm,@5xl] clamp-[py,2,4,@29.5rem,@82rem]">
77
+ Add some fluid typography and padding to the content of the container.
78
+ </div>
79
+ </div>
75
80
  ```
76
81
 
77
82
  ## Supported properties
@@ -97,8 +102,15 @@ clamp-[<property>,<start>,<end>,[minViewportWidth,maxViewportWidth]]
97
102
  - `leading`
98
103
  - `tracking`
99
104
  - `border` including `border-t`, `border-b`, `border-l`, `border-r`, `border-x`, `border-y`.
100
- - `scroll-m`
105
+ - `scroll-m` including `scroll-mx`, `scroll-my`, `scroll-ms`, `scroll-me`, `scroll-mt`, `scroll-mb`, `scroll-ml`, `scroll-mr`
106
+ - `scroll-p` including `scroll-px`, `scroll-py`, `scroll-ps`, `scroll-pe`, `scroll-pt`, `scroll-pb`, `scroll-pl`, `scroll-pr`
107
+
108
+ ## Credits & mentions
109
+
110
+ The plugin is based on the formula presented in this [article](https://chriskirknielsen.com/blog/modern-fluid-typography-with-clamp/).
111
+
112
+ See also [fluid.tw](https://fluid.tw/) by [Max Barvian](https://barvian.me/).
101
113
 
102
- ## Roadmap
114
+ ## License
103
115
 
104
- - Add showcase
116
+ MIT