@zooui/theme-forest 0.0.0-stage → 0.1.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/LICENSE +26 -0
- package/README.md +187 -2
- package/app.config.ts +111 -0
- package/assets/css/forest.css +7 -0
- package/assets/css/theme.css +173 -0
- package/design/ADOPTING.md +114 -0
- package/design/CHANGELOG.md +1 -0
- package/design/RECIPES.md +233 -0
- package/design/SKILL.md +10 -0
- package/design/components.css +211 -0
- package/design/index-ember.html +282 -0
- package/design/index-graphite-violet.html +282 -0
- package/design/index-ink-indigo-authored.html +265 -0
- package/design/index-ink-indigo.html +282 -0
- package/design/index-paper-olive.html +282 -0
- package/design/index-slate-cobalt.html +282 -0
- package/design/index.html +281 -0
- package/design/readme.md +168 -0
- package/design/styles.css +16 -0
- package/design/tailwind.css +177 -0
- package/design/tokens.css +321 -0
- package/nuxt.config.ts +22 -0
- package/package.json +44 -3
- package/schemes/ember.css +55 -0
- package/schemes/graphite-violet.css +50 -0
- package/schemes/ink-indigo.css +50 -0
- package/schemes/paper-olive.css +50 -0
- package/schemes/ramps.css +42 -0
- package/schemes/slate-cobalt.css +50 -0
- package/schemes/teal.css +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 John Campion
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
No font files are in this repository. The Forest theme's default typefaces,
|
|
24
|
+
Inter and JetBrains Mono, are installed as npm dependencies
|
|
25
|
+
(@fontsource-variable/inter, @fontsource-variable/jetbrains-mono) under the SIL
|
|
26
|
+
Open Font License 1.1.
|
package/README.md
CHANGED
|
@@ -1,3 +1,188 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@zooui/theme-forest`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Forest, Zoo UI's first theme: a quiet, dense look for developer-facing products. It is ink on a green-tinted neutral
|
|
4
|
+
ground, with one accent per scheme and near-black code surfaces in both modes. It is a Nuxt layer that extends the
|
|
5
|
+
theme-free [`@zooui/nuxt`](https://github.com/zooui-dev/zooui/blob/main/packages/nuxt/README.md) with Forest's colors, page ground, typefaces, accent schemes and a few
|
|
6
|
+
Nuxt UI restylings. Geometry (radius, spacing, shadows, motion, focus) stays Nuxt UI's.
|
|
7
|
+
|
|
8
|
+
The package also carries Forest's plain-CSS/Tailwind **design source** in [`design/`](design/readme.md), for pages
|
|
9
|
+
that aren't Nuxt: tokens, the `ui-*` component classes, specimens and React reference components.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm forest:dev # → http://localhost:3001 (the baseline: pnpm ks:dev → :3003)
|
|
13
|
+
pnpm forest:build && pnpm forest:test
|
|
14
|
+
pnpm starter:dev # → http://localhost:3002 — the smallest product on Forest
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Using it
|
|
18
|
+
|
|
19
|
+
A Forest product extends this layer (which brings `@zooui/nuxt` with it) and imports `forest.css`, which is the
|
|
20
|
+
base's `base.css` then the theme's `theme.css`:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
// nuxt.config.ts
|
|
24
|
+
export default defineNuxtConfig({ extends: ['@zooui/theme-forest'], css: ['~/assets/css/main.css'] })
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```css
|
|
28
|
+
/* app/assets/css/main.css — the app's ONE Tailwind entry */
|
|
29
|
+
@import "@zooui/theme-forest/assets/css/forest.css";
|
|
30
|
+
@import "@zooui/theme-forest/schemes/ink-indigo.css"; /* the product's scheme (Teal if none) */
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Everything in [`@zooui/nuxt`'s README](https://github.com/zooui-dev/zooui/blob/main/packages/nuxt/README.md) applies: one Tailwind entry, no `@nuxt/ui` or
|
|
34
|
+
`tailwindcss` of the product's own, `<UApp>` at the root, the `Z*` components and the guards. The layer and the
|
|
35
|
+
stylesheet must agree: extending this layer with only `base.css`, or the base with `forest.css`, fails the build.
|
|
36
|
+
`../../apps/starter` is the smallest product on Forest; copy it to start one.
|
|
37
|
+
|
|
38
|
+
## How the color gets in
|
|
39
|
+
|
|
40
|
+
Nuxt UI chooses its semantic colors from Tailwind palettes by name. `assets/css/theme.css` registers Forest's ramps
|
|
41
|
+
as palettes, and `app.config.ts` points Nuxt UI at them:
|
|
42
|
+
|
|
43
|
+
| Nuxt UI | Forest ramp | Palette |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| `primary` | the scheme's accent (`--teal-*`) | `accent` |
|
|
46
|
+
| `neutral` | the pine grays (`--pine-*`) — every surface, text and border | `pine` |
|
|
47
|
+
| `secondary` | the pine grays — Forest's secondary is muted, not a second hue | `pine` |
|
|
48
|
+
| `success`, `info` | **per scheme** — each scheme file declares its own pair (below) | `pine-success`, `pine-info` |
|
|
49
|
+
| `warning` | amber | `pine-amber` |
|
|
50
|
+
| `error` | clay red | `pine-red` |
|
|
51
|
+
|
|
52
|
+
The neutral ramp keeps its name: `--pine-*` and the `pine-*` palettes are Forest's grays (a pine is a forest tree).
|
|
53
|
+
The accent ramp is `--teal-*` in every scheme; a scheme redefines its values.
|
|
54
|
+
|
|
55
|
+
**Success and info, per scheme.** They carry fixed meanings, so they must never read as the primary. But Forest's
|
|
56
|
+
accents span most of the hue wheel, so no single green and blue can stay clear of all of them. Each scheme file
|
|
57
|
+
therefore declares a pair (`--success-*`, `--info-*`, Tailwind's palette values) chosen to sit at least 30° of OKLCH
|
|
58
|
+
hue away from its accent, and the layer's `pine-success` / `pine-info` palettes read them — so a static scheme import
|
|
59
|
+
and `apps/forest`'s live switcher both carry the right pair.
|
|
60
|
+
|
|
61
|
+
| Scheme | Accent | Success | Info |
|
|
62
|
+
| --- | --- | --- | --- |
|
|
63
|
+
| Teal | teal | green | sky |
|
|
64
|
+
| Slate · Cobalt | cobalt | green | cyan |
|
|
65
|
+
| Graphite · Violet | violet | green | blue |
|
|
66
|
+
| Paper · Olive | olive | teal | blue |
|
|
67
|
+
| Ink · Indigo | indigo | green | cyan |
|
|
68
|
+
| Ember · Amber | amber | green | blue |
|
|
69
|
+
|
|
70
|
+
Chosen by measurement (smallest primary-to-status hue gap): mapping them to the accent
|
|
71
|
+
made success purple on Ink · Indigo; pinning a teal success and a cobalt info put success at **0°** on Teal and info
|
|
72
|
+
at **0°** on Slate · Cobalt; Nuxt UI's green and blue put info at **3°** on Slate · Cobalt. Per scheme's tightest
|
|
73
|
+
case is green success on Teal at **36°**. A test holds every scheme to ≥30°.
|
|
74
|
+
|
|
75
|
+
Everything downstream is Nuxt UI's own logic: which shade paints a hover, picking 400 instead of 500 in dark
|
|
76
|
+
mode, the alpha steps behind soft and subtle variants. Where Forest's ramps are sparse (amber and red have only
|
|
77
|
+
100/300/500/700/900) the missing shades are interpolated with `color-mix`, so a scheme change still carries
|
|
78
|
+
through every shade.
|
|
79
|
+
|
|
80
|
+
**Ground.** Nuxt UI paints the light page with `--ui-bg` (white), the same token its cards, inputs, menus and
|
|
81
|
+
overlays use. Forest separates the two, so the layer changes the *page ground* to Forest's paper (`--pine-50`) and
|
|
82
|
+
leaves `--ui-bg` white: everything Nuxt UI draws on `bg-default` stays white and reads as raised. Dark mode keeps Nuxt
|
|
83
|
+
UI's ground — its neutral-900 already is Forest's dark ground. An app that paints its own wrapper with `bg-default`
|
|
84
|
+
hides the ground; let the body show through.
|
|
85
|
+
|
|
86
|
+
## Schemes
|
|
87
|
+
|
|
88
|
+
A scheme only redefines raw ramps (`--pine-*`, `--teal-*`, its success/info pair, and for Ember `--amber-*`), so
|
|
89
|
+
importing it after the layer's stylesheet is all it takes. The same table is in
|
|
90
|
+
[`design/readme.md`](design/readme.md#schemes); `scripts/check-schemes.test.mjs` fails when the two disagree.
|
|
91
|
+
|
|
92
|
+
| Scheme | File | Accent 500 | Character |
|
|
93
|
+
| --- | --- | --- | --- |
|
|
94
|
+
| Teal | `schemes/teal.css` | `#117d72` | green-tinted gray, teal accent; the default |
|
|
95
|
+
| Slate · Cobalt | `schemes/slate-cobalt.css` | `#2a63d8` | cool blue-gray, cobalt accent (the starter's) |
|
|
96
|
+
| Graphite · Violet | `schemes/graphite-violet.css` | `#8c4ec6` | neutral gray, violet accent |
|
|
97
|
+
| Paper · Olive | `schemes/paper-olive.css` | `#40701f` | warm paper, olive accent |
|
|
98
|
+
| Ink · Indigo | `schemes/ink-indigo.css` | `#5a51d4` | violet-tinted gray, indigo accent (`apps/forest`'s) |
|
|
99
|
+
| Ember · Amber | `schemes/ember.css` | `#a85410` | warm gray, amber accent |
|
|
100
|
+
|
|
101
|
+
## Typefaces
|
|
102
|
+
|
|
103
|
+
Forest's faces are **Inter** (interface and display) and **JetBrains Mono** (code and values), both under the SIL
|
|
104
|
+
Open Font License and self-hosted from `@fontsource-variable/inter` and `@fontsource-variable/jetbrains-mono`, which
|
|
105
|
+
the theme depends on: the files ship with the build and nothing is fetched from a font CDN (the theme sets
|
|
106
|
+
`ui.fonts: false`, so Nuxt UI's `@nuxt/fonts` fetches nothing either). Inter is the opsz build, upright and drawn
|
|
107
|
+
italic, so display sizes get Inter's display cut.
|
|
108
|
+
|
|
109
|
+
Each role is two hooks, a family and its OpenType set, declared in a cascade layer (`@layer base`) so any
|
|
110
|
+
unlayered override wins whatever the import order:
|
|
111
|
+
|
|
112
|
+
| Hook | Forest's default |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `--zoo-font-sans`, `--zoo-font-display` | `"Inter Variable"`, then system faces |
|
|
115
|
+
| `--zoo-font-mono` | `"JetBrains Mono Variable"`, then system monos |
|
|
116
|
+
| `--zoo-features-sans`, `--zoo-features-display` | `normal` (these Inter files carry no stylistic sets) |
|
|
117
|
+
| `--zoo-features-mono` | `"calt" 0`: JetBrains Mono's code ligatures off, so pasted text reads as typed |
|
|
118
|
+
|
|
119
|
+
Every place the theme sets a face reads the hooks: Tailwind's `--font-sans`, `--font-mono` and `--font-display`
|
|
120
|
+
and their `--font-*--font-feature-settings`, and preflight's page and `code`/`kbd`/`pre` defaults, so switching the
|
|
121
|
+
face switches the set. Mono is also where Forest sets a value in Nuxt UI: **badges, table and grid headers**
|
|
122
|
+
(Forest's kicker: mono, xs, uppercase, tracked, muted) and **keyboard keys**, the face only; table and grid cells
|
|
123
|
+
take tabular figures. `font-display` is available but not applied: Nuxt UI doesn't style headings, so where it
|
|
124
|
+
goes is a product decision (the starter's heading uses it at 500 with `tracking-tight`).
|
|
125
|
+
|
|
126
|
+
**Licensed faces.** Faces that are licensed separately can ship as their own package (here `@acme/licensed-fonts`)
|
|
127
|
+
that a product installs and imports after Forest; it sets the six hooks, so its faces and their sets replace Inter and
|
|
128
|
+
JetBrains Mono. Its own conflict checks can sit beside `findConflicts`.
|
|
129
|
+
|
|
130
|
+
```css
|
|
131
|
+
@import "@zooui/theme-forest/assets/css/forest.css";
|
|
132
|
+
@import "@zooui/theme-forest/schemes/ink-indigo.css";
|
|
133
|
+
@import "@acme/licensed-fonts/fonts.css";
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Colored edges
|
|
137
|
+
|
|
138
|
+
`@zooui/nuxt` gives cards and overlays a 3px edge in their color ([its colored edges](https://github.com/zooui-dev/zooui/blob/main/packages/nuxt/docs/accents-and-edges.md#colored-edges)).
|
|
139
|
+
Forest adds the same edge to the two surfaces Nuxt UI already colors, through `app.config.ts`, so there is nothing
|
|
140
|
+
new to learn:
|
|
141
|
+
|
|
142
|
+
| Surface | How | Edge |
|
|
143
|
+
| --- | --- | --- |
|
|
144
|
+
| Toast | `useToast().add({ color })`; no progress bar | left |
|
|
145
|
+
| Banner | `<UAlert color="…" variant="outline">` | left, **striped** |
|
|
146
|
+
|
|
147
|
+
**Striping.** Alerts take Forest's hatched edge (the design source's RECIPES, "Banner (hatched edge)"): a 6px strip
|
|
148
|
+
of diagonal stripes in the alert's color, drawn as a `::before` with the `hatch` utility (stripes in
|
|
149
|
+
`currentColor`). It is on every variant; on `solid`, where the surface is already the color, the strip goes white
|
|
150
|
+
so it still shows. `variant="outline"` is Forest's banner itself — a plain raised surface, neutral text and border,
|
|
151
|
+
with only the strip and icon carrying the color. Use Nuxt UI's `orientation="horizontal"` to put the actions on the
|
|
152
|
+
right.
|
|
153
|
+
|
|
154
|
+
## nu-grid
|
|
155
|
+
|
|
156
|
+
For products that use nu-grid (`@nu-grid/nuxt`), the theme's `app.config.ts` carries a `nuGrid` key — inert
|
|
157
|
+
otherwise, and the layer does not depend on nu-grid (`apps/forest` installs it):
|
|
158
|
+
|
|
159
|
+
| | |
|
|
160
|
+
| --- | --- |
|
|
161
|
+
| Color | free — nu-grid themes through Nuxt UI's tokens |
|
|
162
|
+
| Density | nu-grid's own: `default` unless a grid or app picks `compact` |
|
|
163
|
+
| Header | Forest's kicker, in the mono face — through `ui.table`, which nu-grid inherits — and group labels the same |
|
|
164
|
+
| Group band | neutral (`bg-elevated/50`), **3px** accent leading edge on both modes |
|
|
165
|
+
| Cells | tabular figures |
|
|
166
|
+
|
|
167
|
+
The band overrides spell out `dark:` too: tailwind-merge only replaces a class with the same variant, and
|
|
168
|
+
`compact` tints its band `dark:bg-primary/12`. Tests check the band and edge in light and dark on both modes.
|
|
169
|
+
|
|
170
|
+
## The tests prove "color only"
|
|
171
|
+
|
|
172
|
+
`../../apps/forest/tests/forest.spec.ts`: Forest's accent, red and amber are what the buttons paint; Forest's
|
|
173
|
+
neutrals drive border and text; `--ui-radius` and a button's height, padding, radius and weight are Nuxt UI's
|
|
174
|
+
measured values; the specimen layout matches the baseline; overlays still trap and return focus; and dark mode picks
|
|
175
|
+
the 400 accent shade by Nuxt UI's own rule. `../../apps/forest/tests/components.spec.ts` covers the `Z*` components
|
|
176
|
+
on every scheme in both modes, the mono placements, and runs the guards over the whole page; `fonts.spec.ts` holds
|
|
177
|
+
the faces, their sets and the hook contract.
|
|
178
|
+
|
|
179
|
+
## The design source
|
|
180
|
+
|
|
181
|
+
[`design/`](design/readme.md) is Forest for pages without Nuxt: `styles.css` (tokens, base styles and the `ui-*`
|
|
182
|
+
classes, for plain HTML or Go templ), `tailwind.css` (the Tailwind v4 mapping, with [`RECIPES.md`](design/RECIPES.md)
|
|
183
|
+
giving each component as a utility string), specimen pages, and React reference components. It shares the raw ramps
|
|
184
|
+
and the scheme files (`schemes/`) with the Nuxt theme. [`design/ADOPTING.md`](design/ADOPTING.md) says which of the
|
|
185
|
+
three routes to use, and why only one per app.
|
|
186
|
+
|
|
187
|
+
Releasing is shared with the base: [docs/releasing.md](https://github.com/zooui-dev/zooui/blob/main/docs/releasing.md). Record design source
|
|
188
|
+
changes with `changerig add -p @zooui/theme-forest`.
|
package/app.config.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// The Forest theme's app.config — the theme layer's, never the base's: a product's app.config can override these
|
|
2
|
+
// keys but not remove them. Nuxt UI resolves everything else — hover shades, dark-mode shade choice, alpha
|
|
3
|
+
// variants — from these palettes, which is the point: we are choosing colors, not re-specifying components.
|
|
4
|
+
//
|
|
5
|
+
// primary → the scheme's accent: the brand color, and the one that changes most between schemes
|
|
6
|
+
// secondary → the pine grays: Forest's secondary is muted, not a second hue
|
|
7
|
+
// success → the scheme's own success ramp } declared in each scheme file, chosen to sit ≥30° of hue away
|
|
8
|
+
// info → the scheme's own info ramp } from that scheme's accent so neither reads as the primary
|
|
9
|
+
// warning, error → amber and clay red
|
|
10
|
+
//
|
|
11
|
+
// The colored edge (components/edge.ts) on the one surface that already has a color: toasts get a 3px
|
|
12
|
+
// LEFT edge in their color, as Forest's toast does. Written out per color so Tailwind's scan sees each class.
|
|
13
|
+
const toastEdges = [
|
|
14
|
+
{ color: 'primary', class: { root: 'border-l-3 border-primary' } },
|
|
15
|
+
{ color: 'secondary', class: { root: 'border-l-3 border-secondary' } },
|
|
16
|
+
{ color: 'success', class: { root: 'border-l-3 border-success' } },
|
|
17
|
+
{ color: 'info', class: { root: 'border-l-3 border-info' } },
|
|
18
|
+
{ color: 'warning', class: { root: 'border-l-3 border-warning' } },
|
|
19
|
+
{ color: 'error', class: { root: 'border-l-3 border-error' } },
|
|
20
|
+
{ color: 'neutral', class: { root: 'border-l-3 border-inverted' } },
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
// Forest's banner: alerts take a STRIPED edge — a 6px hatched strip down the left, painted in the alert's color
|
|
24
|
+
// (core RECIPES "Banner (hatched edge)"). On every variant the strip is the color; on `solid`, where the surface
|
|
25
|
+
// already IS that color, the strip goes white so it still shows. `outline` becomes Forest's banner itself: a plain
|
|
26
|
+
// raised surface with neutral text and border, and only the strip and icon carrying the color.
|
|
27
|
+
const ALERT_COLORS = ['primary', 'secondary', 'success', 'info', 'warning', 'error', 'neutral'] as const
|
|
28
|
+
const stripe: Record<(typeof ALERT_COLORS)[number], string> = {
|
|
29
|
+
primary: 'before:text-primary', secondary: 'before:text-secondary', success: 'before:text-success', info: 'before:text-info',
|
|
30
|
+
warning: 'before:text-warning', error: 'before:text-error', neutral: 'before:text-inverted',
|
|
31
|
+
}
|
|
32
|
+
const icon: Record<(typeof ALERT_COLORS)[number], string> = {
|
|
33
|
+
primary: 'text-primary', secondary: 'text-secondary', success: 'text-success', info: 'text-info',
|
|
34
|
+
warning: 'text-warning', error: 'text-error', neutral: 'text-highlighted',
|
|
35
|
+
}
|
|
36
|
+
const alertStripes = [
|
|
37
|
+
...ALERT_COLORS.map((color) => ({ color, class: { root: stripe[color] } })),
|
|
38
|
+
{ variant: 'solid', class: { root: 'before:text-white/70' } },
|
|
39
|
+
...ALERT_COLORS.map((color) => ({
|
|
40
|
+
color, variant: 'outline',
|
|
41
|
+
class: { root: 'bg-default text-default ring ring-inset ring-default', title: 'text-highlighted', description: 'text-muted opacity-100', icon: icon[color] },
|
|
42
|
+
})),
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
// Forest's kicker — the mono, uppercase, tracked label it puts over data (core RECIPES "Kicker", "Table"): table and
|
|
46
|
+
// grid headers and group labels. Type only; each component keeps its own padding, height and rules.
|
|
47
|
+
const KICKER = 'font-mono font-medium text-xs leading-[1.2] tracking-[0.08em] uppercase text-muted whitespace-nowrap'
|
|
48
|
+
|
|
49
|
+
export default defineAppConfig({
|
|
50
|
+
/**
|
|
51
|
+
* nu-grid (@nu-grid/nuxt), for products that use it. Inert otherwise: nothing reads this key, and the layer
|
|
52
|
+
* does not depend on nu-grid. The same rules as for Nuxt UI's own components:
|
|
53
|
+
* - color comes free: nu-grid themes through Nuxt UI's tokens, which this layer points at Forest's ramps;
|
|
54
|
+
* - geometry stays nu-grid's: no forced density (1.x defaulted to 'compact') — whichever nu-grid theme a grid
|
|
55
|
+
* uses keeps its own spacing; headers and group labels are Forest's kicker, in type only (`ui.table` and the
|
|
56
|
+
* group slots below);
|
|
57
|
+
* - the colored-edge rule: a group band never tints a large area with the accent — the band is neutral and
|
|
58
|
+
* the accent is a 3px leading edge on both themes ('default' ships 4px, 'compact' 3px).
|
|
59
|
+
* `dark:` is spelled out because tailwind-merge only replaces a class with the SAME variant: 'compact' tints the
|
|
60
|
+
* band `dark:bg-primary/12`, which a plain `bg-elevated/50` would leave in place.
|
|
61
|
+
*/
|
|
62
|
+
nuGrid: {
|
|
63
|
+
ui: {
|
|
64
|
+
slots: {
|
|
65
|
+
groupHeader: 'bg-elevated/50 hover:bg-elevated dark:bg-elevated/50 dark:hover:bg-elevated',
|
|
66
|
+
groupHeaderLeft: 'border-l-3',
|
|
67
|
+
// headers come from `ui.table` (nu-grid inherits it); the group band's labels are its own slots
|
|
68
|
+
groupLabel: KICKER,
|
|
69
|
+
thGroupInner: KICKER,
|
|
70
|
+
// Forest's tables use tabular figures, so numbers line up down a column
|
|
71
|
+
td: 'tabular-nums',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
ui: {
|
|
76
|
+
// The mono face where Forest sets a value, as 1.x did: badges (a count, a version, a state), table headers
|
|
77
|
+
// (the kicker) and keyboard keys. The face only — size, padding and radius stay Nuxt UI's. Table cells take
|
|
78
|
+
// tabular figures, as the grid's do, so numbers line up down a column.
|
|
79
|
+
badge: { slots: { base: 'font-mono' } },
|
|
80
|
+
kbd: { base: 'font-mono' },
|
|
81
|
+
table: { slots: { th: KICKER, td: 'tabular-nums' } },
|
|
82
|
+
// toasts: the colored left edge, and no progress bar (Forest shows the message, not a countdown)
|
|
83
|
+
toast: { slots: { progress: 'hidden' }, compoundVariants: toastEdges },
|
|
84
|
+
alert: {
|
|
85
|
+
slots: { root: "before:content-[''] before:absolute before:inset-y-0 before:left-0 before:w-1.5 before:hatch" },
|
|
86
|
+
compoundVariants: alertStripes,
|
|
87
|
+
},
|
|
88
|
+
// The current-page marker, opt-in through two CSS variables: on a menu that asks for Nuxt UI's `highlight`, the
|
|
89
|
+
// bar's thickness and the current item's weight read `--nav-highlight-size` and `--nav-current-weight`. A product
|
|
90
|
+
// sets them in its own CSS (say 2px and 700). Unset, they fall back to exactly what Nuxt UI ships (h-px / w-px,
|
|
91
|
+
// font-medium), so no menu changes until a product asks. tailwind-merge swaps these for Nuxt UI's own classes, so
|
|
92
|
+
// no element carries both. `variant="link" color="neutral" highlight highlight-color="primary"` gives no pill, a
|
|
93
|
+
// neutral label over a primary underline (unset, highlight-color follows `color`).
|
|
94
|
+
navigationMenu: {
|
|
95
|
+
compoundVariants: [
|
|
96
|
+
{ orientation: 'horizontal', highlight: true, class: { link: 'after:h-[var(--nav-highlight-size,1px)]' } },
|
|
97
|
+
{ orientation: 'vertical', highlight: true, level: true, class: { link: 'after:w-[var(--nav-highlight-size,1px)]' } },
|
|
98
|
+
{ highlight: true, active: true, class: { link: 'font-[weight:var(--nav-current-weight,500)]' } },
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
colors: {
|
|
102
|
+
primary: 'accent',
|
|
103
|
+
secondary: 'pine',
|
|
104
|
+
success: 'pine-success',
|
|
105
|
+
info: 'pine-info',
|
|
106
|
+
warning: 'pine-amber',
|
|
107
|
+
error: 'pine-red',
|
|
108
|
+
neutral: 'pine',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
})
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* Forest — the stylesheet a Forest product imports as the first line of its one Tailwind entry: Zoo UI's base
|
|
2
|
+
(Tailwind, Nuxt UI, the Z* components' sources, color-scheme, data-accent) and then Forest's theme (typefaces,
|
|
3
|
+
ramps as palettes, the default scheme, the ground). It goes with this package's layer, `@zooui/theme-forest`, which
|
|
4
|
+
carries the theme's app.config half; the base layer fails the build if the two are mixed up. A product with its
|
|
5
|
+
own look imports `@zooui/nuxt/assets/css/base.css` instead and extends `@zooui/nuxt`. */
|
|
6
|
+
@import "@zooui/nuxt/assets/css/base.css";
|
|
7
|
+
@import "./theme.css";
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/* The FOREST THEME's stylesheet — Nuxt UI's defaults, with Forest's colors and typefaces on top. That is the whole
|
|
2
|
+
idea: an earlier version re-specified Nuxt UI from the design source's recipes and lost the polish that made Nuxt UI worth adopting. This file
|
|
3
|
+
changes COLOR and TYPE only. Radius, spacing, shadows, motion, focus rings and every component's geometry stay
|
|
4
|
+
as Nuxt UI ships. It comes after base.css (forest.css imports the two in order) and goes with this package's layer
|
|
5
|
+
(nuxt.config.ts), whose app.config.ts is its other half.
|
|
6
|
+
|
|
7
|
+
How the color gets in: Nuxt UI picks its semantic colors (primary, neutral, …) from Tailwind palettes by
|
|
8
|
+
name, so Forest's ramps are registered as Tailwind palettes here and the theme's app.config.ts points Nuxt UI at
|
|
9
|
+
them. Everything downstream — hover shades, dark mode picking 400 instead of 500, alpha variants — stays Nuxt
|
|
10
|
+
UI's own logic. */
|
|
11
|
+
|
|
12
|
+
/* The theme's app.config.ts (the toast edges, the alert stripes) lives outside any app's root, so its classes are
|
|
13
|
+
declared as a source here. */
|
|
14
|
+
@source "../../app.config.ts";
|
|
15
|
+
|
|
16
|
+
/* Forest's default typefaces, self-hosted from the fontsource packages (SIL Open Font License), so Vite emits the
|
|
17
|
+
files with the build and nothing is fetched from a font CDN. Inter's opsz builds, upright and italic: the opsz
|
|
18
|
+
axis (14–32) gives small labels and display sizes their own cuts under `font-optical-sizing: auto`, and the
|
|
19
|
+
italic is the drawn one, not a synthesized slant. JetBrains Mono: upright and italic, wght. */
|
|
20
|
+
@import "@fontsource-variable/inter/opsz.css";
|
|
21
|
+
@import "@fontsource-variable/inter/opsz-italic.css";
|
|
22
|
+
@import "@fontsource-variable/jetbrains-mono/wght.css";
|
|
23
|
+
@import "@fontsource-variable/jetbrains-mono/wght-italic.css";
|
|
24
|
+
|
|
25
|
+
/* The faces as six ROLE HOOKS, one family and one OpenType set per role: --zoo-font-{sans,mono,display} and
|
|
26
|
+
--zoo-features-{sans,mono,display}. Every rule that sets a face reads them, so overriding the hooks swaps a face
|
|
27
|
+
AND its set together (a separate package of licensed faces can do so).
|
|
28
|
+
The defaults sit in a cascade layer so that any unlayered override wins whatever the import order.
|
|
29
|
+
The sets, read off the fontsource files' GSUB tables (these Google Fonts builds carry no ss/cv sets at all):
|
|
30
|
+
- Inter: `normal`. Its single-story a (cv11) and alternate 6/9 are not in these files, so there is nothing to
|
|
31
|
+
pick; tabular figures (tnum, which they do carry) come from `tabular-nums` on table and grid cells.
|
|
32
|
+
- JetBrains Mono: `"calt" 0`. Its code ligatures (-> => != …) are all in calt, so turning it off makes pasted
|
|
33
|
+
text read as typed. Its default i and l are already the high-legibility forms. */
|
|
34
|
+
@layer base {
|
|
35
|
+
:root {
|
|
36
|
+
--zoo-font-sans: "Inter Variable", system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
37
|
+
--zoo-font-display: "Inter Variable", system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
38
|
+
--zoo-font-mono: "JetBrains Mono Variable", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
|
|
39
|
+
--zoo-features-sans: normal;
|
|
40
|
+
--zoo-features-display: normal;
|
|
41
|
+
--zoo-features-mono: "calt" 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Tailwind's tokens read the hooks, never a family name. Each family carries its set in two places:
|
|
46
|
+
- Tailwind's preflight applies --default-font-feature-settings to the page and
|
|
47
|
+
--default-mono-font-feature-settings to code/kbd/samp/pre;
|
|
48
|
+
- the family utilities carry their face's set too (`--font-<family>--font-feature-settings`), so a bare
|
|
49
|
+
`font-mono` span or a `font-display` heading switches its set WITH its face rather than keeping the sans set
|
|
50
|
+
it inherited.
|
|
51
|
+
`static`: preflight reads the mono family through --default-mono-font-family, so --font-mono must be emitted
|
|
52
|
+
even on a page where no `font-mono` utility appears — otherwise code/kbd/pre fall back to the system mono. */
|
|
53
|
+
@theme static {
|
|
54
|
+
--font-sans: var(--zoo-font-sans);
|
|
55
|
+
--font-sans--font-feature-settings: var(--zoo-features-sans);
|
|
56
|
+
--font-mono: var(--zoo-font-mono);
|
|
57
|
+
--font-mono--font-feature-settings: var(--zoo-features-mono);
|
|
58
|
+
--font-display: var(--zoo-font-display);
|
|
59
|
+
--font-display--font-feature-settings: var(--zoo-features-display);
|
|
60
|
+
--default-font-feature-settings: var(--zoo-features-sans);
|
|
61
|
+
--default-mono-font-family: var(--zoo-font-mono);
|
|
62
|
+
--default-mono-font-feature-settings: var(--zoo-features-mono);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Forest's raw ramps, then the default scheme. A product overrides the scheme by importing another AFTER this
|
|
66
|
+
stylesheet; a scheme only redefines raw ramps, so nothing else has to change. */
|
|
67
|
+
@import "../../schemes/ramps.css";
|
|
68
|
+
@import "../../schemes/teal.css";
|
|
69
|
+
|
|
70
|
+
/* Forest's ramps as Tailwind palettes. `static` so they are emitted even where nothing uses a shade directly
|
|
71
|
+
(Nuxt UI reads them through its own --ui-color-* indirection).
|
|
72
|
+
|
|
73
|
+
`pine` is the name of Forest's gray ramp (a pine is a forest tree), and the prefix of every palette Forest
|
|
74
|
+
registers: pine, pine-amber, pine-red, pine-success, pine-info. One prefix marks them as the theme's own and keeps
|
|
75
|
+
them apart from Tailwind's amber and red. `accent` is the exception: it is whatever the scheme's accent is.
|
|
76
|
+
|
|
77
|
+
Forest's ramps are not all 50–950: the accent has 100–900, and amber/red only 100/300/500/700/900. The gaps
|
|
78
|
+
are interpolated with color-mix rather than invented hex values, so a scheme change still carries through
|
|
79
|
+
every shade. */
|
|
80
|
+
@theme static {
|
|
81
|
+
/* neutral — Forest's full 50–950 ramp, used for every surface, text and border Nuxt UI draws */
|
|
82
|
+
--color-pine-50: var(--pine-50);
|
|
83
|
+
--color-pine-100: var(--pine-100);
|
|
84
|
+
--color-pine-200: var(--pine-200);
|
|
85
|
+
--color-pine-300: var(--pine-300);
|
|
86
|
+
--color-pine-400: var(--pine-400);
|
|
87
|
+
--color-pine-500: var(--pine-500);
|
|
88
|
+
--color-pine-600: var(--pine-600);
|
|
89
|
+
--color-pine-700: var(--pine-700);
|
|
90
|
+
--color-pine-800: var(--pine-800);
|
|
91
|
+
--color-pine-900: var(--pine-900);
|
|
92
|
+
--color-pine-950: var(--pine-950);
|
|
93
|
+
|
|
94
|
+
/* accent — the scheme's ramp (named --teal-* whatever the scheme, as in core) */
|
|
95
|
+
--color-accent-50: color-mix(in oklab, var(--teal-100) 45%, white);
|
|
96
|
+
--color-accent-100: var(--teal-100);
|
|
97
|
+
--color-accent-200: var(--teal-200);
|
|
98
|
+
--color-accent-300: var(--teal-300);
|
|
99
|
+
--color-accent-400: var(--teal-400);
|
|
100
|
+
--color-accent-500: var(--teal-500);
|
|
101
|
+
--color-accent-600: var(--teal-600);
|
|
102
|
+
--color-accent-700: var(--teal-700);
|
|
103
|
+
--color-accent-800: var(--teal-800);
|
|
104
|
+
--color-accent-900: var(--teal-900);
|
|
105
|
+
--color-accent-950: color-mix(in oklab, var(--teal-900) 70%, black);
|
|
106
|
+
|
|
107
|
+
/* warning — Forest's amber */
|
|
108
|
+
--color-pine-amber-50: color-mix(in oklab, var(--amber-100) 45%, white);
|
|
109
|
+
--color-pine-amber-100: var(--amber-100);
|
|
110
|
+
--color-pine-amber-200: color-mix(in oklab, var(--amber-100) 50%, var(--amber-300));
|
|
111
|
+
--color-pine-amber-300: var(--amber-300);
|
|
112
|
+
--color-pine-amber-400: color-mix(in oklab, var(--amber-300) 50%, var(--amber-500));
|
|
113
|
+
--color-pine-amber-500: var(--amber-500);
|
|
114
|
+
--color-pine-amber-600: color-mix(in oklab, var(--amber-500) 50%, var(--amber-700));
|
|
115
|
+
--color-pine-amber-700: var(--amber-700);
|
|
116
|
+
--color-pine-amber-800: color-mix(in oklab, var(--amber-700) 50%, var(--amber-900));
|
|
117
|
+
--color-pine-amber-900: var(--amber-900);
|
|
118
|
+
--color-pine-amber-950: color-mix(in oklab, var(--amber-900) 70%, black);
|
|
119
|
+
|
|
120
|
+
/* error — Forest's clay red */
|
|
121
|
+
--color-pine-red-50: color-mix(in oklab, var(--red-100) 45%, white);
|
|
122
|
+
--color-pine-red-100: var(--red-100);
|
|
123
|
+
--color-pine-red-200: color-mix(in oklab, var(--red-100) 50%, var(--red-300));
|
|
124
|
+
--color-pine-red-300: var(--red-300);
|
|
125
|
+
--color-pine-red-400: color-mix(in oklab, var(--red-300) 50%, var(--red-500));
|
|
126
|
+
--color-pine-red-500: var(--red-500);
|
|
127
|
+
--color-pine-red-600: color-mix(in oklab, var(--red-500) 50%, var(--red-700));
|
|
128
|
+
--color-pine-red-700: var(--red-700);
|
|
129
|
+
--color-pine-red-800: color-mix(in oklab, var(--red-700) 50%, var(--red-900));
|
|
130
|
+
--color-pine-red-900: var(--red-900);
|
|
131
|
+
--color-pine-red-950: color-mix(in oklab, var(--red-900) 70%, black);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Status colors, PER SCHEME. Success and info carry fixed meanings, so they must never read as the primary —
|
|
135
|
+
but Forest's six accents span most of the hue wheel (teal, cobalt, violet, olive, indigo, amber), so no single
|
|
136
|
+
green and blue can stay clear of all of them: a pinned teal success sat ON Teal's primary, Nuxt UI's blue
|
|
137
|
+
info ON Slate · Cobalt's. So each scheme file declares its own pair (--success-*, --info-*), chosen to sit at
|
|
138
|
+
least 30° of hue away from its accent, and these palettes read them. Switching schemes switches the pair. */
|
|
139
|
+
@theme static {
|
|
140
|
+
--color-pine-success-50: var(--success-50);
|
|
141
|
+
--color-pine-success-100: var(--success-100);
|
|
142
|
+
--color-pine-success-200: var(--success-200);
|
|
143
|
+
--color-pine-success-300: var(--success-300);
|
|
144
|
+
--color-pine-success-400: var(--success-400);
|
|
145
|
+
--color-pine-success-500: var(--success-500);
|
|
146
|
+
--color-pine-success-600: var(--success-600);
|
|
147
|
+
--color-pine-success-700: var(--success-700);
|
|
148
|
+
--color-pine-success-800: var(--success-800);
|
|
149
|
+
--color-pine-success-900: var(--success-900);
|
|
150
|
+
--color-pine-success-950: var(--success-950);
|
|
151
|
+
|
|
152
|
+
--color-pine-info-50: var(--info-50);
|
|
153
|
+
--color-pine-info-100: var(--info-100);
|
|
154
|
+
--color-pine-info-200: var(--info-200);
|
|
155
|
+
--color-pine-info-300: var(--info-300);
|
|
156
|
+
--color-pine-info-400: var(--info-400);
|
|
157
|
+
--color-pine-info-500: var(--info-500);
|
|
158
|
+
--color-pine-info-600: var(--info-600);
|
|
159
|
+
--color-pine-info-700: var(--info-700);
|
|
160
|
+
--color-pine-info-800: var(--info-800);
|
|
161
|
+
--color-pine-info-900: var(--info-900);
|
|
162
|
+
--color-pine-info-950: var(--info-950);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* The page ground. Nuxt UI paints the light page with --ui-bg (white), the same token its cards, inputs, menus
|
|
166
|
+
and overlays use. Forest separates the two: the ground is its paper (--pine-50) and raised surfaces are white.
|
|
167
|
+
So the GROUND changes and --ui-bg does not — every component Nuxt UI draws on bg-default stays white and now
|
|
168
|
+
reads as raised. Dark mode keeps Nuxt UI's ground (neutral-900, which already is Forest's dark ground).
|
|
169
|
+
An app that paints its own wrapper with bg-default hides this; let the body show through. */
|
|
170
|
+
@layer base {
|
|
171
|
+
body { background-color: var(--ui-color-neutral-50); }
|
|
172
|
+
.dark body { background-color: var(--ui-bg); }
|
|
173
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Adopting Forest across several products
|
|
2
|
+
|
|
3
|
+
The whole point of this layout is that a change made once reaches every product. That only works if products never edit the design source's files.
|
|
4
|
+
|
|
5
|
+
## Three ways to consume Forest — pick ONE per application
|
|
6
|
+
|
|
7
|
+
Forest ships the same design three times, because it has to serve very different runtimes. Shipping
|
|
8
|
+
two into one app is the mistake this section exists to prevent: you get two definitions of a
|
|
9
|
+
button and two places to change it.
|
|
10
|
+
|
|
11
|
+
| | Use it when | What you import | What you write |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| **The Nuxt layer** — `@zooui/theme-forest` (over the base `@zooui/nuxt`) | the app is Nuxt | the theme's `forest.css` and a scheme, from the package | Nuxt UI components and utilities, plus the layer's `Z*` components |
|
|
14
|
+
| **Tailwind + `@theme`** — *canonical for Vue/React and other build-step apps* | the app has a build step and isn't Nuxt | `design/tailwind.css` → `tokens.css` only | utilities, taking the string for each component from `RECIPES.md` |
|
|
15
|
+
| **The `ui-*` class layer** | there is no build step — Go `templ`, plain HTML, an email | `design/styles.css` → tokens + components | `class="ui-btn" data-variant="primary"` |
|
|
16
|
+
|
|
17
|
+
**A Nuxt product uses the layer and nothing else from here.** The layer is Nuxt UI as it ships, with
|
|
18
|
+
Forest's colors, ground and typefaces on top; it takes only the raw ramps and the scheme files, and
|
|
19
|
+
none of the design source's semantic tokens, utilities or recipes. Setup is in `../README.md` ("Using it"), and
|
|
20
|
+
`readme.md` ("In a Nuxt product") maps the design source's vocabulary to Nuxt UI's. The rest of this document is about
|
|
21
|
+
the other two routes, except where it says otherwise.
|
|
22
|
+
|
|
23
|
+
**In a Tailwind application, do not ship the `ui-*` layer.** Every `ui-*` class duplicates what
|
|
24
|
+
utilities already express, so shipping it means one large stylesheet you maintain in parallel with
|
|
25
|
+
your components. Build each component once as an SFC using utilities, and let `RECIPES.md` be the
|
|
26
|
+
source for what those utilities are.
|
|
27
|
+
|
|
28
|
+
**There is no exception.** Everything in the `ui-*` layer is expressible as utilities, including
|
|
29
|
+
the parts that look like they need CSS:
|
|
30
|
+
|
|
31
|
+
| | utilities |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| status circle | `w-2.5 h-2.5 rounded-full bg-ok` |
|
|
34
|
+
| status triangle | `w-0 h-0 border-l-[5.5px] border-l-transparent border-r-[5.5px] border-r-transparent border-b-[10px] border-b-warn` |
|
|
35
|
+
| dashed ring | `w-2.5 h-2.5 rounded-full border-[1.5px] border-dashed border-danger box-border` |
|
|
36
|
+
| bracketed kicker | `before:content-['[_'] before:text-accent after:content-['_]'] after:text-accent` |
|
|
37
|
+
| monogram corner geometry | `rounded-[3px_3px_50%_3px]` |
|
|
38
|
+
| the hatch | the `hatch` utility in `tailwind.css` |
|
|
39
|
+
|
|
40
|
+
**One trap when you wire this up.** Forest's base sets `html { font: var(--type-body) }`, which makes
|
|
41
|
+
the root font-size 14px — so Tailwind's default `--spacing: 0.25rem` silently renders every spacing
|
|
42
|
+
utility at 87.5% of intent (`p-4` becomes 14px). `tailwind.css` pins `--spacing: 4px` to make the
|
|
43
|
+
scale immune to it. Keep that.
|
|
44
|
+
|
|
45
|
+
**Tokens are shared by both routes.** `styles.css` holds the `:root` token sheet and
|
|
46
|
+
`tailwind.css` only maps those names onto Tailwind's namespaces, so a token change reaches both
|
|
47
|
+
without a second edit.
|
|
48
|
+
|
|
49
|
+
## The layering rule
|
|
50
|
+
|
|
51
|
+
Three layers, loaded in this order. Each product owns only the third.
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<link rel="stylesheet" href="design/styles.css"> <!-- 1. Forest — NEVER edit downstream -->
|
|
55
|
+
<link rel="stylesheet" href="schemes/ink-indigo.css"> <!-- 2. scheme — pick one, don't edit -->
|
|
56
|
+
<link rel="stylesheet" href="app.css"> <!-- 3. yours — product-specific only -->
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
1. **Forest** (`styles.css`, `tailwind.css`) — tokens, base styles, `ui-*` components. Identical byte-for-byte in every product. A fix here is a fix everywhere.
|
|
60
|
+
2. **Scheme** (`../schemes/*.css`) — nothing but a `:root` block overriding the raw ramps: neutrals, accent, the success/info pair, and for Ember amber. One per product; see the schemes table in `readme.md`.
|
|
61
|
+
3. **Product layer** (`app.css`) — only what is genuinely unique to that product: its own composite components, page layouts, one-off marketing sections. If you find yourself redefining a token or restyling a `ui-*` class here, that belongs in the design source instead — see below.
|
|
62
|
+
|
|
63
|
+
Corner style is an attribute, not a file: `<html data-corners="tight">`. (Not in Nuxt: there corners are Nuxt UI's `--ui-radius`, and a product that wants squarer ones sets it in its own CSS.)
|
|
64
|
+
|
|
65
|
+
**In Nuxt**, the package enforces this for you: `extends: ['@zooui/theme-forest']` makes Forest a dependency rather than a copy. The layers are the same three — the theme's `forest.css`, then `@zooui/theme-forest/schemes/<slug>.css`, then the product's own CSS, all in the product's one `main.css` — and a product writes `<UButton>`, not a hand-built button. See `../README.md`.
|
|
66
|
+
|
|
67
|
+
## Making a change that should reach every product
|
|
68
|
+
|
|
69
|
+
1. Edit the design source's file in **this** folder — the canonical copy. Schemes and the raw ramps have one copy, in the theme's `../schemes/` (`ramps.css` for the ramps, which `tokens.css` imports): edit them there.
|
|
70
|
+
2. Record the change for `@zooui/theme-forest` (`changerig add -p @zooui/theme-forest`; see `docs/releasing.md`): the design source versions with the theme package.
|
|
71
|
+
3. Non-Nuxt products take the change by upgrading `@zooui/theme-forest` and importing `@zooui/theme-forest/design/*` (or by copying `design/*.css` and `schemes/` over what's there: nothing to merge, because nobody edited them). Nuxt products take it by upgrading `@zooui/theme-forest`.
|
|
72
|
+
|
|
73
|
+
Because products never fork the design source, the copy is a straight overwrite — the reason the layering rule matters more than the tooling. However you move the files (submodule, npm package, a copy script in CI, or by hand) the guarantee is the same.
|
|
74
|
+
|
|
75
|
+
## When a product needs something Forest doesn't have
|
|
76
|
+
|
|
77
|
+
Two honest options:
|
|
78
|
+
|
|
79
|
+
- **It's product-specific** — build it in the product layer out of tokens and `ui-*` classes. A billing page's plan-comparison grid belongs to that product.
|
|
80
|
+
- **A second product will want it** — add it to the design source as a new `ui-*` class, bump the minor version, and roll it out. Two products hand-rolling the same table variant is the failure mode this structure exists to prevent.
|
|
81
|
+
|
|
82
|
+
The test: if you'd have to copy it to the next product, it belongs in the design source.
|
|
83
|
+
|
|
84
|
+
## Things that must not drift
|
|
85
|
+
|
|
86
|
+
- **Semantic tokens.** Products read `--fg-muted`, not `--pine-600` (in Nuxt, `text-muted`, not `text-pine-600`). Redefining a semantic token in the product layer silently breaks dark mode.
|
|
87
|
+
- **The two schemes tables.** The one in `readme.md` and the one in `../README.md`; `scripts/check-schemes.test.mjs` fails when they disagree.
|
|
88
|
+
- **The shape exemptions.** `.ui-status .glyph` and `.ui-eco` tiles carry meaning in their geometry and ignore the corner dial. Don't restyle them.
|
|
89
|
+
- **The fonts.** Set faces only through the six `--zoo-*` hooks (`readme.md`, "Typefaces"), so a face and its OpenType set change together; don't pick new stylistic sets per product.
|
|
90
|
+
- **Voice.** `readme.md`'s voice section applies to every product; consistency in error copy across a family is worth more than a local turn of phrase.
|
|
91
|
+
|
|
92
|
+
## Derived tokens: re-declare, don't just re-scale
|
|
93
|
+
|
|
94
|
+
`--radius-*` are computed from `--radius-scale`. A `var()` inside a custom-property
|
|
95
|
+
declaration resolves **at the element that declares it**, so descendants inherit the
|
|
96
|
+
resolved value, not the formula. Overriding only the input variable therefore does nothing:
|
|
97
|
+
|
|
98
|
+
```css
|
|
99
|
+
/* inert below :root — --radius-sm was already resolved there */
|
|
100
|
+
[data-corners="flat"] { --radius-scale: 0; }
|
|
101
|
+
|
|
102
|
+
/* correct — the radii re-resolve against the local scale */
|
|
103
|
+
[data-corners="flat"] {
|
|
104
|
+
--radius-scale: 0;
|
|
105
|
+
--radius-xs: calc(3px * var(--radius-scale));
|
|
106
|
+
--radius-sm: calc(5px * var(--radius-scale));
|
|
107
|
+
--radius-md: calc(8px * var(--radius-scale));
|
|
108
|
+
--radius-lg: calc(12px * var(--radius-scale));
|
|
109
|
+
--radius-pill: calc(999px * var(--radius-scale));
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
This applies to any future derived token. If you add one, re-declare it in every block
|
|
114
|
+
that overrides its input, and test the override on a container as well as on `<html>`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Changelog
|