UNPKG

@stylex-extend/shared

Version:

Shared utilities for StyleX Extend

24 lines (20 loc) 1.3 kB
import * as CSS from 'csstype'; type CSSProperties = CSS.PropertiesFallback<number | string>; type CSSPropertiesKey = (keyof CSSProperties) | CSS.AtRules | CSS.Pseudos | (string & {}); type SelectOrAtRules = CSS.AtRules | CSS.Pseudos | (string & {}); type CSSPropertiesMoreValue<T> = { default?: T; } & Partial<Record<SelectOrAtRules, T>>; type CSSPropertiesWithMultiValues = { [K in CSSPropertiesKey]?: K extends keyof CSSProperties ? (CSSProperties[K] | CSSPropertiesMoreValue<CSSProperties[K]>) : CSSPropertiesWithMultiValues | (string & {}) | number; }; type CSSObject = CSSPropertiesWithMultiValues; type StylexProperty = CSSObject | ((...args: any[]) => CSSObject); type CSSPropertiesAndSubKey = (keyof CSSProperties) | CSS.AtRules | `&${CSS.Pseudos}` | (string & {}); type StylexCSSObject = { [K in CSSPropertiesAndSubKey]?: K extends keyof CSSProperties ? CSSProperties[K] : StylexCSSObject | (string & {}) | ((...args: any[]) => StylexCSSObject) | number; }; type StylexCSS = StylexCSSObject | ((...args: any[]) => StylexCSSObject); declare function xxhash(str: string): string; declare function randomAlpha(): string; export { type CSSObject, type CSSProperties, type CSSPropertiesWithMultiValues, type StylexCSS, type StylexCSSObject, type StylexProperty, randomAlpha, xxhash };