UNPKG

@nativescript/core

Version:

A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.

71 lines (70 loc) 3.07 kB
import { Color } from '../color'; export type Parsed<V> = { start: number; end: number; value: V; }; export type URL = string; export type Angle = number; export interface Unit<T> { value: number; unit: string; } export type Length = Unit<'px' | 'dip'>; export type Percentage = Unit<'%'>; export type LengthPercentage = Length | Percentage; export type Keyword = string; export interface ColorStop { color: Color; offset?: LengthPercentage; } export interface LinearGradient { angle: number; colors: ColorStop[]; } export interface Background { readonly color?: number | Color; readonly image?: URL | LinearGradient; readonly repeat?: BackgroundRepeat; readonly position?: BackgroundPosition; readonly size?: BackgroundSize; } export type BackgroundRepeat = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat'; export type BackgroundSize = 'auto' | 'cover' | 'contain' | { x: LengthPercentage; y: 'auto' | LengthPercentage; }; export type HorizontalAlign = 'left' | 'center' | 'right'; export type VerticalAlign = 'top' | 'center' | 'bottom'; export interface HorizontalAlignWithOffset { readonly align: 'left' | 'right'; readonly offset: LengthPercentage; } export interface VerticalAlignWithOffset { readonly align: 'top' | 'bottom'; readonly offset: LengthPercentage; } export interface BackgroundPosition { readonly x: HorizontalAlign | HorizontalAlignWithOffset; readonly y: VerticalAlign | VerticalAlignWithOffset; text?: string; } export declare function parseURL(text: string, start?: number): Parsed<URL>; export declare function parseHexColor(text: string, start?: number): Parsed<Color>; export declare function parseCssColor(text: string, start?: number): Parsed<Color>; export declare function convertHSLToRGBColor(hue: number, saturation: number, lightness: number): { r: number; g: number; b: number; }; export declare function parseColorKeyword(value: any, start: number, keyword?: Parsed<string>): Parsed<Color>; export declare function parseColor(value: string, start?: number, keyword?: Parsed<string>): Parsed<Color>; export declare function parseRepeat(value: string, start?: number, keyword?: Parsed<string>): Parsed<BackgroundRepeat>; export declare function parseUnit(text: string, start?: number): Parsed<Unit<string>>; export declare function parsePercentageOrLength(text: string, start?: number): Parsed<LengthPercentage>; export declare function parseAngle(value: string, start?: number): Parsed<Angle>; export declare function parseBackgroundSize(value: string, start?: number, keyword?: Parsed<string>): Parsed<BackgroundSize>; export declare function parseBackgroundPosition(text: string, start?: number, keyword?: Parsed<string>): Parsed<BackgroundPosition>; export declare function parseColorStop(text: string, start?: number): Parsed<ColorStop>; export declare function parseLinearGradient(text: string, start?: number): Parsed<LinearGradient>; export declare function parseBackground(text: string, start?: number): Parsed<Background>;