diff --git a/BUILD.gn b/BUILD.gn index e1f24e6f1ed45eec69c4cebfb7bb9b1e18f6e049..9e3164720c9ebc438e035f6f5a00f2f3374a032c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -120,6 +120,35 @@ ohos_copy("common_api") { module_install_name = "" } +template("ohos_declaration_template") { + forward_variables_from(invoker, "*") + action_with_pydeps(target_name) { + script = "//interface/sdk-js/remove_internal.py" + outputs = [ root_out_dir + "/$target_name/" ] + args = [ + "--input", + rebase_path("//interface/sdk-js/api", root_build_dir), + "--output", + rebase_path(root_out_dir + "/ohos_declaration/$target_name/", + root_build_dir), + ] + } + _module_info_target = "/ohos_declaration/${target_name}_info" + _target_name = target_name + generate_module_info(_module_info_target) { + module_type = "jsdoc" + module_install_name = "" + module_name = _target_name + module_source_dir = root_out_dir + "/ohos_declaration/$_target_name" + install_enable = false + } +} + +ohos_declaration_template("ohos_declaration_ets") { +} +ohos_declaration_template("ohos_declaration_phone") { +} + ohos_copy("ace_platform") { sources = [ "api/config", @@ -129,3 +158,14 @@ ohos_copy("ace_platform") { module_source_dir = target_out_dir + "/$target_name" module_install_name = "" } + +ohos_copy("form_declaration") { + sources = [ + "api/form/action", + "api/form/css", + "api/form/hml", + ] + outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] + module_source_dir = target_out_dir + "/$target_name" + module_install_name = "" +} diff --git a/README.md b/README.md deleted file mode 100644 index 5c6f8b5693c4c30bd71c14bcc690392f47b74686..0000000000000000000000000000000000000000 --- a/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Public JS API Repository - -- [Introduction](#section11660541593) - -## Introduction - -This repository is used to submit **d.ts** declaration files of JS APIs. - diff --git a/api/@internal/component/ets/ability_component.d.ts b/api/@internal/component/ets/ability_component.d.ts index 06bb6c2d78768190c05f83dd9c480b34b64f9897..2ca00277284586bbe46e14156c25f717b9f2f150 100644 --- a/api/@internal/component/ets/ability_component.d.ts +++ b/api/@internal/component/ets/ability_component.d.ts @@ -1,36 +1,41 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {CommonMethod} from "./common"; -import {Want} from "../../../ability/want"; - -export declare class AbilityController { - constructor(); - startAbility(value: Want); - performBackPress(); - getStackCount(); -} - -interface AbilityComponent extends CommonMethod { - (value: { want: Want, controller?: AbilityController }): AbilityComponent; - - onReady(event: () => void): AbilityComponent; - onDestroy(event: () => void): AbilityComponent; - onAbilityCreated(event: (name: string) => void): AbilityComponent; - onAbilityMoveToFront(event: () => void): AbilityComponent; - onAbilityWillRemove(event: () => void): AbilityComponent; -} - -export declare const AbilityComponentInterface: AbilityComponent; +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {CommonMethod} from "./common"; +import {Want} from "../api/common/ability/want"; + +export declare class AbilityController { + constructor(); + startAbility(value: Want); + performBackPress(); + getStackCount(); +} + +export declare class AbilityComponentExtend extends AbilityComponentAttribute { +} + +interface AbilityComponent extends AbilityComponentAttribute { + (value: { want: Want, controller?: AbilityController }): AbilityComponent; +} + +declare class AbilityComponentAttribute extends CommonMethod { + onReady(event: () => void): T; + onDestroy(event: () => void): T; + onAbilityCreated(event: (name: string) => void): T; + onAbilityMoveToFront(event: () => void): T; + onAbilityWillRemove(event: () => void): T; +} + +export declare const AbilityComponentInterface: AbilityComponent; diff --git a/api/@system.network.d.ts b/api/@internal/component/ets/action_sheet.d.ts old mode 100755 new mode 100644 similarity index 41% rename from api/@system.network.d.ts rename to api/@internal/component/ets/action_sheet.d.ts index 85edb3608e44dd31337b53542bf6fe078c55b101..26a0620988ba02a72140f0e6594110ea990e3817 --- a/api/@system.network.d.ts +++ b/api/@internal/component/ets/action_sheet.d.ts @@ -1,33 +1,47 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export interface NetworkResponse { - type: string; - metered: boolean; -} -export interface GetNetworkTypeOptions { - success?: (data: NetworkResponse) => void; - fail?: (data: any, code: number) => void; - complete?: () => void; -} -export interface SubscribeNetworkOptions { - success?: (data: NetworkResponse) => void; - fail?: (data: any, code: number) => void; -} -export default class Network { - static getType(options?: GetNetworkTypeOptions): void; - static subscribe(options?: SubscribeNetworkOptions): void; - static unsubscribe(): void; -} +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { DialogAlignment } from "./alert_dialog"; +import {CommonMethod, Resource} from "./common" + +interface SheetInfo { + title: string | Resource; + icon?: string | Resource; + action: () => void; +} + +export declare class ActionSheetExtend extends ActionSheetAttribute { +} + +interface ActionSheet extends ActionSheetAttribute { +} + +declare class ActionSheetAttribute extends CommonMethod { + show(value: { + title: string | Resource; + message: string | Resource; + confirm?: { + value: string | Resource; + action: () => void; + }; + cancel?: () => void; + sheets: Array; + autoCancel?: boolean; + alignment?: DialogAlignment; + offset?: { dx: number | string | Resource, dy: number | string | Resource }; + }); +} + +export declare const ActionSheetInterface: ActionSheet; diff --git a/api/@internal/component/ets/alert_dialog.d.ts b/api/@internal/component/ets/alert_dialog.d.ts index 620f47db15360d2d22437bfdba9591eda0e3cfa9..361b9823cc132048c5780b626f13d481cb3cfdf3 100644 --- a/api/@internal/component/ets/alert_dialog.d.ts +++ b/api/@internal/component/ets/alert_dialog.d.ts @@ -1,44 +1,55 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {CommonMethod, Resource} from "./common" - -interface AlertDialog extends CommonMethod { - show(value: { - title?: string | Resource; - message: string | Resource; - autoCancel?: boolean; - confirm?: { - value: string | Resource; - action: () => void; - }; - cancel?: () => void; - } | { - title?: string | Resource; - message: string | Resource; - autoCancel?: boolean; - primaryButton: { - value: string | Resource; - action: () => void; - }; - secondaryButton: { - value: string | Resource; - action: () => void; - }; - cancel?: () => void; - }); -} - -export declare const AlertDialogInterface: AlertDialog; +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {CommonMethod, Resource} from "./common" + +export declare enum DialogAlignment { + Top, + Center, + Bottom, + Default +} + +interface AlertDialog { + show(value: { + title?: string | Resource; + message: string | Resource; + autoCancel?: boolean; + confirm?: { + value: string | Resource; + action: () => void; + }; + cancel?: () => void; + alignment?: DialogAlignment; + offset?: { dx: number | string | Resource, dy: number | string | Resource }; + } | { + title?: string | Resource; + message: string | Resource; + autoCancel?: boolean; + primaryButton: { + value: string | Resource; + action: () => void; + }; + secondaryButton: { + value: string | Resource; + action: () => void; + }; + cancel?: () => void; + alignment?: DialogAlignment; + offset?: { dx: number | string | Resource, dy: number | string | Resource }; + }); +} + +export declare const AlertDialogInterface: AlertDialog; diff --git a/api/@internal/component/ets/alphabet_indexer.d.ts b/api/@internal/component/ets/alphabet_indexer.d.ts index db74e50e4cf284eb1cde57d1d6ff21a9f618c22a..27d0858af6d35065cd5795a3082390cb79f7ef05 100644 --- a/api/@internal/component/ets/alphabet_indexer.d.ts +++ b/api/@internal/component/ets/alphabet_indexer.d.ts @@ -17,36 +17,41 @@ import {CommonMethod, Color, Resource} from "./common"; import {FontWeight, FontStyle} from "./text"; export declare enum IndexerAlign { - Left, - Right + Left, + Right } -interface AlphabetIndexer extends CommonMethod { +export declare class AlphabetIndexerExtend extends AlphabetIndexerAttribute { +} + +interface AlphabetIndexer extends AlphabetIndexerAttribute { (value: {ArrayValue : Array, selected : number}): AlphabetIndexer; +} - onSelected(event: (index: number) => void): AlphabetIndexer; +declare class AlphabetIndexerAttribute extends CommonMethod { + onSelected(event: (index: number) => void): T; - color(value: Color | number | string | Resource): AlphabetIndexer; + color(value: Color | number | string | Resource): T; - selectedColor(value: Color | number | string | Resource): AlphabetIndexer; + selectedColor(value: Color | number | string | Resource): T; - popupColor(value: Color | number | string | Resource): AlphabetIndexer; + popupColor(value: Color | number | string | Resource): T; - selectedBackgroundColor(value: Color | number | string | Resource): AlphabetIndexer; + selectedBackgroundColor(value: Color | number | string | Resource): T; - popupBackground(value: Color | number | string | Resource): AlphabetIndexer; + popupBackground(value: Color | number | string | Resource): T; - usingPopup(value: boolean): AlphabetIndexer; + usingPopup(value: boolean): T; - selectedFont(value: { size?: number, weight?: FontWeight, family?: string, style?: FontStyle}): AlphabetIndexer; + selectedFont(value: { size?: number, weight?: FontWeight, family?: string, style?: FontStyle}): T; - popupFont(value: { size?: number, weight?: FontWeight, family?: string, style?: FontStyle}): AlphabetIndexer; + popupFont(value: { size?: number, weight?: FontWeight, family?: string, style?: FontStyle}): T; - iteamSize(value: string | number): AlphabetIndexer; + itemSize(value: string | number): T; - font(value: { size?: number, weight?: FontWeight, family?: string, style?: FontStyle}): AlphabetIndexer; + font(value: { size?: number, weight?: FontWeight, family?: string, style?: FontStyle}): T; - alignStyle(value: IndexerAlign): AlphabetIndexer; + alignStyle(value: IndexerAlign): T; } export declare const AlphabetIndexerInterface: AlphabetIndexer; diff --git a/api/@internal/component/ets/animator.d.ts b/api/@internal/component/ets/animator.d.ts index 5b2b585be9b07839347aa037032d62c593f87dc0..2e51167d79395db85b2229575965e5b04518afca 100644 --- a/api/@internal/component/ets/animator.d.ts +++ b/api/@internal/component/ets/animator.d.ts @@ -16,51 +16,56 @@ import {CommonMethod, AnimationStatus, Curve, FillMode, PlayMode} from "./common"; export declare class SpringProp { - constructor(mass: number, stiffness: number, damping: number): SpringProp; + constructor(mass: number, stiffness: number, damping: number); } export declare class SpringMotion { - constructor(start: number, end: number, velocity: number, prop: SpringProp): SpringMotion; + constructor(start: number, end: number, velocity: number, prop: SpringProp); } export declare class FrictionMotion { - constructor(friction: number, position: number, velocity: number): FrictionMotion; + constructor(friction: number, position: number, velocity: number); } export declare class ScrollMotion { - constructor(position: number, velocity: number, min: number, max: number, prop: SpringProp): ScrollMotion; + constructor(position: number, velocity: number, min: number, max: number, prop: SpringProp); } -interface Animator extends CommonMethod { - (value: string): Animator; +export declare class AnimatorExtend extends AnimatorAttribute { +} + +interface Animator extends AnimatorAttribute { + (value: string): Animator; +} - state(value: AnimationStatus): Animator; +declare class AnimatorAttribute extends CommonMethod { + state(value: AnimationStatus): T; - duration(value: number): Animator; + duration(value: number): T; - curve(value: Curve): Animator; + curve(value: Curve): T; - delay(value: number): Animator; + delay(value: number): T; - fillMode(value: FillMode): Animator; + fillMode(value: FillMode): T; - iterations(value: number): Animator; + iterations(value: number): T; - playMode(value: PlayMode): Animator; + playMode(value: PlayMode): T; - motion(value: Motion): Animator; + motion(value: SpringMotion | FrictionMotion | ScrollMotion): T; - onStart(event: () => void): Animator; + onStart(event: () => void): T; - onPause(event: () => void): Animator; + onPause(event: () => void): T; - onRepeat(event: () => void): Animator; + onRepeat(event: () => void): T; - onCancel(event: () => void): Animator; + onCancel(event: () => void): T; - onFinish(event: () => void): Animator; + onFinish(event: () => void): T; - onFrame(event: (value: number) => void): Animator; + onFrame(event: (value: number) => void): T; } export declare const AnimatorInterface: Animator; \ No newline at end of file diff --git a/api/@internal/component/ets/badge.d.ts b/api/@internal/component/ets/badge.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..49587d21ee2bd80205bd31d44c626d767193c63c --- /dev/null +++ b/api/@internal/component/ets/badge.d.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {CommonMethod, Color} from "./common" + +declare enum BadgePosition { + Right, + RightTop, + Left +} + +interface BadgeStyle { + color?: Color; + fontSize?: number | string; + badgeSize?: number | string; + badgeColor: Color; +} + +export declare class BadgeExtend extends BadgeAttribute { +} + +interface Badge extends BadgeAttribute { + (value: {count: number, position?: BadgePosition, maxCount?: number, style?: BadgeStyle}): Badge; + (value: {value: string, position?: BadgePosition, maxCount?: number, style?: BadgeStyle}): Badge; +} + +declare class BadgeAttribute extends CommonMethod { +} + +export declare const BadgeInterface: Badge \ No newline at end of file diff --git a/api/@internal/component/ets/blank.d.ts b/api/@internal/component/ets/blank.d.ts index 91fcb25f9be5d7aedb4be61b2458ea3517049bbe..42a841d29d59dd3b8c6f03ffbf8ae2ab277b198a 100644 --- a/api/@internal/component/ets/blank.d.ts +++ b/api/@internal/component/ets/blank.d.ts @@ -15,10 +15,15 @@ import {CommonMethod, Color, Resource} from "./common" -interface Blank extends CommonMethod { +export declare class BlankExtend extends BlankAttribute { +} + +interface Blank extends BlankAttribute { (min?: number | string): Blank; +} - color(value: Color | number | string | Resource): Blank; +declare class BlankAttribute extends CommonMethod { + color(value: Color | number | string | Resource): T; } export declare const BlankInterface: Blank \ No newline at end of file diff --git a/api/@internal/component/ets/button.d.ts b/api/@internal/component/ets/button.d.ts index a27720e294d7dac0d8792f5fd9b4207fd7ff487a..8f7fd66a661e841cab04781a665e23344d266a7b 100644 --- a/api/@internal/component/ets/button.d.ts +++ b/api/@internal/component/ets/button.d.ts @@ -23,22 +23,27 @@ export declare enum ButtonType { Normal } -interface Button extends CommonMethod