idlize

Форк
0
699 строк · 15.7 Кб
1
/*
2
 * Copyright (c) 2024 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
import { BlurStyle,
17
         GradientDirection,
18
         DismissReason,
19
         ShadowStyle,
20
         ShadowType,
21
         SheetMode,
22
         SheetSize,
23
         SheetType,
24
         SourceTool,
25
         BorderStyle,
26
         DragPreviewMode,
27
         AdaptiveColor,
28
         ThemeColorMode } from './ArkCommonInterfaces'
29
import { GestureMask,
30
         GesturePriority,
31
        GestureJudgeResult } from './ArkGestureInterfaces'
32
import { CalendarAlign } from './ArkCalendarPickerInterfaces'
33
import { EnumDTS } from './ArkTestInterfaces'
34
import { NavigationTitleMode } from './ArkNavigationInterfaces'
35
import { HorizontalAlign } from './ArkColumnInterfaces'
36
import { SelectedMode } from './ArkTabContentInterfaces'
37
import { BarMode } from './ArkTabsInterfaces'
38
import { TextHeightAdaptivePolicy,
39
         FontStyle,
40
         TextOverflow,
41
         FontWeight,
42
         ColoringStrategy } from './ArkEnumInterfaces'
43

44
export interface CustomComponent extends CommonAttribute {
45
    build(): void;
46
    aboutToAppear(): void;
47
    aboutToDisappear(): void;
48
    aboutToReuse(params: object): void;
49
    aboutToRecycle(): void;
50
}
51

52
export interface Resource {
53

54
  bundleName: string;
55

56
  moduleName: string;
57

58
  id: number;
59

60
  params?: object[];
61

62
  type?: number;
63
}
64

65
export class Color {
66
    White = 0
67
    Black = 1
68
}
69

70
export type Length = string | number | Resource
71

72
export type ResourceColor = Color | number | string
73

74
export type ResourceStr = string
75

76
export interface Offset {
77
    dx: Length;
78

79
    dy: Length;
80
};
81

82
export interface AltOffset {
83
    dx1: Length;
84
    dy2: Length;
85
};
86

87
export interface Position {
88
    x: Length;
89
    y: Length;
90
}
91

92
export type AnimationRange<T> = [from: T, to: T];
93

94
export interface Callback<T> {}
95

96
export interface ClickEvent {
97

98
    displayX: number;
99

100
    displayY: number;
101
}
102

103
export interface StateStyles {
104

105
    normal?: object;
106
}
107

108
export interface AttributeModifier<T>{}
109
export interface ContentModifier<T>{}
110

111
export interface SheetTitleOptions {
112
    title: ResourceStr;
113
    subtitle?: ResourceStr;
114
}
115

116
export interface UICommonEvent {
117
    setOnClick(callback: Callback<ClickEvent> | undefined): void;
118
}
119

120
export interface BindOptions {
121
    backgroundColor?: ResourceColor;
122
    onAppear?: () => void;
123
    onDisappear?: () => void;
124
    onWillAppear?: () => void;
125
    onWillDisappear?: () => void;
126
}
127

128
export interface SheetDismiss {
129
    dismiss: () => void;
130
}
131

132
export interface DismissSheetAction {
133
    dismiss: Callback<void>;
134
    reason: DismissReason;
135
}
136

137
export interface SpringBackAction {
138
    springBack: Callback<void>;
139
}
140

141
export interface UIContext {
142
}
143

144
export interface SheetOptions extends BindOptions {
145
    title?: SheetTitleOptions | CustomBuilder;
146
    detents?: [(SheetSize | Length | undefined), (SheetSize | Length | undefined), (SheetSize | Length | undefined)] | undefined;
147
    height?: SheetSize | Length;
148
    dragBar?: boolean;
149
    maskColor?: ResourceColor;
150
    blurStyle?: BlurStyle;
151
    showClose?: boolean | Resource;
152
    preferType?: SheetType;
153
    shouldDismiss?: (sheetDismiss: SheetDismiss) => void;
154
    onWillDismiss?: Callback<DismissSheetAction>;
155
    onWillSpringBackWhenDismiss?: Callback<SpringBackAction>;
156
    enableOutsideInteractive?: boolean;
157
    width?: Dimension;
158
    borderWidth?: Dimension | EdgeWidths | LocalizedEdgeWidths;
159
    borderColor?: ResourceColor | EdgeColors | LocalizedEdgeColors;
160
    borderStyle?: BorderStyle | EdgeStyles;
161
    shadow?: ShadowOptions | ShadowStyle;
162
    onHeightDidChange?: Callback<number>;
163
    mode?: SheetMode;
164
    onDetentsDidChange?: Callback<number>;
165
    onWidthDidChange?: Callback<number>;
166
    onTypeDidChange?: Callback<int>;
167
    uiContext?: UIContext;
168
}
169

170
export interface BlurOptions {
171
    grayscale: [number, number];
172
}
173

174
export interface BlurStyleOptions {
175
    colorMode?: ThemeColorMode;
176
    adaptiveColor?: AdaptiveColor;
177
    scale?: number;
178
    blurOptions?: BlurOptions;
179
}
180

181
export enum BlurStyleActivePolicy {
182
    FOLLOWS_WINDOW_ACTIVE_STATE = 0,
183
    ALWAYS_ACTIVE = 1,
184
    ALWAYS_INACTIVE = 2,
185
}
186

187
declare enum BlurType {
188
    WITHIN_WINDOW = 0,
189
    BEHIND_WINDOW = 1
190
}
191

192
export interface BackgroundBlurStyleOptions extends BlurStyleOptions {
193
    policy?: BlurStyleActivePolicy;
194
    inactiveColor?: ResourceColor;
195
    type?: BlurType;
196
}
197

198
export interface SizeResult {
199
    width: number,
200
    height: number,
201
}
202

203
export interface EdgeWidths {
204
    top?: Length;
205
    right?: Length;
206
    bottom?: Length;
207
    left?: Length;
208
};
209

210
export type EdgeWidth = EdgeWidths;
211

212
export interface Padding  {
213
    top?: Length;
214
    right?: Length;
215
    bottom?: Length;
216
    left?: Length;
217
};
218

219
export class ImageModifier {
220
}
221

222
export interface DragPreviewOptions {
223
    mode?: DragPreviewMode | Array<int>;
224
    modifier?: ImageModifier;
225
    numberBadge?: boolean | number;
226
}
227

228
export interface DragInteractionOptions {
229

230
    isMultiSelectionEnabled?: boolean;
231

232
    defaultAnimationBeforeLifting?: boolean;
233
}
234

235
export interface CommonMethod<T> {
236
    stateStyles(value: StateStyles): this;
237

238
    backdropBlur(value: number, options?: BlurOptions): this;
239

240
    width(value: Length): this;
241

242
    height(value: Length): this;
243

244
    bindSheet(isShow: boolean, builder: () => void, options?: SheetOptions): this;
245

246
    backgroundBlurStyle(value: BlurStyle, options?: BackgroundBlurStyleOptions): this;
247

248
    dragPreviewOptions(value: DragPreviewOptions, options?: DragInteractionOptions): this;
249
}
250

251
export interface CommonAttribute extends CommonMethod<CommonAttribute> {
252
}
253

254

255
export interface CanvasPath {
256

257
    rect(x: number, y: number, w: number, h: number): void;
258

259
    arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;
260

261
    closePath(): void;
262
}
263

264
export interface CanvasRenderer extends CanvasPath {
265

266
    globalAlpha: number;
267

268
    globalCompositeOperation: string;
269

270
    // drawImage(image: ImageBitmap | PixelMap, dx: number, dy: number): void;
271
}
272
export type LengthMetrics = string
273

274
export interface NativeEmbedInfo {
275
    params?: Map<string, string>
276
}
277
export interface NativeEmbedDataInfo {
278
    info?: NativeEmbedInfo;
279
}
280

281
export interface DividerOptions {
282
    strokeWidth?: Dimension
283
    color?: ResourceColor
284
    startMargin?: Dimension
285
    endMargin?: Dimension
286
}
287
export interface LocalizedPadding {
288
    top?: LengthMetrics
289
    end?: LengthMetrics
290
    bottom?: LengthMetrics
291
    start?: LengthMetrics
292
}
293
export type SymbolGlyphModifier = string
294
export class TabBarSymbol {
295
    normal: SymbolGlyphModifier
296
    selected?: SymbolGlyphModifier
297
}
298
export interface VisibleListContentInfo {
299
    index: number
300
    itemIndexInGroup?: number
301
}
302
export interface TextCascadePickerRangeContent {
303
    text: string | Resource
304
    children?: TextCascadePickerRangeContent[]
305
}
306
export interface TextPickerRangeContent {
307
    icon: string | Resource
308
    text?: string | Resource
309
}
310
export interface TextPickerOptions {
311
    range: string[] | string[][] | Resource | TextPickerRangeContent[] | TextCascadePickerRangeContent[]
312
    value?: string | string[]
313
    selected?: number | number[]
314
}
315
export interface IndicatorStyle {
316
    color?: ResourceColor
317
}
318
export interface EmitterProperty {
319
    index: number
320
    emitRate?: number
321
}
322
export interface BorderOptions {
323

324
}
325
export class RenderingContextSettings {
326
    antialias?: boolean;
327

328
    constructor(antialias?: boolean) {}
329
}
330

331
export interface LabelStyle {
332
    overflow?: TextOverflow;
333
    maxLines?: number;
334
    minFontSize?: number | ResourceStr;
335
    maxFontSize?: number | ResourceStr;
336
    heightAdaptivePolicy?: TextHeightAdaptivePolicy;
337
    font?: Font;
338
}
339
export declare type Dimension = string | Resource;
340
export interface OnScrollVisibleContentChangeCallback {}
341
export interface Vector1 {
342
    x0: number;
343
    x1: number;
344
    x2: number;
345
    x3: number;
346
}
347
export interface Vector2 {
348
    t: number;
349
    x: number;
350
    y: number;
351
    z: number;
352
}
353
export interface PixelMap {}
354

355
export interface RectResult {
356
    x: number;
357
    y: number;
358
    width: number;
359
    height: number;
360
}
361

362
export class TouchTestInfo {
363
    windowX: number;
364
    windowY: number;
365
    parentX: number;
366
    parentY: number;
367
    x: number;
368
    y: number;
369
    rect: RectResult;
370
    id: string;
371
}
372

373
export interface  BooleanInterfaceDTS {
374
    valBool: boolean
375
}
376

377
export interface NumberInterfaceDTS {
378
    valNumber: number
379
}
380

381
export interface StringInterfaceDTS {
382
    valString: string
383
}
384

385
export interface UnionInterfaceDTS {
386

387
    unionProp: number | boolean
388
}
389

390
export interface UnionOptionalInterfaceDTS {
391

392
    unionProp: string | undefined
393
}
394

395
export interface TupleInterfaceDTS {
396

397
    tuple: [number, boolean]
398
}
399

400
export interface OptionInterfaceDTS {
401

402
    tuple: [boolean|undefined, number|undefined]
403
}
404

405
export interface ArrayRefNumberInterfaceDTS {
406

407
    tuple: Array<number>
408
}
409

410
export interface ArrayRefTuplesInterfaceDTS {
411

412
    tuple: Array<[boolean, number]>
413
}
414

415
export interface ClassDTS {
416

417
    valBoolean: boolean
418
}
419

420
// Non materialized class
421
export class ClassWithConstructorDTS {
422

423
    constructor(valNumber: number, valString: string) {}
424
}
425

426
// Non materialized class
427
export class ClassWithConstructorAndFieldsDTS {
428

429
    valNumber: number
430
    valBoolean: boolean
431

432
    constructor(valNumber: number, valBoolean: boolean) {}
433
}
434

435
// Materialized class
436
export class ClassWithConstructorAndMethodsDTS {
437

438
    constructor(valNumber: number, valString: string) {}
439

440
    method(valNumber: number, valString: string): void {}
441
}
442

443
// Materialized class
444
export class ClassWithConstructorAndStaticMethodsDTS {
445

446
    constructor(valNumber: number, valString: string) {}
447

448
    static of(valNumber: number, valString: string): ClassWithConstructorAndStaticMethodsDTS {
449
        return new ClassWithConstructorAndStaticMethodsDTS(valNumber, valString)
450
    }
451
}
452

453
// Materialized class
454
export class ClassWithConstructorAndFieldsAndMethodsDTS {
455

456
    valNumber: number
457
    valBoolean: boolean
458

459
    constructor(valNumber: number, valBoolean: boolean) {}
460

461
    method(valNumber: number, valString: string): void {}
462
}
463

464

465
// Materialized class
466
export class ClassWithConstructorAndWithoutParamsDTS {
467

468
    constructor() {}
469

470
    static of(): ClassWithConstructorAndWithoutParamsDTS {
471
        return new ClassWithConstructorAndWithoutParamsDTS()
472
    }
473

474
    method(): void {}
475
}
476

477
export class ClassWithConstructorAndNonOptionalParamsDTS {
478

479
    constructor(valNumber: number, valString: string) {}
480

481
    static of(valNumber: number, valString: string): ClassWithConstructorAndNonOptionalParamsDTS {
482
        return new ClassWithConstructorAndNonOptionalParamsDTS(valNumber, valString)
483
    }
484

485
    method(valBoolean: boolean, valString: string): void {}
486
}
487

488
// Materialized class
489
export class  ClassWithConstructorAndSomeOptionalParamsDTS {
490

491
    constructor(valNumber: number, valString?: string) {}
492

493
    static of(valNumber: number, valString?: string): ClassWithConstructorAndSomeOptionalParamsDTS {
494
        return new ClassWithConstructorAndSomeOptionalParamsDTS(valNumber, valString)
495
    }
496

497
    method(valBoolean: boolean, valString?: string): void {}
498
}
499

500
// Materialized class
501
export class ClassWithConstructorAndAllOptionalParamsDTS {
502

503
    constructor(valNumber?: number, valString?: string) {}
504

505
    static of(valNumber?: number, valString?: string): ClassWithConstructorAndAllOptionalParamsDTS {
506
        return new ClassWithConstructorAndAllOptionalParamsDTS(valNumber, valString)
507
    }
508

509
    method(valBoolean?: boolean, valString?: string): void {}
510
}
511

512

513
export type CustomBuilder = (() => Object | void)
514

515
export interface ShadowOptions {
516
    radius: number | Resource;
517
    type?: ShadowType;
518
    color?: Color | string | Resource | ColoringStrategy;
519
    offsetX?: number | Resource;
520
    offsetY?: number | Resource;
521
    fill?: boolean;
522
}
523

524
export interface LocalizedEdgeColors  {
525
  top?: ResourceColor;
526
  end?: ResourceColor;
527
  bottom?: ResourceColor;
528
  start?: ResourceColor;
529
}
530

531
export interface LocalizedEdgeWidths {
532
    top?: LengthMetrics;
533
    end?: LengthMetrics;
534
    bottom?: LengthMetrics;
535
    start?: LengthMetrics;
536
}
537

538
export interface Font {
539
  size?: Length;
540
  weight?: FontWeight | number | string;
541
  family?: string | Resource;
542
  style?: FontStyle;
543
}
544

545
export interface EdgeColors {
546
    top?: ResourceColor;
547
    right?: ResourceColor;
548
    bottom?: ResourceColor;
549
    left?: ResourceColor;
550
}
551

552
export interface EdgeStyles {
553
  top?: BorderStyle;
554
  right?: BorderStyle;
555
  bottom?: BorderStyle;
556
  left?: BorderStyle;
557
};
558

559
export interface BaseEvent {}
560

561
export interface FingerInfo {
562
  id: number;
563
  globalX: number;
564
  globalY: number;
565
  localX: number;
566
  localY: number;
567
  displayX: number;
568
  displayY: number;
569
}
570

571
export interface BaseGestureEvent extends BaseEvent {
572
  fingerList: FingerInfo[];
573
}
574

575
export enum LengthMetricsUnit {
576
  DEFAULT = 0,
577
  PX = 1
578
}
579

580
export class ImageData {
581
  readonly data: Uint8ClampedArray;
582
  readonly height?: number;
583
  readonly width?: number;
584
  constructor(width: number, height: number, data?: Uint8ClampedArray, unit?: LengthMetricsUnit) {
585
    this.width = width
586
    this.height = height
587
    this.data = data ?? new Uint8ClampedArray(0)
588
  }
589
}
590

591
export interface GestureInterface<T> {
592
  tag(tag: string): T;
593
  allowedTypes(value: Array<int>): T;
594
}
595

596
export abstract class GestureHandler<T> implements GestureInterface<T> {
597
  abstract tag(tag: string): T;
598
  abstract allowedTypes(types: Array<int>): T;
599
}
600

601
export interface UIGestureEvent {
602
  addGesture<T>(gesture: GestureHandler<T>, priority?: GesturePriority, mask?: GestureMask): void;
603
}
604

605
export interface GestureModifier {
606
  applyGesture(): void;
607
  applyGesture(event: UIGestureEvent): void;
608
}
609

610
declare namespace GestureControl {
611
  enum GestureType {
612
    TAP_GESTURE = 0,
613
    LONG_PRESS_GESTURE = 1,
614
    PAN_GESTURE = 2,
615
    PINCH_GESTURE = 3,
616
    SWIPE_GESTURE = 4,
617
    ROTATION_GESTURE = 5,
618
    DRAG = 6,
619
    CLICK = 7,
620
  }
621
}
622

623
enum GestureRecognizerState {
624
  READY = 0,
625
  DETECTING = 1,
626
  PENDING = 2,
627
  BLOCKED = 3,
628
  SUCCESSFUL = 4,
629
  FAILED = 5,
630
}
631

632
abstract class EventTargetInfo {
633
  abstract getId(): string;
634
}
635

636
interface GestureRecognizer {
637
  getTag(): string;
638

639
  getType(): GestureControl.GestureType;
640

641
  isBuiltIn(): boolean;
642

643
  setEnabled(isEnabled: boolean): void;
644

645
  isEnabled(): boolean;
646

647
  getState(): GestureRecognizerState;
648

649
  getEventTargetInfo(): EventTargetInfo;
650
}
651

652
export type GestureRecognizerJudgeBeginCallback = (event: BaseGestureEvent, current: GestureRecognizer, recognizers: Array<GestureRecognizer>) => GestureJudgeResult;
653

654
export class CanvasRenderingContext2D implements CanvasRenderer {
655
  readonly height: number;
656
  readonly width: number;
657
  globalAlpha: number;
658
  globalCompositeOperation: string;
659
  stopImageAnalyzer(): void {}
660
  constructor(settings?: RenderingContextSettings) {}
661
  static of(height: number, width: number): CanvasRenderingContext2D {
662
    return new CanvasRenderingContext2D()
663
  }
664
  rect(x: number, y: number, w: number, h: number): void {}
665
  arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void {}
666
  closePath(): void {}
667
}
668

669
interface DrawingCanvas {}
670

671
interface Size {
672
  width: number
673
  height: number
674
}
675

676
export class DrawingRenderingContext {
677
  // get size(): Size
678
  // get canvas(): DrawingCanvas;
679
  invalidate(): void {}
680
  constructor(unit?: LengthMetricsUnit) {}
681
}
682

683
export interface BoardStyle {
684
  borderRadius?: Length;
685
}
686

687
export interface ComponentContent {}
688

689
declare class Indicator<T> {}
690

691
export class DotIndicator extends Indicator<DotIndicator> {
692
  constructor() {}
693
  itemWidth(value: Length): DotIndicator {
694
    return this;
695
  }
696
  itemHeight(value: Length): DotIndicator {
697
    return this;
698
  }
699
}
700

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.