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 */ 20/** 21 * Defines the data type of the interface restriction. 22 * @form 23 * @since 9 24 */ 25declare interface Resource { 26 /** 27 * Set id. 28 * @since 7 29 */ 30 /** 31 * Set id. 32 * @form 33 * @since 9 34 */ 35 readonly id: number; 36 37 /** 38 * Set type. 39 * @since 7 40 */ 41 /** 42 * Set type. 43 * @form 44 * @since 9 45 */ 46 readonly type: number; 47 48 /** 49 * Set params. 50 * @since 7 51 */ 52 /** 53 * Set params. 54 * @form 55 * @since 9 56 */ 57 readonly params?: any[]; 58 59 /** 60 * Set bundleName. 61 * @form 62 * @since 9 63 */ 64 readonly bundleName: string; 65 66 /** 67 * Set moduleName. 68 * @form 69 * @since 9 70 */ 71 readonly moduleName: string; 72} 73 74/** 75 * Defines the length property with string, number and resource unit. 76 * @since 7 77 */ 78/** 79 * Defines the length property with string, number and resource unit. 80 * @form 81 * @since 9 82 */ 83declare type Length = string | number | Resource; 84 85/** 86 * Defines the string which can use resource. 87 * @since 7 88 */ 89/** 90 * Defines the string which can use resource. 91 * @form 92 * @since 9 93 */ 94declare type ResourceStr = string | Resource; 95 96/** 97 * Defines the padding property. 98 * @since 7 99 */ 100/** 101 * Defines the padding property. 102 * @form 103 * @since 9 104 */ 105declare type Padding = { 106 /** 107 * top property. 108 * @since 7 109 */ 110 /** 111 * top property. 112 * @form 113 * @since 9 114 */ 115 top?: Length; 116 117 /** 118 * right property. 119 * @since 7 120 */ 121 /** 122 * right property. 123 * @form 124 * @since 9 125 */ 126 right?: Length; 127 128 /** 129 * bottom property. 130 * @since 7 131 */ 132 /** 133 * bottom property. 134 * @form 135 * @since 9 136 */ 137 bottom?: Length; 138 139 /** 140 * left property. 141 * @since 7 142 */ 143 /** 144 * left property. 145 * @form 146 * @since 9 147 */ 148 left?: Length; 149}; 150 151/** 152 * Defines the margin property. 153 * @since 7 154 */ 155/** 156 * Defines the margin property. 157 * @form 158 * @since 9 159 */ 160declare type Margin = Padding; 161 162/** 163 * Defines the border width property. 164 * @form 165 * @since 9 166 */ 167declare type EdgeWidths = { 168 /** 169 * top property. 170 * @form 171 * @since 9 172 */ 173 top?: Length; 174 175 /** 176 * right property. 177 * @form 178 * @since 9 179 */ 180 right?: Length; 181 182 /** 183 * bottom property. 184 * @form 185 * @since 9 186 */ 187 bottom?: Length; 188 189 /** 190 * left property. 191 * @form 192 * @since 9 193 */ 194 left?: Length; 195}; 196 197/** 198 * Defines the border radius property. 199 * @form 200 * @since 9 201 */ 202declare type BorderRadiuses = { 203 /** 204 * top-left property. 205 * @form 206 * @since 9 207 */ 208 topLeft?: Length; 209 210 /** 211 * top-right property. 212 * @form 213 * @since 9 214 */ 215 topRight?: Length; 216 217 /** 218 * bottom-left property. 219 * @form 220 * @since 9 221 */ 222 bottomLeft?: Length; 223 224 /** 225 * bottom-right property. 226 * @form 227 * @since 9 228 */ 229 bottomRight?: Length; 230}; 231 232/** 233 * Defines the border color property. 234 * @form 235 * @since 9 236 */ 237declare type EdgeColors = { 238 /** 239 * top property. 240 * @form 241 * @since 9 242 */ 243 top?: ResourceColor; 244 245 /** 246 * right property. 247 * @form 248 * @since 9 249 */ 250 right?: ResourceColor; 251 252 /** 253 * bottom property. 254 * @form 255 * @since 9 256 */ 257 bottom?: ResourceColor; 258 259 /** 260 * left property. 261 * @form 262 * @since 9 263 */ 264 left?: ResourceColor; 265}; 266 267/** 268 * Defines the border style property. 269 * @form 270 * @since 9 271 */ 272declare type EdgeStyles = { 273 /** 274 * top property. 275 * @form 276 * @since 9 277 */ 278 top?: BorderStyle; 279 280 /** 281 * right property. 282 * @form 283 * @since 9 284 */ 285 right?: BorderStyle; 286 287 /** 288 * bottom property. 289 * @form 290 * @since 9 291 */ 292 bottom?: BorderStyle; 293 294 /** 295 * left property. 296 * @form 297 * @since 9 298 */ 299 left?: BorderStyle; 300}; 301 302/** 303 * Defines the offset property. 304 * @since 7 305 */ 306declare type Offset = { 307 /** 308 * dx property. 309 */ 310 dx: Length; 311 312 /** 313 * dy property. 314 */ 315 dy: Length; 316}; 317 318/** 319 * Defines the color which can use resource. 320 * @since 7 321 */ 322/** 323 * Defines the color which can use resource. 324 * @form 325 * @since 9 326 */ 327declare type ResourceColor = Color | number | string | Resource; 328 329/** 330 * Defines the length constrain property. 331 * @form 332 * @since 9 333 */ 334declare type LengthConstrain = { 335 /** 336 * minimum length. 337 * @form 338 * @since 9 339 */ 340 minLength: Length; 341 342 /** 343 * maximum length. 344 * @form 345 * @since 9 346 */ 347 maxLength: Length; 348}; 349 350/** 351 * Defines the font used for text. 352 * @since 7 353 */ 354declare interface Font { 355 /** 356 * font size. 357 */ 358 size?: Length; 359 360 /** 361 * font weight. 362 */ 363 weight?: FontWeight | number | string; 364 365 /** 366 * font family. 367 */ 368 family?: string | Resource; 369 370 /** 371 * font style. 372 */ 373 style?: FontStyle; 374} 375 376/** 377 * Defines the area property. 378 * @since 8 379 */ 380/** 381 * Defines the area property. 382 * @form 383 * @since 9 384 */ 385declare interface Area { 386 /** 387 * Defines the width property. 388 * @since 8 389 */ 390 /** 391 * Defines the width property. 392 * @form 393 * @since 9 394 */ 395 width: Length; 396 397 /** 398 * Defines the height property. 399 * @since 8 400 */ 401 /** 402 * Defines the height property. 403 * @form 404 * @since 9 405 */ 406 height: Length; 407 408 /** 409 * Defines the local position. 410 * @since 8 411 */ 412 /** 413 * Defines the local position. 414 * @form 415 * @since 9 416 */ 417 position: Position; 418 419 /** 420 * Defines the global position. 421 * @since 8 422 */ 423 /** 424 * Defines the global position. 425 * @form 426 * @since 9 427 */ 428 globalPosition: Position; 429} 430 431/** 432 * Defines the position. 433 * @since 7 434 */ 435/** 436 * Defines the position. 437 * @form 438 * @since 9 439 */ 440declare interface Position { 441 /** 442 * Coordinate x of the Position. 443 * @since 7 444 */ 445 /** 446 * Coordinate x of the Position. 447 * @form 448 * @since 9 449 */ 450 x?: Length; 451 /** 452 * Coordinate y of the Position. 453 * @since 7 454 */ 455 /** 456 * Coordinate y of the Position. 457 * @form 458 * @since 9 459 */ 460 y?: Length; 461} 462 463/** 464 * Defines the constrain size options. 465 * @since 7 466 */ 467/** 468 * Defines the constrain size options. 469 * @form 470 * @since 9 471 */ 472declare interface ConstraintSizeOptions { 473 /** 474 * Defines the min width. 475 * @since 7 476 */ 477 /** 478 * Defines the min width. 479 * @form 480 * @since 9 481 */ 482 minWidth?: Length; 483 /** 484 * Defines the max width. 485 * @since 7 486 */ 487 /** 488 * Defines the max width. 489 * @form 490 * @since 9 491 */ 492 maxWidth?: Length; 493 /** 494 * Defines the min height. 495 * @since 7 496 */ 497 /** 498 * Defines the min height. 499 * @form 500 * @since 9 501 */ 502 minHeight?: Length; 503 /** 504 * Defines the max height. 505 * @since 7 506 */ 507 /** 508 * Defines the max height. 509 * @form 510 * @since 9 511 */ 512 maxHeight?: Length; 513} 514 515/** 516 * Defines the size options. 517 * @since 7 518 */ 519/** 520 * Defines the size options. 521 * @form 522 * @since 9 523 */ 524declare interface SizeOptions { 525 /** 526 * Defines the width. 527 * @since 7 528 */ 529 /** 530 * Defines the width. 531 * @form 532 * @since 9 533 */ 534 width?: Length; 535 /** 536 * Defines the height. 537 * @since 7 538 */ 539 /** 540 * Defines the height. 541 * @form 542 * @since 9 543 */ 544 height?: Length; 545} 546 547/** 548 * Defines the options of border. 549 * @since 7 550 */ 551/** 552 * Defines the options of border. 553 * @form 554 * @since 9 555 */ 556declare interface BorderOptions { 557 /** 558 * Defines the border width. 559 * @type { Length } 560 * @since 7 561 */ 562 /** 563 * Defines the border width. 564 * @type { EdgeWidths | Length } 565 * @form 566 * @since 9 567 */ 568 width?: EdgeWidths | Length; 569 /** 570 * Defines the border color. 571 * @type { ResourceColor } 572 * @since 7 573 */ 574 /** 575 * Defines the border color. 576 * @type { EdgeColors | ResourceColor } 577 * @form 578 * @since 9 579 */ 580 color?: EdgeColors | ResourceColor; 581 /** 582 * Defines the border radius. 583 * @type { Length } 584 * @since 7 585 */ 586 /** 587 * Defines the border radius. 588 * @type { BorderRadiuses | Length } 589 * @form 590 * @since 9 591 */ 592 radius?: BorderRadiuses | Length; 593 /** 594 * Defines the border style. 595 * @type { BorderStyle } 596 * @since 7 597 */ 598 /** 599 * Defines the border style. 600 * @type { EdgeStyles | BorderStyle } 601 * @form 602 * @since 9 603 */ 604 style?: EdgeStyles | BorderStyle; 605} 606 607/** 608 * Defines the ColorFilter object. 609 * @form 610 * @since 9 611 */ 612declare class ColorFilter { 613 /** 614 * Creates ColorFilter with 4*5 matrix. 615 * @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. 616 * @form 617 * @since 9 618 */ 619 constructor(value: number[]); 620} 621 622declare module "GlobalResource" { 623 module "GlobalResource" { 624 // @ts-ignore 625 export { Resource }; 626 } 627} 628