UNPKG

@synergy-design-system/components

Version:
31 lines (30 loc) 1.3 kB
/** * Resolves a CSS custom property token to its computed value on the document body. * * @param token CSS custom property name, e.g. --syn-color-primary. * @returns Trimmed computed value or an empty string when the token is not defined. */ export declare const getRealStyleValue: (token: string) => string; /** * Resolves a CSS custom property token and parses the numeric part from the value. * * @param token CSS custom property name. * @returns Parsed floating-point number from the computed style value. */ export declare const getRealValueWithoutUnit: (token: string) => number; /** * Normalizes either a single value or an array into an array shape. * * @param value A single item or an array of items. * @returns The input as an array. */ export declare const normalizeArray: <T>(value: T | T[]) => T[]; /** * Ensures that a nested property path exists and applies a default value when the final key is missing. * Existing values are preserved. * * @param target Object that is read and potentially mutated. * @param keyPath Dot-separated key path, e.g. a.b.c. * @param value Default value to assign when the final key does not exist. */ export declare const setDefaultValueIfNotAvailable: (target: Record<string, unknown>, keyPath: string, value: unknown) => void;