@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.2 kB
TypeScript
import { type BorderColorPropertyValue } from './shared-border-color';
export type BorderRightColorValue = BorderColorPropertyValue;
/**
* Parse CSS border-right-color property
*
* @param value - CSS border-right-color property value
* @returns Parsed border color value or null if invalid
*
* @example
* parse('blue') // { type: 'color', format: 'named', values: { name: 'blue' } }
* parse('rgb(255, 0, 0)') // { type: 'color', format: 'rgb', values: { r: 255, g: 0, b: 0 } }
* parse('currentcolor') // { type: 'keyword', keyword: 'currentcolor' }
* parse('var(--color)') // null (CSS variables handled at runtime)
*/
export declare function parse(value: string): BorderRightColorValue;
/**
* Convert parsed border-right-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: 'blue' } }) // 'blue'
* toCSSValue({ type: 'keyword', keyword: 'currentcolor' }) // 'currentcolor'
* toCSSValue({ type: 'keyword', keyword: 'initial' }) // 'initial'
*/
export declare function toCSSValue(parsed: BorderRightColorValue): string | null;