UNPKG

1.73 kBTypeScriptView Raw
1import type { IElement } from '../../dom';
2import type { DisplayObject } from '../../display-objects';
3import type { CSSStyleValue } from '../cssom';
4import { CSSUnitValue } from '../cssom';
5import type { CSSValueParser } from './types';
6export declare function parseDimension(unitRegExp: RegExp, string: string): CSSStyleValue | undefined;
7/**
8 * <length>
9 * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length
10 * length with only absolute unit, eg. 1px
11 */
12export declare const parseLength: CSSValueParser;
13/**
14 * <percentage>
15 * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/percentage
16 */
17export declare const parserPercentage: (css: string) => CSSUnitValue;
18/**
19 * length with absolute or relative unit,
20 * eg. 1px, 0.7em, 50%, calc(100% - 200px);
21 *
22 * @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length-percentage
23 */
24export declare const parseLengthOrPercentage: (css: string) => CSSUnitValue;
25export declare const parseAngle: (css: string) => CSSUnitValue;
26/**
27 * merge CSSUnitValue
28 *
29 * @example
30 * 10px + 20px = 30px
31 * 10deg + 10rad
32 */
33export declare function mergeDimensions(left: CSSUnitValue, right: CSSUnitValue, target: IElement, nonNegative?: boolean, index?: number): [number, number, (value: number) => string];
34export declare function convertAngleUnit(value: CSSUnitValue): number;
35export declare function parseDimensionArray(string: string | (string | number)[]): CSSUnitValue[];
36export declare function mergeDimensionList(left: CSSUnitValue[], right: CSSUnitValue[], target: IElement | null): [number[], number[], (list: number[]) => string] | undefined;
37export declare function convertPercentUnit(valueWithUnit: CSSUnitValue, vec3Index: number, target: DisplayObject): number;