tailwind-clamp 4.0.6 → 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 +19 -11
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +2 -3
- package/LICENSE +0 -21
- package/README.html +0 -249
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwind-clamp",
|
|
3
|
-
"version": "4.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "4.0.7",
|
|
4
|
+
"description": "Plugin to leverage the the CSS clamp function in your Tailwind CSS project.",
|
|
5
5
|
"main": "dist/index.umd.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"dev": "vite",
|
|
19
19
|
"build": "vite build",
|
|
20
20
|
"build:docs": "vite build --config vite.config.docs.js",
|
|
21
|
-
"build:all": "npm run build && npm run build:docs",
|
|
22
21
|
"preview": "vite preview"
|
|
23
22
|
},
|
|
24
23
|
"repository": {
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Nicolas Cusan
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/README.html
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<title>Tailwind clamp</title>
|
|
6
|
-
<style>
|
|
7
|
-
/* From extension vscode.github */
|
|
8
|
-
/*---------------------------------------------------------------------------------------------
|
|
9
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
11
|
-
*--------------------------------------------------------------------------------------------*/
|
|
12
|
-
|
|
13
|
-
.vscode-dark img[src$=\#gh-light-mode-only],
|
|
14
|
-
.vscode-light img[src$=\#gh-dark-mode-only],
|
|
15
|
-
.vscode-high-contrast:not(.vscode-high-contrast-light) img[src$=\#gh-light-mode-only],
|
|
16
|
-
.vscode-high-contrast-light img[src$=\#gh-dark-mode-only] {
|
|
17
|
-
display: none;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
</style>
|
|
21
|
-
|
|
22
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/markdown.css">
|
|
23
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/highlight.css">
|
|
24
|
-
<style>
|
|
25
|
-
body {
|
|
26
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif;
|
|
27
|
-
font-size: 14px;
|
|
28
|
-
line-height: 1.6;
|
|
29
|
-
}
|
|
30
|
-
</style>
|
|
31
|
-
<style>
|
|
32
|
-
.task-list-item {
|
|
33
|
-
list-style-type: none;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.task-list-item-checkbox {
|
|
37
|
-
margin-left: -20px;
|
|
38
|
-
vertical-align: middle;
|
|
39
|
-
pointer-events: none;
|
|
40
|
-
}
|
|
41
|
-
</style>
|
|
42
|
-
<style>
|
|
43
|
-
:root {
|
|
44
|
-
--color-note: #0969da;
|
|
45
|
-
--color-tip: #1a7f37;
|
|
46
|
-
--color-warning: #9a6700;
|
|
47
|
-
--color-severe: #bc4c00;
|
|
48
|
-
--color-caution: #d1242f;
|
|
49
|
-
--color-important: #8250df;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
</style>
|
|
53
|
-
<style>
|
|
54
|
-
@media (prefers-color-scheme: dark) {
|
|
55
|
-
:root {
|
|
56
|
-
--color-note: #2f81f7;
|
|
57
|
-
--color-tip: #3fb950;
|
|
58
|
-
--color-warning: #d29922;
|
|
59
|
-
--color-severe: #db6d28;
|
|
60
|
-
--color-caution: #f85149;
|
|
61
|
-
--color-important: #a371f7;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
</style>
|
|
66
|
-
<style>
|
|
67
|
-
.markdown-alert {
|
|
68
|
-
padding: 0.5rem 1rem;
|
|
69
|
-
margin-bottom: 16px;
|
|
70
|
-
color: inherit;
|
|
71
|
-
border-left: .25em solid #888;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.markdown-alert>:first-child {
|
|
75
|
-
margin-top: 0
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.markdown-alert>:last-child {
|
|
79
|
-
margin-bottom: 0
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.markdown-alert .markdown-alert-title {
|
|
83
|
-
display: flex;
|
|
84
|
-
font-weight: 500;
|
|
85
|
-
align-items: center;
|
|
86
|
-
line-height: 1
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.markdown-alert .markdown-alert-title .octicon {
|
|
90
|
-
margin-right: 0.5rem;
|
|
91
|
-
display: inline-block;
|
|
92
|
-
overflow: visible !important;
|
|
93
|
-
vertical-align: text-bottom;
|
|
94
|
-
fill: currentColor;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.markdown-alert.markdown-alert-note {
|
|
98
|
-
border-left-color: var(--color-note);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.markdown-alert.markdown-alert-note .markdown-alert-title {
|
|
102
|
-
color: var(--color-note);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.markdown-alert.markdown-alert-important {
|
|
106
|
-
border-left-color: var(--color-important);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.markdown-alert.markdown-alert-important .markdown-alert-title {
|
|
110
|
-
color: var(--color-important);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.markdown-alert.markdown-alert-warning {
|
|
114
|
-
border-left-color: var(--color-warning);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.markdown-alert.markdown-alert-warning .markdown-alert-title {
|
|
118
|
-
color: var(--color-warning);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.markdown-alert.markdown-alert-tip {
|
|
122
|
-
border-left-color: var(--color-tip);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.markdown-alert.markdown-alert-tip .markdown-alert-title {
|
|
126
|
-
color: var(--color-tip);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.markdown-alert.markdown-alert-caution {
|
|
130
|
-
border-left-color: var(--color-caution);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.markdown-alert.markdown-alert-caution .markdown-alert-title {
|
|
134
|
-
color: var(--color-caution);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
</style>
|
|
138
|
-
|
|
139
|
-
</head>
|
|
140
|
-
<body class="vscode-body vscode-light">
|
|
141
|
-
<h1 id="tailwind-clamp">Tailwind clamp</h1>
|
|
142
|
-
<p>Tailwind CSS plugin to use CSS <code>clamp</code> in your project. Enabling fluid interfaces using Tailwind syntax.</p>
|
|
143
|
-
<p>The plugin is based on the formula presented in this <a href="https://chriskirknielsen.com/blog/modern-fluid-typography-with-clamp/">article</a></p>
|
|
144
|
-
<h2 id="features">Features</h2>
|
|
145
|
-
<ul>
|
|
146
|
-
<li>Clamp values between a min and max viewport width, making it grow / shrink with the viewport.</li>
|
|
147
|
-
<li>Possibility to use small to large, large to small, negative to positive, positive to negative and negative to negative values. (Negative values only work on properties that allow them, e.g. <code>margin</code>)</li>
|
|
148
|
-
<li>Supports <code>px</code>, <code>rem</code> and <code>em</code> units.</li>
|
|
149
|
-
<li>Supports <code>text</code> values with multiple properties (<code>fontSize</code>, <code>lineHeight</code>, <code>letterSpacing</code>). If <code>lineHeight</code> is definded as a unitless number or a <code>calc()</code> function, the resulting value is calculated and converted to the <code>fontSize</code> unit.</li>
|
|
150
|
-
<li>Supports using Tailwind CSS theme values, arbitrary values or a combination.</li>
|
|
151
|
-
<li>Supports container queries.</li>
|
|
152
|
-
</ul>
|
|
153
|
-
<h2 id="requirements">Requirements</h2>
|
|
154
|
-
<p>The current version of the plugin is designed to be used with Tailwind version 4. To use it with version 3 use version 3.x.</p>
|
|
155
|
-
<h2 id="installation">Installation</h2>
|
|
156
|
-
<p>Install the plugin from npm:</p>
|
|
157
|
-
<pre><code class="language-sh">npm i tailwind-clamp
|
|
158
|
-
</code></pre>
|
|
159
|
-
<p>Add the plugin in your main CSS file:</p>
|
|
160
|
-
<pre><code class="language-css"><span class="hljs-keyword">@import</span> <span class="hljs-string">'tailwindcss'</span>;
|
|
161
|
-
<span class="hljs-keyword">@plugin</span> <span class="hljs-string">"tailwind-clamp"</span>;
|
|
162
|
-
</code></pre>
|
|
163
|
-
<h3 id="configuration">Configuration</h3>
|
|
164
|
-
<p>The plugin allows two configuration options:</p>
|
|
165
|
-
<table>
|
|
166
|
-
<thead>
|
|
167
|
-
<tr>
|
|
168
|
-
<th>Name</th>
|
|
169
|
-
<th>Type</th>
|
|
170
|
-
<th>Description</th>
|
|
171
|
-
<th>Default value</th>
|
|
172
|
-
</tr>
|
|
173
|
-
</thead>
|
|
174
|
-
<tbody>
|
|
175
|
-
<tr>
|
|
176
|
-
<td><strong><code>minSize</code></strong></td>
|
|
177
|
-
<td><code>{string}</code></td>
|
|
178
|
-
<td>Viewport or container size where the clamp starts.</td>
|
|
179
|
-
<td><code>23.4375rem</code></td>
|
|
180
|
-
</tr>
|
|
181
|
-
<tr>
|
|
182
|
-
<td><strong><code>maxSize</code></strong></td>
|
|
183
|
-
<td><code>{string}</code></td>
|
|
184
|
-
<td>Viewport or container size where the clamp end.</td>
|
|
185
|
-
<td><code>90rem</code></td>
|
|
186
|
-
</tr>
|
|
187
|
-
</tbody>
|
|
188
|
-
</table>
|
|
189
|
-
<p>Value should be a css length (<code>px</code>, <code>rem</code>, <code>em</code>). The unit for both options need to match.</p>
|
|
190
|
-
<pre><code class="language-css"><span class="hljs-keyword">@import</span> <span class="hljs-string">"tailwindcss"</span>;
|
|
191
|
-
<span class="hljs-keyword">@plugin</span> <span class="hljs-string">"tailwind-clamp"</span> {
|
|
192
|
-
minSize: <span class="hljs-number">25rem</span>,
|
|
193
|
-
maxSize: <span class="hljs-number">80rem</span>
|
|
194
|
-
};
|
|
195
|
-
</code></pre>
|
|
196
|
-
<h2 id="usage">Usage</h2>
|
|
197
|
-
<p>The plugin relies on the arbitrary values syntax <code>clamp-[...]</code>. You need to pass at least three arguments separated by commas without whitespace, optionally you can also pass the <code>minSize</code> and the <code>maxSize</code>:</p>
|
|
198
|
-
<pre><code>clamp-[<property>,<start>,<end>,[minSize,maxSize]]
|
|
199
|
-
</code></pre>
|
|
200
|
-
<h3 id="arguments">Arguments</h3>
|
|
201
|
-
<ul>
|
|
202
|
-
<li><strong><code>property</code></strong> Property that the value should be applied to. See a list of all supported properties below.</li>
|
|
203
|
-
<li><strong><code>start</code></strong> Value at <code>minSize</code> viewport size. It can be a key from your Tailwind CSS config file or a a css length (<code>px</code>, <code>rem</code>, <code>em</code>), the unit will need to match <code>end</code>.</li>
|
|
204
|
-
<li><strong><code>end</code></strong> Value at <code>maxSize</code> viewport size. It can be a key from your Tailwind CSS config file or a css length (<code>px</code>, <code>rem</code>, <code>em</code>), the unit will need to match <code>start</code>.</li>
|
|
205
|
-
<li><strong><code>[minSize=23.4375rem]</code></strong> Viewport or container size, where the clamp starts, defaults to <code>23.4375rem</code> (<code>375px</code>). It can be a breakpoint name from your theme or a css length (<code>px</code>, <code>rem</code>, <code>em</code>), the unit will need to match <code>maxSize</code> and be smaller than <code>maxSize</code>.</li>
|
|
206
|
-
<li><strong><code>[maxSize=90rem]</code></strong> Viewport or container size, where the clamp stops, defaults to <code>90rem</code> (<code>1440px</code>). It can be a breakpoint name from your theme or a css length (<code>px</code>, <code>rem</code>, <code>em</code>), the unit will need to match <code>minSize</code> and be be larger than <code>minSize</code>.</li>
|
|
207
|
-
</ul>
|
|
208
|
-
<h3 id="examples">Examples</h3>
|
|
209
|
-
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"clamp-[px,20,40] clamp-[py,10,18]"</span>></span>
|
|
210
|
-
Add some fluid padding here.
|
|
211
|
-
<span class="hljs-tag"></<span class="hljs-name">div</span>></span>
|
|
212
|
-
|
|
213
|
-
<span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"@container"</span>></span>
|
|
214
|
-
<span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"clamp-[text,lg,3xl,@sm,@5xl] clamp-[py,2,4,@29.5rem,@82rem]"</span>></span>
|
|
215
|
-
Add some fluid typography and padding to the content of the container.
|
|
216
|
-
<span class="hljs-tag"></<span class="hljs-name">div</span>></span>
|
|
217
|
-
<span class="hljs-tag"></<span class="hljs-name">div</span>></span>
|
|
218
|
-
</code></pre>
|
|
219
|
-
<h2 id="supported-properties">Supported properties</h2>
|
|
220
|
-
<ul>
|
|
221
|
-
<li><code>p</code> including <code>pt</code>, <code>pb</code>, <code>pl</code>, <code>pr</code>, <code>px</code>, <code>py</code>, <code>ps</code>, <code>pe</code>.</li>
|
|
222
|
-
<li><code>m</code> including <code>mt</code>, <code>mb</code>, <code>ml</code>, <code>mr</code>, <code>mx</code>, <code>my</code>, <code>ms</code>, <code>me</code>.</li>
|
|
223
|
-
<li><code>inset</code> including <code>inset-x</code>, <code>inset-y</code>.</li>
|
|
224
|
-
<li><code>top</code></li>
|
|
225
|
-
<li><code>left</code> and <code>start</code>.</li>
|
|
226
|
-
<li><code>right</code> and <code>end</code>.</li>
|
|
227
|
-
<li><code>bottom</code></li>
|
|
228
|
-
<li><code>text</code> including <code>font-size</code>, <code>line-height</code> and <code>letter-spacing</code> if defined.</li>
|
|
229
|
-
<li><code>gap</code> including <code>gap-x</code>, <code>gap-y</code>.</li>
|
|
230
|
-
<li><code>w</code></li>
|
|
231
|
-
<li><code>h</code></li>
|
|
232
|
-
<li><code>size</code></li>
|
|
233
|
-
<li><code>min-w</code> and <code>min-h</code></li>
|
|
234
|
-
<li><code>max-w</code> and <code>max-h</code></li>
|
|
235
|
-
<li><code>rounded</code> including <code>rounded-s</code>, <code>rounded-ss</code>, <code>rounded-se</code>, <code>rounded-e</code>, <code>rounded-ee</code>, <code>rounded-es</code>, <code>rounded-t</code>, <code>rounded-r</code>, <code>rounded-b</code>, <code>rounded-l</code>, <code>rounded-tl</code>, <code>rounded-tr</code>, <code>rounded-bl</code>, <code>rounded-br</code>.</li>
|
|
236
|
-
<li><code>translate-x</code> and <code>translate-y</code></li>
|
|
237
|
-
<li><code>text-stroke</code></li>
|
|
238
|
-
<li><code>stroke</code></li>
|
|
239
|
-
<li><code>leading</code></li>
|
|
240
|
-
<li><code>tracking</code></li>
|
|
241
|
-
<li><code>border</code> including <code>border-t</code>, <code>border-b</code>, <code>border-l</code>, <code>border-r</code>, <code>border-x</code>, <code>border-y</code>.</li>
|
|
242
|
-
<li><code>scroll-m</code> including <code>scroll-mx</code>, <code>scroll-my</code>, <code>scroll-ms</code>, <code>scroll-me</code>, <code>scroll-mt</code>, <code>scroll-mb</code>, <code>scroll-ml</code>, <code>scroll-mr</code></li>
|
|
243
|
-
<li><code>scroll-p</code> including <code>scroll-px</code>, <code>scroll-py</code>, <code>scroll-ps</code>, <code>scroll-pe</code>, <code>scroll-pt</code>, <code>scroll-pb</code>, <code>scroll-pl</code>, <code>scroll-pr</code></li>
|
|
244
|
-
</ul>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
</body>
|
|
249
|
-
</html>
|