@uncinq/design-tokens 1.7.3 → 1.8.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.
- package/README.md +52 -441
- package/dist/tokens.json +4629 -0
- package/docs/_index.md +119 -0
- package/docs/colors.md +218 -0
- package/docs/customizing.md +77 -0
- package/docs/dark-mode.md +96 -0
- package/docs/dtcg.md +231 -0
- package/docs/naming.md +127 -0
- package/docs/reference.md +128 -0
- package/docs/style-dictionary.md +181 -0
- package/docs/utopia.md +54 -0
- package/package.json +3 -1
package/docs/utopia.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
isIndex: false
|
|
3
|
+
title: Fluid scales
|
|
4
|
+
description: The Utopia method behind the fluid font-size and spacing tokens, and when to reach for them.
|
|
5
|
+
weight: 8
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Source: <https://utopia.fyi>
|
|
10
|
+
|
|
11
|
+
## Principle
|
|
12
|
+
|
|
13
|
+
Each fluid token is a `clamp()` expression that scales linearly between a minimum and a maximum value, with no breakpoints.
|
|
14
|
+
|
|
15
|
+
```css
|
|
16
|
+
property: clamp(min, intercept + slope × 1vw, max);
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
slope = (max_px − min_px) / (viewport_max − viewport_min)
|
|
21
|
+
intercept = min_px − slope × viewport_min (÷ 16 → rem)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Viewport range
|
|
27
|
+
|
|
28
|
+
All fluid tokens use the same viewport range: **375 px → 1440 px** (range = 1065).
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
slope = (max_px − min_px) / 1065
|
|
32
|
+
intercept = min_px − slope × 375 (÷ 16 → rem)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This range covers modern phones (375 px) to wide desktop screens (1440 px). Tokens are clamped at both ends — below 375 px they stay at `min`, above 1440 px they stay at `max`.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
- **Fluid** (`--spacing-fluid-*`, `--font-size-fluid-*`) for layout and headings, anything that should breathe across screen sizes.
|
|
42
|
+
- **Fixed** (`--spacing-*`, `--font-size-*`) for UI components where continuous scaling would break the layout: badges, labels, icons, internal gaps.
|
|
43
|
+
|
|
44
|
+
The rule of thumb is whether the element has room to grow. A heading in a page flow does. A badge sitting inside a button does not, and scaling it continuously leaves it visually unrelated to the text it labels at one end of the range or the other.
|
|
45
|
+
|
|
46
|
+
## Worked example
|
|
47
|
+
|
|
48
|
+
`--font-size-fluid-2xs` is declared as:
|
|
49
|
+
|
|
50
|
+
```css
|
|
51
|
+
clamp(0.625rem, 0.5810rem + 0.1878vw, 0.75rem)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
It reads as: never smaller than `0.625rem` (10px), never larger than `0.75rem` (12px), and in between it grows linearly with the viewport. At 375px wide the middle term evaluates to the minimum, at 1440px to the maximum, which is what ties every fluid token in the package to the same two anchor widths.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uncinq/design-tokens",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Framework-agnostic design tokens — JSON DTCG primitive and semantic — CSS custom properties.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
],
|
|
23
23
|
"files": [
|
|
24
24
|
"dist/css/",
|
|
25
|
+
"dist/tokens.json",
|
|
26
|
+
"docs/",
|
|
25
27
|
"tokens/"
|
|
26
28
|
],
|
|
27
29
|
"exports": {
|