Skip to content

← All changelogs

typestyles

packages/typestyles/CHANGELOG.md

0.37.0

Minor Changes

  • #353 e72531e Thanks @dbanksdesign! - breakpoint(name, 'max') (and 'maxHeight') derived from a stored min-width / min-height condition now emits an exclusive range query (@media (width < 48rem)) instead of the inclusive (max-width: 48rem). min and max for the same breakpoint now partition the viewport instead of both matching at exactly the breakpoint width. Breakpoints stored as (max-width: …) are unchanged.

  • #352 c3640c6 Thanks @dbanksdesign! - tokens.declare() refs are now enumerable and strict: Object.keys / Object.entries / spread list a group's schema keys, and a path that isn't in the schema returns undefined instead of a phantom var(--…) proxy. Group proxies still contribute nothing when used as theme overrides. tokens.entries() / tokens.walk() remain the way to enumerate every leaf.

  • #369 2f20a5b Thanks @dbanksdesign! - theme.override({ name, extend }) adds new token namespaces to a child theme. They are registered once, emitted on the child's class, and typed on the returned theme's tokens (Theme<E & X>). tokens still patches existing namespaces only. createTheme({ tokens }) and tokens.ensureNamespace() already cover the root-theme side.

  • #370 e997f7d Thanks @dbanksdesign! - Breaking: every token leaf is now a { name, var } ref instead of a bare var(--…) string. This covers tokens.create(), tokens.use(), theme.tokens, and ctx.tokens in override and theme components factories, so they match tokens.declare() refs and component vars. Refs coerce to var(--…) in template strings and when used directly as style values or as values of other tokens, so most code keeps working; code that relied on a leaf being a string (typeof, .startsWith, === against a string) should use .var. TokenRefTree leaves are typed as the new UntypedTokenRef, which is accepted by every CSS property. isTokenRef is now true for plain created leaves.

  • #371 32d4349 Thanks @dbanksdesign! - Theme boundary cleanup. Token refs are accepted as values in CreateTokenValues (tokens.create, createTheme({ tokens }), mode leaves, Theme.override patches) and serialize to var(--…). Theme.override patches accept partial mode leaves ({ dark: '#fff' }); a scalar parent fills the omitted modes. Breaking: Theme.tokens is required, so no !/?. is needed; reading it on a theme from the low-level createTheme() now throws a pointer to tokens.createTheme() instead of returning undefined.

  • #372 97d0634 Thanks @dbanksdesign! - createTypeStyles(...).withTokenRefs(designTokens) records the instance's built-in token refs at the type level (runtime no-op, same instance), so ctx.tokens in tokens.createTheme({ components }) factories is typed with those refs plus the theme's own tokens namespaces, instead of a loose any-namespace bag. createTheme now infers tokens as its own type parameter so factories can see them. Declared true schema leaves are typed as refs (UntypedTokenRef), matching their runtime shape.

Patch Changes

  • #374 55791d9 Thanks @dbanksdesign! - breakpoint(name, 'maxHeight') derived from a min-width breakpoint is now exclusive ((height < …)), like 'max'. Previously only same-axis conversions (min-height → maxHeight) were exclusive, so maxHeight still emitted an inclusive (max-height: …) for width-based breakpoints.

  • #364 05b7e90 Thanks @dbanksdesign! - Mode-aware { light, dark } values only compile to light-dark() when both sides are colors or images. Keywords such as normal/screen, none and filter functions used to be treated as colors, producing light-dark(normal, screen), which is invalid and silently fell back. They now emit the light value plus a dark-mode override rule, like shadows already did. Color detection recognizes CSS named colors, transparent, currentcolor, system colors, hex and color/image functions.

    The "cannot use light-dark() — emitting a dark-mode override rule instead" warning is gone (tokens and component vars): the override rule is the supported output, not something to fix.

  • #370 e997f7d Thanks @dbanksdesign! - ctx.tokens in override({ styles: (ctx) => … }) and createTheme({ components }) factories now returns real { name, var } refs for every leaf, as OverrideTokenNode promises. Before, tokens.space.md.var was undefined at runtime, so declarations written against the types were silently dropped. ${tokens.space.md} still interpolates to var(--…). tokens.use() and theme.tokens are unchanged (they are typed as var() strings).

0.36.1

Patch Changes

  • #359 1405fe3 Thanks @dbanksdesign! - Fix auto-routed recipe var defaults overriding inherited values (regression in 0.36.0, #329). A slot that reads a var now gets the var's default, and its override() theme values, only where it has no host ancestor (a portaled popup), through .slot:where(:not(.host *)). Before this fix the default was declared on the slot unconditionally. That declaration beat the value the slot should inherit from the host: a variant (a tone colour), an inline style or a value set per item (a rating star's fill), so those stopped reaching the slot. Explicit slots options keep declaring the default unconditionally.

  • #355 0506457 Thanks @dbanksdesign! - Stop warning when a syntax: '*' var/token has a var()/env()-dependent value. @property with * adds nothing (no type, no interpolation), so skipping it is the correct result; typed syntaxes without a usable initial still warn.

0.36.0

