UNPKG

11.5 kBTypeScriptView Raw
1/**
2 * General @nativescript/core types used throughout the library.
3 */
4import * as animationModule from '../ui/animation';
5export declare namespace CoreTypes {
6 /**
7 * Denotes a length number that is in device independent pixel units.
8 */
9 type dip = number;
10 /**
11 * Denotes a length number that is in physical device pixels.
12 */
13 type px = number;
14 /**
15 * Denotes a normalized percent number.
16 * 0% is represented as 0
17 * 50% is represented as 0.5
18 * 100% is represented as 1
19 */
20 type percent = number;
21 type LengthDipUnit = {
22 readonly unit: 'dip';
23 readonly value: dip;
24 };
25 type LengthPxUnit = {
26 readonly unit: 'px';
27 readonly value: px;
28 };
29 type LengthPercentUnit = {
30 readonly unit: '%';
31 readonly value: percent;
32 };
33 type LengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit;
34 type PercentLengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit | LengthPercentUnit;
35 const zeroLength: LengthType;
36 type KeyboardInputType = 'datetime' | 'phone' | 'number' | 'url' | 'email' | 'integer';
37 namespace KeyboardType {
38 const datetime = "datetime";
39 const phone = "phone";
40 const number = "number";
41 const url = "url";
42 const email = "email";
43 const integer = "integer";
44 }
45 type AutofillType = 'username' | 'password' | 'none' | string;
46 namespace AutofillType {
47 const username = "username";
48 const password = "password";
49 const newUsername = "newUsername";
50 const newPassword = "newPassword";
51 const oneTimeCode = "oneTimeCode";
52 const none = "none";
53 }
54 type ReturnKeyButtonType = 'done' | 'next' | 'go' | 'search' | 'send';
55 namespace ReturnKeyType {
56 const done = "done";
57 const next = "next";
58 const go = "go";
59 const search = "search";
60 const send = "send";
61 }
62 type TextAlignmentType = 'initial' | 'left' | 'center' | 'right' | 'justify';
63 namespace TextAlignment {
64 const left = "left";
65 const center = "center";
66 const right = "right";
67 const justify = "justify";
68 }
69 type TextDecorationType = 'none' | 'underline' | 'line-through' | 'underline line-through';
70 namespace TextDecoration {
71 const none = "none";
72 const underline = "underline";
73 const lineThrough = "line-through";
74 }
75 type TextTransformType = 'initial' | 'none' | 'capitalize' | 'uppercase' | 'lowercase';
76 namespace TextTransform {
77 const none = "none";
78 const capitalize = "capitalize";
79 const uppercase = "uppercase";
80 const lowercase = "lowercase";
81 }
82 type WhiteSpaceType = 'initial' | 'normal' | 'nowrap';
83 namespace WhiteSpace {
84 const normal = "normal";
85 const nowrap = "nowrap";
86 }
87 type TextOverflowType = 'clip' | 'ellipsis' | 'initial' | 'unset';
88 namespace TextOverflow {
89 const clip = "clip";
90 const ellipsis = "ellipsis";
91 const initial = "initial";
92 const unset = "unset";
93 }
94 type MaxLinesType = number;
95 type OrientationType = 'horizontal' | 'vertical';
96 namespace Orientation {
97 const horizontal = "horizontal";
98 const vertical = "vertical";
99 }
100 type DeviceOrientationType = 'portrait' | 'landscape' | 'unknown';
101 namespace DeviceOrientation {
102 const portrait = "portrait";
103 const landscape = "landscape";
104 const unknown = "unknown";
105 }
106 type HorizontalAlignmentType = 'left' | 'center' | 'right' | 'stretch';
107 namespace HorizontalAlignment {
108 const left = "left";
109 const center = "center";
110 const right = "right";
111 const stretch = "stretch";
112 const isValid: (value: any) => value is HorizontalAlignmentType;
113 const parse: (value: any) => HorizontalAlignmentType;
114 }
115 type VerticalAlignmentType = 'top' | 'middle' | 'bottom' | 'stretch';
116 namespace VerticalAlignment {
117 const top = "top";
118 const middle = "middle";
119 const bottom = "bottom";
120 const stretch = "stretch";
121 }
122 type VerticalAlignmentTextType = VerticalAlignmentType | 'text-top' | 'text-bottom' | 'sup' | 'sub' | 'baseline';
123 namespace VerticalAlignmentText {
124 const top = "top";
125 const middle = "middle";
126 const bottom = "bottom";
127 const stretch = "stretch";
128 const texttop = "text-top";
129 const textbottom = "text-bottom";
130 const sup = "sup";
131 const sub = "sub";
132 const baseline = "baseline";
133 const isValid: (value: any) => value is VerticalAlignmentTextType;
134 const parse: (value: string) => VerticalAlignmentTextType;
135 }
136 type ImageStretchType = 'none' | 'aspectFill' | 'aspectFit' | 'fill';
137 namespace ImageStretch {
138 const none: ImageStretchType;
139 const aspectFill: ImageStretchType;
140 const aspectFit: ImageStretchType;
141 const fill: ImageStretchType;
142 }
143 type VisibilityType = 'visible' | 'hidden' | 'collapse' | 'collapsed';
144 namespace Visibility {
145 const visible: VisibilityType;
146 const collapse: VisibilityType;
147 const collapsed: VisibilityType;
148 const hidden: VisibilityType;
149 const isValid: (value: any) => value is VisibilityType;
150 const parse: (value: string) => VisibilityType;
151 }
152 namespace FontAttributes {
153 const Normal = 0;
154 const Bold = 1;
155 const Italic: number;
156 }
157 namespace DeviceType {
158 const Phone: string;
159 const Tablet: string;
160 }
161 type UpdateTextTriggerType = 'focusLost' | 'textChanged';
162 namespace UpdateTextTrigger {
163 const focusLost: UpdateTextTriggerType;
164 const textChanged: UpdateTextTriggerType;
165 }
166 namespace Accuracy {
167 const any: number;
168 const high: number;
169 }
170 type DockType = 'left' | 'top' | 'right' | 'bottom';
171 namespace Dock {
172 const left: DockType;
173 const top: DockType;
174 const right: DockType;
175 const bottom: DockType;
176 }
177 type AutocapitalizationInputType = 'none' | 'words' | 'sentences' | 'allcharacters';
178 namespace AutocapitalizationType {
179 const none: AutocapitalizationInputType;
180 const words: AutocapitalizationInputType;
181 const sentences: AutocapitalizationInputType;
182 const allCharacters: AutocapitalizationInputType;
183 }
184 namespace NavigationBarVisibility {
185 const auto: string;
186 const never: string;
187 const always: string;
188 }
189 namespace AndroidActionBarIconVisibility {
190 const auto: string;
191 const never: string;
192 const always: string;
193 }
194 namespace AndroidActionItemPosition {
195 const actionBar: string;
196 const actionBarIfRoom: string;
197 const popup: string;
198 }
199 namespace IOSActionItemPosition {
200 const left: string;
201 const right: string;
202 }
203 namespace ImageFormat {
204 const png: string;
205 const jpeg: string;
206 const jpg: string;
207 }
208 namespace FontStyle {
209 const normal: string;
210 const italic: string;
211 }
212 namespace FontWeight {
213 const thin: string;
214 const extraLight: string;
215 const light: string;
216 const normal: string;
217 const medium: string;
218 const semiBold: string;
219 const bold: string;
220 const extraBold: string;
221 const black: string;
222 }
223 type BackgroundRepeatType = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
224 namespace BackgroundRepeat {
225 const repeat: BackgroundRepeatType;
226 const repeatX: BackgroundRepeatType;
227 const repeatY: BackgroundRepeatType;
228 const noRepeat: BackgroundRepeatType;
229 const isValid: (value: any) => value is BackgroundRepeatType;
230 const parse: (value: any) => BackgroundRepeatType;
231 }
232 namespace AnimationCurve {
233 const ease = "ease";
234 const easeIn = "easeIn";
235 const easeOut = "easeOut";
236 const easeInOut = "easeInOut";
237 const linear = "linear";
238 const spring = "spring";
239 function cubicBezier(x1: number, y1: number, x2: number, y2: number): animationModule.CubicBezierAnimationCurve;
240 }
241 namespace StatusBarStyle {
242 const light = "light";
243 const dark = "dark";
244 }
245 namespace SystemAppearance {
246 const light = "light";
247 const dark = "dark";
248 }
249}
250/**
251 * NOTE: Auto migrate deprecations via eslint-plugin in future
252 */
253/**
254 * @deprecated Use `CoreTypes.dip` instead.
255 */
256export type dip = number;
257/**
258 * @deprecated Use `CoreTypes.px` instead.
259 */
260export type px = number;
261/**
262 * @deprecated Use `CoreTypes.percent` instead.
263 */
264export type percent = number;
265/**
266 * @deprecated Use `CoreTypes.LengthDipUnit` instead.
267 */
268export type LengthDipUnit = CoreTypes.LengthDipUnit;
269/**
270 * @deprecated Use `CoreTypes.LengthPxUnit` instead.
271 */
272export type LengthPxUnit = CoreTypes.LengthPxUnit;
273/**
274 * @deprecated Use `CoreTypes.LengthPercentUnit` instead.
275 */
276export type LengthPercentUnit = CoreTypes.LengthPercentUnit;
277/**
278 * @deprecated Use `CoreTypes.LengthType` instead.
279 */
280export type LengthType = CoreTypes.LengthType;
281/**
282 * @deprecated Use `CoreTypes.PercentLengthType` instead.
283 */
284export type PercentLengthType = CoreTypes.PercentLengthType;
285/**
286 * @deprecated Use `CoreTypes.AnimationCurve` instead.
287 */
288export declare const AnimationCurve: typeof CoreTypes.AnimationCurve;
289/**
290 * @deprecated Use `CoreTypes.HorizontalAlignmentType` instead.
291 */
292export type HorizontalAlignment = CoreTypes.HorizontalAlignmentType;
293/**
294 * @deprecated Use `CoreTypes.VerticalAlignmentType` instead.
295 */
296export type VerticalAlignment = CoreTypes.VerticalAlignmentType;
297/**
298 * @deprecated Use `CoreTypes` instead. Enums will be removed in 9.0
299 */
300export declare const Enums: {
301 Accuracy: typeof CoreTypes.Accuracy;
302 AndroidActionBarIconVisibility: typeof CoreTypes.AndroidActionBarIconVisibility;
303 AndroidActionItemPosition: typeof CoreTypes.AndroidActionItemPosition;
304 AnimationCurve: typeof CoreTypes.AnimationCurve;
305 AutocapitalizationType: typeof CoreTypes.AutocapitalizationType;
306 BackgroundRepeat: typeof CoreTypes.BackgroundRepeat;
307 DeviceOrientation: typeof CoreTypes.DeviceOrientation;
308 DeviceType: typeof CoreTypes.DeviceType;
309 Dock: typeof CoreTypes.Dock;
310 FontAttributes: typeof CoreTypes.FontAttributes;
311 FontStyle: typeof CoreTypes.FontStyle;
312 FontWeight: typeof CoreTypes.FontWeight;
313 HorizontalAlignment: typeof CoreTypes.HorizontalAlignment;
314 IOSActionItemPosition: typeof CoreTypes.IOSActionItemPosition;
315 ImageFormat: typeof CoreTypes.ImageFormat;
316 KeyboardType: typeof CoreTypes.KeyboardType;
317 NavigationBarVisibility: typeof CoreTypes.NavigationBarVisibility;
318 Orientation: typeof CoreTypes.Orientation;
319 ReturnKeyType: typeof CoreTypes.ReturnKeyType;
320 StatusBarStyle: typeof CoreTypes.StatusBarStyle;
321 Stretch: typeof CoreTypes.ImageStretch;
322 SystemAppearance: typeof CoreTypes.SystemAppearance;
323 TextAlignment: typeof CoreTypes.TextAlignment;
324 TextDecoration: typeof CoreTypes.TextDecoration;
325 TextTransform: typeof CoreTypes.TextTransform;
326 UpdateTextTrigger: typeof CoreTypes.UpdateTextTrigger;
327 VerticalAlignment: typeof CoreTypes.VerticalAlignment;
328 Visibility: typeof CoreTypes.Visibility;
329 WhiteSpace: typeof CoreTypes.WhiteSpace;
330};