UNPKG

@wix/css-property-parser

Version:

A comprehensive TypeScript library for parsing and serializing CSS property values with full MDN specification compliance

22 lines (21 loc) 963 B
import type { GlobalKeyword, CSSLengthValue, CSSPercentageValue, CSSVariableValue } from '../types'; /** * Generic sizing property parser * @param value - CSS value string to parse * @param keywords - Array of valid keywords for this specific property * @param requireNonNegative - Whether to enforce non-negative values (default: true) * @returns Parsed sizing value or null if invalid */ export declare function parseSizingProperty<T extends string>(value: string, keywords: readonly T[], requireNonNegative?: boolean): CSSLengthValue | CSSPercentageValue | { type: 'keyword'; keyword: T | GlobalKeyword; } | CSSVariableValue | null; /** * Generic sizing property toCSSValue converter * @param parsed - Parsed sizing value * @returns CSS string or null if invalid */ export declare function sizingToCSSValue(parsed: CSSLengthValue | CSSPercentageValue | { type: 'keyword'; keyword: string; } | CSSVariableValue | null): string | null;