@rowkit/tokens 0.4.0 → 1.0.0-beta.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 +74 -12
- package/dist/color.d.ts +249 -493
- package/dist/css.d.ts +16 -4
- package/dist/index.d.ts +383 -352
- package/dist/index.js +90 -409
- package/dist/index.js.map +1 -1
- package/dist/radius.d.ts +21 -17
- package/dist/reference.d.ts +20 -0
- package/dist/reference.data.d.ts +2 -0
- package/dist/reference.js +403 -0
- package/dist/reference.js.map +1 -0
- package/dist/shadow.d.ts +76 -20
- package/dist/size.d.ts +194 -0
- package/dist/style.d.ts +129 -0
- package/dist/themes/index.d.ts +69 -0
- package/dist/themes/modern.d.ts +139 -0
- package/dist/themes-B0J8E0xq.js +1022 -0
- package/dist/themes-B0J8E0xq.js.map +1 -0
- package/dist/tokens.css +1268 -232
- package/dist/typography.d.ts +69 -46
- package/package.json +7 -3
- package/dist/blur.d.ts +0 -18
- package/dist/reference.html +0 -1275
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# @rowkit/tokens
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@rowkit/tokens)
|
|
4
4
|
[](https://github.com/NikolaiKushner/rowkit/blob/main/LICENSE)
|
|
5
5
|
|
|
6
|
-
The design tokens behind [rowkit](https://www.npmjs.com/package/rowkit) — colour,
|
|
6
|
+
The design tokens behind [rowkit](https://www.npmjs.com/package/rowkit) — colour, shadows, sizes, corners, type, layers and motion for its two themes: **Windows 98**, the default, and **modern**, in light and dark. Plus `defineTheme()`, to make a theme of your own (with rowkit installed, import it from `rowkit/theme` — the same function, matched to the components).
|
|
7
7
|
|
|
8
8
|
Usable on its own. Nothing here depends on Vue, so a chart library, a design tool or an email template can read the same values the components use.
|
|
9
9
|
|
|
@@ -12,14 +12,14 @@ Usable on its own. Nothing here depends on Vue, so a chart library, a design too
|
|
|
12
12
|
## Install
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npm i @rowkit/tokens
|
|
15
|
+
npm i @rowkit/tokens@beta
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Two layers
|
|
19
19
|
|
|
20
|
-
**Primitives** are the raw
|
|
20
|
+
**Primitives** are the raw palette — the VGA colours and Windows 98's system colours: `--color-vga-navy` is one specific blue and means nothing on its own. **Semantic** tokens name a role — `--color-card`, `--color-muted-foreground`, `--color-border` — and point at a primitive through `var()`.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Rebranding is a matter of repointing semantic references rather than hunting hex codes. The modern theme has a palette of its own (`--color-modern-*`) and points the same semantic names at it, once for light and once for dark.
|
|
23
23
|
|
|
24
24
|
## Use
|
|
25
25
|
|
|
@@ -30,7 +30,13 @@ As a Tailwind v4 theme:
|
|
|
30
30
|
@import '@rowkit/tokens/css';
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Every token becomes a theme value, so `bg-card`, `text-
|
|
33
|
+
Every token becomes a theme value, so `bg-card`, `text-ui`, `p-4` and `shadow-raised` resolve to the scales above. The stylesheet also carries both themes. Pick one with an attribute on any element; themes nest:
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<html data-theme="modern" data-color-scheme="dark"></html>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Without `data-theme` a page is Windows 98. Without `data-color-scheme` the modern theme follows the system's light or dark setting.
|
|
34
40
|
|
|
35
41
|
As CSS custom properties, for anything Tailwind does not cover:
|
|
36
42
|
|
|
@@ -46,18 +52,74 @@ Or in TypeScript, fully typed, when a value has to reach JavaScript:
|
|
|
46
52
|
```ts
|
|
47
53
|
import { tokens } from '@rowkit/tokens'
|
|
48
54
|
|
|
49
|
-
tokens.color.
|
|
55
|
+
tokens.color.vga.silver // '#c0c0c0' — the face of every window
|
|
56
|
+
|
|
57
|
+
const series = [tokens.color.vga.navy, tokens.color.vga.green, tokens.color.vga.maroon]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`tokens` is grouped by scale rather than flattened, so `tokens.color.vga.navy` narrows to its literal type and autocompletes at every level. The scales are Windows 98's values.
|
|
61
|
+
|
|
62
|
+
## Themes as data
|
|
63
|
+
|
|
64
|
+
`tokens.themes` has each theme as the CSS variables it declares — every value a theme may set, by name:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { tokens } from '@rowkit/tokens'
|
|
68
|
+
|
|
69
|
+
tokens.themes.win98['--spacing-control-md'] // '28px'
|
|
70
|
+
tokens.themes.modern.light['--spacing-control-md'] // '32px'
|
|
71
|
+
tokens.themes.modern.dark // only what the dark scheme changes
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## A theme of your own
|
|
50
75
|
|
|
51
|
-
|
|
76
|
+
`defineTheme()` starts from `modern` (the default) or `win98`, lays your values over it and returns the stylesheet — every variable declared, and for a theme with a dark scheme, the dark rules too, following the system unless `data-color-scheme` fixes it. A token name rowkit does not have throws, so a typo fails the build.
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { defineTheme } from '@rowkit/tokens'
|
|
80
|
+
|
|
81
|
+
export const acme = defineTheme({
|
|
82
|
+
name: 'acme', // <html data-theme="acme">
|
|
83
|
+
extends: 'modern',
|
|
84
|
+
light: { '--color-control-primary': '#5b3df5', '--radius-md': '10px' },
|
|
85
|
+
dark: { '--color-control-primary': '#7c66ff' },
|
|
86
|
+
})
|
|
52
87
|
```
|
|
53
88
|
|
|
54
|
-
`
|
|
89
|
+
Write the string to a file imported after `rowkit/styles`, or into a `<style>` element at start-up. `themeRule(selector, scheme, values)` writes one rule, if you would rather assemble the stylesheet yourself:
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { themeRule, tokens } from '@rowkit/tokens'
|
|
93
|
+
|
|
94
|
+
themeRule('.print', 'light', { ...tokens.themes.win98, '--color-background': '#ffffff' })
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The whole guide, with a live builder: [Themes](https://rowkit.dev/foundations/themes).
|
|
98
|
+
|
|
99
|
+
## Reference
|
|
100
|
+
|
|
101
|
+
`@rowkit/tokens/reference` describes every token a theme sets: what it is for, which components read it, and its value in Windows 98 and in modern light and dark. A separate entry point, so the main one stays small.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { tokenReference } from '@rowkit/tokens/reference'
|
|
105
|
+
|
|
106
|
+
tokenReference.find((t) => t.name === '--color-control-primary')
|
|
107
|
+
// { name, group: 'color', description: '…', components: ['Button'], values: { win98, modernLight, modernDark } }
|
|
108
|
+
```
|
|
55
109
|
|
|
56
110
|
## Notes on the values
|
|
57
111
|
|
|
58
|
-
**
|
|
112
|
+
**Windows 98's colour is the exact Windows 98 palette.** Primitives are `#rrggbb` values from the VGA palette and the default Windows 98 scheme, named as in the design's Figma variables. The modern palette follows the designer's Figma file.
|
|
113
|
+
|
|
114
|
+
**Depth: bevels in Windows 98, soft shadows in modern.** In Windows 98, `shadow-raised`, `shadow-sunken`, `shadow-window` and the rest are hard inset lines in the four `bevel-*` colours. The modern theme sets the same names to soft shadows outside the box and hairline edges.
|
|
115
|
+
|
|
116
|
+
**Corners: square in Windows 98, rounded in modern.** In Windows 98 the radius scale multiplies `--radius`, which is `0rem` until you set it. The modern theme sets each step as a length: 7px for a button or a field, 12px for a window.
|
|
117
|
+
|
|
118
|
+
**Type: PT Sans and VT323 in Windows 98, the system's faces in modern.** Both set the interface at 13px (`text-ui`) — in Windows 98, its 8pt at Large Fonts. Windows 98 has two weights, regular and bold; modern's emphasis (`--font-weight-strong`) is semibold. The font files are not shipped: for Windows 98, load `@fontsource/pt-sans` and `@fontsource/vt323` in the app. The modern theme loads nothing.
|
|
119
|
+
|
|
120
|
+
**Motion: next to none in Windows 98, short in modern.** Windows 98 changes state at once; the modern theme uses transitions of 120–160ms.
|
|
59
121
|
|
|
60
|
-
**Contrast is asserted, not claimed.** Every semantic pairing is checked against WCAG AA in the package's own tests
|
|
122
|
+
**Contrast is asserted, not claimed.** Every semantic text pairing is checked against WCAG AA, and every control boundary and focus ring against 3:1, in every theme and scheme, in the package's own tests.
|
|
61
123
|
|
|
62
124
|
**Spacing keys are multiples of 4px.** `4` is 1rem, `2` is 8px — the convention most Vue and Tailwind developers already carry.
|
|
63
125
|
|
|
@@ -67,4 +129,4 @@ const series = [tokens.color.primary[500], tokens.color.success[500]]
|
|
|
67
129
|
|
|
68
130
|
MIT © Nikolai Kushner
|
|
69
131
|
|
|
70
|
-
|
|
132
|
+
The Windows 98 theme is a tribute to Windows 98. rowkit is not affiliated with or endorsed by Microsoft.
|