UNPKG

2.4 kBTypeScriptView Raw
1import { LayoutBase } from '../layout-base';
2import { Style } from '../../styling/style';
3import { CssProperty } from '../../core/properties';
4import { View } from '../../core/view';
5
6export type FlexDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
7export type FlexWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
8export type JustifyContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around';
9export type AlignItems = 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
10export type AlignContent = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'stretch';
11
12/**
13 * A flex order integer.
14 */
15export type Order = number;
16
17/**
18 * A flex-grow number. Negative values are invalid.
19 */
20export type FlexGrow = number;
21
22/**
23 * A flex-shrink number. Negative values are invalid.
24 */
25export type FlexShrink = number;
26
27/**
28 * A flex-wrap-before value. True, false or their string presentations "true" or "false".
29 */
30export type FlexWrapBefore = boolean;
31
32export type AlignSelf = 'auto' | AlignItems;
33
34export class FlexboxLayout extends LayoutBase {
35 public flexDirection: FlexDirection;
36 public flexWrap: FlexWrap;
37 public justifyContent: JustifyContent;
38 public alignItems: AlignItems;
39 public alignContent: AlignContent;
40
41 public static setOrder(view: View, order: number);
42 public static getOrder(view: View): number;
43
44 public static setFlexGrow(view: View, grow: number);
45 public static getFlexGrow(view: View);
46
47 public static setFlexShrink(view: View, shrink: number);
48 public static getFlexShrink(view: View): number;
49
50 public static setAlignSelf(view: View, align: AlignSelf);
51 public static getAlignSelf(view: View): AlignSelf;
52
53 public static setFlexWrapBefore(view: View, wrap: boolean);
54 public static getFlexWrapBefore(view: View): boolean;
55}
56
57export const flexDirectionProperty: CssProperty<Style, FlexDirection>;
58export const flexWrapProperty: CssProperty<Style, FlexWrap>;
59export const justifyContentProperty: CssProperty<Style, JustifyContent>;
60export const alignItemsProperty: CssProperty<Style, AlignItems>;
61
62export const orderProperty: CssProperty<Style, Order>;
63export const flexGrowProperty: CssProperty<Style, FlexGrow>;
64export const flexShrinkProperty: CssProperty<Style, FlexShrink>;
65export const flexWrapBeforeProperty: CssProperty<Style, FlexWrapBefore>;
66export const alignSelfProperty: CssProperty<Style, AlignSelf>;