• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2025 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
16import { memo } from "@ohos.arkui.stateManagement.runtime";
17import { ComponentBuilder, CommonMethod  } from "@ohos.arkui.component.common";
18import { Length, ResourceColor  } from "@ohos.arkui.component.units";
19
20@Retention({policy: "SOURCE"})
21export declare @interface Component {};
22
23@Retention({policy: "SOURCE"})
24export declare @interface Entry { routeName: string };
25
26@Retention({policy: "SOURCE"})
27export declare @interface Reusable {};
28
29export declare abstract class CustomComponent<T extends CustomComponent<T, T_Options>, T_Options> implements
30    CommonMethod {
31
32    @memo
33    @ComponentBuilder
34    static $_instantiate<S extends CustomComponent<S, S_Options>, S_Options>(
35        factory: () => S,
36        initializers?: S_Options,
37        @memo
38        content?: () => void
39    ): S;
40
41    // Life cycle for custom component
42    aboutToAppear(): void;
43    aboutToDisappear(): void;
44    aboutToReuse(): void;
45    aboutToRecycle(): void;
46
47    @memo
48    build(): void;
49
50    // Implementation of common method
51    @memo
52    width(w: Length): this;
53    @memo
54    height(h: Length): this;
55    @memo
56    backgroundColor(color: ResourceColor): this;
57}