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-`. */
|
/** Colour roles that switch with the theme. Key = token name without `--ipal-`. */
|
||||||
export const COLOR_DEFAULTS = {
|
export const COLOR_DEFAULTS = {
|
||||||
bg: { dark: 'oklch(0.145 0 0)', light: 'oklch(1 0 0)' },
|
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: { 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)' },
|
'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)' },
|
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
|
// 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': {
|
'primary-hover': {
|
||||||
dark: 'color-mix(in oklch, var(--ipal-primary), black 12%)',
|
dark: 'color-mix(in oklch, var(--ipal-primary), black 12%)',
|
||||||
light: '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%)',
|
light: 'color-mix(in oklch, var(--ipal-secondary), white 18%)',
|
||||||
},
|
},
|
||||||
'secondary-text': { dark: 'var(--ipal-text-inverse)', light: 'var(--ipal-text-inverse)' },
|
'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: { 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)' },
|
'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: { 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)' },
|
'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>
|
} as const satisfies Record<string, ColorDefault>
|
||||||
|
|
||||||
export type ColorRole = keyof typeof COLOR_DEFAULTS
|
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))`
|
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>> = {
|
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: onInverse(18),
|
||||||
'border-strong': onInverse(30),
|
'border-strong': onInverse(30),
|
||||||
surface: onInverse(8),
|
focus: 'var(--ipal-focus-inverse)',
|
||||||
hover: onInverse(12),
|
hover: onInverse(12),
|
||||||
link: 'var(--ipal-link-inverse)',
|
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-`. */
|
/** Theme-independent tokens. Key = token name without `--ipal-`. */
|
||||||
export const STATIC_DEFAULTS = {
|
export const STATIC_DEFAULTS = {
|
||||||
// next/font slots: variable '--font-family-body' / '--font-family-heading' on <html>. Not --font-body:
|
// 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).
|
// 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-body': 'var(--font-family-body, ui-sans-serif, system-ui, sans-serif)',
|
||||||
'font-heading': 'var(--font-family-heading, var(--ipal-font-body))',
|
'font-heading': 'var(--font-family-heading, var(--ipal-font-body))',
|
||||||
'font-mono': 'var(--font-family-mono, ui-monospace, SFMono-Regular, Menlo, monospace)',
|
'font-mono': 'var(--font-family-mono, ui-monospace, SFMono-Regular, Menlo, monospace)',
|
||||||
'lh-body': '1.6',
|
|
||||||
'lh-heading': '1.15',
|
|
||||||
'fw-body': '400',
|
'fw-body': '400',
|
||||||
'fw-heading': '650',
|
'fw-heading': '650',
|
||||||
'tracking-heading': '-0.01em',
|
'lh-body': '1.6',
|
||||||
|
'lh-heading': '1.15',
|
||||||
radius: '0.375rem',
|
radius: '0.375rem',
|
||||||
'radius-sm': '0.25rem',
|
|
||||||
'radius-card': '0.75rem',
|
'radius-card': '0.75rem',
|
||||||
'radius-media': '0.5rem',
|
|
||||||
'radius-full': '9999px',
|
'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)',
|
'radius-media': '0.5rem',
|
||||||
'shadow-md': '0 4px 8px -2px oklch(0 0 0 / 0.08), 0 2px 4px -2px oklch(0 0 0 / 0.06)',
|
'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)',
|
'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',
|
'shadow-md': '0 4px 8px -2px oklch(0 0 0 / 0.08), 0 2px 4px -2px oklch(0 0 0 / 0.06)',
|
||||||
'duration-fast': '150ms',
|
'shadow-sm': '0 1px 2px 0 oklch(0 0 0 / 0.06), 0 1px 3px 0 oklch(0 0 0 / 0.08)',
|
||||||
duration: '250ms',
|
'tracking-heading': '-0.01em',
|
||||||
'duration-slow': '400ms',
|
|
||||||
'ease-out': 'cubic-bezier(0.22, 1, 0.36, 1)',
|
|
||||||
'ease-in-out': 'cubic-bezier(0.65, 0, 0.35, 1)',
|
|
||||||
'z-header': '40',
|
'z-header': '40',
|
||||||
'z-overlay': '50',
|
'z-overlay': '50',
|
||||||
'z-toast': '60',
|
'z-toast': '60',
|
||||||
'focus-width': '2px',
|
|
||||||
'focus-offset': '2px',
|
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
/** Dark-theme shadows: deeper black plus a hairline ring, since a soft grey shadow vanishes on dark. */
|
/** Dark-theme shadows: deeper black plus a hairline ring, since a soft grey shadow vanishes on dark. */
|
||||||
export const DARK_SHADOWS = {
|
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-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
|
} as const
|
||||||
|
|
||||||
export type StaticToken = keyof typeof STATIC_DEFAULTS
|
export type StaticToken = keyof typeof STATIC_DEFAULTS
|
||||||
@@ -133,7 +133,7 @@ export const FLUID_TOKENS = [
|
|||||||
|
|
||||||
export type FluidToken = (typeof FLUID_TOKENS)[number]
|
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`. */
|
/** 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
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ async function loadTokens(file: string): Promise<TokensInput> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The `ipal-tokens` command. Returns the exit code. */
|
/** The `ipal-tokens` command. Returns the exit code. */
|
||||||
export async function runTokensCli(args: string[], { cwd = process.cwd(), log = console.log }: { cwd?: string; log?: Log } = {}): Promise<number> {
|
export async function runTokensCli(args: string[], { cwd = process.cwd(), log = (line: string) => process.stdout.write(`${line}\n`) }: { cwd?: string; log?: Log } = {}): Promise<number> {
|
||||||
if (args.includes('--help') || args.includes('-h')) {
|
if (args.includes('--help') || args.includes('-h')) {
|
||||||
log(TOKENS_CLI_USAGE)
|
log(TOKENS_CLI_USAGE)
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ function channels(inner: string): string[] {
|
|||||||
|
|
||||||
function functionCall(value: string): { args: string; name: string } | null {
|
function functionCall(value: string): { args: string; name: string } | null {
|
||||||
const m = /^([a-z-]+)\((.*)\)$/is.exec(value.trim())
|
const m = /^([a-z-]+)\((.*)\)$/is.exec(value.trim())
|
||||||
return m ? { args: m[2], name: m[1].toLowerCase() } : null
|
return m ? { name: m[1].toLowerCase(), args: m[2] } : null
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Value lookup for var(): returns the raw CSS value of a token, or undefined. */
|
/** Value lookup for var(): returns the raw CSS value of a token, or undefined. */
|
||||||
@@ -131,8 +131,9 @@ function mix(args: string, lookup: TokenLookup, depth: number): null | Rgba {
|
|||||||
const [, first, second] = splitArgs(args)
|
const [, first, second] = splitArgs(args)
|
||||||
if (!first || !second) {return null}
|
if (!first || !second) {return null}
|
||||||
const side = (s: string) => {
|
const side = (s: string) => {
|
||||||
const m = /^(.*?)\s+(\d*\.?\d+)%$/.exec(s)
|
const cut = s.lastIndexOf(' ')
|
||||||
return m ? { color: m[1], pct: Number(m[2]) / 100 } : { color: s, pct: undefined }
|
const pct = s.slice(cut + 1)
|
||||||
|
return cut > 0 && /^(?:\d+(?:\.\d+)?|\.\d+)%$/.test(pct) ? { color: s.slice(0, cut).trim(), pct: Number(pct.slice(0, -1)) / 100 } : { color: s, pct: undefined }
|
||||||
}
|
}
|
||||||
const a = side(first)
|
const a = side(first)
|
||||||
const b = side(second)
|
const b = side(second)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const reducedMotion: Entries = [
|
|||||||
|
|
||||||
/** The inverse scope: what nested content reads inside `data-surface="inverse"`. */
|
/** The inverse scope: what nested content reads inside `data-surface="inverse"`. */
|
||||||
const inverseEntries: Entries = [
|
const inverseEntries: Entries = [
|
||||||
...Object.entries(INVERSE_SCOPE).map(([role, value]) => [role, value!] as const),
|
...Object.entries(INVERSE_SCOPE).map(([role, value]) => [role, value] as const),
|
||||||
['link-hover', 'var(--ipal-link-inverse)'],
|
['link-hover', 'var(--ipal-link-inverse)'],
|
||||||
['color-scheme', 'dark'],
|
['color-scheme', 'dark'],
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ export type TokensInput = {
|
|||||||
light?: ColorInput
|
light?: ColorInput
|
||||||
}
|
}
|
||||||
container?: { default?: string; measure?: string; narrow?: string; wide?: string }
|
container?: { default?: string; measure?: string; narrow?: string; wide?: string }
|
||||||
|
/** Which fluid file the site imports: `'wide'` = fluid-wide.css (grows to 1920px, the default for new sites). */
|
||||||
|
fluid?: FluidRange
|
||||||
font?: {
|
font?: {
|
||||||
body?: string
|
body?: string
|
||||||
fwBody?: number | string
|
fwBody?: number | string
|
||||||
@@ -27,8 +29,6 @@ export type TokensInput = {
|
|||||||
}
|
}
|
||||||
/** Rewrite fluid sizes from min → max pairs (rem or px); the clamp() is computed for the `fluid` range. */
|
/** Rewrite fluid sizes from min → max pairs (rem or px); the clamp() is computed for the `fluid` range. */
|
||||||
fs?: Partial<Record<FluidSizeName<'fs-'>, readonly [RemValue, RemValue]>>
|
fs?: Partial<Record<FluidSizeName<'fs-'>, readonly [RemValue, RemValue]>>
|
||||||
/** Which fluid file the site imports: `'wide'` = fluid-wide.css (grows to 1920px, the default for new sites). */
|
|
||||||
fluid?: FluidRange
|
|
||||||
motion?: { base?: string; easeInOut?: string; easeOut?: string; fast?: string; slow?: string }
|
motion?: { base?: string; easeInOut?: string; easeOut?: string; fast?: string; slow?: string }
|
||||||
radius?: { card?: string; control?: string; media?: string; sm?: string }
|
radius?: { card?: string; control?: string; media?: string; sm?: string }
|
||||||
/** Any other `--ipal-*` value (name without `--ipal-`), e.g. `{ 'hero-min-h': 'min(100svh, 60rem)' }`. */
|
/** Any other `--ipal-*` value (name without `--ipal-`), e.g. `{ 'hero-min-h': 'min(100svh, 60rem)' }`. */
|
||||||
|
|||||||
+10
-10
@@ -17,20 +17,20 @@ export type RemValue = number | string
|
|||||||
|
|
||||||
/** min → max (rem) of every fluid size the plugin ships. fluid.css and fluid-wide.css are this table. */
|
/** min → max (rem) of every fluid size the plugin ships. fluid.css and fluid-wide.css are this table. */
|
||||||
export const FLUID_SCALE = {
|
export const FLUID_SCALE = {
|
||||||
'fs-xs': [0.75, 0.8125],
|
|
||||||
'fs-sm': [0.875, 0.9375],
|
|
||||||
'fs-base': [1, 1.125],
|
'fs-base': [1, 1.125],
|
||||||
'fs-lg': [1.125, 1.375],
|
|
||||||
'fs-h4': [1.125, 1.5],
|
|
||||||
'fs-h3': [1.25, 1.75],
|
|
||||||
'fs-h2': [1.5, 2.5],
|
|
||||||
'fs-h1': [2, 3.5],
|
|
||||||
'fs-display': [2.5, 4.5],
|
'fs-display': [2.5, 4.5],
|
||||||
'space-stack': [1, 1.5],
|
'fs-h1': [2, 3.5],
|
||||||
|
'fs-h2': [1.5, 2.5],
|
||||||
|
'fs-h3': [1.25, 1.75],
|
||||||
|
'fs-h4': [1.125, 1.5],
|
||||||
|
'fs-lg': [1.125, 1.375],
|
||||||
|
'fs-sm': [0.875, 0.9375],
|
||||||
|
'fs-xs': [0.75, 0.8125],
|
||||||
'space-gap': [1, 2],
|
'space-gap': [1, 2],
|
||||||
'space-gutter': [1, 2.5],
|
'space-gutter': [1, 2.5],
|
||||||
'space-section-sm': [1.5, 3.75],
|
|
||||||
'space-section': [3, 7.5],
|
'space-section': [3, 7.5],
|
||||||
|
'space-section-sm': [1.5, 3.75],
|
||||||
|
'space-stack': [1, 1.5],
|
||||||
} as const satisfies Record<string, readonly [number, number]>
|
} as const satisfies Record<string, readonly [number, number]>
|
||||||
|
|
||||||
export type FluidSize = keyof typeof FLUID_SCALE
|
export type FluidSize = keyof typeof FLUID_SCALE
|
||||||
@@ -39,7 +39,7 @@ const ROOT_PX = 16
|
|||||||
|
|
||||||
export function toRem(value: RemValue): number {
|
export function toRem(value: RemValue): number {
|
||||||
if (typeof value === 'number') {return value}
|
if (typeof value === 'number') {return value}
|
||||||
const m = /^\s*(-?\d*\.?\d+)\s*(rem|px)?\s*$/.exec(value)
|
const m = /^\s*(-?(?:\d+(?:\.\d+)?|\.\d+))\s*(?:(rem|px)\s*)?$/.exec(value)
|
||||||
if (!m) {throw new Error(`ipal-kit tokens: "${value}" is not a size in rem or px`)}
|
if (!m) {throw new Error(`ipal-kit tokens: "${value}" is not a size in rem or px`)}
|
||||||
return m[2] === 'px' ? Number(m[1]) / ROOT_PX : Number(m[1])
|
return m[2] === 'px' ? Number(m[1]) / ROOT_PX : Number(m[1])
|
||||||
}
|
}
|
||||||
|
|||||||
+64
-64
@@ -11,107 +11,107 @@
|
|||||||
|
|
||||||
:root {
|
:root {
|
||||||
--ipal-bg: oklch(1 0 0);
|
--ipal-bg: oklch(1 0 0);
|
||||||
--ipal-surface: oklch(1 0 0);
|
|
||||||
--ipal-surface-muted: oklch(0.97 0 0);
|
|
||||||
--ipal-surface-raised: oklch(1 0 0);
|
|
||||||
--ipal-surface-inverse: oklch(0.205 0 0);
|
|
||||||
--ipal-text: oklch(0.371 0 0);
|
|
||||||
--ipal-text-strong: oklch(0.205 0 0);
|
|
||||||
--ipal-text-muted: oklch(0.53 0 0);
|
|
||||||
--ipal-text-inverse: oklch(0.97 0 0);
|
|
||||||
--ipal-border: oklch(0.922 0 0);
|
--ipal-border: oklch(0.922 0 0);
|
||||||
--ipal-border-strong: oklch(0.87 0 0);
|
--ipal-border-strong: oklch(0.87 0 0);
|
||||||
--ipal-primary: oklch(0.546 0.245 262.881);
|
--ipal-primary: oklch(0.546 0.245 262.881);
|
||||||
|
--ipal-surface: oklch(1 0 0);
|
||||||
|
--ipal-surface-inverse: oklch(0.205 0 0);
|
||||||
|
--ipal-surface-muted: oklch(0.97 0 0);
|
||||||
|
--ipal-surface-raised: oklch(1 0 0);
|
||||||
|
--ipal-text: oklch(0.371 0 0);
|
||||||
|
--ipal-text-inverse: oklch(0.97 0 0);
|
||||||
|
--ipal-text-muted: oklch(0.53 0 0);
|
||||||
|
--ipal-text-strong: oklch(0.205 0 0);
|
||||||
|
--ipal-accent: var(--ipal-primary);
|
||||||
|
--ipal-accent-text: var(--ipal-primary-text);
|
||||||
|
--ipal-danger: oklch(0.505 0.213 27.518);
|
||||||
|
--ipal-danger-surface: oklch(0.971 0.013 17.38);
|
||||||
|
--ipal-focus: var(--ipal-link);
|
||||||
|
--ipal-focus-inverse: var(--ipal-text-inverse);
|
||||||
|
--ipal-hover: oklch(0.97 0 0);
|
||||||
|
--ipal-info: oklch(0.488 0.243 264.376);
|
||||||
|
--ipal-info-surface: oklch(0.97 0.014 254.604);
|
||||||
|
--ipal-link: var(--ipal-primary);
|
||||||
|
--ipal-link-hover: color-mix(in oklch, var(--ipal-link), var(--ipal-text-strong) 30%);
|
||||||
|
--ipal-link-inverse: var(--ipal-text-inverse);
|
||||||
|
--ipal-overlay: oklch(0 0 0 / 0.5);
|
||||||
--ipal-primary-hover: color-mix(in oklch, var(--ipal-primary), black 12%);
|
--ipal-primary-hover: color-mix(in oklch, var(--ipal-primary), black 12%);
|
||||||
--ipal-primary-text: oklch(1 0 0);
|
--ipal-primary-text: oklch(1 0 0);
|
||||||
--ipal-secondary: var(--ipal-text-strong);
|
--ipal-secondary: var(--ipal-text-strong);
|
||||||
--ipal-secondary-hover: color-mix(in oklch, var(--ipal-secondary), white 18%);
|
--ipal-secondary-hover: color-mix(in oklch, var(--ipal-secondary), white 18%);
|
||||||
--ipal-secondary-text: var(--ipal-text-inverse);
|
--ipal-secondary-text: var(--ipal-text-inverse);
|
||||||
--ipal-accent: var(--ipal-primary);
|
|
||||||
--ipal-accent-text: var(--ipal-primary-text);
|
|
||||||
--ipal-link: var(--ipal-primary);
|
|
||||||
--ipal-link-hover: color-mix(in oklch, var(--ipal-link), var(--ipal-text-strong) 30%);
|
|
||||||
--ipal-link-inverse: var(--ipal-text-inverse);
|
|
||||||
--ipal-hover: oklch(0.97 0 0);
|
|
||||||
--ipal-focus: var(--ipal-link);
|
|
||||||
--ipal-focus-inverse: var(--ipal-text-inverse);
|
|
||||||
--ipal-overlay: oklch(0 0 0 / 0.5);
|
|
||||||
--ipal-success: oklch(0.527 0.154 150.069);
|
--ipal-success: oklch(0.527 0.154 150.069);
|
||||||
--ipal-success-surface: oklch(0.982 0.018 155.826);
|
--ipal-success-surface: oklch(0.982 0.018 155.826);
|
||||||
--ipal-warning: oklch(0.555 0.163 48.998);
|
--ipal-warning: oklch(0.555 0.163 48.998);
|
||||||
--ipal-warning-surface: oklch(0.987 0.022 95.277);
|
--ipal-warning-surface: oklch(0.987 0.022 95.277);
|
||||||
--ipal-danger: oklch(0.505 0.213 27.518);
|
--ipal-container-narrow: 48rem;
|
||||||
--ipal-danger-surface: oklch(0.971 0.013 17.38);
|
--ipal-duration: 250ms;
|
||||||
--ipal-info: oklch(0.488 0.243 264.376);
|
--ipal-duration-fast: 150ms;
|
||||||
--ipal-info-surface: oklch(0.97 0.014 254.604);
|
--ipal-duration-slow: 400ms;
|
||||||
|
--ipal-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
|
||||||
|
--ipal-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
|
||||||
|
--ipal-focus-offset: 2px;
|
||||||
|
--ipal-focus-width: 2px;
|
||||||
--ipal-font-body: var(--font-family-body, ui-sans-serif, system-ui, sans-serif);
|
--ipal-font-body: var(--font-family-body, ui-sans-serif, system-ui, sans-serif);
|
||||||
--ipal-font-heading: var(--font-family-heading, var(--ipal-font-body));
|
--ipal-font-heading: var(--font-family-heading, var(--ipal-font-body));
|
||||||
--ipal-font-mono: var(--font-family-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
|
--ipal-font-mono: var(--font-family-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
|
||||||
--ipal-lh-body: 1.6;
|
|
||||||
--ipal-lh-heading: 1.15;
|
|
||||||
--ipal-fw-body: 400;
|
--ipal-fw-body: 400;
|
||||||
--ipal-fw-heading: 650;
|
--ipal-fw-heading: 650;
|
||||||
--ipal-tracking-heading: -0.01em;
|
--ipal-lh-body: 1.6;
|
||||||
|
--ipal-lh-heading: 1.15;
|
||||||
--ipal-radius: 0.375rem;
|
--ipal-radius: 0.375rem;
|
||||||
--ipal-radius-sm: 0.25rem;
|
|
||||||
--ipal-radius-card: 0.75rem;
|
--ipal-radius-card: 0.75rem;
|
||||||
--ipal-radius-media: 0.5rem;
|
|
||||||
--ipal-radius-full: 9999px;
|
--ipal-radius-full: 9999px;
|
||||||
--ipal-shadow-sm: 0 1px 2px 0 oklch(0 0 0 / 0.06), 0 1px 3px 0 oklch(0 0 0 / 0.08);
|
--ipal-radius-media: 0.5rem;
|
||||||
--ipal-shadow-md: 0 4px 8px -2px oklch(0 0 0 / 0.08), 0 2px 4px -2px oklch(0 0 0 / 0.06);
|
--ipal-radius-sm: 0.25rem;
|
||||||
--ipal-shadow-lg: 0 16px 32px -8px oklch(0 0 0 / 0.14), 0 4px 8px -4px oklch(0 0 0 / 0.08);
|
--ipal-shadow-lg: 0 16px 32px -8px oklch(0 0 0 / 0.14), 0 4px 8px -4px oklch(0 0 0 / 0.08);
|
||||||
--ipal-container-narrow: 48rem;
|
--ipal-shadow-md: 0 4px 8px -2px oklch(0 0 0 / 0.08), 0 2px 4px -2px oklch(0 0 0 / 0.06);
|
||||||
--ipal-duration-fast: 150ms;
|
--ipal-shadow-sm: 0 1px 2px 0 oklch(0 0 0 / 0.06), 0 1px 3px 0 oklch(0 0 0 / 0.08);
|
||||||
--ipal-duration: 250ms;
|
--ipal-tracking-heading: -0.01em;
|
||||||
--ipal-duration-slow: 400ms;
|
|
||||||
--ipal-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
|
|
||||||
--ipal-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
|
|
||||||
--ipal-z-header: 40;
|
--ipal-z-header: 40;
|
||||||
--ipal-z-overlay: 50;
|
--ipal-z-overlay: 50;
|
||||||
--ipal-z-toast: 60;
|
--ipal-z-toast: 60;
|
||||||
--ipal-focus-width: 2px;
|
|
||||||
--ipal-focus-offset: 2px;
|
|
||||||
color-scheme: light;
|
color-scheme: light;
|
||||||
}
|
}
|
||||||
|
|
||||||
:root[data-theme="dark"] {
|
:root[data-theme="dark"] {
|
||||||
--ipal-bg: oklch(0.145 0 0);
|
--ipal-bg: oklch(0.145 0 0);
|
||||||
--ipal-surface: oklch(0.205 0 0);
|
|
||||||
--ipal-surface-muted: oklch(0.18 0 0);
|
|
||||||
--ipal-surface-raised: oklch(0.235 0 0);
|
|
||||||
--ipal-surface-inverse: oklch(0.97 0 0);
|
|
||||||
--ipal-text: oklch(0.87 0 0);
|
|
||||||
--ipal-text-strong: oklch(0.97 0 0);
|
|
||||||
--ipal-text-muted: oklch(0.708 0 0);
|
|
||||||
--ipal-text-inverse: oklch(0.205 0 0);
|
|
||||||
--ipal-border: oklch(0.269 0 0);
|
--ipal-border: oklch(0.269 0 0);
|
||||||
--ipal-border-strong: oklch(0.371 0 0);
|
--ipal-border-strong: oklch(0.371 0 0);
|
||||||
--ipal-primary: oklch(0.546 0.245 262.881);
|
--ipal-primary: oklch(0.546 0.245 262.881);
|
||||||
|
--ipal-surface: oklch(0.205 0 0);
|
||||||
|
--ipal-surface-inverse: oklch(0.97 0 0);
|
||||||
|
--ipal-surface-muted: oklch(0.18 0 0);
|
||||||
|
--ipal-surface-raised: oklch(0.235 0 0);
|
||||||
|
--ipal-text: oklch(0.87 0 0);
|
||||||
|
--ipal-text-inverse: oklch(0.205 0 0);
|
||||||
|
--ipal-text-muted: oklch(0.708 0 0);
|
||||||
|
--ipal-text-strong: oklch(0.97 0 0);
|
||||||
|
--ipal-accent: var(--ipal-primary);
|
||||||
|
--ipal-accent-text: var(--ipal-primary-text);
|
||||||
|
--ipal-danger: oklch(0.704 0.191 22.216);
|
||||||
|
--ipal-danger-surface: oklch(0.258 0.092 26.042);
|
||||||
|
--ipal-focus: var(--ipal-link);
|
||||||
|
--ipal-focus-inverse: var(--ipal-text-inverse);
|
||||||
|
--ipal-hover: oklch(0.269 0 0);
|
||||||
|
--ipal-info: oklch(0.707 0.165 254.624);
|
||||||
|
--ipal-info-surface: oklch(0.282 0.091 267.935);
|
||||||
|
--ipal-link: color-mix(in oklch, var(--ipal-primary), white 40%);
|
||||||
|
--ipal-link-hover: color-mix(in oklch, var(--ipal-link), var(--ipal-text-strong) 30%);
|
||||||
|
--ipal-link-inverse: var(--ipal-text-inverse);
|
||||||
|
--ipal-overlay: oklch(0 0 0 / 0.65);
|
||||||
--ipal-primary-hover: color-mix(in oklch, var(--ipal-primary), black 12%);
|
--ipal-primary-hover: color-mix(in oklch, var(--ipal-primary), black 12%);
|
||||||
--ipal-primary-text: oklch(1 0 0);
|
--ipal-primary-text: oklch(1 0 0);
|
||||||
--ipal-secondary: var(--ipal-text-strong);
|
--ipal-secondary: var(--ipal-text-strong);
|
||||||
--ipal-secondary-hover: color-mix(in oklch, var(--ipal-secondary), black 12%);
|
--ipal-secondary-hover: color-mix(in oklch, var(--ipal-secondary), black 12%);
|
||||||
--ipal-secondary-text: var(--ipal-text-inverse);
|
--ipal-secondary-text: var(--ipal-text-inverse);
|
||||||
--ipal-accent: var(--ipal-primary);
|
|
||||||
--ipal-accent-text: var(--ipal-primary-text);
|
|
||||||
--ipal-link: color-mix(in oklch, var(--ipal-primary), white 40%);
|
|
||||||
--ipal-link-hover: color-mix(in oklch, var(--ipal-link), var(--ipal-text-strong) 30%);
|
|
||||||
--ipal-link-inverse: var(--ipal-text-inverse);
|
|
||||||
--ipal-hover: oklch(0.269 0 0);
|
|
||||||
--ipal-focus: var(--ipal-link);
|
|
||||||
--ipal-focus-inverse: var(--ipal-text-inverse);
|
|
||||||
--ipal-overlay: oklch(0 0 0 / 0.65);
|
|
||||||
--ipal-success: oklch(0.792 0.209 151.711);
|
--ipal-success: oklch(0.792 0.209 151.711);
|
||||||
--ipal-success-surface: oklch(0.266 0.065 152.934);
|
--ipal-success-surface: oklch(0.266 0.065 152.934);
|
||||||
--ipal-warning: oklch(0.828 0.189 84.429);
|
--ipal-warning: oklch(0.828 0.189 84.429);
|
||||||
--ipal-warning-surface: oklch(0.279 0.077 45.635);
|
--ipal-warning-surface: oklch(0.279 0.077 45.635);
|
||||||
--ipal-danger: oklch(0.704 0.191 22.216);
|
|
||||||
--ipal-danger-surface: oklch(0.258 0.092 26.042);
|
|
||||||
--ipal-info: oklch(0.707 0.165 254.624);
|
|
||||||
--ipal-info-surface: oklch(0.282 0.091 267.935);
|
|
||||||
--ipal-shadow-sm: 0 1px 2px 0 oklch(0 0 0 / 0.4), 0 0 0 1px oklch(1 0 0 / 0.04);
|
|
||||||
--ipal-shadow-md: 0 4px 8px -2px oklch(0 0 0 / 0.5), 0 0 0 1px oklch(1 0 0 / 0.05);
|
|
||||||
--ipal-shadow-lg: 0 16px 32px -8px oklch(0 0 0 / 0.6), 0 0 0 1px oklch(1 0 0 / 0.06);
|
--ipal-shadow-lg: 0 16px 32px -8px oklch(0 0 0 / 0.6), 0 0 0 1px oklch(1 0 0 / 0.06);
|
||||||
|
--ipal-shadow-md: 0 4px 8px -2px oklch(0 0 0 / 0.5), 0 0 0 1px oklch(1 0 0 / 0.05);
|
||||||
|
--ipal-shadow-sm: 0 1px 2px 0 oklch(0 0 0 / 0.4), 0 0 0 1px oklch(1 0 0 / 0.04);
|
||||||
--ipal-surface-dark: var(--ipal-surface);
|
--ipal-surface-dark: var(--ipal-surface);
|
||||||
--ipal-border-dark: var(--ipal-border);
|
--ipal-border-dark: var(--ipal-border);
|
||||||
--ipal-text-dark: var(--ipal-text);
|
--ipal-text-dark: var(--ipal-text);
|
||||||
@@ -127,15 +127,15 @@
|
|||||||
/* Inverted section (settings.background = inverted): content inside reads the inverse roles. */
|
/* Inverted section (settings.background = inverted): content inside reads the inverse roles. */
|
||||||
|
|
||||||
[data-surface="inverse"] {
|
[data-surface="inverse"] {
|
||||||
--ipal-text: var(--ipal-text-inverse);
|
|
||||||
--ipal-text-strong: var(--ipal-text-inverse);
|
|
||||||
--ipal-text-muted: color-mix(in oklch, var(--ipal-text-inverse) 72%, var(--ipal-surface-inverse));
|
|
||||||
--ipal-border: color-mix(in oklch, var(--ipal-text-inverse) 18%, var(--ipal-surface-inverse));
|
--ipal-border: color-mix(in oklch, var(--ipal-text-inverse) 18%, var(--ipal-surface-inverse));
|
||||||
--ipal-border-strong: color-mix(in oklch, var(--ipal-text-inverse) 30%, var(--ipal-surface-inverse));
|
--ipal-border-strong: color-mix(in oklch, var(--ipal-text-inverse) 30%, var(--ipal-surface-inverse));
|
||||||
--ipal-surface: color-mix(in oklch, var(--ipal-text-inverse) 8%, var(--ipal-surface-inverse));
|
--ipal-focus: var(--ipal-focus-inverse);
|
||||||
--ipal-hover: color-mix(in oklch, var(--ipal-text-inverse) 12%, var(--ipal-surface-inverse));
|
--ipal-hover: color-mix(in oklch, var(--ipal-text-inverse) 12%, var(--ipal-surface-inverse));
|
||||||
--ipal-link: var(--ipal-link-inverse);
|
--ipal-link: var(--ipal-link-inverse);
|
||||||
--ipal-focus: var(--ipal-focus-inverse);
|
--ipal-surface: color-mix(in oklch, var(--ipal-text-inverse) 8%, var(--ipal-surface-inverse));
|
||||||
|
--ipal-text: var(--ipal-text-inverse);
|
||||||
|
--ipal-text-muted: color-mix(in oklch, var(--ipal-text-inverse) 72%, var(--ipal-surface-inverse));
|
||||||
|
--ipal-text-strong: var(--ipal-text-inverse);
|
||||||
--ipal-link-hover: var(--ipal-link-inverse);
|
--ipal-link-hover: var(--ipal-link-inverse);
|
||||||
color-scheme: dark;
|
color-scheme: dark;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user