effcss
Version:
Self-confident CSS-in-JS
95 lines (94 loc) • 2.31 kB
TypeScript
import type { TCreateScope } from './scope';
import { resolveAtRules } from './_process/atrules';
import { resolveUnits } from './_process/units';
import { resolvePseudo } from './_process/pseudo';
import { resolveColor } from './_process/color';
import { resolvePalette } from './_process/palette';
import { resolveCoef } from './_process/coef';
import { dash, comma, space, range, each, when, merge } from './utils';
type TScope = ReturnType<ReturnType<TCreateScope>>;
type TBezier = {
x1?: number;
y1?: number;
x2?: number;
y2?: number;
};
export interface IMakerParams {
dash: typeof dash;
comma: typeof comma;
space: typeof space;
range: typeof range;
each: typeof each;
merge: typeof merge;
when: typeof when;
/**
* BEM selector resolver
*/
bem: TScope['selector'];
/**
* CSS units
*/
units: ReturnType<typeof resolveUnits>;
/**
* Pseudoclasses and pseudoelements
*/
pseudo: ReturnType<typeof resolvePseudo>;
/**
* At-rules
*/
at: ReturnType<typeof resolveAtRules>;
/**
* Colors
*/
color: ReturnType<typeof resolveColor>;
/**
* Color palette
*/
palette: ReturnType<typeof resolvePalette>;
/**
* Coefficient
*/
coef: ReturnType<typeof resolveCoef>;
/**
* Resolve theme variable
* @param name - name
* @param fallback - fallback value
*/
themeVar: TScope['varExp'];
/**
* Scalable size value
*/
size: (coef?: number | string) => string;
/**
* Scalable time value
*/
time: (coef?: number | string) => string;
/**
* Scalable angle value
*/
angle: (coef?: number | string) => string;
/**
* Easing function
*/
easing: (bezier?: TBezier) => string;
}
export type TProcessor = {
/**
* Compile stylesheet maker to CSSStylesheet content
* @param params - params
*/
compile(params: {
key: string;
maker: (params: IMakerParams) => object;
}): string;
};
type TCreateProcessor = (params: {
scope: ReturnType<TCreateScope>;
globalKey: string;
}) => TProcessor;
/**
* Create style processor
* @param params - processor params
*/
export declare const createProcessor: TCreateProcessor;
export {};