Design tokens: lint fixes (sorted catalogue, linear regexes), tokens.css regenerated
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cf205c59ef
commit
07d54da893
@@ -10,18 +10,34 @@ export type ColorDefault = { dark: string; light: string }
|
||||
/** Colour roles that switch with the theme. Key = token name without `--ipal-`. */
|
||||
export const COLOR_DEFAULTS = {
|
||||
bg: { dark: 'oklch(0.145 0 0)', light: 'oklch(1 0 0)' },
|
||||
surface: { dark: 'oklch(0.205 0 0)', light: 'oklch(1 0 0)' },
|
||||
'surface-muted': { dark: 'oklch(0.18 0 0)', light: 'oklch(0.97 0 0)' },
|
||||
'surface-raised': { dark: 'oklch(0.235 0 0)', light: 'oklch(1 0 0)' },
|
||||
'surface-inverse': { dark: 'oklch(0.97 0 0)', light: 'oklch(0.205 0 0)' },
|
||||
text: { dark: 'oklch(0.87 0 0)', light: 'oklch(0.371 0 0)' },
|
||||
'text-strong': { dark: 'oklch(0.97 0 0)', light: 'oklch(0.205 0 0)' },
|
||||
'text-muted': { dark: 'oklch(0.708 0 0)', light: 'oklch(0.53 0 0)' },
|
||||
'text-inverse': { dark: 'oklch(0.205 0 0)', light: 'oklch(0.97 0 0)' },
|
||||
border: { dark: 'oklch(0.269 0 0)', light: 'oklch(0.922 0 0)' },
|
||||
'border-strong': { dark: 'oklch(0.371 0 0)', light: 'oklch(0.87 0 0)' },
|
||||
primary: { dark: 'oklch(0.546 0.245 262.881)', light: 'oklch(0.546 0.245 262.881)' },
|
||||
surface: { dark: 'oklch(0.205 0 0)', light: 'oklch(1 0 0)' },
|
||||
'surface-inverse': { dark: 'oklch(0.97 0 0)', light: 'oklch(0.205 0 0)' },
|
||||
'surface-muted': { dark: 'oklch(0.18 0 0)', light: 'oklch(0.97 0 0)' },
|
||||
'surface-raised': { dark: 'oklch(0.235 0 0)', light: 'oklch(1 0 0)' },
|
||||
text: { dark: 'oklch(0.87 0 0)', light: 'oklch(0.371 0 0)' },
|
||||
'text-inverse': { dark: 'oklch(0.205 0 0)', light: 'oklch(0.97 0 0)' },
|
||||
'text-muted': { dark: 'oklch(0.708 0 0)', light: 'oklch(0.53 0 0)' },
|
||||
'text-strong': { dark: 'oklch(0.97 0 0)', light: 'oklch(0.205 0 0)' },
|
||||
// darker in both themes: the text on primary stays readable on hover
|
||||
accent: { dark: 'var(--ipal-primary)', light: 'var(--ipal-primary)' },
|
||||
'accent-text': { dark: 'var(--ipal-primary-text)', light: 'var(--ipal-primary-text)' },
|
||||
danger: { dark: 'oklch(0.704 0.191 22.216)', light: 'oklch(0.505 0.213 27.518)' },
|
||||
'danger-surface': { dark: 'oklch(0.258 0.092 26.042)', light: 'oklch(0.971 0.013 17.38)' },
|
||||
focus: { dark: 'var(--ipal-link)', light: 'var(--ipal-link)' },
|
||||
'focus-inverse': { dark: 'var(--ipal-text-inverse)', light: 'var(--ipal-text-inverse)' },
|
||||
hover: { dark: 'oklch(0.269 0 0)', light: 'oklch(0.97 0 0)' },
|
||||
info: { dark: 'oklch(0.707 0.165 254.624)', light: 'oklch(0.488 0.243 264.376)' },
|
||||
'info-surface': { dark: 'oklch(0.282 0.091 267.935)', light: 'oklch(0.97 0.014 254.604)' },
|
||||
link: { dark: 'color-mix(in oklch, var(--ipal-primary), white 40%)', light: 'var(--ipal-primary)' },
|
||||
'link-hover': {
|
||||
dark: 'color-mix(in oklch, var(--ipal-link), var(--ipal-text-strong) 30%)',
|
||||
light: 'color-mix(in oklch, var(--ipal-link), var(--ipal-text-strong) 30%)',
|
||||
},
|
||||
'link-inverse': { dark: 'var(--ipal-text-inverse)', light: 'var(--ipal-text-inverse)' },
|
||||
overlay: { dark: 'oklch(0 0 0 / 0.65)', light: 'oklch(0 0 0 / 0.5)' },
|
||||
'primary-hover': {
|
||||
dark: 'color-mix(in oklch, var(--ipal-primary), black 12%)',
|
||||
light: 'color-mix(in oklch, var(--ipal-primary), black 12%)',
|
||||
@@ -33,26 +49,10 @@ export const COLOR_DEFAULTS = {
|
||||
light: 'color-mix(in oklch, var(--ipal-secondary), white 18%)',
|
||||
},
|
||||
'secondary-text': { dark: 'var(--ipal-text-inverse)', light: 'var(--ipal-text-inverse)' },
|
||||
accent: { dark: 'var(--ipal-primary)', light: 'var(--ipal-primary)' },
|
||||
'accent-text': { dark: 'var(--ipal-primary-text)', light: 'var(--ipal-primary-text)' },
|
||||
link: { dark: 'color-mix(in oklch, var(--ipal-primary), white 40%)', light: 'var(--ipal-primary)' },
|
||||
'link-hover': {
|
||||
dark: 'color-mix(in oklch, var(--ipal-link), var(--ipal-text-strong) 30%)',
|
||||
light: 'color-mix(in oklch, var(--ipal-link), var(--ipal-text-strong) 30%)',
|
||||
},
|
||||
'link-inverse': { dark: 'var(--ipal-text-inverse)', light: 'var(--ipal-text-inverse)' },
|
||||
hover: { dark: 'oklch(0.269 0 0)', light: 'oklch(0.97 0 0)' },
|
||||
focus: { dark: 'var(--ipal-link)', light: 'var(--ipal-link)' },
|
||||
'focus-inverse': { dark: 'var(--ipal-text-inverse)', light: 'var(--ipal-text-inverse)' },
|
||||
overlay: { dark: 'oklch(0 0 0 / 0.65)', light: 'oklch(0 0 0 / 0.5)' },
|
||||
success: { dark: 'oklch(0.792 0.209 151.711)', light: 'oklch(0.527 0.154 150.069)' },
|
||||
'success-surface': { dark: 'oklch(0.266 0.065 152.934)', light: 'oklch(0.982 0.018 155.826)' },
|
||||
warning: { dark: 'oklch(0.828 0.189 84.429)', light: 'oklch(0.555 0.163 48.998)' },
|
||||
'warning-surface': { dark: 'oklch(0.279 0.077 45.635)', light: 'oklch(0.987 0.022 95.277)' },
|
||||
danger: { dark: 'oklch(0.704 0.191 22.216)', light: 'oklch(0.505 0.213 27.518)' },
|
||||
'danger-surface': { dark: 'oklch(0.258 0.092 26.042)', light: 'oklch(0.971 0.013 17.38)' },
|
||||
info: { dark: 'oklch(0.707 0.165 254.624)', light: 'oklch(0.488 0.243 264.376)' },
|
||||
'info-surface': { dark: 'oklch(0.282 0.091 267.935)', light: 'oklch(0.97 0.014 254.604)' },
|
||||
} as const satisfies Record<string, ColorDefault>
|
||||
|
||||
export type ColorRole = keyof typeof COLOR_DEFAULTS
|
||||
@@ -71,55 +71,55 @@ export const LEGACY_DARK_ROLES = [
|
||||
*/
|
||||
const onInverse = (percent: number) => `color-mix(in oklch, var(--ipal-text-inverse) ${percent}%, var(--ipal-surface-inverse))`
|
||||
export const INVERSE_SCOPE: Partial<Record<ColorRole, string>> = {
|
||||
text: 'var(--ipal-text-inverse)',
|
||||
'text-strong': 'var(--ipal-text-inverse)',
|
||||
'text-muted': onInverse(72),
|
||||
border: onInverse(18),
|
||||
'border-strong': onInverse(30),
|
||||
surface: onInverse(8),
|
||||
focus: 'var(--ipal-focus-inverse)',
|
||||
hover: onInverse(12),
|
||||
link: 'var(--ipal-link-inverse)',
|
||||
focus: 'var(--ipal-focus-inverse)',
|
||||
surface: onInverse(8),
|
||||
text: 'var(--ipal-text-inverse)',
|
||||
'text-muted': onInverse(72),
|
||||
'text-strong': 'var(--ipal-text-inverse)',
|
||||
}
|
||||
|
||||
/** Theme-independent tokens. Key = token name without `--ipal-`. */
|
||||
export const STATIC_DEFAULTS = {
|
||||
// next/font slots: variable '--font-family-body' / '--font-family-heading' on <html>. Not --font-body:
|
||||
// that name is Tailwind's font-body utility key, which maps back to these tokens (a var() cycle).
|
||||
'container-narrow': '48rem',
|
||||
duration: '250ms',
|
||||
'duration-fast': '150ms',
|
||||
'duration-slow': '400ms',
|
||||
'ease-in-out': 'cubic-bezier(0.65, 0, 0.35, 1)',
|
||||
'ease-out': 'cubic-bezier(0.22, 1, 0.36, 1)',
|
||||
'focus-offset': '2px',
|
||||
'focus-width': '2px',
|
||||
'font-body': 'var(--font-family-body, ui-sans-serif, system-ui, sans-serif)',
|
||||
'font-heading': 'var(--font-family-heading, var(--ipal-font-body))',
|
||||
'font-mono': 'var(--font-family-mono, ui-monospace, SFMono-Regular, Menlo, monospace)',
|
||||
'lh-body': '1.6',
|
||||
'lh-heading': '1.15',
|
||||
'fw-body': '400',
|
||||
'fw-heading': '650',
|
||||
'tracking-heading': '-0.01em',
|
||||
'lh-body': '1.6',
|
||||
'lh-heading': '1.15',
|
||||
radius: '0.375rem',
|
||||
'radius-sm': '0.25rem',
|
||||
'radius-card': '0.75rem',
|
||||
'radius-media': '0.5rem',
|
||||
'radius-full': '9999px',
|
||||
'shadow-sm': '0 1px 2px 0 oklch(0 0 0 / 0.06), 0 1px 3px 0 oklch(0 0 0 / 0.08)',
|
||||
'shadow-md': '0 4px 8px -2px oklch(0 0 0 / 0.08), 0 2px 4px -2px oklch(0 0 0 / 0.06)',
|
||||
'radius-media': '0.5rem',
|
||||
'radius-sm': '0.25rem',
|
||||
'shadow-lg': '0 16px 32px -8px oklch(0 0 0 / 0.14), 0 4px 8px -4px oklch(0 0 0 / 0.08)',
|
||||
'container-narrow': '48rem',
|
||||
'duration-fast': '150ms',
|
||||
duration: '250ms',
|
||||
'duration-slow': '400ms',
|
||||
'ease-out': 'cubic-bezier(0.22, 1, 0.36, 1)',
|
||||
'ease-in-out': 'cubic-bezier(0.65, 0, 0.35, 1)',
|
||||
'shadow-md': '0 4px 8px -2px oklch(0 0 0 / 0.08), 0 2px 4px -2px oklch(0 0 0 / 0.06)',
|
||||
'shadow-sm': '0 1px 2px 0 oklch(0 0 0 / 0.06), 0 1px 3px 0 oklch(0 0 0 / 0.08)',
|
||||
'tracking-heading': '-0.01em',
|
||||
'z-header': '40',
|
||||
'z-overlay': '50',
|
||||
'z-toast': '60',
|
||||
'focus-width': '2px',
|
||||
'focus-offset': '2px',
|
||||
} as const
|
||||
|
||||
/** Dark-theme shadows: deeper black plus a hairline ring, since a soft grey shadow vanishes on dark. */
|
||||
export const DARK_SHADOWS = {
|
||||
'shadow-sm': '0 1px 2px 0 oklch(0 0 0 / 0.4), 0 0 0 1px oklch(1 0 0 / 0.04)',
|
||||
'shadow-md': '0 4px 8px -2px oklch(0 0 0 / 0.5), 0 0 0 1px oklch(1 0 0 / 0.05)',
|
||||
'shadow-lg': '0 16px 32px -8px oklch(0 0 0 / 0.6), 0 0 0 1px oklch(1 0 0 / 0.06)',
|
||||
'shadow-md': '0 4px 8px -2px oklch(0 0 0 / 0.5), 0 0 0 1px oklch(1 0 0 / 0.05)',
|
||||
'shadow-sm': '0 1px 2px 0 oklch(0 0 0 / 0.4), 0 0 0 1px oklch(1 0 0 / 0.04)',
|
||||
} as const
|
||||
|
||||
export type StaticToken = keyof typeof STATIC_DEFAULTS
|
||||
@@ -133,7 +133,7 @@ export const FLUID_TOKENS = [
|
||||
|
||||
export type FluidToken = (typeof FLUID_TOKENS)[number]
|
||||
|
||||
export type IpalTokenName = ColorRole | FluidToken | StaticToken | `${(typeof LEGACY_DARK_ROLES)[number]}-dark`
|
||||
export type IpalTokenName = `${(typeof LEGACY_DARK_ROLES)[number]}-dark` | ColorRole | FluidToken | StaticToken
|
||||
|
||||
/** Standard breakpoints in rem (Tailwind 4 defaults). CSS variables can't be used in `@media`. */
|
||||
export const IPAL_BREAKPOINTS = { sm: 40, md: 48, lg: 64, xl: 80, '2xl': 96 } as const
|
||||
export const IPAL_BREAKPOINTS = { '2xl': 96, lg: 64, md: 48, sm: 40, xl: 80 } as const
|
||||
|
||||
Reference in New Issue
Block a user