/**
 * General @nativescript/core types used throughout the library.
 */ import * as animationModule from '../ui/animation' ; import { makeValidator , makeParser } from '../ui/core/properties' ; export namespace CoreTypes { /**
     * Denotes a length number that is in device independent pixel units.
     */ export type dip = number ; /**
     * Denotes a length number that is in physical device pixels.
     */ export type px = number ; /**
     * Denotes a normalized percent number.
     * 0% is represented as 0
     * 50% is represented as 0.5
     * 100% is represented as 1
     */ export type percent = number ; export type LengthDipUnit = { readonly unit : 'dip' ; readonly value : dip ; } ; export type LengthPxUnit = { readonly unit : 'px' ; readonly value : px ; } ; export type LengthPercentUnit = { readonly unit : '%' ; readonly value : percent ; } ; export type LengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit ; export type PercentLengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit | LengthPercentUnit ; export type KeyboardInputType = 'datetime' | 'phone' | 'number' | 'url' | 'email' | 'integer' ; export module KeyboardType { export const datetime = 'datetime' ; export const phone = 'phone' ; export const number = 'number' ; export const url = 'url' ; export const email = 'email' ; export const integer = 'integer' ; } export type AutofillType = 'username' | 'password' | 'none' | string ; export module AutofillType { export const username = 'username' ; export const password = 'password' ; export const none = 'none' ; } export type ReturnKeyButtonType = 'done' | 'next' | 'go' | 'search' | 'send' ; export module ReturnKeyType { export const done = 'done' ; export const next = 'next' ; export const go = 'go' ; export const search = 'search' ; export const send = 'send' ; } export type TextAlignmentType = 'initial' | 'left' | 'center' | 'right' | 'justify' ; export module TextAlignment { export const left = 'left' ; export const center = 'center' ; export const right = 'right' ; export const justify = 'justify' ; } export type TextDecorationType = 'none' | 'underline' | 'line-through' | 'underline line-through' ; export module TextDecoration { export const none = 'none' ; export const underline = 'underline' ; export const lineThrough = 'line-through' ; } export type TextTransformType = 'initial' | 'none' | 'capitalize' | 'uppercase' | 'lowercase' ; export module TextTransform { export const none = 'none' ; export const capitalize = 'capitalize' ; export const uppercase = 'uppercase' ; export const lowercase = 'lowercase' ; } export type WhiteSpaceType = 'initial' | 'normal' | 'nowrap' ; export module WhiteSpace { export const normal = 'normal' ; export const nowrap = 'nowrap' ; } export type OrientationType = 'horizontal' | 'vertical' ; export module Orientation { export const horizontal = 'horizontal' ; export const vertical = 'vertical' ; } export type DeviceOrientationType = 'portrait' | 'landscape' | 'unknown' ; export module DeviceOrientation { export const portrait = 'portrait' ; export const landscape = 'landscape' ; export const unknown = 'unknown' ; } export type HorizontalAlignmentType = 'left' | 'center' | 'right' | 'stretch' ; export module HorizontalAlignment { export const left = 'left' ; export const center = 'center' ; export const right = 'right' ; export const stretch = 'stretch' ; export const isValid = makeValidator < HorizontalAlignmentType > ( left , center , right , stretch ) ; export const parse = makeParser < HorizontalAlignmentType > ( isValid ) ; } export type VerticalAlignmentType = 'top' | 'middle' | 'bottom' | 'stretch' ; export module VerticalAlignment { export const top = 'top' ; export const middle = 'middle' ; export const bottom = 'bottom' ; export const stretch = 'stretch' ; } export type VerticalAlignmentTextType = VerticalAlignmentType | 'text-top' | 'text-bottom' | 'sup' | 'sub' | 'baseline' ; export namespace VerticalAlignmentText { export const top = 'top' ; export const middle = 'middle' ; export const bottom = 'bottom' ; export const stretch = 'stretch' ; export const texttop = 'text-top' ; export const textbottom = 'text-bottom' ; export const sup = 'sup' ; export const sub = 'sub' ; export const baseline = 'baseline' ; export const isValid = makeValidator < VerticalAlignmentTextType > ( top , middle , bottom , stretch , texttop , textbottom , sup , sub , baseline ) ; export const parse = ( value ) => ( value . toLowerCase ( ) === 'center' ? middle : parseStrict ( value ) ) ; const parseStrict = makeParser < CoreTypes . VerticalAlignmentTextType > ( isValid ) ; } export type ImageStretchType = 'none' | 'aspectFill' | 'aspectFit' | 'fill' ; export module ImageStretch { export const none = 'none' ; export const aspectFill = 'aspectFill' ; export const aspectFit = 'aspectFit' ; export const fill = 'fill' ; } export type VisibilityType = 'visible' | 'hidden' | 'collapse' | 'collapsed' ; export module Visibility { export const visible = 'visible' ; export const collapse = 'collapse' ; export const collapsed = 'collapsed' ; export const hidden = 'hidden' ; export const isValid = makeValidator < CoreTypes . VisibilityType > ( visible , hidden , collapse ) ; export const parse = ( value ) => ( value . toLowerCase ( ) === 'collapsed' ? collapse : parseStrict ( value ) ) ; const parseStrict = makeParser < CoreTypes . VisibilityType > ( isValid ) ; } export module FontAttributes { export const Normal = 0 ; export const Bold = 1 ; export const Italic = 1 << 1 ; } export module DeviceType { export const Phone = 'Phone' ; export const Tablet = 'Tablet' ; } export type UpdateTextTriggerType = 'focusLost' | 'textChanged' ; export module UpdateTextTrigger { export const focusLost = 'focusLost' ; export const textChanged = 'textChanged' ; } export module Accuracy { export const any = 300 ; export const high = 3 ; } export type DockType = 'left' | 'top' | 'right' | 'bottom' ; export module Dock { export const left = 'left' ; export const top = 'top' ; export const right = 'right' ; export const bottom = 'bottom' ; } export type AutocapitalizationInputType = 'none' | 'words' | 'sentences' | 'allcharacters' ; export module AutocapitalizationType { export const none = 'none' ; export const words = 'words' ; export const sentences = 'sentences' ; export const allCharacters = 'allcharacters' ; } export module NavigationBarVisibility { export const auto = 'auto' ; export const never = 'never' ; export const always = 'always' ; } export module AndroidActionBarIconVisibility { export const auto = 'auto' ; export const never = 'never' ; export const always = 'always' ; } export module AndroidActionItemPosition { export const actionBar = 'actionBar' ; export const actionBarIfRoom = 'actionBarIfRoom' ; export const popup = 'popup' ; } export module IOSActionItemPosition { export const left = 'left' ; export const right = 'right' ; } export module ImageFormat { export const png = 'png' ; export const jpeg = 'jpeg' ; export const jpg = 'jpg' ; } export module FontStyle { export const normal = 'normal' ; export const italic = 'italic' ; } export module FontWeight { export const thin = '100' ; export const extraLight = '200' ; export const light = '300' ; export const normal = 'normal' ; export const medium = '500' ; export const semiBold = '600' ; export const bold = 'bold' ; export const extraBold = '800' ; export const black = '900' ; } export type BackgroundRepeatType = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' ; export module BackgroundRepeat { export const repeat = 'repeat' ; export const repeatX = 'repeat-x' ; export const repeatY = 'repeat-y' ; export const noRepeat = 'no-repeat' ; export const isValid = makeValidator < BackgroundRepeatType > ( repeat , repeatX , repeatY , noRepeat ) ; export const parse = makeParser < BackgroundRepeatType > ( isValid ) ; } let animation ; export module AnimationCurve { export const ease = 'ease' ; export const easeIn = 'easeIn' ; export const easeOut = 'easeOut' ; export const easeInOut = 'easeInOut' ; export const linear = 'linear' ; export const spring = 'spring' ; export function cubicBezier ( x1 , y1 , x2 , y2 ) { animation = animation || require ( '../ui/animation' ) ; return new animation . CubicBezierAnimationCurve ( x1 , y1 , x2 , y2 ) ; } } export module StatusBarStyle { export const light = 'light' ; export const dark = 'dark' ; } export module SystemAppearance { export const light = 'light' ; export const dark = 'dark' ; } } /**
 * NOTE: Auto migrate deprecations via eslint-plugin in future
 */ deprecated export type dip = number ; deprecated export type px = number ; deprecated export type percent = number ; deprecated export type LengthDipUnit = CoreTypes . LengthDipUnit ; deprecated export type LengthPxUnit = CoreTypes . LengthPxUnit ; deprecated export type LengthPercentUnit = CoreTypes . LengthPercentUnit ; deprecated export type LengthType = CoreTypes . LengthType ; deprecated export type PercentLengthType = CoreTypes . PercentLengthType ; deprecated export const AnimationCurve = CoreTypes . AnimationCurve ; deprecated export type HorizontalAlignment = CoreTypes . HorizontalAlignmentType ; deprecated export type VerticalAlignment = CoreTypes . VerticalAlignmentType ; deprecated export const Enums = { Accuracy : CoreTypes . Accuracy , AndroidActionBarIconVisibility : CoreTypes . AndroidActionBarIconVisibility , AndroidActionItemPosition : CoreTypes . AndroidActionItemPosition , AnimationCurve : CoreTypes . AnimationCurve , AutocapitalizationType : CoreTypes . AutocapitalizationType , BackgroundRepeat : CoreTypes . BackgroundRepeat , DeviceOrientation : CoreTypes . DeviceOrientation , DeviceType : CoreTypes . DeviceType , Dock : CoreTypes . Dock , FontAttributes : CoreTypes . FontAttributes , FontStyle : CoreTypes . FontStyle , FontWeight : CoreTypes . FontWeight , HorizontalAlignment : CoreTypes . HorizontalAlignment , IOSActionItemPosition : CoreTypes . IOSActionItemPosition , ImageFormat : CoreTypes . ImageFormat , KeyboardType : CoreTypes . KeyboardType , NavigationBarVisibility : CoreTypes . NavigationBarVisibility , Orientation : CoreTypes . Orientation , ReturnKeyType : CoreTypes . ReturnKeyType , StatusBarStyle : CoreTypes . StatusBarStyle , Stretch : CoreTypes . ImageStretch , SystemAppearance : CoreTypes . SystemAppearance , TextAlignment : CoreTypes . TextAlignment , TextDecoration : CoreTypes . TextDecoration , TextTransform : CoreTypes . TextTransform , UpdateTextTrigger : CoreTypes . UpdateTextTrigger , VerticalAlignment : CoreTypes . VerticalAlignment , Visibility : CoreTypes . Visibility , WhiteSpace : CoreTypes . WhiteSpace , } ;