UNPKG

@loadsmart/miranda-tokens

Version:

Design tokens for the Miranda Design System

29 lines (28 loc) 1.97 kB
import type { BACKGROUND_COLOR_TOKENS, BORDER_RADIUS_TOKENS, BORDER_TOKENS, BORDER_WIDTH_TOKENS, COLOR_TOKENS, ELEVATION_TOKENS, FONT_FAMILY_TOKENS, FONT_SIZE_TOKENS, FONT_WEIGHT_TOKENS, GLOBAL_TOKENS, GLOW_TOKENS, LINE_HEIGHT_TOKENS, OPACITY_TOKENS, SPACING_TOKENS, SPACING_TOKENS_WITH_NONE, MEDIA_QUERY_TOKENS, TOKENS } from './values.js'; type DashPrefix<T extends string> = T extends '' ? '' : `-${T}`; export type DashNestedKeys<T> = T extends string | number ? '' : (T extends object ? { [K in Exclude<keyof T, symbol>]: `${K}${DashPrefix<DashNestedKeys<T[K]>>}`; }[Exclude<keyof T, symbol>] : '') extends infer D ? Extract<D, string> : never; export type TokenValue = string | number; export type FlattenableTheme = { [key: string]: TokenValue | FlattenableTheme; }; export type FlattenedTheme<T extends FlattenableTheme> = Record<DashNestedKeys<T>, TokenValue>; export type BackgroundColorToken = (typeof BACKGROUND_COLOR_TOKENS)[number]; export type BorderToken = (typeof BORDER_TOKENS)[number]; export type BorderRadiusToken = (typeof BORDER_RADIUS_TOKENS)[number]; export type BorderWidthToken = (typeof BORDER_WIDTH_TOKENS)[number]; export type ColorToken = (typeof COLOR_TOKENS)[number]; export type ElevationToken = (typeof ELEVATION_TOKENS)[number]; export type FontFamilyToken = (typeof FONT_FAMILY_TOKENS)[number]; export type FontSizeToken = (typeof FONT_SIZE_TOKENS)[number]; export type FontWeightToken = (typeof FONT_WEIGHT_TOKENS)[number]; export type GlowToken = (typeof GLOW_TOKENS)[number]; export type GlobalToken = (typeof GLOBAL_TOKENS)[number]; export type LineHeightToken = (typeof LINE_HEIGHT_TOKENS)[number]; export type OpacityToken = (typeof OPACITY_TOKENS)[number]; export type SpacingToken = (typeof SPACING_TOKENS)[number]; export type SpacingTokenWithNone = (typeof SPACING_TOKENS_WITH_NONE)[number]; export type MediaQueryToken = (typeof MEDIA_QUERY_TOKENS)[number]; export type Token = (typeof TOKENS)[number]; export {};