@refineui/tokens 1.0.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 +80 -0
- package/dist/css-variables.css +672 -0
- package/dist/index.d.mts +1049 -0
- package/dist/index.d.ts +1049 -0
- package/dist/index.js +978 -0
- package/dist/index.mjs +921 -0
- package/dist/refineui-typography.css +111 -0
- package/dist/spec/component-sizes.json +485 -0
- package/dist/spec/focus.json +20 -0
- package/dist/spec/foundation.json +90 -0
- package/dist/spec/index.json +25 -0
- package/dist/spec/motion.json +78 -0
- package/dist/spec/semantic-colors.json +1256 -0
- package/dist/spec/semantic-text.json +173 -0
- package/dist/spec/token-graph.json +1194 -0
- package/dist/spec/trace-index.json +830 -0
- package/dist/spec/trace-v2.json +973 -0
- package/dist/tailwind-theme.css +348 -0
- package/package.json +50 -0
- package/tailwind.css +4 -0
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# @refineui/tokens
|
|
2
|
+
|
|
3
|
+
Design tokens for RefineUI — TypeScript source of truth plus generated CSS.
|
|
4
|
+
|
|
5
|
+
## Install / build
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun run build # or pnpm build — builds utilities → tokens → react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`@refineui/tokens` `build` runs `tsup` then `scripts/generate-css.mjs` and `scripts/generate-spec.mjs`, writing:
|
|
12
|
+
|
|
13
|
+
| File | Contents |
|
|
14
|
+
|------|----------|
|
|
15
|
+
| `dist/css-variables.css` | `:root` + dark semantic colors, motion, theme elevation, foundation sizes, focus ring, reduced-motion overrides |
|
|
16
|
+
| `dist/tailwind-theme.css` | Tailwind v4 `@theme` |
|
|
17
|
+
| `dist/refineui-typography.css` | `@utility refineui-typo-*` |
|
|
18
|
+
| `dist/spec/*.json` | Machine-readable token spec for Docs / MCP / Doctor |
|
|
19
|
+
|
|
20
|
+
`@refineui/react` build appends component recipes spec to `dist/spec/`.
|
|
21
|
+
|
|
22
|
+
## Layers
|
|
23
|
+
|
|
24
|
+
1. **Primitive / Foundation** (`src/global`) — palette, spacing, radius, shadows, foundation sizes, opacities, icon sizes, **`typographys`**, **`motion`** (raw duration / easing / scale / distance steps)
|
|
25
|
+
2. **Semantic** (`src/semantic`) — color aliases, **`semanticInteraction`** (motion roles → Foundation steps), elevation pairs, **`SEMANTIC_TEXT`** (bodyMd, labelSm, … → Foundation keys)
|
|
26
|
+
3. **Component** — colors/sizes/typography/state role maps in `@refineui/react` (`componentColorTokens`, `componentTypographyTokens`)
|
|
27
|
+
4. **Recipe** — `packages/react/src/recipes/` (base, variants, compoundVariants; slot recipes for Alert/Dialog/…)
|
|
28
|
+
5. **Interaction** — `refineui.css` + `data-state` contract
|
|
29
|
+
|
|
30
|
+
### Motion flow
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
motion.duration.duration150 (Foundation)
|
|
34
|
+
→ semanticInteraction.duration.fast (semantic role)
|
|
35
|
+
→ --refineui-foundation-motion-duration-150
|
|
36
|
+
→ --refineui-motion-duration-fast: var(--refineui-foundation-motion-duration-150)
|
|
37
|
+
|
|
38
|
+
motion.scale.scale98
|
|
39
|
+
→ semanticInteraction.scale.press (+ alias buttonActive)
|
|
40
|
+
→ --refineui-motion-scale-press
|
|
41
|
+
→ --refineui-motion-button-active-scale: var(--refineui-motion-scale-press)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Prefer semantic role CSS vars (`--refineui-motion-duration-fast`, `--refineui-motion-scale-press`) in components.
|
|
45
|
+
|
|
46
|
+
### Typography flow
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
typographys.body2 (Foundation)
|
|
50
|
+
→ SEMANTIC_TEXT.bodyMd (semantic role)
|
|
51
|
+
→ componentTypographyTokens.formControl.md (Web Kit)
|
|
52
|
+
→ semanticTextClass('bodyMd') → refineui-typo-body-2 (CSS utility)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
CSS also emits semantic aliases: `--refineui-text-body-md-font-size` → `--refineui-typography-body-2-font-size`.
|
|
56
|
+
|
|
57
|
+
## Theme
|
|
58
|
+
|
|
59
|
+
- Semantic colors and bare elevations (`--refineui-elevation-8`, `shadow-refineui-8`) switch under `[data-theme="dark"]` / `.dark`
|
|
60
|
+
- Explicit `*light` / `*dark` elevations remain available when you need a fixed mode
|
|
61
|
+
|
|
62
|
+
## Consumption
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import {
|
|
66
|
+
foundationSizes,
|
|
67
|
+
motion,
|
|
68
|
+
opacities,
|
|
69
|
+
semanticColors,
|
|
70
|
+
semanticInteraction,
|
|
71
|
+
spacings,
|
|
72
|
+
} from "@refineui/tokens";
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```css
|
|
76
|
+
@import "@refineui/tokens/css-variables.css";
|
|
77
|
+
@import "@refineui/tokens/tailwind.css";
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Spacing uses `sizeNone` … `sizeXXXLarge` (2→4→6→8→10… after the scale shift). 8px is `sizeSmall`.
|