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
7
* http://www.apache.org/licenses/LICENSE-2.0
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.
28
ThemeColorMode } from './ArkCommonInterfaces'
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,
42
ColoringStrategy } from './ArkEnumInterfaces'
44
export interface CustomComponent extends CommonAttribute {
46
aboutToAppear(): void;
47
aboutToDisappear(): void;
48
aboutToReuse(params: object): void;
49
aboutToRecycle(): void;
52
export interface Resource {
70
export type Length = string | number | Resource
72
export type ResourceColor = Color | number | string
74
export type ResourceStr = string
76
export interface Offset {
82
export interface AltOffset {
87
export interface Position {
92
export type AnimationRange<T> = [from: T, to: T];
94
export interface Callback<T> {}
96
export interface ClickEvent {
103
export interface StateStyles {
108
export interface AttributeModifier<T>{}
109
export interface ContentModifier<T>{}
111
export interface SheetTitleOptions {
113
subtitle?: ResourceStr;
116
export interface UICommonEvent {
117
setOnClick(callback: Callback<ClickEvent> | undefined): void;
120
export interface BindOptions {
121
backgroundColor?: ResourceColor;
122
onAppear?: () => void;
123
onDisappear?: () => void;
124
onWillAppear?: () => void;
125
onWillDisappear?: () => void;
128
export interface SheetDismiss {
132
export interface DismissSheetAction {
133
dismiss: Callback<void>;
134
reason: DismissReason;
137
export interface SpringBackAction {
138
springBack: Callback<void>;
141
export interface UIContext {
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;
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;
158
borderWidth?: Dimension | EdgeWidths | LocalizedEdgeWidths;
159
borderColor?: ResourceColor | EdgeColors | LocalizedEdgeColors;
160
borderStyle?: BorderStyle | EdgeStyles;
161
shadow?: ShadowOptions | ShadowStyle;
162
onHeightDidChange?: Callback<number>;
164
onDetentsDidChange?: Callback<number>;
165
onWidthDidChange?: Callback<number>;
166
onTypeDidChange?: Callback<int>;
167
uiContext?: UIContext;
170
export interface BlurOptions {
171
grayscale: [number, number];
174
export interface BlurStyleOptions {
175
colorMode?: ThemeColorMode;
176
adaptiveColor?: AdaptiveColor;
178
blurOptions?: BlurOptions;
181
export enum BlurStyleActivePolicy {
182
FOLLOWS_WINDOW_ACTIVE_STATE = 0,
187
declare enum BlurType {
192
export interface BackgroundBlurStyleOptions extends BlurStyleOptions {
193
policy?: BlurStyleActivePolicy;
194
inactiveColor?: ResourceColor;
198
export interface SizeResult {
203
export interface EdgeWidths {
210
export type EdgeWidth = EdgeWidths;
212
export interface Padding {
219
export class ImageModifier {
222
export interface DragPreviewOptions {
223
mode?: DragPreviewMode | Array<int>;
224
modifier?: ImageModifier;
225
numberBadge?: boolean | number;
228
export interface DragInteractionOptions {
230
isMultiSelectionEnabled?: boolean;
232
defaultAnimationBeforeLifting?: boolean;
235
export interface CommonMethod<T> {
236
stateStyles(value: StateStyles): this;
238
backdropBlur(value: number, options?: BlurOptions): this;
240
width(value: Length): this;
242
height(value: Length): this;
244
bindSheet(isShow: boolean, builder: () => void, options?: SheetOptions): this;
246
backgroundBlurStyle(value: BlurStyle, options?: BackgroundBlurStyleOptions): this;
248
dragPreviewOptions(value: DragPreviewOptions, options?: DragInteractionOptions): this;
251
export interface CommonAttribute extends CommonMethod<CommonAttribute> {
255
export interface CanvasPath {
257
rect(x: number, y: number, w: number, h: number): void;
259
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;
264
export interface CanvasRenderer extends CanvasPath {
268
globalCompositeOperation: string;
270
// drawImage(image: ImageBitmap | PixelMap, dx: number, dy: number): void;
272
export type LengthMetrics = string
274
export interface NativeEmbedInfo {
275
params?: Map<string, string>
277
export interface NativeEmbedDataInfo {
278
info?: NativeEmbedInfo;
281
export interface DividerOptions {
282
strokeWidth?: Dimension
283
color?: ResourceColor
284
startMargin?: Dimension
285
endMargin?: Dimension
287
export interface LocalizedPadding {
290
bottom?: LengthMetrics
291
start?: LengthMetrics
293
export type SymbolGlyphModifier = string
294
export class TabBarSymbol {
295
normal: SymbolGlyphModifier
296
selected?: SymbolGlyphModifier
298
export interface VisibleListContentInfo {
300
itemIndexInGroup?: number
302
export interface TextCascadePickerRangeContent {
303
text: string | Resource
304
children?: TextCascadePickerRangeContent[]
306
export interface TextPickerRangeContent {
307
icon: string | Resource
308
text?: string | Resource
310
export interface TextPickerOptions {
311
range: string[] | string[][] | Resource | TextPickerRangeContent[] | TextCascadePickerRangeContent[]
312
value?: string | string[]
313
selected?: number | number[]
315
export interface IndicatorStyle {
316
color?: ResourceColor
318
export interface EmitterProperty {
322
export interface BorderOptions {
325
export class RenderingContextSettings {
328
constructor(antialias?: boolean) {}
331
export interface LabelStyle {
332
overflow?: TextOverflow;
334
minFontSize?: number | ResourceStr;
335
maxFontSize?: number | ResourceStr;
336
heightAdaptivePolicy?: TextHeightAdaptivePolicy;
339
export declare type Dimension = string | Resource;
340
export interface OnScrollVisibleContentChangeCallback {}
341
export interface Vector1 {
347
export interface Vector2 {
353
export interface PixelMap {}
355
export interface RectResult {
362
export class TouchTestInfo {
373
export interface BooleanInterfaceDTS {
377
export interface NumberInterfaceDTS {
381
export interface StringInterfaceDTS {
385
export interface UnionInterfaceDTS {
387
unionProp: number | boolean
390
export interface UnionOptionalInterfaceDTS {
392
unionProp: string | undefined
395
export interface TupleInterfaceDTS {
397
tuple: [number, boolean]
400
export interface OptionInterfaceDTS {
402
tuple: [boolean|undefined, number|undefined]
405
export interface ArrayRefNumberInterfaceDTS {
410
export interface ArrayRefTuplesInterfaceDTS {
412
tuple: Array<[boolean, number]>
415
export interface ClassDTS {
420
// Non materialized class
421
export class ClassWithConstructorDTS {
423
constructor(valNumber: number, valString: string) {}
426
// Non materialized class
427
export class ClassWithConstructorAndFieldsDTS {
432
constructor(valNumber: number, valBoolean: boolean) {}
436
export class ClassWithConstructorAndMethodsDTS {
438
constructor(valNumber: number, valString: string) {}
440
method(valNumber: number, valString: string): void {}
444
export class ClassWithConstructorAndStaticMethodsDTS {
446
constructor(valNumber: number, valString: string) {}
448
static of(valNumber: number, valString: string): ClassWithConstructorAndStaticMethodsDTS {
449
return new ClassWithConstructorAndStaticMethodsDTS(valNumber, valString)
454
export class ClassWithConstructorAndFieldsAndMethodsDTS {
459
constructor(valNumber: number, valBoolean: boolean) {}
461
method(valNumber: number, valString: string): void {}
466
export class ClassWithConstructorAndWithoutParamsDTS {
470
static of(): ClassWithConstructorAndWithoutParamsDTS {
471
return new ClassWithConstructorAndWithoutParamsDTS()
477
export class ClassWithConstructorAndNonOptionalParamsDTS {
479
constructor(valNumber: number, valString: string) {}
481
static of(valNumber: number, valString: string): ClassWithConstructorAndNonOptionalParamsDTS {
482
return new ClassWithConstructorAndNonOptionalParamsDTS(valNumber, valString)
485
method(valBoolean: boolean, valString: string): void {}
489
export class ClassWithConstructorAndSomeOptionalParamsDTS {
491
constructor(valNumber: number, valString?: string) {}
493
static of(valNumber: number, valString?: string): ClassWithConstructorAndSomeOptionalParamsDTS {
494
return new ClassWithConstructorAndSomeOptionalParamsDTS(valNumber, valString)
497
method(valBoolean: boolean, valString?: string): void {}
501
export class ClassWithConstructorAndAllOptionalParamsDTS {
503
constructor(valNumber?: number, valString?: string) {}
505
static of(valNumber?: number, valString?: string): ClassWithConstructorAndAllOptionalParamsDTS {
506
return new ClassWithConstructorAndAllOptionalParamsDTS(valNumber, valString)
509
method(valBoolean?: boolean, valString?: string): void {}
513
export type CustomBuilder = (() => Object | void)
515
export interface ShadowOptions {
516
radius: number | Resource;
518
color?: Color | string | Resource | ColoringStrategy;
519
offsetX?: number | Resource;
520
offsetY?: number | Resource;
524
export interface LocalizedEdgeColors {
527
bottom?: ResourceColor;
528
start?: ResourceColor;
531
export interface LocalizedEdgeWidths {
534
bottom?: LengthMetrics;
535
start?: LengthMetrics;
538
export interface Font {
540
weight?: FontWeight | number | string;
541
family?: string | Resource;
545
export interface EdgeColors {
547
right?: ResourceColor;
548
bottom?: ResourceColor;
549
left?: ResourceColor;
552
export interface EdgeStyles {
555
bottom?: BorderStyle;
559
export interface BaseEvent {}
561
export interface FingerInfo {
571
export interface BaseGestureEvent extends BaseEvent {
572
fingerList: FingerInfo[];
575
export enum LengthMetricsUnit {
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) {
587
this.data = data ?? new Uint8ClampedArray(0)
591
export interface GestureInterface<T> {
593
allowedTypes(value: Array<int>): T;
596
export abstract class GestureHandler<T> implements GestureInterface<T> {
597
abstract tag(tag: string): T;
598
abstract allowedTypes(types: Array<int>): T;
601
export interface UIGestureEvent {
602
addGesture<T>(gesture: GestureHandler<T>, priority?: GesturePriority, mask?: GestureMask): void;
605
export interface GestureModifier {
606
applyGesture(): void;
607
applyGesture(event: UIGestureEvent): void;
610
declare namespace GestureControl {
613
LONG_PRESS_GESTURE = 1,
617
ROTATION_GESTURE = 5,
623
enum GestureRecognizerState {
632
abstract class EventTargetInfo {
633
abstract getId(): string;
636
interface GestureRecognizer {
639
getType(): GestureControl.GestureType;
641
isBuiltIn(): boolean;
643
setEnabled(isEnabled: boolean): void;
645
isEnabled(): boolean;
647
getState(): GestureRecognizerState;
649
getEventTargetInfo(): EventTargetInfo;
652
export type GestureRecognizerJudgeBeginCallback = (event: BaseGestureEvent, current: GestureRecognizer, recognizers: Array<GestureRecognizer>) => GestureJudgeResult;
654
export class CanvasRenderingContext2D implements CanvasRenderer {
655
readonly height: number;
656
readonly width: number;
658
globalCompositeOperation: string;
659
stopImageAnalyzer(): void {}
660
constructor(settings?: RenderingContextSettings) {}
661
static of(height: number, width: number): CanvasRenderingContext2D {
662
return new CanvasRenderingContext2D()
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 {}
669
interface DrawingCanvas {}
676
export class DrawingRenderingContext {
678
// get canvas(): DrawingCanvas;
679
invalidate(): void {}
680
constructor(unit?: LengthMetricsUnit) {}
683
export interface BoardStyle {
684
borderRadius?: Length;
687
export interface ComponentContent {}
689
declare class Indicator<T> {}
691
export class DotIndicator extends Indicator<DotIndicator> {
693
itemWidth(value: Length): DotIndicator {
696
itemHeight(value: Length): DotIndicator {