Repository navigation
v2.3.0 — Shared ThemeController, DTCG Tokens, CSS-in-JS Adapters & Modern CSS
TokiForge 2.3.0 introduces a shared headless ThemeController that all framework adapters now build on, W3C DTCG token format support, four new packages (Emotion, styled-components, CMS, design-tools), a modern OKLCH color engine — and a large batch of critical fixes across the core exporter, framework adapters, and the CLI.
✨ Highlights
ThemeController(core) — a headless controller that owns the full theming lifecycle: initial-theme resolution (persisted → option → config default), CSS injection, localStorage persistence, system-theme watching, and change subscriptions. The React, Next.js, Remix, Solid, Svelte, and SvelteKit adapters are now thin wrappers over it, so theming behaves identically in every framework.- W3C DTCG format support —
$value/$type/$descriptiontoken files parse transparently, andTokenParser.toDTCG()exports for Figma Variables, Tokens Studio, and Style Dictionary v4 interop. Both formats can be mixed in one file. - Composite tokens — typography objects flatten to per-part variables, shadow tokens compose to
box-shadowstrings (multi-shadow andinsetsupported), font stacks join into fallback lists, andcubicBezierbecomescubic-bezier(). - Modern CSS output —
TokenExporter.exportLightDarkCSS()emits a single stylesheet using the CSSlight-dark()function +color-schemefor zero-JS light/dark switching, andcontroller.setThemeWithTransition()cross-fades theme switches via the View Transitions API with graceful fallback. - OKLCH color engine & APCA —
ColorUtils.parseColor()(hex/rgb/hsl), OKLCH conversions,generateScale()for Tailwind-style 50–900 palettes, perceptualmix(), andAccessibilityUtils.calculateAPCA()implementing the WCAG 3 candidate contrast algorithm. tokiforge docs— generates a self-contained static HTML styleguide (swatches, CSS variables, values, descriptions) from a token file.
📦 New packages
@tokiforge/emotion— Emotion adapter withThemeProvider,useTheme, andstyledre-export@tokiforge/styled-components— styled-components v5+ adapter with the same API@tokiforge/cms— headless CMS integrations for Contentful, Strapi, and Sanity (fetch & push)@tokiforge/design-tools— Sketch and Adobe XD plugin API adapters
🐛 Critical fixes
- Core:
TokenExporter.flattenTokensdropped ancestor keys —color.primaryemitted--hf-primaryinstead of the documented--hf-color-primary, colliding same-named leaves across groups. Full paths are now emitted everywhere. - Core: chained token references (
{a}→{b}→ value) now resolve fully, with circular-reference protection; shorthand 3/4-digit hex no longer producesNaN. - CLI: the published binary crashed on launch (
require is not defined in ES module scope) — now built as ESM. - Next.js: the
'use client'directive was stripped from the built bundle, breaking App Router usage; the index and server entries now build sequentially with the directive preserved. - All adapters: initial theme application now respects the persisted /
initialTheme/defaultThemeresolution order (previously React had empty initial tokens, Vue injected no CSS on load, and Next.js/Remix ignored the persisted theme).
🛠️ Infrastructure
- Test suites added for the Next.js, Remix, Astro, Solid, SvelteKit, and Storybook adapters; the React suite is re-enabled — 400+ tests across the monorepo now run on every push across Linux, Windows, and macOS on Node 20 and 22.
- New bundle-size CI guard fails the build when gzipped bundles exceed budget.
- New Token Diff GitHub Action comments a design-token change summary on PRs that touch token files.
Full Changelog: 2.2.4...2.3.0