@designtools/tokens 0.3.0 → 0.5.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/CHANGELOG.md ADDED
@@ -0,0 +1,85 @@
1
+ # Changelog
2
+
3
+ Notable changes to `@designtools/tokens`. Dates are release dates; versions follow semver, with breaking changes in the minor slot while the package is pre-1.0.
4
+
5
+ ## 0.4.0
6
+
7
+ Partial regeneration, and the bug that made it necessary.
8
+
9
+ ### Fixed
10
+
11
+ - **The semantic bridge now follows `--seed-shade`.** Re-anchoring the ramp left the bridge on its hardcoded steps, so a brand colour anchored at 700 sat on `--color-primary-700` while `--primary` still pointed at 500 — the brand colour unreachable through `bg-primary`, with nothing in the output to say so. Mappings are now offsets from the anchor, resolved at emit time and clamped to the ends of the ramp. `--ring` moves with them, being primary-derived; `muted`, `border`, `input` and `shadow` do not, being neutral-derived.
12
+ - **Alias pairs no longer drift apart.** `destructive`/`red`, `success`/`green` and `warning`/`yellow` are two names for one scale, but `--color` moved only the name you typed, so `bg-red-500` and `bg-destructive-500` could silently differ in the same file. Overriding either now moves both.
13
+ - **The plain `css` format emits `.dark` and `.light` hooks.** Without them a project driving dark mode off a class — how Tailwind's own dark variant works — got no dark mode at all, and nothing in the build to say why.
14
+ - **The bridge constants had two copies**, one emitting `var()` references and one computing the values `--report` measures, so the CSS could disagree with its own contrast report. Now a single source in `bridge.ts`.
15
+ - **The parity harness and the fixture generator both dropped `seedShade`** on the way into `exportTokens` — the same desync in test form. The `seed-shade` fixture had been pinning the wrong value as faithfully as it would have pinned the right one.
16
+
17
+ ### Added
18
+
19
+ - **`--ramps <names>`** — scope output to colour families. A family is one colour plus everything computed against it: its ramp, its alias ramp, and its semantic tokens. That is the safe unit to regenerate alone, because the contrast search that picks its foregrounds runs inside it.
20
+ - **`--merge`** — rewrite only the declarations a run generates into the file at `--out`, preserving every other line byte for byte. A family spans four blocks (`:root`, light, dark, and the `prefers-color-scheme` fallback); the media copy is the one a hand-splice forgets, leaving system-dark on the old colour.
21
+ - **`--check` honours `--ramps` and `--merge`.** A full check on a part-hand-edited file reports drift forever and cannot tell a wanted edit from a mistake; a scoped check compares only what the run generates.
22
+ - **The output states its own override contract**, built from the selectors each file actually emitted: the blocks are unlayered, here is the specificity to match, check both colour schemes, and a `--color-*` ramp step cannot be intercepted this way at all because Tailwind inlines its literal value into every utility.
23
+ - **`--report` covers what a palette can be silently wrong about** — where the semantics landed against their anchor, peak chroma per ramp (a seed can be chromatic by the numbers and still read as grey), and surface and utility contrast, which nothing had measured before. Ring is judged against 1.4.11's 3:1 rather than the body-text bar; border is reported without a verdict, since the generator cannot tell a decorative rule from a control boundary. These are reported but not scored, so the number stays comparable with earlier versions.
24
+ - npm metadata: keywords (there were none), homepage, bugs, and `repository.directory`.
25
+
26
+ ### Changed
27
+
28
+ - `--vanilla` and `--replace-palette` warn instead of being silently ignored. For an agent a silent no-op is worse than an error: it leaves a false belief about the output.
29
+
30
+ ### Notes
31
+
32
+ - **Default output is effectively unchanged.** Across all five formats the only differences in the entire release are two selector lines and a comment block — every colour value in every default fixture is byte-identical. Only a non-default `--seed-shade` moves, which is the bug being fixed.
33
+ - **`--merge` against a file generated before 0.4.0** will refuse: the old file carries the previous dark selectors, so a new slice cannot place its blocks. It leaves the file untouched rather than half-applying. Regenerate once, then `--merge`.
34
+ - On the default seed, `--report` shows the focus ring clearing neither mode against the canvas (1.82:1 light, 2.71:1 dark). Left as-is because changing it shifts every palette; it is at least visible now.
35
+
36
+ ## 0.3.0
37
+
38
+ ### Changed
39
+
40
+ - **`tailwind-v4` clears Tailwind's stock palette by default** (`--color-*: initial`), so a colour class the file does not define fails to compile rather than rendering off-brand. If a project does not own `--color-slate-900`, `bg-slate-900` yields Tailwind's stock slate — off-brand, compiles cleanly, reads as deliberate in review, and survives a re-theme. Better a build error.
41
+ - `--no-replace-palette` opts out, for an existing Tailwind codebase still using stock hues. `--replace-palette` becomes a no-op.
42
+
43
+ Tailwind's `transparent`, `current` and `inherit` are not part of the `--color-*` namespace and are unaffected.
44
+
45
+ ## 0.2.1
46
+
47
+ ### Fixed
48
+
49
+ - The 0.2 API was missing from the package barrel. `selectTokenSections`, the section and shade helpers and the provenance functions all worked from the CLI — which imports modules directly — while being unreachable to programmatic callers. Added a test asserting every CLI capability is exported.
50
+
51
+ ## 0.2.0
52
+
53
+ Made the Tailwind v4 output usable, and gave the CLI a verification story.
54
+
55
+ ### Fixed
56
+
57
+ - **`@theme static`, not plain `@theme`.** Tailwind tree-shakes a plain theme block down to the tokens some utility references, silently and with no build error. Measured on a default palette that dropped **47 of 140** colour tokens, including every `red`/`green`/`yellow` ramp, so `bg-red-500` fell back to Tailwind's stock red.
58
+ - **Semantic aliases are re-bound in every mode block.** Custom properties inherit their *computed* value, so `--color-primary: var(--primary)` declared only in `@theme` captured the light value and did not re-resolve inside a scoped `[data-theme="dark"]` subtree — a dark card on a light page kept the light colour. `<html class="dark">` happened to work either way, being the same element, which is why it went unnoticed.
59
+ - **`tailwind-v4` mode selectors match the `css` export** — `[data-theme="dark"], .dark` rather than `.dark` alone — and it gained the `prefers-color-scheme` fallback it had never had.
60
+ - **Primitive naming converged on `--color-*` across formats**, so `css` and `tailwind-v4` are interchangeable. Previously each was internally consistent but they could not be mixed.
61
+ - **A seed outside 15–98% lightness no longer inverts the ramp.** It was reproduced exactly at its anchor while its neighbours were clamped, so `#0a0a0a` gave shade 500 lighter than 600. Pre-existing; reproduces at the default anchor on 0.1.6.
62
+
63
+ ### Added
64
+
65
+ - **`--seed-shade <25..950>`** — place the brand colour somewhere other than 500. Brand colours arrive as whatever they are, and a deep navy or pale tint pinned to the middle leaves no headroom on one side. Each side's easing curve is resampled onto its new step count and the chroma envelope follows the anchor.
66
+ - **`--shades <tailwind|full|list>`** — choose which steps exist. Tokens naming a dropped step snap to the nearest emitted one, and every substitution is reported, because snapping changes a design decision.
67
+ - **`--only <ramp|primitives|semantic|surface|utility>`** — slice by tier, to keep generated colour separable from hand-tuned files.
68
+ - **`--seed <file.json>` / `--stdin`** — replay a saved configuration; flags still win over it.
69
+ - **`--check`** — regenerate in memory and compare against `--out`, exiting non-zero on drift. Reads a provenance header, so it distinguishes a generator upgrade from a hand edit.
70
+ - **`--report`** — the measured contrast of every semantic pairing, with a score.
71
+ - **`--replace-palette`** — clear Tailwind's stock palette (default from 0.3.0).
72
+ - A provenance header naming the version and a fingerprint of the inputs.
73
+ - Structural invariant tests, covering what a golden fixture cannot: bytes can be stable and still be incoherent CSS. Chief among them, every `var(--x)` an export emits must resolve to a `--x:` the same output defines.
74
+
75
+ ### Removed
76
+
77
+ - **shadcn/ui compatibility aliases** (`--background`, `--card`, `--secondary`, `--sidebar-*`, `--chart-*`) and the **`lovable` format**, which was a shadcn-shaped `globals.css`. `exportToLovable` and `ExportOptions.compat` are gone.
78
+
79
+ ### Deprecated
80
+
81
+ - `--vanilla` — the aliases it switched off no longer exist, so it is the only behaviour.
82
+
83
+ ## 0.1.7 — do not use
84
+
85
+ Published by mistake: this is the breaking 0.2.0 payload under a patch version, so a caretted `^0.1.6` resolves to it and picks up breaking changes with no version signal. Use `0.1.6` for the old behaviour or `0.2.1`+ for the new.