idlize
188 строк · 3.9 Кб
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
16declare type PixelMap = import('../resource/image').default.PixelMap;
17
18declare type AnimationRange<T> = [from: T, to: T];
19
20declare interface Callback<T> {}
21
22declare interface ClickEvent extends BaseEvent {
23
24displayX: number;
25
26displayY: number;
27}
28
29declare interface StateStyles {
30
31normal?: any;
32}
33
34declare interface AttributeModifier<T>{}
35declare interface ContentModifier<T>{}
36
37declare interface SheetTitleOptions {
38title: ResourceStr;
39subtitle?: ResourceStr;
40}
41
42declare interface UICommonEvent {
43setOnClick(callback: Callback<ClickEvent> | undefined): void;
44}
45
46declare enum SheetSize {
47MEDIUM,
48LARGE,
49FIT_CONTENT = 2,
50}
51
52declare interface BindOptions {
53backgroundColor?: ResourceColor;
54}
55
56declare interface SheetOptions extends BindOptions {
57title?: SheetTitleOptions;
58detents?: [(SheetSize | Length), (SheetSize | Length)?, (SheetSize | Length)?];
59}
60
61declare enum BlurStyle {
62Thin = 0,
63}
64
65declare enum ThemeColorMode {
66SYSTEM = 0,
67LIGHT = 1,
68DARK = 2
69}
70
71declare enum AdaptiveColor {
72DEFAULT = 0,
73}
74
75declare interface BlurOptions {
76grayscale: [number, number];
77}
78
79declare interface BlurStyleOptions {
80colorMode?: ThemeColorMode;
81adaptiveColor?: AdaptiveColor;
82scale?: number;
83blurOptions?: BlurOptions;
84}
85
86declare interface BackgroundBlurStyleOptions extends BlurStyleOptions {}
87
88declare interface SizeResult {
89width: number,
90height: number,
91}
92
93declare type EdgeWidths = {
94top?: Length;
95right?: Length;
96bottom?: Length;
97left?: Length;
98};
99
100declare type EdgeWidth = EdgeWidths;
101
102declare type Padding = {
103top?: Length;
104right?: Length;
105bottom?: Length;
106left?: Length;
107};
108
109declare interface DragPreviewOptions {
110numberBadge?: boolean | number;
111}
112
113declare interface DragInteractionOptions {
114
115isMultiSelectionEnabled?: boolean;
116
117defaultAnimationBeforeLifting?: boolean;
118}
119
120
121declare class CommonMethod<T> {
122
123constructor();
124
125stateStyles(value: StateStyles): T;
126
127backdropBlur(value: number, options?: BlurOptions): T;
128
129width(value: Length): T;
130
131height(value: Length): T;
132
133bindSheet(isShow: boolean, builder: () => void, options?: SheetOptions): T;
134
135backgroundBlurStyle(value: BlurStyle, options?: BackgroundBlurStyleOptions): T;
136
137dragPreviewOptions(value: DragPreviewOptions, options?: DragInteractionOptions): T;
138}
139
140declare interface Rectangle {
141
142x?: Length;
143
144y?: Length;
145
146width?: Length;
147
148height?: Length;
149}
150declare interface CommonInterface {
151(): CommonAttribute
152}
153declare class CommonAttribute extends CommonMethod<CommonAttribute> {
154}
155
156declare const Common: CommonInterface
157
158declare class CustomComponent extends CommonAttribute {
159build(): void;
160aboutToAppear(): void;
161aboutToDisappear(): void;
162aboutToReuse(params: object): void;
163aboutToRecycle(): void;
164}
165
166declare class CommonShapeMethod<T> extends CommonMethod<T> {
167constructor();
168
169stroke(value: ResourceColor): T;
170}
171
172declare class ScrollableCommonMethod<T> extends CommonMethod<T> {
173scrollBarWidth(value: number | string): T;
174}
175
176declare module 'commonEvent' {
177module 'commonEvent' {
178// @ts-ignore
179export { UICommonEvent };
180}
181}
182
183declare module 'commonAttribute'{
184module 'commonAttribute' {
185// @ts-ignore
186export { CommonAttribute };
187}
188}
189