@animus-ui/theming 0.1.0-next.21 → 0.1.0-next.30

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.
Files changed (2) hide show
  1. package/CLAUDE.md +20 -20
  2. package/package.json +1 -1
package/CLAUDE.md CHANGED
@@ -1,28 +1,28 @@
1
- # Animus Theming Package
1
+ # @animus-ui/theming Legacy Theme Builder
2
2
 
3
- ## Key Files
3
+ **Status: Legacy.** Consumers use `createTheme` and `ThemeBuilder` from `@animus-ui/system`, which re-exports them. Do not add new API surface here — extend system instead.
4
4
 
5
- - `src/utils/createTheme.ts` ThemeBuilder fluent API
6
- - `src/utils/serializeTokens.ts` — Token→CSS variable generation
7
- - `src/utils/flattenScale.ts` — Nested object flattening with `-` separator
5
+ ## What This Package Is
8
6
 
9
- ## Theme Flow
7
+ ThemeBuilder fluent API for defining design tokens and their CSS variable bindings. System re-exports `createTheme`, `ThemeBuilder`, `flattenScale`, and `serializeTokens`.
10
8
 
11
- ```
12
- createTheme(base)
13
- .addColors({...}) → flat colors + CSS vars
14
- .addColorModes('dark', {}) → semantic aliases per mode
15
- .addScale('shadows', fn) → custom scales (can reference colors)
16
- .createScaleVariables(key) → convert scale to CSS vars
17
- .build() → final theme object
18
- ```
9
+ ## Emission Tracking
19
10
 
20
- ## Theme Object Structure
11
+ Not all scales produce CSS variables. The distinction matters for extraction:
21
12
 
22
- - **Public scales** (`theme.colors.primary`): CSS var references (`var(--color-primary)`)
23
- - **Private variables** (`theme._variables`): CSS var definitions for DOM injection
24
- - **Private tokens** (`theme._tokens`): Original values
13
+ - `addColors({...})` — always emits CSS variables (`--color-primary`, etc.)
14
+ - `addScale({ name, values, emit: true })` opts into CSS variable emission
15
+ - `addScale({ name, values })` raw values only, no CSS variables
25
16
 
26
- ## Integration with Core
17
+ The `Emitted` generic parameter accumulates through the builder chain, tracking which scales have CSS variables. This powers `EmittedScales<T>` and `EmittedTokenPaths<T>` — used to validate `{scale.key}` token references at the type level.
27
18
 
28
- Props reference scales by name: `bg: { property: 'backgroundColor', scale: 'colors' }`. At runtime, `lookupScaleValue('primary', 'colors', theme)` resolves to `var(--color-primary)`.
19
+ ## serialize() Output
20
+
21
+ `tokens.serialize()` produces the `SerializedTheme` consumed by the extraction pipeline:
22
+
23
+ | Field | Content | Consumer |
24
+ |-------|---------|----------|
25
+ | `scalesJson` | Flattened `"scale.key" → "value"` | Rust theme_resolver |
26
+ | `variableMapJson` | `"colors.primary" → "--color-primary"` | Rust token alias resolution |
27
+ | `variableCss` | `:root { --color-*: ... }` declarations | Vite plugin virtual module |
28
+ | `contextualVarsJson` | Per-scale contextual var names | Rust contextual resolution |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animus-ui/theming",
3
- "version": "0.1.0-next.21",
3
+ "version": "0.1.0-next.30",
4
4
  "description": "Theming Utilities",
5
5
  "author": "Aaron Robb <airrobb@gmail.com>",
6
6
  "homepage": "https://github.com/codecaaron/animus#readme",