@wix/css-property-parser
Version:
A comprehensive TypeScript library for parsing and serializing CSS property values with full MDN specification compliance
28 lines (27 loc) • 1.21 kB
TypeScript
import { type BorderColorPropertyValue } from './shared-border-color';
export type BorderBottomColorValue = BorderColorPropertyValue;
/**
* Parse CSS border-bottom-color property
*
* @param value - CSS border-bottom-color property value
* @returns Parsed border color value or null if invalid
*
* @example
* parse('green') // { type: 'color', format: 'named', values: { name: 'green' } }
* parse('hsl(120, 100%, 50%)') // { type: 'color', format: 'hsl', values: { h: 120, s: 100, l: 50 } }
* parse('currentcolor') // { type: 'keyword', keyword: 'currentcolor' }
* parse('var(--color)') // null (CSS variables handled at runtime)
*/
export declare function parse(value: string): BorderBottomColorValue;
/**
* Convert parsed border-bottom-color back to CSS string
*
* @param parsed - Parsed border color value
* @returns CSS string representation or null if invalid
*
* @example
* toCSSValue({ type: 'color', format: 'named', values: { name: 'green' } }) // 'green'
* toCSSValue({ type: 'keyword', keyword: 'currentcolor' }) // 'currentcolor'
* toCSSValue({ type: 'keyword', keyword: 'unset' }) // 'unset'
*/
export declare function toCSSValue(parsed: BorderBottomColorValue): string | null;