- exports: ipalKit, IpalOptions, ipalEnvRules, IpalEnvFeatures, ipalT, ipalVar, IPAL_TOKENS, IPAL_BREAKPOINTS, IpalTokenName, IpalGlobalSlug are aliases of the iapl names - env: IAPL_* is read first, IPAL_* as fallback (readEnv; EnvRule.aliases for assertEnv); the crawler service reads IPAL_CRAWLER_SITES too - doctor: reads ipal-doctor.json when it is the only one, the old pointer block, ipal-audit-skip and old skill folders; new rule legacy-names (info) and storage-names (warning) - iapl-skills: installs iapl-*, removes the 16 old folders by exact name, rewrites the old pointer block in place; a project's own ipal-* skill stays - storageNames: 'ipal' (default) | 'iapl': the cookie the scanner declares and the 2FA counter's kv prefix; <PageStats visitorCookie>, IAPL_VISITOR_COOKIE, verifyLimit.keyPrefix - test/legacyNames.test.ts: 24 tests for all of the above Co-Authored-By: Claude Fable 5.2 <[email protected]>
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
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})`
|
|
}
|
|
|
|
/** @deprecated The name before 1.17.0; the same object as `IAPL_TOKENS`. Removed in 2.0. */
|
|
export const IPAL_TOKENS = IAPL_TOKENS
|
|
|
|
/** @deprecated The name before 1.17.0; the same function as `iaplVar`. Removed in 2.0. */
|
|
export const ipalVar = iaplVar
|