imsc
Version:
Renders IMSC documents to HTML5 fragments
77 lines • 2.27 kB
TypeScript
/**
* @param {string} str
* @returns {[number, number, number, number]}
*/
export function parseColor(str: string): [number, number, number, number];
/**
* @param {string} str
* @returns {{ value: number, unit: string } | null}
*/
export function parseLength(str: string): {
value: number;
unit: string;
} | null;
/**
* @param {string} str
* @returns {string | any[] | null}
*/
export function parseTextShadow(str: string): string | any[] | null;
/**
* @typedef {{ value: number, unit: string }} Offset
* @typedef {{ edge: string, offset: Offset }} Position
*/
/**
* @param {string} str
* @returns {{h: Position, v: Position} | null}
*/
export function parsePosition(str: string): {
h: Position;
v: Position;
} | null;
/**
* Computes a specified length to a root container relative length
*
* @param {number} lengthVal Length value to be computed
* @param {string} lengthUnit Units of the length value
* @param {number} emScale length of 1em, or null if em is not allowed
* @param {number} percentScale length to which , or null if perecentage is not allowed
* @param {number} cellScale length of 1c, or null if c is not allowed
* @param {number} pxScale length of 1px, or null if px is not allowed
* @param {number} direction 0 if the length is computed in the horizontal direction, 1 if the length is computed in the vertical direction
* @return {number} Computed length
*/
export function toComputedLength(lengthVal: number, lengthUnit: string, emLength: any, percentLength: any, cellLength: any, pxLength: any): number;
/**
* @param {Object} obj
* @param {string} prop
* @returns {boolean}
*/
export function hasOwnProperty(obj: Object, prop: string): boolean;
export class ComputedLength {
/**
* @param {number} rw
* @param {number} rh
*/
constructor(rw: number, rh: number);
rw: number;
rh: number;
/**
* @param {number} width
* @param {number} height
* @returns {number}
*/
toUsedLength(width: number, height: number): number;
/**
* @returns {boolean}
*/
isZero(): boolean;
}
export type Offset = {
value: number;
unit: string;
};
export type Position = {
edge: string;
offset: Offset;
};
//# sourceMappingURL=utils.d.ts.map