@wix/css-property-parser
Version:
A comprehensive TypeScript library for parsing and serializing CSS property values with full MDN specification compliance
32 lines (31 loc) • 1.11 kB
TypeScript
import { type WordBreakValue } from '../types';
/**
* Parses CSS word-break property values
*
* Syntax: normal | break-all | keep-all | break-word | inherit | initial | unset | revert
*
* @param value - The CSS word-break value to parse
* @returns Parsed WordBreakValue or null if invalid
*
* @example
* ```typescript
* parse('normal') // { type: 'keyword', keyword: 'normal' }
* parse('break-all') // { type: 'keyword', keyword: 'break-all' }
* parse('keep-all') // { type: 'keyword', keyword: 'keep-all' }
* ```
*/
export declare function parse(value: string): WordBreakValue | null;
/**
* Converts a parsed WordBreakValue back to a CSS string
*
* @param parsed - The parsed WordBreakValue to convert
* @returns CSS string representation or null if invalid
*
* @example
* ```typescript
* toCSSValue({ type: 'keyword', keyword: 'normal' }) // 'normal'
* toCSSValue({ type: 'keyword', keyword: 'break-all' }) // 'break-all'
* toCSSValue({ type: 'keyword', keyword: 'keep-all' }) // 'keep-all'
* ```
*/
export declare function toCSSValue(parsed: WordBreakValue | null): string | null;