• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * Defines the data type of the interface restriction.
18 * @since 7
19 */
20declare interface Resource {
21  /**
22   * Set id.
23   * @since 7
24   */
25  readonly id: number;
26
27  /**
28   * Set type.
29   * @since 7
30   */
31  readonly type: number;
32
33  /**
34   * Set params.
35   * @since 7
36   */
37  readonly params?: any[];
38}
39
40/**
41 * Defines the length property with string, number and resource unit.
42 * @since 7
43 */
44declare type Length = string | number | Resource;
45
46/**
47 * Defines the string which can use resource.
48 * @since 7
49 */
50declare type ResourceStr = string | Resource;
51
52/**
53 * Defines the padding property.
54 * @since 7
55 */
56declare type Padding = {
57  /**
58   * top property.
59   */
60  top?: Length;
61
62  /**
63   * right property.
64   */
65  right?: Length;
66
67  /**
68   * bottom property.
69   */
70  bottom?: Length;
71
72  /**
73   * left property.
74   */
75  left?: Length;
76};
77
78/**
79 * Defines the margin property.
80 * @since 7
81 */
82declare type Margin = Padding;
83
84/**
85 * Defines the offset property.
86 * @since 7
87 */
88declare type Offset = {
89  /**
90   * dx property.
91   */
92  dx: Length;
93
94  /**
95   * dy property.
96   */
97  dy: Length;
98};
99
100/**
101 * Defines the color which can use resource.
102 * @since 7
103 */
104declare type ResourceColor = Color | number | string | Resource;
105
106/**
107 * Defines the font used for text.
108 * @since 7
109 */
110declare interface Font {
111  /**
112   * font size.
113   */
114  size?: Length;
115
116  /**
117   * font weight.
118   */
119  weight?: FontWeight | number | string;
120
121  /**
122   * font family.
123   */
124  family?: string | Resource;
125
126  /**
127   * font style.
128   */
129  style?: FontStyle;
130}
131
132/**
133 * Defines the area property.
134 * @since 8
135 */
136declare interface Area {
137  /**
138   * Defines the width property.
139   * @since 8
140   */
141  width: Length;
142
143  /**
144   * Defines the height property.
145   * @since 8
146   */
147  height: Length;
148
149  /**
150   * Defines the local position.
151   * @since 8
152   */
153  position: Position;
154
155  /**
156   * Defines the global position.
157   * @since 8
158   */
159  globalPosition: Position;
160}
161
162/**
163 * Defines the position.
164 * @since 7
165 */
166declare interface Position {
167  /**
168   * Coordinate x of the Position.
169   * @since 7
170   */
171  x?: Length;
172  /**
173   * Coordinate y of the Position.
174   * @since 7
175   */
176  y?: Length;
177}
178
179/**
180 * Defines the constrain size options.
181 * @since 7
182 */
183declare interface ConstraintSizeOptions {
184  /**
185   * Defines the min width.
186   * @since 7
187   */
188  minWidth?: Length;
189  /**
190   * Defines the max width.
191   * @since 7
192   */
193  maxWidth?: Length;
194  /**
195   * Defines the min height.
196   * @since 7
197   */
198  minHeight?: Length;
199  /**
200   * Defines the max height.
201   * @since 7
202   */
203  maxHeight?: Length;
204}
205
206/**
207 * Defines the size options.
208 * @since 7
209 */
210declare interface SizeOptions {
211  /**
212   * Defines the width.
213   * @since 7
214   */
215  width?: Length;
216  /**
217   * Defines the height.
218   * @since 7
219   */
220  height?: Length;
221}
222
223/**
224 * Defines the options of border.
225 * @since 7
226 */
227declare interface BorderOptions {
228  /**
229   * Defines the border width.
230   * @since 7
231   */
232  width?: Length;
233  /**
234   * Defines the border color.
235   * @since 7
236   */
237  color?: ResourceColor;
238  /**
239   * Defines the border radius.
240   * @since 7
241   */
242  radius?: Length;
243  /**
244   * Defines the border style.
245   * @since 7
246   */
247  style?: BorderStyle;
248}
249