@nativescript/core
Version:
A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.
331 lines (330 loc) • 11.6 kB
TypeScript
/**
* General @nativescript/core types used throughout the library.
*/
import { CubicBezierAnimationCurve } from '../ui/animation/animation-interfaces';
export declare namespace CoreTypes {
type CSSWideKeywords = 'initial' | 'inherit' | 'unset' | 'revert';
/**
* Denotes a length number that is in device independent pixel units.
*/
type dip = number;
/**
* Denotes a length number that is in physical device pixels.
*/
type px = number;
/**
* Denotes a normalized percent number.
* 0% is represented as 0
* 50% is represented as 0.5
* 100% is represented as 1
*/
type percent = number;
type LengthDipUnit = {
readonly unit: 'dip';
readonly value: dip;
};
type LengthPxUnit = {
readonly unit: 'px';
readonly value: px;
};
type LengthPercentUnit = {
readonly unit: '%';
readonly value: percent;
};
type FixedLengthType = dip | LengthDipUnit | LengthPxUnit | CSSWideKeywords;
type LengthType = 'auto' | FixedLengthType;
type PercentLengthType = 'auto' | FixedLengthType | LengthPercentUnit;
const zeroLength: LengthType;
type KeyboardInputType = 'datetime' | 'phone' | 'number' | 'url' | 'email' | 'integer';
namespace KeyboardType {
const datetime = "datetime";
const phone = "phone";
const number = "number";
const url = "url";
const email = "email";
const integer = "integer";
}
type AutofillType = 'username' | 'password' | 'none' | string;
namespace AutofillType {
const username = "username";
const password = "password";
const newUsername = "newUsername";
const newPassword = "newPassword";
const oneTimeCode = "oneTimeCode";
const none = "none";
}
type ReturnKeyButtonType = 'done' | 'next' | 'go' | 'search' | 'send';
namespace ReturnKeyType {
const done = "done";
const next = "next";
const go = "go";
const search = "search";
const send = "send";
}
type TextAlignmentType = 'left' | 'center' | 'right' | 'justify' | CSSWideKeywords;
namespace TextAlignment {
const left = "left";
const center = "center";
const right = "right";
const justify = "justify";
}
type TextDecorationType = 'none' | 'underline' | 'line-through' | 'underline line-through' | CSSWideKeywords;
namespace TextDecoration {
const none = "none";
const underline = "underline";
const lineThrough = "line-through";
}
type TextTransformType = 'none' | 'capitalize' | 'uppercase' | 'lowercase' | CSSWideKeywords;
namespace TextTransform {
const none = "none";
const capitalize = "capitalize";
const uppercase = "uppercase";
const lowercase = "lowercase";
}
type WhiteSpaceType = 'normal' | 'nowrap' | CSSWideKeywords;
namespace WhiteSpace {
const normal = "normal";
const nowrap = "nowrap";
}
type TextOverflowType = 'clip' | 'ellipsis' | CSSWideKeywords;
namespace TextOverflow {
const clip = "clip";
const ellipsis = "ellipsis";
}
type MaxLinesType = number;
type OrientationType = 'horizontal' | 'vertical';
namespace Orientation {
const horizontal = "horizontal";
const vertical = "vertical";
}
type DeviceOrientationType = 'portrait' | 'landscape' | 'unknown';
namespace DeviceOrientation {
const portrait = "portrait";
const landscape = "landscape";
const unknown = "unknown";
}
type HorizontalAlignmentType = 'left' | 'center' | 'right' | 'stretch' | CSSWideKeywords;
namespace HorizontalAlignment {
const left = "left";
const center = "center";
const right = "right";
const stretch = "stretch";
const isValid: (value: any) => value is HorizontalAlignmentType;
const parse: (value: any) => HorizontalAlignmentType;
}
type VerticalAlignmentType = 'top' | 'middle' | 'bottom' | 'stretch' | CSSWideKeywords;
namespace VerticalAlignment {
const top = "top";
const middle = "middle";
const bottom = "bottom";
const stretch = "stretch";
}
type VerticalAlignmentTextType = VerticalAlignmentType | 'text-top' | 'text-bottom' | 'sup' | 'sub' | 'baseline';
namespace VerticalAlignmentText {
const top = "top";
const middle = "middle";
const bottom = "bottom";
const stretch = "stretch";
const texttop = "text-top";
const textbottom = "text-bottom";
const sup = "sup";
const sub = "sub";
const baseline = "baseline";
const isValid: (value: any) => value is VerticalAlignmentTextType;
const parse: (value: string) => VerticalAlignmentTextType;
}
type ImageStretchType = 'none' | 'aspectFill' | 'aspectFit' | 'fill';
namespace ImageStretch {
const none: ImageStretchType;
const aspectFill: ImageStretchType;
const aspectFit: ImageStretchType;
const fill: ImageStretchType;
}
type VisibilityType = 'visible' | 'hidden' | 'collapse' | 'collapsed' | CSSWideKeywords;
namespace Visibility {
const visible: VisibilityType;
const collapse: VisibilityType;
const collapsed: VisibilityType;
const hidden: VisibilityType;
const isValid: (value: any) => value is VisibilityType;
const parse: (value: string) => VisibilityType;
}
namespace FontAttributes {
const Normal = 0;
const Bold = 1;
const Italic: number;
}
namespace DeviceType {
const Phone: string;
const Tablet: string;
}
type UpdateTextTriggerType = 'focusLost' | 'textChanged';
namespace UpdateTextTrigger {
const focusLost: UpdateTextTriggerType;
const textChanged: UpdateTextTriggerType;
}
namespace Accuracy {
const any: number;
const high: number;
}
type DockType = 'left' | 'top' | 'right' | 'bottom';
namespace Dock {
const left: DockType;
const top: DockType;
const right: DockType;
const bottom: DockType;
}
type AutocapitalizationInputType = 'none' | 'words' | 'sentences' | 'allcharacters';
namespace AutocapitalizationType {
const none: AutocapitalizationInputType;
const words: AutocapitalizationInputType;
const sentences: AutocapitalizationInputType;
const allCharacters: AutocapitalizationInputType;
}
namespace NavigationBarVisibility {
const auto: string;
const never: string;
const always: string;
}
namespace AndroidActionBarIconVisibility {
const auto: string;
const never: string;
const always: string;
}
namespace AndroidActionItemPosition {
const actionBar: string;
const actionBarIfRoom: string;
const popup: string;
}
namespace IOSActionItemPosition {
const left: string;
const right: string;
}
namespace ImageFormat {
const png: string;
const jpeg: string;
const jpg: string;
}
namespace FontStyle {
const normal: string;
const italic: string;
}
namespace FontWeight {
const thin: string;
const extraLight: string;
const light: string;
const normal: string;
const medium: string;
const semiBold: string;
const bold: string;
const extraBold: string;
const black: string;
}
type BackgroundRepeatType = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | CSSWideKeywords;
namespace BackgroundRepeat {
const repeat: BackgroundRepeatType;
const repeatX: BackgroundRepeatType;
const repeatY: BackgroundRepeatType;
const noRepeat: BackgroundRepeatType;
const isValid: (value: any) => value is BackgroundRepeatType;
const parse: (value: any) => BackgroundRepeatType;
}
namespace AnimationCurve {
const ease = "ease";
const easeIn = "easeIn";
const easeOut = "easeOut";
const easeInOut = "easeInOut";
const linear = "linear";
const spring = "spring";
function cubicBezier(x1: number, y1: number, x2: number, y2: number): CubicBezierAnimationCurve;
}
namespace StatusBarStyle {
const light = "light";
const dark = "dark";
}
namespace SystemAppearance {
const light = "light";
const dark = "dark";
}
}
/**
* NOTE: Auto migrate deprecations via eslint-plugin in future
*/
/**
* @deprecated Use `CoreTypes.dip` instead.
*/
export type dip = number;
/**
* @deprecated Use `CoreTypes.px` instead.
*/
export type px = number;
/**
* @deprecated Use `CoreTypes.percent` instead.
*/
export type percent = number;
/**
* @deprecated Use `CoreTypes.LengthDipUnit` instead.
*/
export type LengthDipUnit = CoreTypes.LengthDipUnit;
/**
* @deprecated Use `CoreTypes.LengthPxUnit` instead.
*/
export type LengthPxUnit = CoreTypes.LengthPxUnit;
/**
* @deprecated Use `CoreTypes.LengthPercentUnit` instead.
*/
export type LengthPercentUnit = CoreTypes.LengthPercentUnit;
/**
* @deprecated Use `CoreTypes.LengthType` instead.
*/
export type LengthType = CoreTypes.LengthType;
/**
* @deprecated Use `CoreTypes.PercentLengthType` instead.
*/
export type PercentLengthType = CoreTypes.PercentLengthType;
/**
* @deprecated Use `CoreTypes.AnimationCurve` instead.
*/
export declare const AnimationCurve: typeof CoreTypes.AnimationCurve;
/**
* @deprecated Use `CoreTypes.HorizontalAlignmentType` instead.
*/
export type HorizontalAlignment = CoreTypes.HorizontalAlignmentType;
/**
* @deprecated Use `CoreTypes.VerticalAlignmentType` instead.
*/
export type VerticalAlignment = CoreTypes.VerticalAlignmentType;
/**
* @deprecated Use `CoreTypes` instead. Enums will be removed in 9.0
*/
export declare const Enums: {
Accuracy: typeof CoreTypes.Accuracy;
AndroidActionBarIconVisibility: typeof CoreTypes.AndroidActionBarIconVisibility;
AndroidActionItemPosition: typeof CoreTypes.AndroidActionItemPosition;
AnimationCurve: typeof CoreTypes.AnimationCurve;
AutocapitalizationType: typeof CoreTypes.AutocapitalizationType;
BackgroundRepeat: typeof CoreTypes.BackgroundRepeat;
DeviceOrientation: typeof CoreTypes.DeviceOrientation;
DeviceType: typeof CoreTypes.DeviceType;
Dock: typeof CoreTypes.Dock;
FontAttributes: typeof CoreTypes.FontAttributes;
FontStyle: typeof CoreTypes.FontStyle;
FontWeight: typeof CoreTypes.FontWeight;
HorizontalAlignment: typeof CoreTypes.HorizontalAlignment;
IOSActionItemPosition: typeof CoreTypes.IOSActionItemPosition;
ImageFormat: typeof CoreTypes.ImageFormat;
KeyboardType: typeof CoreTypes.KeyboardType;
NavigationBarVisibility: typeof CoreTypes.NavigationBarVisibility;
Orientation: typeof CoreTypes.Orientation;
ReturnKeyType: typeof CoreTypes.ReturnKeyType;
StatusBarStyle: typeof CoreTypes.StatusBarStyle;
Stretch: typeof CoreTypes.ImageStretch;
SystemAppearance: typeof CoreTypes.SystemAppearance;
TextAlignment: typeof CoreTypes.TextAlignment;
TextDecoration: typeof CoreTypes.TextDecoration;
TextTransform: typeof CoreTypes.TextTransform;
UpdateTextTrigger: typeof CoreTypes.UpdateTextTrigger;
VerticalAlignment: typeof CoreTypes.VerticalAlignment;
Visibility: typeof CoreTypes.Visibility;
WhiteSpace: typeof CoreTypes.WhiteSpace;
};