@rokkit/cli 1.1.16 → 1.1.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/cli",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "description": "Command line utilities for icon bundling and conversion.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@mdi/svg": "^7.4.47",
30
- "@rokkit/unocss": "1.1.16",
30
+ "@rokkit/unocss": "1.1.18",
31
31
  "sade": "^1.8.1",
32
32
  "@iconify/tools": "5.0.3",
33
33
  "@iconify/types": "^2.0.0",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: semantic-styles-rokkit
3
- description: Use when building, styling, or auditing a Rokkit-powered app (Svelte 5 + UnoCSS presetRokkit) — covers the named-token vocabulary (paper / ink / primary / on-primary / *-soft), the rokkit.config.js palette→skin→tokens pipeline, dual-palette dark mode, migrating legacy z-scale utilities (bg-surface-z0, text-primary-z5) to named tokens, and the rokkit init / rokkit doctor CLI.
3
+ description: Use when building, styling, or auditing a Rokkit-powered app (Svelte 5 + UnoCSS presetRokkit) — covers the named-token vocabulary (paper / ink / primary / on-primary / *-soft), EXTENDING it with custom tokens via `overrides:` and the full palette ladder via `tokens: 'extended'`, the rokkit.config.js palette→skin→tokens pipeline, dual-palette dark mode, migrating legacy z-scale utilities (bg-surface-z0, text-primary-z5) to named tokens, and the rokkit init / rokkit doctor CLI.
4
4
  ---
5
5
 
6
6
  # Semantic Styles — Rokkit
@@ -239,6 +239,72 @@ existing code keeps working. New code should use named tokens. See the migration
239
239
 
240
240
  ---
241
241
 
242
+ ## Layer 3b — Extending the vocabulary (`overrides` + `tokens: extended`)
243
+
244
+ **The named-token set is the _default_ vocabulary, not a hard limit.** When a design needs
245
+ a token the core set lacks — a second accent tone, a dedicated `on-accent` text color, a
246
+ divider-line color — add it. Don't conclude "core only has `accent`/`accent-soft`, so this
247
+ can't be expressed." Two mechanisms:
248
+
249
+ ### `overrides:` — add (or retune) named tokens
250
+
251
+ `overrides` is a `{ name: value }` map in `rokkit.config.js`. Each entry emits a `--<name>`
252
+ CSS var **and** auto-generates color utilities for it. Value forms:
253
+
254
+ - **Palette reference** — `'<palette>.<shade>'`, **dot notation** (`'sky.600'`, NOT
255
+ `'sky-600'`). The palette must be one you declared in `palettes:` (see the gotcha below).
256
+ - **Raw color** — any CSS color string: `'#0ea5e9'`, `'oklch(0.55 0.13 245)'`.
257
+ - **Per-mode** — `{ light, dark }`, each side a palette ref or raw color. Including a `dark`
258
+ side emits/extends the `[data-mode="dark"]` block so the token flips automatically.
259
+
260
+ ```js
261
+ // rokkit.config.js
262
+ overrides: {
263
+ 'accent-2': 'sky.600', // a second, deeper accent tone
264
+ 'on-accent': 'kami.50', // readable text on an accent fill
265
+ 'accent-line': { light: 'sky.200', dark: 'sky.800' }, // divider that flips per mode
266
+ 'brand-ring': 'sky.500', // a custom focus ring (see -ring rule)
267
+ 'paper-edge': 'oklch(0.62 0.02 245)', // RETUNE a reserved token (see below)
268
+ }
269
+ ```
270
+
271
+ This makes `bg-accent-2` · `text-accent-2` · `border-accent-2` · `text-on-accent` ·
272
+ `border-accent-line` · `ring-brand-ring` … all real utilities, plus `var(--accent-2)` etc.
273
+ in CSS.
274
+
275
+ **Generated prefixes** (per color-valued override): `bg-`, `text-`, `border-`
276
+ (+ `border-t/-b/-l/-r`), `outline-`, `fill-`, `stroke-`. **`ring-<name>` is emitted only
277
+ when the name ends in `-ring`** (e.g. `brand-ring` → `ring-brand-ring`).
278
+
279
+ **Reserved-name overrides win.** Naming an override after a built-in token (`paper-edge`,
280
+ `accent`, `focus-ring`, …) replaces that token's skin-derived value — the way to retune one
281
+ token without touching the palette. Reserved names already own their utilities, so no extra
282
+ shortcut is generated for them; the override only changes the value.
283
+
284
+ > **Gotcha — palette refs resolve against your `palettes:` block, not Tailwind's built-in
285
+ > names.** `'sky.600'` works only if `sky` is declared in `palettes:`. If a role uses a
286
+ > Tailwind palette purely by name (`skin: { accent: 'sky' }` with no `palettes.sky`), either
287
+ > declare that palette in `palettes:` or give the override a raw color / `{ light, dark }`
288
+ > value. An unknown palette or shade throws at build time.
289
+
290
+ ### `tokens: 'extended'` — expose the full palette ladder
291
+
292
+ When you want *arbitrary shades* of a role rather than a few named tokens, switch that role
293
+ (or the whole config) to `extended`. It emits the full 11-shade ladder as
294
+ `--color-{role}-{shade}` vars + `bg-/text-/border-…-{role}-{shade}` utilities:
295
+
296
+ ```js
297
+ tokens: { accent: 'extended' } // → bg-accent-600, text-accent-300, var(--color-accent-700), …
298
+ // or globally: tokens: 'extended'
299
+ ```
300
+
301
+ **Which to reach for:** `overrides` for a *small set of semantic* tokens (`on-accent`,
302
+ `accent-line`) — they read as intent and survive a palette swap. `extended` for
303
+ *programmatic* shade access (charts, data-viz, a component that walks the whole ramp).
304
+ Default stays `'core'`.
305
+
306
+ ---
307
+
242
308
  ## Migrating from z-scale to named tokens
243
309
 
244
310
  `rokkit doctor` scans `src/**` and prints the suggested replacement per occurrence
@@ -378,6 +444,8 @@ export default {
378
444
 
379
445
  | Mistake | Why it fails | Fix |
380
446
  |---|---|---|
447
+ | "core only emits `accent`/`accent-soft`, so I can't have `accent-2`/`on-accent`" | the vocabulary is extensible, not fixed | add them under `overrides:` (or use `tokens: 'extended'`) — see Layer 3b |
448
+ | Override palette ref `'sky-600'` (hyphen) | refs use **dot** notation | `'sky.600'` (and `sky` must be in `palettes:`) |
381
449
  | `color: #3D3730` in a component | breaks on theme change | `text-ink` (or the right named token) |
382
450
  | Using `bg-surface-z5` / `text-primary-z5` in new code | legacy back-compat layer | named tokens — see migration table (or run `rokkit doctor`) |
383
451
  | Single-palette `surface` but expecting dark mode | no `[data-mode]` block is emitted | make `surface`/`ink` dual-palette `{ light, dark }` |