• 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   * Set bundleName.
41   * @since 9
42   */
43  readonly bundleName: string;
44
45  /**
46   * Set moduleName.
47   * @since 9
48   */
49  readonly moduleName: string;
50}
51
52/**
53 * Defines the length property with string, number and resource unit.
54 * @since 7
55 */
56declare type Length = string | number | Resource;
57
58/**
59 * Defines the string which can use resource.
60 * @since 7
61 */
62declare type ResourceStr = string | Resource;
63
64/**
65 * Defines the padding property.
66 * @since 7
67 */
68declare type Padding = {
69  /**
70   * top property.
71   */
72  top?: Length;
73
74  /**
75   * right property.
76   */
77  right?: Length;
78
79  /**
80   * bottom property.
81   */
82  bottom?: Length;
83
84  /**
85   * left property.
86   */
87  left?: Length;
88};
89
90/**
91 * Defines the margin property.
92 * @since 7
93 */
94declare type Margin = Padding;
95
96/**
97 * Defines the border width property.
98 * @since 9
99 */
100 declare type EdgeWidths = {
101  /**
102   * top property.
103   * @since 9
104   */
105  top?: Length;
106
107  /**
108   * right property.
109   * @since 9
110   */
111  right?: Length;
112
113  /**
114   * bottom property.
115   * @since 9
116   */
117  bottom?: Length;
118
119  /**
120   * left property.
121   * @since 9
122   */
123  left?: Length;
124};
125
126/**
127 * Defines the border radius property.
128 * @since 9
129 */
130declare type BorderRadiuses = {
131  /**
132   * top-left property.
133   * @since 9
134   */
135  topLeft?: Length;
136
137  /**
138   * top-right property.
139   * @since 9
140   */
141  topRight?: Length;
142
143  /**
144   * bottom-left property.
145   * @since 9
146   */
147  bottomLeft?: Length;
148
149  /**
150   * bottom-right property.
151   * @since 9
152   */
153  bottomRight?: Length;
154};
155
156/**
157 * Defines the border color property.
158 * @since 9
159 */
160declare type EdgeColors = {
161  /**
162   * top property.
163   * @since 9
164   */
165  top?: ResourceColor;
166
167  /**
168   * right property.
169   * @since 9
170   */
171  right?: ResourceColor;
172
173  /**
174   * bottom property.
175   * @since 9
176   */
177  bottom?: ResourceColor;
178
179  /**
180   * left property.
181   * @since 9
182   */
183  left?: ResourceColor;
184};
185
186/**
187 * Defines the border style property.
188 * @since 9
189 */
190declare type EdgeStyles = {
191  /**
192   * top property.
193   * @since 9
194   */
195  top?: BorderStyle;
196
197  /**
198   * right property.
199   * @since 9
200   */
201  right?: BorderStyle;
202
203  /**
204   * bottom property.
205   * @since 9
206   */
207  bottom?: BorderStyle;
208
209  /**
210   * left property.
211   * @since 9
212   */
213  left?: BorderStyle;
214};
215
216/**
217 * Defines the offset property.
218 * @since 7
219 */
220declare type Offset = {
221  /**
222   * dx property.
223   */
224  dx: Length;
225
226  /**
227   * dy property.
228   */
229  dy: Length;
230};
231
232/**
233 * Defines the color which can use resource.
234 * @since 7
235 */
236declare type ResourceColor = Color | number | string | Resource;
237
238/**
239 * Defines the length constrain property.
240 * @since 9
241 */
242declare type LengthConstrain = {
243  /**
244   * minimum length.
245   */
246  minLength: Length;
247
248  /**
249   * maximum length.
250   */
251  maxLength: Length;
252};
253
254/**
255 * Defines the font used for text.
256 * @since 7
257 */
258declare interface Font {
259  /**
260   * font size.
261   */
262  size?: Length;
263
264  /**
265   * font weight.
266   */
267  weight?: FontWeight | number | string;
268
269  /**
270   * font family.
271   */
272  family?: string | Resource;
273
274  /**
275   * font style.
276   */
277  style?: FontStyle;
278}
279
280/**
281 * Defines the area property.
282 * @since 8
283 */
284declare interface Area {
285  /**
286   * Defines the width property.
287   * @since 8
288   */
289  width: Length;
290
291  /**
292   * Defines the height property.
293   * @since 8
294   */
295  height: Length;
296
297  /**
298   * Defines the local position.
299   * @since 8
300   */
301  position: Position;
302
303  /**
304   * Defines the global position.
305   * @since 8
306   */
307  globalPosition: Position;
308}
309
310/**
311 * Defines the position.
312 * @since 7
313 */
314declare interface Position {
315  /**
316   * Coordinate x of the Position.
317   * @since 7
318   */
319  x?: Length;
320  /**
321   * Coordinate y of the Position.
322   * @since 7
323   */
324  y?: Length;
325}
326
327/**
328 * Defines the constrain size options.
329 * @since 7
330 */
331declare interface ConstraintSizeOptions {
332  /**
333   * Defines the min width.
334   * @since 7
335   */
336  minWidth?: Length;
337  /**
338   * Defines the max width.
339   * @since 7
340   */
341  maxWidth?: Length;
342  /**
343   * Defines the min height.
344   * @since 7
345   */
346  minHeight?: Length;
347  /**
348   * Defines the max height.
349   * @since 7
350   */
351  maxHeight?: Length;
352}
353
354/**
355 * Defines the size options.
356 * @since 7
357 */
358declare interface SizeOptions {
359  /**
360   * Defines the width.
361   * @since 7
362   */
363  width?: Length;
364  /**
365   * Defines the height.
366   * @since 7
367   */
368  height?: Length;
369}
370
371/**
372 * Defines the options of border.
373 * @since 7
374 */
375declare interface BorderOptions {
376  /**
377   * Defines the border width.
378   * @type { Length }
379   * @since 7
380   */
381  /**
382   * Defines the border width.
383   * @type { EdgeWidths | Length }
384   * @since 9
385   */
386  width?: EdgeWidths | Length;
387  /**
388   * Defines the border color.
389   * @type { ResourceColor }
390   * @since 7
391   */
392  /**
393   * Defines the border color.
394   * @type { EdgeColors | ResourceColor }
395   * @since 9
396   */
397  color?: EdgeColors | ResourceColor;
398  /**
399   * Defines the border radius.
400   * @type { Length }
401   * @since 7
402   */
403  /**
404   * Defines the border radius.
405   * @type { BorderRadiuses | Length }
406   * @since 9
407   */
408  radius?: BorderRadiuses | Length;
409  /**
410   * Defines the border style.
411   * @type { BorderStyle }
412   * @since 7
413   */
414  /**
415   * Defines the border style.
416   * @type { EdgeStyles | BorderStyle }
417   * @since 9
418   */
419  style?: EdgeStyles | BorderStyle;
420}
421
422/**
423 * Defines the ColorFilter object.
424 * @since 9
425 */
426declare class ColorFilter {
427  /**
428   * Creates ColorFilter with 4*5 matrix.
429   * @param value 4*5 color matrix values. The value[m*n] is located in the m row and n column. The matrix is row-first.
430   * @since 9
431   */
432  constructor(value: number[]);
433}
434
435declare module "GlobalResource" {
436  module "GlobalResource" {
437    // @ts-ignore
438    export { Resource };
439  }
440}
441