@kuma-ui/system
Version:
🐻 Kuma UI is a utility-first, zero-runtime CSS-in-JS library that offers an outstanding developer experience and optimized performance.
37 lines (34 loc) • 1.46 kB
TypeScript
import * as CSS from 'csstype';
import { StyledKeyType } from './keys.js';
import { Tokens } from '@kuma-ui/sheet';
type If<C extends boolean, T, F> = C extends true ? T : F;
type ThemeSystemType = Record<Tokens, string & {}>;
type CSSProperty = Exclude<CSS.Properties[keyof CSS.Properties], undefined>;
type RemoveColon<T extends string> = T extends `${infer R}${infer R2}` ? R extends ":" ? RemoveColon<R2> : `${R}${R2}` : T;
type ExcludeHyphen<T extends string> = Exclude<T, `-${string}`>;
type CSSValue<P extends keyof CSS.Properties, Q extends boolean = false> = CSSProperties<P, Q>[P];
type CSSProperties<P extends keyof CSS.Properties,
/** If true, the CSS property value can be a number */
Q extends boolean = false> = If<Q, Pick<CSS.PropertiesFallback<number>, P>, Pick<CSS.PropertiesFallback, P>>;
type UtilityCSSMapping<K extends StyledKeyType> = {
[key in K]: keyof CSS.Properties;
};
type ResponsiveStyle = {
base: string;
media: {
[breakpoint: string]: string;
};
};
type SystemStyle = {
base: ResponsiveStyle["base"];
responsive: ResponsiveStyle["media"];
pseudo: {
key: string;
base: ResponsiveStyle["base"];
responsive: ResponsiveStyle["media"];
}[];
};
type AddProperty<T, T2> = {
[Key in keyof T]: T[Key] | T2;
};
export { AddProperty, CSSProperties, CSSProperty, CSSValue, ExcludeHyphen, RemoveColon, ResponsiveStyle, SystemStyle, ThemeSystemType, UtilityCSSMapping };