@weasel-js/theme 1.5.2 → 1.6.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 +39 -1
- package/dist/{chunk-XFCWYN2L.js → chunk-6R3FTRRJ.js} +914 -60
- package/dist/chunk-6R3FTRRJ.js.map +1 -0
- package/dist/chunk-GI7ZAXIB.js +12 -0
- package/dist/chunk-GI7ZAXIB.js.map +1 -0
- package/dist/chunk-QKRFHBRB.js +557 -0
- package/dist/chunk-QKRFHBRB.js.map +1 -0
- package/dist/colorMode-CoklZomJ.d.ts +12 -0
- package/dist/engine.d.ts +76 -8
- package/dist/engine.js +180 -424
- package/dist/engine.js.map +1 -1
- package/dist/faces.css +19 -0
- package/dist/fonts.css +4 -18
- package/dist/index.d.ts +49 -5
- package/dist/index.js +172 -20
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +50 -6
- package/dist/react.js +68 -6
- package/dist/react.js.map +1 -1
- package/dist/{resolveTheme-CF8i5IHy.d.ts → themes-bTfTZjCh.d.ts} +598 -65
- package/dist/tokens.css +103 -1
- package/fonts/README.md +5 -6
- package/package.json +4 -3
- package/dist/chunk-LL2ERJPZ.js +0 -175
- package/dist/chunk-LL2ERJPZ.js.map +0 -1
- package/dist/chunk-PJMTWM34.js +0 -6
- package/dist/chunk-PJMTWM34.js.map +0 -1
- package/dist/chunk-XFCWYN2L.js.map +0 -1
- package/dist/theme-DAZcQi_L.d.ts +0 -191
package/README.md
CHANGED
|
@@ -23,7 +23,8 @@ import '@weasel-js/theme/fonts.css'; // optional — bundled Oswald + Inter
|
|
|
23
23
|
|
|
24
24
|
`tokens.css` is required; component styles reference the custom properties it
|
|
25
25
|
declares. `fonts.css` is optional — skip it and the token font stacks fall back
|
|
26
|
-
to `system-ui`.
|
|
26
|
+
to `system-ui`. It sets `:root`'s font as well as declaring the faces; import
|
|
27
|
+
`@weasel-js/theme/faces.css` instead for the `@font-face` rules alone. Nothing is fetched from a third-party host either way.
|
|
27
28
|
|
|
28
29
|
Modes are selected with a data attribute, which cascades:
|
|
29
30
|
|
|
@@ -88,6 +89,43 @@ const { tokens, provenance, issues } = derive(slate, { mode: 'light' });
|
|
|
88
89
|
const theme: Theme = { ...bake(slate), extends: weaselTheme };
|
|
89
90
|
```
|
|
90
91
|
|
|
92
|
+
### Axes in DTCG
|
|
93
|
+
|
|
94
|
+
DTCG has one variant dimension, so a document from `toDTCG` holds mode in
|
|
95
|
+
`modes` and every other axis at its default value. That part is plain DTCG: a
|
|
96
|
+
tool that ignores extensions reads a theme at `density=comfortable` (or whatever
|
|
97
|
+
each axis defaults to). The other values ride in the root's
|
|
98
|
+
`$extensions["com.weasel.axes"]`, which `loadDTCG` reads back:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
"$extensions": {
|
|
102
|
+
"com.weasel.axes": {
|
|
103
|
+
"axes": { "mode": { … }, "density": { "default": "comfortable", "values": { "compact": {}, "comfortable": {}, "roomy": {} } } },
|
|
104
|
+
"varies": { "gap": ["density"] },
|
|
105
|
+
"overrides": {
|
|
106
|
+
"density=compact": { "primitives": { "dimension": { "$type": "dimension", "gap": { "$value": "2px" } } }, "modes": {} },
|
|
107
|
+
"density=roomy": { "primitives": { "dimension": { "$type": "dimension", "gap": { "$value": "8px" } } }, "modes": {} }
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
- `axes` — every axis the theme resolves with, mode included.
|
|
114
|
+
- `varies` — for each token that depends on an axis besides mode, which ones.
|
|
115
|
+
- `overrides` — a layer shaped like the document (`primitives` and `modes`) for
|
|
116
|
+
each combination of non-default values some token varies by. The key names
|
|
117
|
+
only the axes off their default, in axis order: `density=compact`,
|
|
118
|
+
`density=roomy,contrast=high`.
|
|
119
|
+
|
|
120
|
+
A token listed in `varies` takes its value at a selection from the layer whose
|
|
121
|
+
key matches that selection's non-default values on its own axes — the plain
|
|
122
|
+
groups when all are at default. Absent from that layer, it has no value there
|
|
123
|
+
and falls through to the theme it extends. Axes a token varies by
|
|
124
|
+
independently cost one layer per value; only a token whose value depends on two
|
|
125
|
+
axes at once adds layers for their combinations. This follows the same idea as
|
|
126
|
+
the DTCG resolver module's modifiers and Tokens Studio's theme groups: a base
|
|
127
|
+
set plus per-dimension overrides rather than one mode per combination.
|
|
128
|
+
|
|
91
129
|
## Editing tokens
|
|
92
130
|
|
|
93
131
|
`src/generated/` is generated — never edit it. Change `themes/weasel.json`,
|