tailwind-clamp 4.3.0 → 4.3.1

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
@@ -10,6 +10,8 @@ Leverage the the CSS `clamp` function in your [Tailwind CSS](https://tailwindcss
10
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.
11
11
  - Supports using Tailwind CSS theme values, arbitrary values or a combination.
12
12
  - Supports container queries.
13
+ - Supports CSS custom properties (`--*`) as the target property, to store `clamp()` values in variables for reuse.
14
+ - Supports defining clamped theme variables via `@theme { --clamp-*: start, end; }`.
13
15
 
14
16
  ## Requirements
15
17
 
@@ -97,7 +99,8 @@ You can use CSS custom properties (`--*`) as the target property to store a `cla
97
99
  clamp-[--variable-name,start,end]
98
100
  ```
99
101
 
100
- Only explicit CSS lengths (`px`, `rem`, `em`) are accepted as values — theme tokens and unitless numbers are not supported for custom properties.
102
+ > [!NOTE]
103
+ > Only explicit CSS lengths (`px`, `rem`, `em`) are accepted as values — theme tokens and unitless numbers are not supported for custom properties.
101
104
 
102
105
  #### Example
103
106
 
@@ -164,7 +167,8 @@ Or in custom CSS:
164
167
  }
165
168
  ```
166
169
 
167
- Only explicit CSS lengths (`px`, `rem`, `em`) are accepted — unitless numbers and theme tokens are not supported in theme variable definitions.
170
+ > [!NOTE]
171
+ > Only explicit CSS lengths (`px`, `rem`, `em`) are accepted — unitless numbers and theme tokens are not supported in theme variable definitions.
168
172
 
169
173
  ## Supported properties
170
174
 
package/dist/index.js CHANGED
@@ -2214,6 +2214,7 @@ const or = (t) => /^-?\d*\.?\d+(px|rem|em)$/.test(t.trim()) || t.trim() === "0",
2214
2214
  return function({ matchUtilities: n, addBase: r, theme: o, config: i }) {
2215
2215
  const s = o("clamp") || {}, u = {}, c = {};
2216
2216
  for (const [p, l] of Object.entries(s)) {
2217
+ if (typeof l != "string") continue;
2217
2218
  const v = l.split(",")[0];
2218
2219
  or(v) ? c[p] = l : u[p] = l;
2219
2220
  }
@@ -2301,7 +2302,11 @@ const or = (t) => /^-?\d*\.?\d+(px|rem|em)$/.test(t.trim()) || t.trim() === "0",
2301
2302
  }
2302
2303
  }), fe;
2303
2304
  }
2304
- let Oe = L(x && ((Ge = i().theme[x]) == null ? void 0 : Ge[l[1]]) || l[1]), Te = L(x && ((Je = i().theme[x]) == null ? void 0 : Je[l[2]]) || l[2]);
2305
+ let Oe = L(
2306
+ x && ((Ge = i().theme[x]) == null ? void 0 : Ge[l[1]]) || l[1]
2307
+ ), Te = L(
2308
+ x && ((Je = i().theme[x]) == null ? void 0 : Je[l[2]]) || l[2]
2309
+ );
2305
2310
  if (ye === "spacing") {
2306
2311
  const S = L(
2307
2312
  typeof o("spacing") == "string" ? o("spacing") : o("spacing.1")