@nativescript/core
Version:
A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.
346 lines (345 loc) • 13.1 kB
TypeScript
/**
* General @nativescript/core types used throughout the library.
*/
import { CubicBezierAnimationCurve } from './animation-types';
export declare namespace CoreTypes {
type AndroidOverflowSingle = 'ignore' | 'none' | 'dont-apply';
type AndroidOverflowMultiple = 'left' | 'right' | 'top' | 'bottom' | 'left-dont-consume' | 'top-dont-consume' | 'right-dont-consume' | 'bottom-dont-consume' | 'all-but-left' | 'all-but-top' | 'all-but-right' | 'all-but-bottom';
type AndroidOverflowStacked = AndroidOverflowSingle | `${AndroidOverflowSingle},${AndroidOverflowSingle}` | `${AndroidOverflowSingle},${AndroidOverflowMultiple}` | `${AndroidOverflowMultiple},${AndroidOverflowSingle}` | `${AndroidOverflowMultiple},${AndroidOverflowMultiple}`;
export type AndroidOverflow = AndroidOverflowSingle | AndroidOverflowMultiple | AndroidOverflowStacked;
export type CSSWideKeywords = 'initial' | 'inherit' | 'unset' | 'revert';
/**
* 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 FixedLengthType = dip | LengthDipUnit | LengthPxUnit | CSSWideKeywords;
export type LengthType = 'auto' | FixedLengthType;
export type PercentLengthType = 'auto' | FixedLengthType | LengthPercentUnit;
export const zeroLength: LengthType;
export type KeyboardInputType = 'datetime' | 'phone' | 'number' | 'decimal' | 'url' | 'email' | 'integer';
export namespace KeyboardType {
const datetime = "datetime";
const phone = "phone";
const number = "number";
const decimal = "decimal";
const url = "url";
const email = "email";
const integer = "integer";
}
export type AutofillType = 'username' | 'password' | 'none' | string;
export namespace AutofillType {
const username = "username";
const password = "password";
const newUsername = "newUsername";
const newPassword = "newPassword";
const oneTimeCode = "oneTimeCode";
const none = "none";
}
export type ReturnKeyButtonType = 'done' | 'next' | 'go' | 'search' | 'send';
export namespace ReturnKeyType {
const done = "done";
const next = "next";
const go = "go";
const search = "search";
const send = "send";
}
export type TextAlignmentType = 'left' | 'center' | 'right' | 'justify' | CSSWideKeywords;
export namespace TextAlignment {
const left = "left";
const center = "center";
const right = "right";
const justify = "justify";
}
export type TextDecorationType = 'none' | 'underline' | 'line-through' | 'underline line-through' | CSSWideKeywords;
export namespace TextDecoration {
const none = "none";
const underline = "underline";
const lineThrough = "line-through";
}
export type TextTransformType = 'none' | 'capitalize' | 'uppercase' | 'lowercase' | CSSWideKeywords;
export namespace TextTransform {
const none = "none";
const capitalize = "capitalize";
const uppercase = "uppercase";
const lowercase = "lowercase";
}
export type WhiteSpaceType = 'normal' | 'nowrap' | 'wrap' | CSSWideKeywords;
export namespace WhiteSpace {
const normal = "normal";
const nowrap = "nowrap";
const wrap = "wrap";
}
export type TextOverflowType = 'clip' | 'ellipsis' | CSSWideKeywords;
export namespace TextOverflow {
const clip = "clip";
const ellipsis = "ellipsis";
}
export type MaxLinesType = number;
export type OrientationType = 'horizontal' | 'vertical';
export namespace Orientation {
const horizontal = "horizontal";
const vertical = "vertical";
}
export type DeviceOrientationType = 'portrait' | 'landscape' | 'unknown';
export namespace DeviceOrientation {
const portrait = "portrait";
const landscape = "landscape";
const unknown = "unknown";
}
export type HorizontalAlignmentType = 'start' | 'left' | 'center' | 'right' | 'end' | 'stretch' | CSSWideKeywords;
export namespace HorizontalAlignment {
const start = "start";
const left = "left";
const center = "center";
const right = "right";
const end = "end";
const stretch = "stretch";
const isValid: (value: any) => value is HorizontalAlignmentType;
const parse: (value: any) => HorizontalAlignmentType;
}
export type VerticalAlignmentType = 'top' | 'middle' | 'bottom' | 'stretch' | CSSWideKeywords;
export namespace VerticalAlignment {
const top = "top";
const middle = "middle";
const bottom = "bottom";
const stretch = "stretch";
}
export type VerticalAlignmentTextType = VerticalAlignmentType | 'text-top' | 'text-bottom' | 'sup' | 'sub' | 'baseline';
export 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;
}
export type ImageStretchType = 'none' | 'aspectFill' | 'aspectFit' | 'fill';
export namespace ImageStretch {
const none: ImageStretchType;
const aspectFill: ImageStretchType;
const aspectFit: ImageStretchType;
const fill: ImageStretchType;
}
export type VisibilityType = 'visible' | 'hidden' | 'collapse' | 'collapsed' | CSSWideKeywords;
export 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;
}
export namespace FontAttributes {
const Normal = 0;
const Bold = 1;
const Italic: number;
}
export namespace DeviceType {
const Phone: string;
const Tablet: string;
}
export type UpdateTextTriggerType = 'focusLost' | 'textChanged';
export namespace UpdateTextTrigger {
const focusLost: UpdateTextTriggerType;
const textChanged: UpdateTextTriggerType;
}
export namespace Accuracy {
const any: number;
const high: number;
}
export type DockType = 'left' | 'top' | 'right' | 'bottom';
export namespace Dock {
const left: DockType;
const top: DockType;
const right: DockType;
const bottom: DockType;
}
export type AutocapitalizationInputType = 'none' | 'words' | 'sentences' | 'allcharacters';
export namespace AutocapitalizationType {
const none: AutocapitalizationInputType;
const words: AutocapitalizationInputType;
const sentences: AutocapitalizationInputType;
const allCharacters: AutocapitalizationInputType;
}
export namespace NavigationBarVisibility {
const auto: string;
const never: string;
const always: string;
}
export namespace AndroidActionBarIconVisibility {
const auto: string;
const never: string;
const always: string;
}
export namespace AndroidActionItemPosition {
const actionBar: string;
const actionBarIfRoom: string;
const popup: string;
}
export namespace IOSActionItemPosition {
const left: string;
const right: string;
}
export namespace ImageFormat {
const png: string;
const jpeg: string;
const jpg: string;
}
export namespace FontStyle {
const normal: string;
const italic: string;
}
export 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;
}
export type BackgroundRepeatType = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | CSSWideKeywords;
export 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;
}
export 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;
}
export namespace StatusBarStyle {
const light = "light";
const dark = "dark";
}
export namespace SystemAppearance {
const light = "light";
const dark = "dark";
}
export type LayoutDirectionType = 'ltr' | 'rtl';
export namespace LayoutDirection {
const ltr = "ltr";
const rtl = "rtl";
}
export {};
}
/**
* 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;
LayoutDirection: typeof CoreTypes.LayoutDirection;
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;
};