resolveFontSizeTokens (types/index.ts)

OpenBitFun · src/web-ui/src/infrastructure/font-preference/types/index.ts · typescript · MIT
ui, tag:knn-classified

Resolves UI font size tokens based on user preference.

// Source: https://github.com/GCWing/OpenBitFun | License: MIT | Copyright 2026 CWing
// Provided via justclaw.it.com; keep this notice with the code.

import {
  createTypographySizeScale,
  type TypographySizeScale,
} from '@openbitfun/design-tokens/typography-runtime';

export type FontSizeLevel = 'compact' | 'small' | 'default' | 'medium' | 'large' | 'custom';

export interface UiFontSizePreference {
  level: FontSizeLevel;
  /** Only used when level === 'custom'. Range: 12–20. */
  customPx?: number;
}

export interface FontPreference {
  uiSize: UiFontSizePreference;
}

export type FontSizeTokens = TypographySizeScale;

export type FontSizeLevelPresets = Record<Exclude<FontSizeLevel, 'custom'>, FontSizeTokens>;

/** UI baseline (px) for each preset level. Default = 14. */
export cons

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key