Minor Changes

  • #329 1bb8e7f Thanks @dbanksdesign! - Auto-route recipe var defaults to slots that read them (#322). Recipe vars defaults were declared on the var host slot plus any slots listed in the var's explicit slots option. A slot rendered outside the host element (a portaled popover, a flyout) that read a var without being listed silently computed var(--x) to the @property initial-value instead — for atProperty.color that is transparent, so the element disappeared.

    • While building a recipe, TypeStyles now records which slots read vars.x.var in their styles — in base blocks, variant options, and compound variants — and emits the var's default on each of those slots too, so the default reaches every slot whose styles use it no matter where the slot renders.
    • Theme (override()) values for the var are emitted on those slots as well, so portal-rendered slots pick up theme overrides without relying on inheritance.
    • The explicit slots option is now an override for slots that must carry a var without reading it in the recipe styles (for example a slot styled only through a consumer override); reads and explicit slots lists union, and defaults are never emitted twice on the same slot.
    • Dimensioned / flat recipes are unaffected (there is only the host slot).
  • #338 54535af Thanks @dbanksdesign! - Add real CSS source maps for extracted CSS. Enable with extract.sourceMap: true in @typestyles/vite. Each extracted rule is mapped back to the recipe() / style() call site via a VLQ source map emitted as a companion .css.map asset, referenced by a /*# sourceMappingURL=... */ comment. The dev server also serves the map so the same mappings are available during development. The shared @typestyles/build-runner extraction pipeline now captures per-rule source locations and generates the map, and typestyles exposes getRegisteredCssForSourceMap() for consumers that need the raw mapping data. This complements extract.sourceComments and typestyles/inspect with a standard, tool-friendly source map.

  • #336 9793af7 Thanks @dbanksdesign! - Add dev-only inspection helpers for runtime style debugging. The new typestyles/inspect entry point exports inspect(className), inspectClassList(classNames), and inspectElement(element), and registers window.__TYPESTYLES_INSPECT__ for console use. In attribute mode, opt in to data-ts-source attributes by setting globalThis.__TYPESTYLES_DEV_INSPECT__ = true (or { root } to relativize paths). This complements the existing extract.sourceComments option, which covers extracted CSS, by addressing the runtime injection path where CSSStyleSheet.insertRule strips comments. The Vite plugin now auto-imports typestyles/inspect in dev so the global is available without manual imports.

  • #334 f12cf4d Thanks @dbanksdesign! - Add inheritOverride option to recipe vars so ancestor custom-property values are not shadowed by the host class default (#333).

    Recipe vars defaults are normally declared on the recipe's host class — for example .var-ui-code-block { --var-ui-code-block-fontsize: var(--var-ui-fontSize-sm) }. Because the host class targets the same element, this re-declaration shadows any value set on an ancestor, so "set this component's var for everything in this region" did not work the way a custom property normally would.

    • A recipe var can now be marked with inheritOverride: true:

      ts
      recipe({
        name: 'code-block',
        vars: {
          fontSize: { value: 'var(--fontSize-sm)', inheritOverride: true },
        },
        styles: ({ vars }) => ({
          base: { fontSize: vars.fontSize.var },
        }),
      });
      
    • With inheritOverride: true, the default is emitted as a var(--name, <default>) fallback wherever the var is read, instead of being declared on the host class. An ancestor can now set --code-block-fontsize and the component will use that value.

    • The host class no longer re-declares the default for inheritOverride vars, and the default is not copied onto routed slots either; read sites always carry the fallback.

    • typestyles/lite plans record the fallback value so the zero-runtime handle's .vars.x.var matches the full runtime.

    • Non-inheritOverride vars keep the existing behavior: defaults are declared on the host and routed slots as before.

  • #328 0a8e18c Thanks @dbanksdesign! - Add runtime token-ref introspection (#321). Token refs from tokens.declare() / tokens.create() are lazy proxies whose has trap used to return true for every key, making a token group indistinguishable from a leaf at runtime ('var' in group was true, and reading group.var handed back another proxy for a custom property that does not exist).

    • New isTokenRef(value) export: true only for token leaf refs (the { name, var } objects a tree returns for leaf paths); groups always return false.
    • New tokens.entries(refs) / tokens.walk(refs, visit): enumerate the leaves of any refs tree or subtree (from declare, create, or use) as [path, ref] pairs — namespace-relative dashed paths in declaration order, refs normalized to the { name, var } shape.
    • The has trap on token refs proxies is now honest: 'var' in ref is true only for leaves, and 'path' in tree is true only for declared or created paths. A token path literally named var, name, or length wins over the member shims in both in checks and property access.
    • New TokenLeafRef type export (the { name, var } leaf shape).

Patch Changes

  • #326 d083e60 Thanks @dbanksdesign! - Normalize bare-length breakpoint values to (min-width: …) media conditions. Registering breakpoints: { xl: '80rem' } and calling breakpoint('xl') (or using xl in responsive property values) used to emit the invalid, never-matching query @media (80rem); it now emits @media (min-width: 80rem), and the breakpoint() return type reflects the wrapped condition. A dev warning is logged when a bare value is normalized.

  • #330 c2f9194 Thanks @dbanksdesign! - Keyframe stops now use the same value serialization as styles: unitless properties (e.g. opacity, lineHeight, fontWeight) keep their numbers unitless instead of getting an invalid px appended, and custom properties (--*) never receive a unit. Previously { opacity: 1 } in a keyframe stop serialized as opacity: 1px, which the browser silently dropped.

  • #332 58a9482 Thanks @dbanksdesign! - Fix crash when a slot recipe has a slot named name (or length): these collide with read-only own properties of functions, which previously threw during recipe creation and took down all extracted CSS. Slot accessors are now defined with Object.defineProperty so reserved names are supported.

  • #331 e303365 Thanks @dbanksdesign! - Theme token values no longer emit :root rules at runtime. createTheme({ tokens }) and Theme.override({ tokens }) register each namespace through tokens.create, which also emitted the theme's values as :root { --scope-ns-token: … } custom properties plus :root-anchored dark-mode override rules for leaves that cannot use light-dark() (e.g. shadow tokens with { light, dark } leaves). Importing a theme module therefore restyled the whole page — on a dark-mode visit every element picked up that theme's dark shadows, not just elements under .theme-{name}. Theme token values now live only on the theme class, which createTheme already emits (matching the zero-runtime extraction output), and the shared :root value tree is left untouched so a later tokens.create() cannot re-emit theme values either.

0.35.2

Patch Changes

  • #316 e861e27 Thanks @dbanksdesign! - compile: true keeps recipe .vars. Client plans now record each recipe's var refs, and the typestyles/lite handle exposes the same { name, var } tree, so components that assign recipe vars per instance no longer crash in zero-runtime builds (#315).

    recipe.vars (and the tree c.vars() returns) is now a frozen plain object instead of a Proxy, in both runtimes: reads are plain property lookups, and Object.keys, spread and JSON.stringify see the nested refs. Dashed paths still read the same ref (vars['track-color'] is vars.track.color).

0.35.1

Patch Changes

  • #312 839fb80 Thanks @dbanksdesign! - Restore CSS keyword value suggestions in style objects. CSSValue is now (string & {}) | number (the csstype pattern), so display: '|' and flexDirection: '|' suggest csstype keywords again inside style(), recipe styles blocks and callbacks, and slot variant options. Any string is still assignable, so widened inferred values keep working.

    Also speeds up typechecking code that uses withUtils / createStyles({ utils }): CSSPropertiesWithUtils no longer makes TypeScript compare every csstype value union against a generic mapped type.

0.35.0

