@andreibratila/tailwind-utopia
Version:
A Tailwindcss v4 library for fluid typography and spacing with Utopia
20 lines (18 loc) • 524 B
JavaScript
// Generate all possible pairs from the given array (including reverse pairs)
export function pair(array) {
return array
.map((v, i) =>
array.slice(i + 1).map((w) => [
[v, w],
[w, v],
])
)
.flat(2);
}
export function calcValue(min, max) {
return typeof min === "number" && typeof max === "number"
? `calc(${(min / 16).toFixed(2)}rem + ${(max - min).toFixed(
2
)} * var(--fluid-bp))`
: `calc(((${min} / 16) * 1rem) + (${max} - ${min}) * var(--fluid-bp))`;
}