/**
 * Resolved numeric rectangular size.
 */ export interface AbsoluteSizeSchema { /**
     * Height of the rectangle.
     */ height : number ; /**
     * Width of the rectangle.
     */ width : number ; } /**
 * User-friendly size as a number of pixels or percentage.
 */ export type RelativeSize = number | string ; /**
 * User-friendly rectangular size.
 */ export interface RelativeSizeSchema { /**
     * Height of the rectangle.
     */ height : RelativeSize ; /**
     * Width of the rectangle.
     */ width : RelativeSize ; } param container param relative returns const convertRelativeToAbsoluteSize = ( container , relative ) : number => { if ( typeof relative === "number" ) { return relative ; } if ( ! /^(\d+)%$/ . test ( relative ) ) { throw new Error ( "Relative size should be in percentage form." ) ; } return ( container * parseFloat ( relative . substring ( 0 , relative . length - 1 ) ) ) / 100 ; } ; param container param requestedSize returns export const getAbsoluteSizeInContainer = ( container , requestedSize ) : AbsoluteSizeSchema => ( { height : convertRelativeToAbsoluteSize ( container . height , requestedSize . height ) , width : convertRelativeToAbsoluteSize ( container . width , requestedSize . width ) , } ) ; param container param height returns export const getAbsoluteSizeRemaining = ( container , height ) : AbsoluteSizeSchema => ( { height : container . height - height , width : container . width , } ) ;