Replaced by an explicit list of forms only (ten exported names, runtime env names, project file names and marks, commands, skill names, the log prefix, the brand in prose). Package name, import paths, routes, CSS tokens, data attributes, custom keys, context flags, the cookie and kv keys are not touched. package.json keeps the five old bin names beside the five new ones. The old names stop working in this commit and come back as aliases in the next; docs follow. Co-Authored-By: Claude Fable 5.2 <[email protected]>
28 lines
894 B
TypeScript
28 lines
894 B
TypeScript
import {
|
|
COLOR_DEFAULTS,
|
|
FLUID_TOKENS,
|
|
type IaplTokenName,
|
|
LEGACY_DARK_ROLES,
|
|
STATIC_DEFAULTS,
|
|
} from './catalog.js'
|
|
|
|
const NAMES = [
|
|
...Object.keys(COLOR_DEFAULTS),
|
|
...FLUID_TOKENS,
|
|
...Object.keys(STATIC_DEFAULTS),
|
|
...LEGACY_DARK_ROLES.map((role) => `${role}-dark`),
|
|
] as IaplTokenName[]
|
|
|
|
/**
|
|
* Every token as a ready `var(--ipal-…)` string, keyed by name without the prefix —
|
|
* for inline styles, charts, canvas or a styleguide page: `IAPL_TOKENS.primary`.
|
|
*/
|
|
export const IAPL_TOKENS = Object.freeze(
|
|
Object.fromEntries(NAMES.map((name) => [name, `var(--ipal-${name})`])) as Record<IaplTokenName, string>,
|
|
)
|
|
|
|
/** `var(--ipal-<name>)`, with an optional fallback: `iaplVar('surface', '#fff')`. */
|
|
export function iaplVar(name: IaplTokenName, fallback?: string): string {
|
|
return fallback === undefined ? `var(--ipal-${name})` : `var(--ipal-${name}, ${fallback})`
|
|
}
|