@wix/css-property-parser
Version:
A comprehensive TypeScript library for parsing and serializing CSS property values with full MDN specification compliance
27 lines (26 loc) • 1.05 kB
TypeScript
import { type WritingModeValue } from '../types';
/**
* Parses CSS writing-mode property values
*
* Syntax: horizontal-tb | vertical-rl | vertical-lr | inherit | initial | unset | revert
*
* @param value - The CSS writing-mode value to parse
* @returns Parsed WritingModeValue or null if invalid
*
* @example
* ```typescript
* parse('horizontal-tb') // { type: 'keyword', keyword: 'horizontal-tb' }
* parse('vertical-rl') // { type: 'keyword', keyword: 'vertical-rl' }
* parse('vertical-lr') // { type: 'keyword', keyword: 'vertical-lr' }
* parse('inherit') // { type: 'keyword', keyword: 'inherit' }
* parse('var(--writing-mode)') // { type: 'variable', variable: 'writing-mode' }
* ```
*/
export declare function parse(value: string): WritingModeValue | null;
/**
* Converts a parsed WritingModeValue back to its CSS string representation
*
* @param value - The parsed writing-mode value
* @returns CSS string representation or null if invalid
*/
export declare function toCSSValue(value: WritingModeValue | null): string | null;