@furystack/shades
Version:
A lightweight UI framework for FuryStack with JSX support
33 lines • 1.32 kB
TypeScript
import type { CSSObject, CSSProperties } from './models/css-object.js';
/**
* @example
* camelToKebab('backgroundColor') // 'background-color'
*/
export declare const camelToKebab: (str: string) => string;
export declare const isSelectorKey: (key: string) => boolean;
/**
* Serializes the non-selector entries of a {@link CSSProperties} object as
* a CSS declaration body. Selector keys (`&...`) are skipped.
*/
export declare const propertiesToCSSString: (properties: CSSProperties) => string;
/** Builds `selector { decls; }` from the non-selector entries. Empty when no decls. */
export declare const generateCSSRule: (selector: string, properties: CSSProperties) => string;
/**
* Renders a {@link CSSObject} as CSS rules. Base properties become a single
* rule against `selector`; each `&...` selector key produces an additional
* rule with `&` substituted for `selector`.
*
* @example
* ```typescript
* generateCSS('my-component', {
* color: 'red',
* '&:hover': { color: 'blue' },
* '& .inner': { fontWeight: 'bold' }
* })
* // my-component { color: red; }
* // my-component:hover { color: blue; }
* // my-component .inner { font-weight: bold; }
* ```
*/
export declare const generateCSS: (selector: string, cssObject: CSSObject) => string;
//# sourceMappingURL=css-generator.d.ts.map