Minor Changes

  • #310 ad6fe59 Thanks @dbanksdesign! - Add an experimental compile-time transform (compile: true) for zero-runtime client bundles.

    Extraction now records a small JSON plan per recipe() — base classes, slots, dimensions and defaults, i.e. everything a call needs — in the same Node run that produces the CSS (runTypestylesExtract returns { css, plans }; runTypestylesBuild is unchanged). With compile: true, the Vite, Rollup, esbuild (and Bun), and webpack (and Rspack) integrations replace recipe({ name, ... }) definitions in client bundles with createAttrsRecipeFromPlan(<plan>) from the new typestyles/lite entry (under 1 KB gzipped), and mark calls of style factories imported from typestyles (createTypeStyles, createStyles, createTokens, createGlobal) as pure. The style configs, token tables and CSS machinery they referenced then tree-shake away. Class names, data-* attributes and the emitted CSS are unchanged.

    Plans cover attribute-mode dimensioned and slot recipes, flat and multi-slot recipes, and the class-name modes (semantic, bem, template, hashed, compact, atomic) for dimensioned recipes (with compound variants) plus slot recipes in semantic/bem/template. Parity with the real runtime is tested across a grid of selections. Calls that can't be planned (non-literal names, spreads in the recipe config, a name used in more than one scope, themes/tokens whose results are read at runtime, recipes in unsupported shapes) keep the runtime, and the Vite and Rollup integrations warn when a substantial part of it remains.

    On var-ui's bundle fixtures this removes about 80–105 KB of minified JS (button-only 312.7 → 230.2 KB, form-kit 457.9 → 367.3 KB, date-kit 512.9 → 421.7 KB).

    @typestyles/vite returns two plugins when compile: true (the transform must run after Vite's own TypeScript transform); otherwise it still returns a single plugin. Rewritten modules keep accurate source maps, still go through duplicate-namespace checks, and are re-transformed in watch mode and with webpack's cache so plans never go stale. Plans are only recorded while extraction runs (getClientPlans() is empty in normal runtime builds), and extraction now returns its result through a temp file, so style modules that log to stdout no longer affect it. @typestyles/build-runner gains the shared transform (transformRecipeCalls, indexPlans, …) and acorn, magic-string and @jridgewell/remapping dependencies.

  • #307 429d477 Thanks @dbanksdesign! - Zero-runtime client builds now ship no CSS insertion runtime — for every typestyles entry point.

    typestyles publishes its stylesheet module (dist/sheet.js) next to a no-op sibling (dist/sheet-noop.js) that exports the same API but does nothing. Every other module reaches the sheet through that one file, so in mode: 'build' the bundler integrations just redirect it in client bundles. The stylesheet state, CSSOM/DOM plumbing, insertion registry and dev-time collision bookkeeping never enter the module graph, while class names and data attributes are computed identically.

    • One module graph, one registry: typestyles, typestyles/css, typestyles/color, … are all covered, with nothing to import differently and no specifier rewriting.
    • @typestyles/vite (and @typestyles/astro) and @typestyles/rollup: resolveId hook (client builds only for Vite). @typestyles/esbuild: onResolve hook (skipped for platform: 'node'). @typestyles/webpack and @typestyles/next/build: module-factory hook (non-node targets / client bundles only; server bundles keep the real runtime for SSR collection).
    • mode: 'runtime' / 'hybrid', development builds, and server/SSR/node builds keep the full runtime.
    • Vite, Rollup and webpack warn at build time if the real sheet still ends up in a zero-runtime client bundle.
    • Development diagnostics (namespace/class-name collision tracking) are gated behind the sheet, so they are absent from zero-runtime bundles.
    • @typestyles/build-runner exports toZeroRuntimeSheetId, isSheetRequest, findRealSheetModules, zeroRuntimeLeakMessage and ZeroRuntimeSheetWebpackPlugin for custom integrations.
    • The package also declares a conservative sideEffects allowlist (hmr, server, build, testing).

0.34.0

Minor Changes

  • #302 910b6e9 Thanks @dbanksdesign! - Add typestyles/dtcg runtime DTCG codec. fromDTCG treats input as untrusted: it enforces maxDepth, maxNameLength, maxTokens, maxErrors and maxWarnings limits (options with safe defaults), allows only letters (including combining marks), digits, - and _ in names, rejects values that could break CSS (including comment delimiters, unterminated strings, unbalanced brackets and url(), and reports structured values and other likely mistakes in warnings. toDTCG never throws, skips cycles and stops after maxNodes groups and tokens.

  • #306 6b862ab Thanks @dbanksdesign! - Add opt-in extract.sourceComments to precede each extracted CSS rule with a /* path:line */ comment naming the recipe() / style() call that registered it. @typestyles/vite passes the option through to the extract; paths are relative to the project root. Runtime injection is unchanged because insertRule drops comments.

Patch Changes

  • #305 d951a89 Thanks @dbanksdesign! - Fix slot recipe call results being typed as Record<string, ComponentAttrsResult>. The result is now keyed by the declared slot names, so a mistyped slot is a compile error.

0.33.0

Minor Changes

  • #293 d5f4a08 Thanks @dbanksdesign! - Emit recipe var defaults and theme overrides on slots named by the var, in addition to the host, so a portaled element receives the custom property.

0.32.3

Patch Changes

  • #287 7979a45 Thanks @dbanksdesign! - Build with tsdown (via Vite+) instead of tsup. Public exports and types are unchanged; the output no longer includes JSDoc comments, and @typestyles/next now shares code between its entry points instead of duplicating it.

0.32.2

Patch Changes

0.32.1

Patch Changes

  • #279 e0f6d15 Thanks @dbanksdesign! - Export RecipeCallResult so libraries can declaration-emit a recipe() result without TS4023.

0.32.0

Minor Changes

  • #276 31872bc Thanks @dbanksdesign! - Breaking: recipe() and override() take one object. Positional calls (recipe(name, config), recipe(name, definition, callback), and override(component, config, options)) are removed. Declare slots, variant axes, and vars on that object and put option styles in styles, which is checked against those fields. Every call returns { className, attrs, props }.

0.31.1

Patch Changes

  • #271 5b73636 Thanks @dbanksdesign! - Legacy recipes that return vars: c.vars(...) now expose those names on recipe.vars (name and var), including attribute-mode slot, flat, and dimensioned callbacks. Schema recipes were already typed this way.

  • #273 1e43920 Thanks @dbanksdesign! - Collapse style and recipe signatures onto StylesApi and RecipeFn. Declare component vars with vars on the config or c.vars(); recipe() options are { layer, themeable }.

0.31.0

Minor Changes

  • #269 4c21864 Thanks @dbanksdesign! - BREAKING: Automatic dark fallbacks for token values that cannot compile to light-dark() now match data-color-mode instead of data-mode, on :root or the theme class and on a descendant. Pass colorModeAttribute to createTypeStyles / createTokens to use another attribute, or resolvedDarkWhen on tokens.createTheme() for a custom condition.

0.30.1

Patch Changes

  • #266 0594c19 Thanks @dbanksdesign! - OverrideConfigFor and override() now accept schema-first recipes. Theme configs follow the definition's axes, slots, and c.vars() keys instead of resolving to never.

0.30.0

Minor Changes

  • #260 fe19d88 Thanks @dbanksdesign! - Schema-first recipes: add variant.enum(options, { default }) and variant.boolean({ default }) axis helpers, plus a recipe(namespace, definition, callback, options?) call shape whose style callback is contextually typed from the definition. The callback is checked against the definition: missing options, unknown axes, and unknown option keys are all errors. Schema recipes expose .defaults, an internal-var-typed .vars, derived RecipeVariants (null-free props) / RecipeDefaultsOf / VariantOptions types, and getComponentMeta(recipe).schema for docs generators. Legacy recipe call shapes are unchanged.

0.29.0

Minor Changes

  • #253 dda8658 Thanks @dbanksdesign! - Public API redesign: createTypeStyles returns a flat { style, hash, recipe, tokens, global, … } surface; nested layers: { order, token, style, global? }; global.rule / global.rules; remove root styles / tokens / global singletons. Migrate codemod emits style / recipe via createTypeStyles. Cache-bust extract module imports so Next route CSS re-runs register styles.

Patch Changes

  • #256 b5a2077 Thanks @dbanksdesign! - Fix flat createTypeStyles recipe typing (#254): the factory overloads now discriminate on mode and layers, so mode: 'attribute' factories return attribute recipes ({ className, attrs, props } results) and layered factories get a { layer } override checked against layers.order. The loose (namespace, config: any, options?) => any intersection that degraded callback configs and call results to any is gone. New exported types: SemanticRecipeFn, LayeredSemanticRecipeFn, AttributeRecipeFn, LayeredAttributeRecipeFn; TypeStylesApi is now generic over the recipe signature (TypeStylesApi<Recipe>) with the previous shape as default.

0.28.0

Minor Changes

  • #250 c0b0ef8 Thanks @dbanksdesign! - BREAKING: Remove structured createTheme({ colorMode }) / Theme.override({ colorMode }) patches. Light/dark values are mode-aware token leaves only ({ light, dark } → CSS light-dark()). Keep instance colorModes and conditional modes / tokens.colorMode.* presets.

0.27.0

Minor Changes

  • #246 1b93cff Thanks @dbanksdesign! - Add Theme.source and typed Theme.override() for deriving child themes from a root createTheme. Override patches are deep-partials of the parent token tree (excess keys error). Remove createTheme({ from }) — fork with theme.override({ name, tokens }) instead. Rename ThemeSurface → Theme, ThemePreset → ThemeSource, and ThemeSurfaceOverrideInput → ThemeOverrideInput. Raise main-entry gzip budget (+400 B) for override/source runtime.

0.26.1

Patch Changes

  • #244 7a3ebfd Thanks @dbanksdesign! - Consolidate same-named @layer blocks (and hoist @property) in getRegisteredCss() / SSR / extract output so generated CSS is easier to read.

  • #242 a48f23b Thanks @dbanksdesign! - Fix tokens.create(..., { decl }) rejecting mode-aware { light, dark } leaves. Schema validation now expands those leaves before path checks so declared color slots accept light/dark pairs.

0.26.0

Minor Changes

  • #240 cc0f437 Thanks @dbanksdesign! - Add styles.when / whenStyle to spread ThemeCondition into recipe slot style objects (closes #235). Raise main-entry gzip budget (+400 B) for the new helper.

  • #237 56c9bf1 Thanks @dbanksdesign! - Simplify tokens.createTheme to a single named-argument object: per-namespace values live under tokens (replacing base / extend), presets use from with sibling-field merges (no patch), and docs cover migration from StyleX, Panda, vanilla-extract, and Stitches.

0.25.0

Minor Changes

  • #221 f8e1bb4 Thanks @dbanksdesign! - Add per-instance component registry (getComponent, getThemeableComponents, listComponentNamespaces) and themeable opt-out on styles.component() (#214). Raise main-entry gzip budget (+300 B) for registry runtime.

  • #223 5e4858e Thanks @dbanksdesign! - Add createTheme({ components }) for namespace-keyed recipe overrides on the same createTypeStyles instance (#216). Raise main-entry gzip budget (+400 B) for theme component override runtime.

  • #225 5582a83 Thanks @dbanksdesign! - Add createTheme({ extend }), ThemeSurface.tokens, and tokens.ensureNamespace() (#218). Raise main-entry gzip budget (+400 B) for extend/token-context runtime.

  • #227 b698012 Thanks @dbanksdesign! - Add createTheme({ from, patch }) preset merge for design-system themes (#220). Raise main-entry gzip budget (+400 B cumulative) for preset merge runtime.

  • #222 40ae70b Thanks @dbanksdesign! - Add tokens.disposeTheme() and replace-by-default createTheme (#215). Raise main-entry gzip budget (+600 B cumulative with registry work) for theme disposal runtime.

  • #224 457d7b0 Thanks @dbanksdesign! - Accept inline { light, dark } token leaves in theme overrides with automatic normalization (#217). Export normalizeModeAwareOverrides and normalizeThemeConfig. Raise main-entry gzip budget (+600 B) for normalization runtime.

  • #226 cf3f66c Thanks @dbanksdesign! - Add component registry extract helpers and extract.registeredComponentsModule / include: 'allRegisteredComponents' (#219). The include flag appends a convention themeable-refs registry module to the extract graph when it exists.

0.24.0

Minor Changes

  • #210 4b1f40d Thanks @dbanksdesign! - Add mergeProps and combine helpers for attribute-mode DOM binding, and dev warnings when cx() drops variant attrs. Raise main-entry gzip budget (+800 B) for the new runtime.

0.23.1

Patch Changes

  • #208 b51907a Thanks @dbanksdesign! - Fix invalidateKeys / invalidatePrefix so layered theme rules are dropped from the live stylesheet (CSSOM and #typestyles-fallback) without deleting sibling themes in the same @layer. Nested @media / @supports groupings are walked the same way, emptied groupings are removed, and concatenated fallback text is pruned by registered CSS.

0.23.0

Minor Changes

  • #202 42fb13d Thanks @dbanksdesign! - Add typed vars on styles.override() and symmetric top-level vars on component configs. Recipes expose a recipe.vars ref tree; theme consumers override with the same logical keys on styles.override({ vars }). c.vars() auto-stamps override typing metadata — pass vars: v in the recipe return (no duplicate definition object).

Patch Changes

0.22.0

Minor Changes

  • #199 c0642fd Thanks @dbanksdesign! - Add typed vars on styles.override() and symmetric top-level vars on component configs. Recipes expose a recipe.vars ref tree; theme consumers override with the same logical keys on styles.override({ vars }). c.vars() auto-stamps override typing metadata — pass vars: v in the recipe return (no duplicate definition object).

0.21.0

Minor Changes

  • #196 c749aaf Thanks @dbanksdesign! - Add supports() and styles.supports() helpers for typed @supports feature-query keys, mirroring the container() pattern. Object forms accept camelCase declaration features (joined with and); string forms pass through raw conditions including not and selector(). Raise main-entry gzip budget (+200 B) for the new helper runtime.

Patch Changes

  • #197 bf6614f Thanks @dbanksdesign! - Fix slot+variant components not emitting c.vars() default assignments when both slots and dimensioned variants are used together.

0.20.0

Minor Changes

  • #192 51a78c0 Thanks @dbanksdesign! - Add relative color syntax helpers (color.from, rgbFrom, oklchFrom) and OKLCH manipulation sugar (lighten, darken, saturate, desaturate, rotate, grayscale) on typestyles/color, plus trigonometric/exponential CSS math helpers (sin, cos, tan, atan2, pow, sqrt, hypot) on the main entry.

Patch Changes

  • #195 40ca798 Thanks @dbanksdesign! - Fix slot-based components not emitting c.vars() default assignments when values reference other CSS custom properties.

0.19.0

Minor Changes

  • #188 0d33463 Thanks @dbanksdesign! - Add syntax-typed design tokens via tokens.declare(): SyntaxRef<'<color>'> (and other CSS syntaxes) for compile-time ref compatibility in create({ decl }) and styles(), while plain tokens.create() without declare stays unchanged.

Patch Changes

  • #190 046d084 Thanks @dbanksdesign! - Fix tokens.use() when passed a tokens.declare() handle — rebuild proxies from declared schema paths instead of resolving an empty namespace. Raise main-entry gzip budget (+200 B) for syntax-typed token runtime.

0.18.1

Patch Changes

  • #186 db05b28 Thanks @dbanksdesign! - Default component c.var(), c.vars(), and .declare() @property registrations to inherits: true, matching tokens.declare() behavior. Explicit inherits: false overrides are preserved.

0.18.0

Minor Changes

  • #185 06de0f6 Thanks @dbanksdesign! - Add mediaQueries constant export with ready-to-use @media (...) strings for prefers-reduced-motion, prefers-contrast, and hover/pointer capability queries (hover, any-hover, pointer, any-pointer), grouped by feature. Drop a leaf value (e.g. mediaQueries.prefersReducedMotion.reduce) directly into a styles.class, styles.override, or styles.component (nested inside base or a variant's style) object as a key.

  • #184 00cf163 Thanks @dbanksdesign! - Add typestyles/testing subpath export (resetAll, onAfterReset, createTestHarness) for coordinating test-state reset across design systems built on typestyles.

Patch Changes

  • #182 748d530 Thanks @copilot-swe-agent! - Default tokens.declare() typed schema leaves to inherits: true for @property registration, including direct atProperty preset leaves, while preserving explicit inherits: false overrides.

0.17.0

Minor Changes

  • #176 939a158 Thanks @dbanksdesign! - Export cloneThemeValues and mergeThemeOverrides for ref-aware theme override merging (Issue #168)

  • #180 1338c06 Thanks @dbanksdesign! - Export ModeAwareTokenLeaf, ModeAwareTokenObject, and TokenRefTree; preserve input shape in tokens.create() return types (nested namespaces, mode-aware leaves, plain scalars).

  • #178 eeb4253 Thanks @dbanksdesign! - Add styles.breakpoint() and styles.media() helpers that build viewport @media keys from configured breakpoints, matching the container() + atRuleBlock pattern for container queries.

Patch Changes

  • #175 f96b133 Thanks @dbanksdesign! - Discriminate slot+variant styles.component() configs so callback recipes infer per-slot return types without casts (Issue #166)

  • #179 200359e Thanks @dbanksdesign! - Export OverrideConfigFor and MultiSlotReturn so design-system consumers can infer styles.override() config shapes from recipe return types (Issue #160)

  • #177 3a8feb2 Thanks @dbanksdesign! - Fix conditions type-checking in styles.override() configs and type mode-aware { light, dark } property values in override and recipe styles (Issue #169)

  • #173 ed956d8 Thanks @dbanksdesign! - Fix CSSProperties assignability for c.vars() computed custom-property keys in nested selectors (Issue #167)

0.16.0

Minor Changes

  • #164 aebb0c0 Thanks @dbanksdesign! - Add mode-aware token leaves ({ light, dark }) on tokens.create() and tokens.createTheme() when colorModes is configured. Color/image-compatible values compile to light-dark() on custom properties; incompatible values (e.g. shadow shorthands) emit dark-mode override rules. createTheme accepts structured colorMode: { light, dark } patches and emits color-scheme: light dark on theme surfaces. Preset mode layers (tokens.colorMode.*) are passed via modes instead of colorMode. Documentation updated in Tokens and Theming patterns guides.

0.15.0

Minor Changes

  • #161 7d24e42 Thanks @dbanksdesign! - Add conditional styles.override() blocks (conditions + ThemeCondition) and colorModes config for { light, dark } property values that compile to light-dark() on color/image properties. Export colorModes constant (['light', 'dark']) for createStyles / createTypeStyles.

0.14.0

Minor Changes

  • #157 f163b08 Thanks @dbanksdesign! - Add atProperty presets (atProperty.color, atProperty.angle, etc.) for spreadable @property registration metadata across tokens, components, styles, and typestyles/css.

    Add typestyles/css subpath with css.atProperty, css.customProperty, css.customProperties, and css.var for exact-name CSS custom property control.

    Add styles.property.declare / styles.property.set and ctx.vars.declare / ctx.var.declare for split @property registration and value assignment. Shorthand styles.property(id, options?) and ctx.vars(definitions) behavior is unchanged.

    Export PropertyRegistration, PropertyRef, and PropertyOptions types. TokenDescriptor and RegisteredPropertyOptions are deprecated aliases.

  • #159 bc7e94d Thanks @dbanksdesign! - Add namespace-optional overloads for tokens.declare(schema) and tokens.create(values) so design systems can register a flat token tree without a namespace segment in emitted --* names.

    When the namespace is omitted, custom property names use --{scopeId}-{path} (scoped) or --{path} (unscoped) instead of --{scopeId}-{namespace}-{path}. Pass { decl } on create() to pair with a namespace-less declare() for schema validation and forward references.

0.13.0

Minor Changes

  • #155 9865095 Thanks @dbanksdesign! - tokens.declare(namespace, schema) accepts a schema object, emits @property for syntax leaves, and infers ref types from the input shape. tokens.create() accepts plain values only (no inline TokenDescriptor); pass { decl } for typed partial fills with merge semantics across calls. Schema-less declare(), declare<T>(), and LooseTokenRef are removed.

0.12.0

Minor Changes

  • #154 0b1c9e8 Thanks @dbanksdesign! - Register @property with a syntax-appropriate placeholder initial-value (e.g. transparent for <color>, 0 for <number>) instead of always skipping registration for var()/env()-dependent token values. The real value still reaches the cascade via the existing unconditional :root declaration. Add TokenDescriptor.initial / RegisteredPropertyOptions.initial to override the placeholder explicitly. Note: a dependent token that previously fell back to CSS's default inherits: true (because @property was skipped) now respects its inherits option like any other typed token — pass inherits: true explicitly if you relied on the old implicit-inheritance fallback.

  • #154 0b1c9e8 Thanks @dbanksdesign! - Add tokens.declare(namespace, options?) — a lazy var(--…) reference proxy for referencing a token before its value exists, either within the same tokens.create() call (self-referencing derived tokens) or across modules without a real import cycle. Names resolve through the same logic tokens.create/tokens.use already use, including scopeId and nameTemplate.

0.11.2

Patch Changes

  • #150 8496b57 Thanks @dbanksdesign! - Allow widened CSS keywords on VariantOptionStyle and block multi-slot overload fallthrough when recipe keys are present

0.11.1

Patch Changes

  • #147 2364f0f Thanks @dbanksdesign! - Tighten VariantOptionStyle for CSS IntelliSense while keeping custom-property assignability

0.11.0

Minor Changes

0.10.0

Minor Changes

  • #141 35e02a7 Thanks @dbanksdesign! - Breaking: semantic component class names now use block, block--dimension-option, and block__slot forms instead of hyphen semantic names. Compound variants now emit chained modifier selectors instead of *-compound-N classes. Attribute mode now kebab-cases data-* names and supports slots, returning per-slot { className, attrs, props } results.

    Upgrade notes: regenerate public-classname snapshots; update hand-written CSS / tests that targeted *-base or *-compound-N. Prefer distinct namespaces for styles.class and styles.component when they would share a base class string — dev builds warn on that collision. See docs migration guide (0.10 semantic naming).

  • #143 34d7fe2 Thanks @dbanksdesign! - Add styles.override() for recipe-shaped typed component restyling, backed by non-enumerable __tsMeta on every styles.component() return and getComponentMeta() for consumers. Supports semantic, bem, template, and attribute naming modes with selectorPrefix + cascade layer options.

    Raises the main-entry gzip budget to 26 KB for the new override runtime.

0.9.0

Minor Changes

  • #130 644a96c Thanks @dbanksdesign! - variantStrategy: 'attribute' (from the unreleased PR #130) is now createStyles({ mode: 'attribute' }) / createTypeStyles({ mode: 'attribute' }) — an instance-wide setting instead of a per-component field, matching how semantic/hashed/compact/atomic already work. Every dimensioned styles.component() call from that instance compiles variants to &[data-{dimension}="{option}"] selectors and returns { className, attrs, props }; slots is rejected at the type level. variantStrategy/defaultVariantStrategy no longer exist. See specs/attribute-driven-variants.md.

  • #132 6be2124 Thanks @dbanksdesign! - Add mode: 'bem' to createStyles/createTypeStyles: dimensioned and slot styles.component() variants compile to BEM modifier classes (block--modifier, block__element--modifier) instead of the default {namespace}-{dimension}-{option} naming. The base/root class drops the -base suffix (the bare block class is the base state). Compound variants compile to chained modifier-class selectors with no synthetic class. Dev mode warns when two dimensions would produce the same modifier class name. See specs/bem-variant-mode.md.

  • #137 9cf89f1 Thanks @dbanksdesign! - Add mode: 'template' to createStyles/createTypeStyles: dimensioned and slot styles.component() variants compile to class names decided by a user-supplied classNameTemplate: (ctx) => string function, instead of a fixed convention. mode: 'bem' is now implemented internally as a built-in preset of this same mechanism — its public behavior for valid input is unchanged, though in development it now also validates that emitted class names are legal CSS identifiers (previously invalid variant/slot names could silently produce a broken selector). See specs/classname-template-mode.md.

0.8.2

Patch Changes

  • #125 7111074 Thanks @dbanksdesign! - Fix styles.class() throwing when the same class name is registered twice in one process — e.g. meta-frameworks with multiple server module graphs in a single process (the Vite Environment API, or RSC frameworks like Waku/Vocs) re-evaluate the same source module once per environment, which previously crashed SSR with [typestyles] styles.class('name', ...) was called more than once for scope '...'.

    In development, styles.class() now matches the re-registration behavior styles.component() already had: it invalidates the previous rule(s) for that class and re-registers instead of throwing (the same trade-off already made for HMR / out-of-order dispose re-execution). Production behavior is unchanged — it never threw there.

    Also fixes a related bug in the shared HMR invalidation path (invalidateKeys / invalidatePrefix, used by both styles.class() and styles.component()): re-registering before the prior registration's CSS had flushed left the stale CSS text queued alongside the new CSS, producing a duplicate, conflicting rule once flushed.

0.8.1

Patch Changes

  • #123 f641e3f Thanks @dbanksdesign! - Fix two runtime injection bugs that could leave pages completely unstyled in real browsers:
    • @property registrations whose initial value contains var() / env() now degrade to the universal "*" syntax without an initial-value (the CSS spec requires initial values to be computationally independent, so browsers rejected the typed rule outright). inherits behavior is preserved, and defaults still cascade via the :root / base-style assignments.
    • Rules rejected by CSSStyleSheet.insertRule are now appended as text to a dedicated <style id="typestyles-fallback"> element instead of the main managed element. Appending text to the main element made browsers re-parse it from its text content, silently discarding every rule previously inserted through insertRule — a single rejected rule wiped the entire runtime sheet.

0.8.0

Minor Changes

  • #119 10edb85 Thanks @dbanksdesign! - Add styles.scope() for proximity-correct nested theme overrides via CSS @scope (P5.3).

    Introduce @typestyles/cli, a new package with the typestyles binary and subcommands. The first command is typestyles snapshot, which scans semantic styles.class / styles.component class names and writes .typestyles-public-classnames.json for semver guarding. Snapshot logic and heavy deps (typescript, fast-glob) live in this package so the core typestyles runtime stays lean.

    Also ships the opt-in @typestyles/no-removed-public-classname ESLint rule (consumes @typestyles/cli programmatically).

  • #116 7ea7356 Thanks @dbanksdesign! - Add 'descendant' as a third scope value on tokens.when.attr / tokens.when.className theme conditions, compiling to a descendant-combinator selector (.theme-name [data-x="y"]) so a mode can match a marker element inside the themed subtree — the relationship a fixed-tone surface (e.g. an always-dark toast on a light page) needs. when.not() on a descendant-scoped condition is rejected with an explicit dev warning (P5.4).

  • #121 4be825a Thanks @dbanksdesign! - Add responsive object syntax for breakpoint shorthand in style property values. Register breakpoints once via createStyles({ breakpoints }) or createTypeStyles({ breakpoints }), then use { base, md, lg } on CSS properties — expands to @media blocks at serialization time. Supports _ alias, breakpoints.fromTokens, atomic mode, and dev-time validation for unknown breakpoints.

  • #120 2bfa8a4 Thanks @dbanksdesign! - Add optional nameTemplate on createTokens and tokens.create for custom CSS custom property names — migration from existing variable systems, Style Dictionary / DTCG naming conventions, and cross-namespace aliasing. Default --{scopeId}-{namespace}-{path} behavior is unchanged when nameTemplate is omitted. Theme overrides, tokens.use(), and @property registration share the same resolved names.

0.7.0

Minor Changes

  • #94 47bc7bd Thanks @dbanksdesign! - Document streaming SSR and RSC patterns against request-scoped collection (P1.9). Add TYPESTYLES_STYLE_ID, typestylesStyleHtml, injectStylesIntoHtml, and streamingDocumentShell helpers on typestyles/server. Expand the SSR guide with request-safe collection, RSC decision table, and streaming examples.

  • #95 f06fb48 Thanks @dbanksdesign! - Rename hash-only class naming mode to compact and implement true per-declaration atomic output with cross-component dedup (P2.10). styles.class, styles.component, and styles.hashClass in atomic mode now emit one class per CSS declaration; identical declarations share a class.

  • #105 0729526 Thanks @dbanksdesign! - Add @property registration for typed token leaves ({ value, syntax, inherits? } in tokens.create) and standalone styles.property(id, opts). Both return { name, var, toString } refs (P3.24).

  • #112 b701e62 Thanks @dbanksdesign! - Add typestyles/color-scale subpath with parseColor (hex → OKLCH), generateRamp (perceptual OKLCH ramps), and contrastRatio (WCAG relative luminance). Design-system palette ramps now call the shared generateRamp implementation (P5.1).

  • #113 3459b70 Thanks @dbanksdesign! - Add typestyles/token-scale subpath with generateGeometricScale (modular ladders like font sizes from { base, ratio, steps }), generateLinearScale (grid-based ladders like radii from { base, multiplier, steps }), and expandDurationBand (a { min, base, max } motion band from { base, ratio }, rounded to the nearest 5ms by default). Pure numeric outputs with zero naming opinions — mapping steps to token names stays a design-system concern (P5.2).

Patch Changes

  • #101 23bd4f1 Thanks @dbanksdesign! - Consolidate planning docs: remove 6 stale files, update ARCHITECTURE.md and IMPROVEMENTS.md.

  • #98 e17b8a0 Thanks @dbanksdesign! - Add npm landing-page READMEs for every published package, an examples index with contributor guidance, and doc-to-example cross-links (P2.13).

  • #103 a4ccfbc Thanks @dbanksdesign! - styles.compose() now infers merged variant selection types from composed component functions (P3.22). Unknown variant keys are rejected by TypeScript and logged in development when no composed function accepts them.

  • #104 8de36fa Thanks @dbanksdesign! - tokens.use() now infers token shapes from a tokens.create() return value (P3.23). Pass the created ref for cross-package typing, or declare a TokenRegistry on createTokens() for string-based lookups.

  • #107 aff0a8c Thanks @dbanksdesign! - Fix reset() to also clear registeredNamespaces — previously required manual clearing in tests.

  • #102 a984b6b Thanks @dbanksdesign! - Dev-mode warning for unscoped namespace collisions (P3.5.2): styles.component() now emits a console.warn when the same namespace is registered more than once without a scopeId, helping catch cross-file class name collisions before they reach production.

0.6.0

Minor Changes

  • #78 aa88d25 Thanks @dbanksdesign! - Add createStyles({ utils }) (and createTypeStyles({ utils })) so shorthand style expanders attach to one styles instance without a separate withUtils object. styles.withUtils remains on the default export; there is no global registerUtils.

  • #93 60a8383 Thanks @dbanksdesign! - Add debug names and optional fallbacks to createVar(). Document the dynamic styling story on a dedicated page and cross-link from performance and best-practices guides.

  • #90 f979149 Thanks @dbanksdesign! - Move color helpers to the typestyles/color subpath entry to shrink the main runtime bundle (~14.9 KB gzip). CI enforces a gzip budget on dist/index.js.

    Breaking: import { color } from 'typestyles' is removed — use import { color } from 'typestyles/color' (or named imports from that subpath).

  • #89 b29a531 Thanks @dbanksdesign! - Request-safe SSR collection (P0.4): isolate collectStyles / collectStylesFromModules sheet state with Node AsyncLocalStorage, and add async render support to collectStyles.

Patch Changes

  • #86 fd16bad Thanks @dbanksdesign! - Fix silent-wrong-output correctness issues (P0.1): refresh the unitless CSS property set, prefix scopeId onto semantic class names, add dev-mode class-name collision warnings, and wire useTypestyles to subscribeRegisteredCss via useSyncExternalStore.

0.5.0

Minor Changes

  • #52: Add built-in cx() utility for joining class names with falsy-value filtering

  • #63: Add first-class container query helpers: container() for typed @container keys, readable containerRef() / createContainerRef() for container-name, and atRuleBlock() / styles.atRuleBlock() so computed @… nests type-check without casting. Documentation and design-system example updated.

  • #62: Add opt-in CSS cascade layers (@layer) and a unified createTypeStyles factory.

    • createStyles({ layers }) — Pass a layer tuple (as const) or { order, prependFrameworkLayers? }. Emits a single @layer …; preamble (once per stack) and wraps rules in @layer name { … }. When enabled, every class, hashClass, and component call must pass a third argument { layer: … } (with hashClass, use { layer, label? } instead of a positional label).
    • createTokens({ layers, tokenLayer }) — When layers is set, tokenLayer is required; :root and theme CSS are emitted into that layer.
    • createTypeStyles(options) — Returns { styles, tokens } with one shared scopeId and optional layers / tokenLayer for both class and token output.
    • createTheme / createDarkMode — Optional fourth argument for layer context when using tokens with layers.

    Default behavior is unchanged when layers is omitted (flat CSS, no layer option).

    New exports include createTypeStyles, StylesApiWithLayers, CreateStylesInput, LayerOption, LayeredComponentFn, cascade layer types (CascadeLayersInput, ResolvedCascadeLayers, etc.), and ThemeEmitLayerContext.

    ClassNamingConfig may include resolved cascadeLayers. The sheet exposes registerCascadeLayerOrder for the preamble.

    Documentation: new cascade-layers doc (docs/content/docs/cascade-layers.md), updates to class naming, API reference, and tokens. The design-system example uses createTypeStyles.

  • #61: Add function overload for styles.component(namespace, (ctx) => config) with component-scoped internal custom properties: ctx.var(id, options?) and ctx.vars(definitions) using the same nested shape as tokens (string/number leaves or { value, syntax?, inherits? }). Default values are merged into base; optional syntax registers @property. ctx.var now takes value (not initialValue) for defaults and typed registration. New exports: ComponentConfigContext, ComponentVarDefinitions, ComponentVarDescriptor, ComponentVarNode, ComponentVarRefTree, and related *Input types for the component overload.

  • #73: typestyles: Extend global.fontFace / FontFaceProps: src may be a string or an array of fragments (joined into one CSS src); optional @font-face descriptors sizeAdjust, ascentOverride, descentOverride, and lineGapOverride; dedupe keys use normalized src (including array vs equivalent comma-separated string). Export FontFaceSrc. When the same rule dedupe key is registered again with different CSS, the later rule is skipped and non-production builds warn on the mismatch (re-registration with identical CSS stays silent). Tests cover multi-src font faces, metric overrides, and global dedupe warnings.

    @typestyles/next: README examples use styles.component and default variant calls; add Fonts and local files guidance for Next extraction (public/fonts/, root-relative URLs) versus Vite asset URLs.

  • #72: Add createGlobal for scoped global CSS (optional cascade layers and default globalLayer), wire global into createTypeStyles, and ship a typestyles/globals entry with Josh Comeau’s reset (plus layer support for layered stacks) and small selector recipes.

    • createTypeStyles now returns { styles, tokens, global }. With layers, pass optional globalLayer so global.style / global.apply defaults match your stack; tokenLayer remains required when layers are enabled.
    • global.style accepts GlobalStyleTuple recipes (from typestyles/globals) in addition to selector + properties; root global ignores per-call layer (dev warning) — use createGlobal / layered createTypeStyles for @layer.
    • global.apply(...tuples) applies multiple tuples in one call.
    • New content helper for typed CSS content values on the main export.
    • Types: GlobalApiUnlayered, GlobalApiLayered, GlobalStyleTuple.
  • #59: Replace global class naming with instance-based APIs.

    Breaking: Remove configureClassNaming, getClassNamingConfig, and resetClassNaming. Use createStyles({ mode?, prefix?, scopeId? }) for a dedicated style API (same surface as the default styles export). The default import { styles } from 'typestyles' is createStyles() with default options.

    Breaking: createTokens({ scopeId? }) returns the token and theme API (create, use, createTheme, createDarkMode, when, colorMode, plus read-only scopeId). The default import { tokens } from 'typestyles' is createTokens(). When scopeId is set, emitted custom properties and theme class segments are prefixed (sanitized) so multiple bundles on one page do not collide.

    Breaking: Low-level createComponent, createClass, and createHashClass now take ClassNamingConfig as the first argument when imported from implementation modules; application code should use createStyles() or the default styles object.

    Breaking: createTheme and createDarkMode accept an optional third argument scopeId for unscoped usage; instances from createTokens({ scopeId }) bind scope automatically.

    New exports: mergeClassNaming, defaultClassNamingConfig, scopedTokenNamespace, StylesApi, TokensApi, CreateTokensOptions. Style instances expose read-only classNaming.

    Documentation, examples, and the design-system package are updated to describe and use the new pattern.

  • #49: Add ESLint configuration across all packages, examples, and docs. Create shared eslint.base.js config with TypeScript rules and add lint scripts to all package.json files. Update CI workflow to run lint via turbo.

  • #56: Support nested token objects in tokens.create and the same nested shape in tokens.createTheme. Nested keys become hyphenated CSS custom properties (for example color.text.primary → --color-text-primary and var(--color-text-primary)).

    Export flattenTokenEntries and the FlatTokenEntry type so consumers can build --namespace-key declarations with the same rules as the token APIs.

    The design-system example now uses this pattern directly instead of local flatten/ref helpers.

  • #66: Add fileScopeId(import.meta) for per-file scopeId so the same logical class or component name in different modules does not collide. In development, registering the same styles.class or styles.component name twice under one scope throws (with guidance to use scopeId / fileScopeId); production behavior is unchanged. In development, unknown variant dimensions, invalid option values, and unknown flat variant keys emit console.error. createComponent and styles.component overloads use const type parameters for sharper literal inference.

  • #68: Infer multipart slots from the array literal passed to styles.component (and createComponent) using a const type parameter on Slots extends readonly string[]. Slot names are typed as Slots[number], so destructuring and () return Record<…> with known keys and errors on unknown properties—without as const on slots when the array is written inline.

    Type-only: MultiSlotConfig, MultiSlotReturn, SlotComponentConfig, SlotComponentFunction, and related inputs now take a readonly string tuple type parameter (the slots array) instead of a single string union S. Call-site inference is unchanged for typical object literals; advanced extends / explicit generics may need a small adjustment.

    Docs and the design-system example drop redundant as const on slots where inference applies.

  • #57: Breaking: tokens.createTheme now takes a config object with base, and either modes or colorMode (presets). Namespace overrides must live under base (for example { base: { color: { … } } }). It returns a ThemeSurface (className, name, string coercion) instead of a plain class string—use surface.className or `${surface}` where a string is required.

    Adds tokens.when (media, prefersDark / prefersLight, attribute/class scope, selector escape hatch, and / or / not) and tokens.colorMode presets (mediaOnly, attributeOnly, mediaOrAttribute, systemWithLightDarkOverride), plus tokens.createDarkMode as a shorthand for media-only dark overrides.

    Theme rules use stable dedupe keys (theme:{name}:base, theme:{name}:mode:{id}:branch:{n}). In development, empty mode overrides and dubious when.selector / when.not shapes log warnings.

    Types: ThemeOverrides allows deep partial nested token maps; new exports include ThemeConditionNot and DeepPartialTokenValues.

  • #54: Unify multi-variant styling on styles.component with a CVA-style return value: call it for a composed class string (base always applied) or destructure named class strings. Supports dimensioned variants (variants, compoundVariants, defaultVariants), flat variant maps, and slot-based configs.

    Remove styles.create from the public styles API; use styles.component instead.

    Update Vite and Rollup static namespace extraction to match styles.component(...) only (no longer scans styles.create(...)).

  • #64: Add has, is, and where helpers for :has(), :is(), and :where() nested keys (also on styles). Infer literal @container … keys from typed container() arguments so bracket notation mixes with longhands without as CSSProperties; use atRuleBlock when the key is only a generic string. Export ContainerObjectKey and document the pattern in the docs.

Patch Changes

  • #45: Add comprehensive test coverage for previously untested modules: props utils/generate/runtime, typestyles build, and migrate transform/css/files.

  • #34: withTypestylesExtract now sets NEXT_PUBLIC_TYPESTYLES_RUNTIME_DISABLED via next.config env so client bundles disable runtime style injection under Turbopack as well as webpack (webpack DefinePlugin alone does not run for Turbopack). Core sheet reads this env flag alongside __TYPESTYLES_RUNTIME_DISABLED__.

    README: build-time CSS / Turbopack notes; clarify getTypestylesMetadata and fix the previous generateMetadata example. Add @typestyles/next tests for withTypestylesExtract.

    TypeScript: module augmentation + client.d.ts declaration for useServerInsertedHTML (aligned @types/react / @types/react-dom); add typecheck script; restore webpack + typestyles devDependencies and server.d.ts / ./build exports. buildTypestylesForNext now uses collectStylesFromModules from typestyles/build (no separate @typestyles/build package).

  • #50: Add lint-staged for prettier formatting on pre-commit hook and format entire codebase

Unreleased

Breaking changes

  • Instance-based APIs replace global class naming. Removed configureClassNaming, getClassNamingConfig, and resetClassNaming.
    • Use createStyles({ mode?, prefix?, scopeId? }) for a dedicated style API (same surface as the default styles export). Default import { styles } from 'typestyles' is createStyles().
    • Use createTokens({ scopeId? }) for a dedicated token + theme API. Default import { tokens } from 'typestyles' is createTokens(). When scopeId is set, tokens.create / createTheme emit scoped --{scope}-namespace-* variables and .theme-{scope}-{name} classes (sanitized segments).
    • New exports: mergeClassNaming, defaultClassNamingConfig, scopedTokenNamespace, and types StylesApi, TokensApi, CreateTokensOptions.
  • Low-level createComponent, createClass, and createHashClass now take ClassNamingConfig as the first argument when imported from internal modules; app code should use createStyles() or the default styles object instead.

0.4.0

Minor Changes

  • #25: Updating bundler integrations and adding examples

  • #27: Add a new styles.withUtils(utils) API for defining typed style shorthands (for example marginX, paddingY, and size) and using them with styles.class, styles.create, and styles.hashClass.

  • #33: Add configurable class naming modes for gradual adoption across packages:

    • configureClassNaming({ mode, prefix?, scopeId? }) with modes semantic (default), hashed, and atomic.
    • Applies to styles.create, styles.class, styles.component (including slot recipes), and affects prefix / optional scopeId mixing for styles.hashClass.
    • Export getClassNamingConfig and resetClassNaming (for tests).

    Documentation:

    • New site page docs/content/docs/class-naming.md (sidebar: Class naming) describing modes, scopeId, SSR, and testing.
    • Cross-links from Getting Started, Styles, Recipes, Atomic CSS utilities, API Reference, and Testing.
  • #31: Unify variant APIs around styles.component and add first-class multipart slot support via slots.

    Breaking changes:

    • Remove styles.recipe in favor of styles.component.
    • Remove recipe type aliases (RecipeConfig, RecipeFunction, RecipeVariants) and replace with component terminology (ComponentVariants, plus new slot component types).

    New capability:

    • styles.component(name, { slots, base, variants, compoundVariants, defaultVariants }) now returns per-slot class maps for multipart components.

    Naming update for slot mode:

    • Slot base classes now use {namespace}-{slot} (without -base).
  • #23: Add styles.class() for single-class definitions and a three-argument styles.create(name, base, variants) API that automatically includes base styles, then updated the Next.js example to use the new DX without affecting published packages.

  • #26: feat: styles.recipe()

0.3.0

Minor Changes

  • #9: Add support for attribute selectors in nested styles. You can now use [data-variant], [disabled], [data-size="lg"] and other attribute selectors directly in style definitions:

    typescript
    styles.create("button", {
      padding: "8px",
      '[data-variant="primary"]': { backgroundColor: "blue" },
      "[disabled]": { opacity: 0.5 },
    });
    
  • #10: Fix lint errors and TypeScript issues

    • Replace any types with unknown in type definitions
    • Fix empty object types {} in defineProperties
    • Add proper generic type parameters to functions
    • Prefix unused parameters with underscore
    • Add eslint ignores for generated docs files and scripts
    • Fix test assertions to use proper types

Patch Changes

  • #13: Add CI workflow for lint, typecheck, and test

0.2.0

Minor Changes

  • #6: Add new @typestyles/props package for type-safe atomic CSS utility generation, with defineProperties() and createProps() APIs supporting responsive conditions, shorthand properties, and automatic CSS injection.

    Add compose to styles namespace for composing multiple selector functions or class strings. Add createVar() and assignVars() for CSS custom property management. Export insertRules, reset, and flushSync utilities from the sheet module. Add CSSVarRef and RecipeVariants type exports.

0.1.0

Minor Changes

  • #4: Add styles.component() API for multi-variant component styles with support for base styles, variant dimensions, compound variants, and default variants. Add global.style() and global.fontFace() APIs for applying styles to arbitrary CSS selectors and declaring @font-face rules. Update the Vite plugin to support HMR for the new APIs.

0.0.2

Patch Changes

  • #1: Initial release of typestyles - CSS-in-TypeScript that embraces CSS instead of hiding from it.

    Features:

    • Core typestyles library with type-safe CSS styling
    • Server-side rendering support
    • Vite plugin for HMR support