UNPKG

@nex-ui/system

Version:

A lightweight and performant styling library based on Emotion, focusing on component architecture and developer experience.

100 lines (97 loc) 5.17 kB
import { Dictionary, CSSProperties } from '../types.js'; type TokenValue = string | number; type ResponsiveColor = { _DEFAULT?: CSSProperties['color']; _light?: CSSProperties['color']; _dark?: CSSProperties['color']; }; type SemanticTokenValue = TokenValue | ResponsiveColor; type TokenCategory = 'fontFamilies' | 'fontSizes' | 'fontWeights' | 'lineHeights' | 'colors' | 'spaces' | 'sizes' | 'borders' | 'radii' | 'borderWidths' | 'shadows' | 'zIndexes' | 'transitions'; type ColorsDefinition = Dictionary<{ 50?: CSSProperties['color']; 100?: CSSProperties['color']; 200?: CSSProperties['color']; 300?: CSSProperties['color']; 400?: CSSProperties['color']; 500?: CSSProperties['color']; 600?: CSSProperties['color']; 700?: CSSProperties['color']; 800?: CSSProperties['color']; 900?: CSSProperties['color']; } | CSSProperties['color']>; type RadiiDefinition = Dictionary<string | number>; type SpacesDefinition = Dictionary<string | number>; type SizesDefinition = Dictionary<string | number>; type FontSizesDefinition = Dictionary<string | number>; type FontWeightsDefinition = Dictionary<string | number>; type LineHeightsDefinition = Dictionary<string | number>; type BordersDefinition = Dictionary<string>; type FontFamiliesDefinition = Dictionary<string>; type TransitionsDefinition = Dictionary<string>; type ShadowsDefinition = Dictionary<string>; type BorderWidthsDefinition = Dictionary<string | number>; type ZIndexesDefinition = Dictionary<number>; type NestedColor = CSSProperties['color'] | ResponsiveColor | ({ DEFAULT?: CSSProperties['color'] | ResponsiveColor; _DEFAULT?: never; _light?: never; _dark?: never; } & { [key: string]: NestedColor; }); type SemanticColorDefinition = Dictionary<NestedColor>; type StringAndNumberForNestedSemanticTokenValue = string | number | ({ DEFAULT?: string | number; } & { [key: string]: StringAndNumberForNestedSemanticTokenValue; }); type StringForNestedSemanticTokenValue = string | ({ DEFAULT?: string; } & { [key: string]: StringForNestedSemanticTokenValue; }); type SemanticSpacesDefinition = Dictionary<StringAndNumberForNestedSemanticTokenValue>; type SemanticSizesDefinition = Dictionary<StringAndNumberForNestedSemanticTokenValue>; type SemanticFontFamiliesDefinition = Dictionary<StringForNestedSemanticTokenValue>; type SemanticFontSizesDefinition = Dictionary<StringAndNumberForNestedSemanticTokenValue>; type SemanticFontWeightsDefinition = Dictionary<StringAndNumberForNestedSemanticTokenValue>; type SemanticLineHeightsDefinition = Dictionary<StringAndNumberForNestedSemanticTokenValue>; type SemanticBordersDefinition = Dictionary<StringAndNumberForNestedSemanticTokenValue>; type SemanticRadiiDefinition = Dictionary<StringAndNumberForNestedSemanticTokenValue>; type SemanticTransitionsDefinition = Dictionary<StringForNestedSemanticTokenValue>; type SemanticBorderWidthsDefinition = Dictionary<StringAndNumberForNestedSemanticTokenValue>; type SemanticZIndexesDefinition = Dictionary<StringAndNumberForNestedSemanticTokenValue>; type SemanticShadowsDefinition = Dictionary<StringForNestedSemanticTokenValue>; type SemanticTokensDefinition = { colors?: SemanticColorDefinition; spaces?: SemanticSpacesDefinition; sizes?: SemanticSizesDefinition; fontFamilies?: SemanticFontFamiliesDefinition; fontSizes?: SemanticFontSizesDefinition; fontWeights?: SemanticFontWeightsDefinition; lineHeights?: SemanticLineHeightsDefinition; borders?: SemanticBordersDefinition; radii?: SemanticRadiiDefinition; transitions?: SemanticTransitionsDefinition; shadows?: SemanticShadowsDefinition; borderWidths?: SemanticBorderWidthsDefinition; zIndexes?: SemanticZIndexesDefinition; }; type TokensDefinition = { colors?: ColorsDefinition; spaces?: SpacesDefinition; sizes?: SizesDefinition; fontFamilies?: FontFamiliesDefinition; fontSizes?: FontSizesDefinition; fontWeights?: FontWeightsDefinition; lineHeights?: LineHeightsDefinition; borders?: BordersDefinition; radii?: RadiiDefinition; shadows?: ShadowsDefinition; transitions?: TransitionsDefinition; borderWidths?: BorderWidthsDefinition; zIndexes?: ZIndexesDefinition; }; type ConditionKey = 'base' | 'light' | 'dark'; type CssVarMap = Map<ConditionKey, Map<string, string | number>>; export type { BorderWidthsDefinition, BordersDefinition, ColorsDefinition, ConditionKey, CssVarMap, FontFamiliesDefinition, FontSizesDefinition, FontWeightsDefinition, LineHeightsDefinition, RadiiDefinition, ResponsiveColor, SemanticBorderWidthsDefinition, SemanticBordersDefinition, SemanticColorDefinition, SemanticFontFamiliesDefinition, SemanticFontSizesDefinition, SemanticFontWeightsDefinition, SemanticLineHeightsDefinition, SemanticRadiiDefinition, SemanticShadowsDefinition, SemanticSizesDefinition, SemanticSpacesDefinition, SemanticTokenValue, SemanticTokensDefinition, SemanticTransitionsDefinition, SemanticZIndexesDefinition, ShadowsDefinition, SizesDefinition, SpacesDefinition, TokenCategory, TokenValue, TokensDefinition, TransitionsDefinition, ZIndexesDefinition };