diff --git a/api/@ohos.curves.d.ts b/api/@ohos.curves.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1ffd9819ad5008827d0a5ed60c7d78f796165608 --- /dev/null +++ b/api/@ohos.curves.d.ts @@ -0,0 +1,73 @@ +/* +* 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. +*/ + +/** + * Contains interpolator functions such as initialization, third-order Bezier curves, and spring curves. + * @import import Curves from '@ohos.curves' + * @devices phone, tablet, tv, wearable + * @since 7 + */ +declare namespace curves { + /** + * enum Curve. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + enum Curve { + Linear, + Ease, + EaseIn, + EaseOut, + EaseInOut, + FastOutSlowIn, + LinearOutSlowIn, + FastOutLinearIn, + ExtremeDeceleration, + Sharp, + Rhythm, + Smooth, + Friction, + } + + /** + * Initializes the interpolator curve when called. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + function init(curve?: Curve): string; + + /** + * Constructs a step curve when called. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + function steps(count: number, end: boolean): string; + + /** + * Constructs a third-order Bezier curve when called. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + function cubicBezier(x1: number, y1: number, x2: number, y2: number): string; + + /** + * Constructs a spring curve when called. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + function spring(velocity: number, mass: number, stiffness: number, damping: number): string; +} + +export default curves; diff --git a/api/@ohos.matrix4.d.ts b/api/@ohos.matrix4.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..635a260179ca9879324b6c25558f6dd2759501a0 --- /dev/null +++ b/api/@ohos.matrix4.d.ts @@ -0,0 +1,277 @@ +/* + * Copyright (c) 2020 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. + */ + +/** + * Used to do matrix operations + * @import import Matrix4 from '@ohos.matrix4' + * @devices phone, tablet, tv, wearable + * @since 7 + */ +declare namespace matrix4 { + /** + * Set translation parameters + * @devices phone, tablet, tv, wearable + * @since 7 + */ + interface TranslateOption { + /** + * Indicates the translation distance of the x-axis, in px. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + x?: number; + + /** + * Indicates the translation distance of the y-axis, in px. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + y?: number; + + /** + * Indicates the translation distance of the z-axis, in px. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + z?: number; + } + + /** + * Set scaling parameters + * @devices phone, tablet, tv, wearable + * @since 7 + */ + interface ScaleOption { + /** + * Zoom factor of the x-axis. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + x?: number; + + /** + * Zoom factor of the y-axis. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + y?: number; + + /** + * Zoom factor of the z-axis. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + z?: number; + + /** + * Transform the x-axis coordinate of the center point. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + centerX?: number; + + /** + * Transform the y-axis coordinate of the center point. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + centerY?: number; + } + + /** + * Set Rotation Parameters. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + interface RotateOption { + /** + * Axis of rotation vector x coordinate. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + x?: number; + + /** + * Axis of rotation vector y coordinate. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + y?: number; + + /** + * Axis of rotation vector z coordinate. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + z?: number; + + /** + * Transform the x-axis coordinate of the center point. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + centerX?: number; + + /** + * Transform the y-axis coordinate of the center point. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + centerY?: number; + + /** + * Rotation angle. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + angle?: number; + } + + /** + * Matrix4Transit. + * @devices phone, tablet, tv, wearable + * @since 7 + */ + interface Matrix4Transit { + /** + * Copy function of Matrix, which can copy a copy of the current matrix object. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + copy(): Matrix4Transit; + + /** + * The inverse function of Matrix returns an inverse matrix of the current matrix object, that is, the effect is exactly the opposite. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + invert(): Matrix4Transit; + + /** + * Matrix superposition function, which can superpose the effects of two matrices to generate a new matrix object. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + combine(options:Matrix4Transit): Matrix4Transit; + + /** + * Matrix translation function, which can add the x-axis, Y-axis, or Z-axis translation effect to the current matrix. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + translate(options:TranslateOption): Matrix4Transit; + + /** + * Scaling function of the Matrix, which can add the x-axis, Y-axis, or Z-axis scaling effect to the current matrix. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + scale(options:ScaleOption): Matrix4Transit; + + /* Rotation function of the Matrix. You can add the x-axis, Y-axis, or Z-axis rotation effect to the current matrix. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + rotate(options:RotateOption): Matrix4Transit; + + /** + * Matrix coordinate point conversion function, which can apply the current transformation effect to a coordinate point. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + transformPoint(options:[number,number]): [number,number]; + } + + /** + * Constructor of Matrix, which can create a fourth-order matrix based on the input parameters. The matrix is column-first. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + function init(options: [number,number,number,number,number,number,number,number,number,number,number,number,number,number,number,number]): Matrix4Transit; + + /** + * Matrix initialization function, which can return an identity matrix object. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + function identity(): Matrix4Transit; + + /** + * Copy function of Matrix, which can copy a copy of the current matrix object. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + function copy(): Matrix4Transit; + + /** + * The inverse function of Matrix returns an inverse matrix of the current matrix object, that is, the effect is exactly the opposite. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + function invert(): Matrix4Transit; + + /** + * Matrix superposition function, which can superpose the effects of two matrices to generate a new matrix object. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + function combine(options:Matrix4Transit): Matrix4Transit; + + /** + * Matrix translation function, which can add the x-axis, Y-axis, or Z-axis translation effect to the current matrix. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + function translate(options:TranslateOption): Matrix4Transit; + + /** + * Scaling function of the Matrix, which can add the x-axis, Y-axis, or Z-axis scaling effect to the current matrix. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + function scale(options:ScaleOption): Matrix4Transit; + + /** + * Rotation function of the Matrix. You can add the x-axis, Y-axis, or Z-axis rotation effect to the current matrix. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + function rotate(options:RotateOption): Matrix4Transit; + + /** + * Matrix coordinate point conversion function, which can apply the current transformation effect to a coordinate point. + * @since 7 + * @devices phone, tablet, tv, wearable + * @return Return to Matrix4Transit + */ + function transformPoint(options:[number,number]): [number,number]; +} + +export default matrix4; \ No newline at end of file diff --git a/api/@ohos.mediaquery.d.ts b/api/@ohos.mediaquery.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fe889218bf4c2fbc32eb5beb197e38dc4c4db719 --- /dev/null +++ b/api/@ohos.mediaquery.d.ts @@ -0,0 +1,61 @@ +/* + * 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 {Callback} from './basic'; + +declare namespace mediaquery { + + interface MediaQueryResult { + + /** + * Whether the match condition is met. + * This parameter is read-only. + * @since 8 + */ + readonly matches: boolean; + + /** + * Matching condition of a media event. + * This parameter is read-only. + * @since 8 + */ + readonly media: string; + } + + interface MediaQueryListener extends MediaQueryResult { + + /** + * Registers a callback with the corresponding query condition by using the handle. + * This callback is triggered when the media attributes change. + * @since 8 + */ + on(type: 'change', callback: Callback): void; + + /** + * Deregisters a callback with the corresponding query condition by using the handle. + * This callback is not triggered when the media attributes chang. + * @since 8 + */ + off(type: 'change', callback?: Callback): void; + } + + /** + * Sets the media query criteria and returns the corresponding listening handle + * @since 8 + */ + function matchMediaSync(condition: string): MediaQueryListener; +} + +export default mediaquery; diff --git a/api/@ohos.prompt.d.ts b/api/@ohos.prompt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..40dc9faa4b18c9c75cb416bbd43d2c7e4e301150 --- /dev/null +++ b/api/@ohos.prompt.d.ts @@ -0,0 +1,159 @@ +/* + * 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 {AsyncCallback} from './basic'; + +/** + * @since 8 + * @import prompt from '@ohos.prompt'; + */ +declare namespace prompt { + + /** + * @since 8 + */ + interface ShowToastOptions { + + /** + * Text to display. + * @since 8 + */ + message: string; + + /** + * Duration of toast dialog box. The default value is 1500. + * The recommended value ranges from 1500 ms to 10000ms. + * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000 ms. + * @since 8 + */ + duration?: number; + + /** + * The distance between toast dialog box and the bottom of screen. + * @since 8 + */ + bottom?: string | number; + } + + /** + * @since 8 + */ + interface Button { + + /** + * @since 8 + */ + text: string; + + /** + * @since 8 + */ + color: string; + } + + /** + * @since 8 + */ + interface ShowDialogSuccessResponse { + + /** + * @since 8 + */ + index: number; + } + + /** + * @since 8 + */ + interface ShowDialogOptions { + + /** + * Title of the text to display. + * @since 8 + */ + title?: string; + + /** + * Text body. + * @since 8 + */ + message?: string; + + /** + * Array of buttons in the dialog box. + * The array structure is {text:'button', color: '#666666'}. + * One to three buttons are supported. The first button is of the positiveButton type, the second is of the negativeButton type, and the third is of the neutralButton type. + * @since 8 + */ + buttons?: [Button, Button?, Button?]; + } + + /** + * @since 8 + */ + interface ActionMenuSuccessResponse { + + /** + * @since 8 + */ + index: number; + } + + /** + * @devices tv, phone, tablet, wearable + * @since 8 + */ + interface ActionMenuOptions { + + /** + * Title of the text to display. + * @since 8 + */ + title?: string; + + /** + * Array of buttons in the dialog box. + * The array structure is {text:'button', color: '#666666'}. + * One to six buttons are supported. + * @since 8 + */ + buttons: [Button, Button?, Button?, Button?, Button?, Button?]; + } + + /** + * Displays the notification text. + * @param options Options. + * @since 8 + */ + function showToast(options: ShowToastOptions):void; + + /** + * Displays the dialog box. + * @param options Options. + * @since 8 + */ + function showDialog(options: ShowDialogOptions, callback: AsyncCallback):void; + function showDialog(options: ShowDialogOptions): Promise; + + /** + * Displays the menu. + * @param options Options. + * @since 8 + */ + function showActionMenu(options: ActionMenuOptions, callback: AsyncCallback):void; + function showActionMenu(options: ActionMenuOptions): Promise; +} + +export default prompt; diff --git a/api/@ohos.router.d.ts b/api/@ohos.router.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dc9fb60ca4840efc0c3b7b49194eb743a58b939b --- /dev/null +++ b/api/@ohos.router.d.ts @@ -0,0 +1,161 @@ +/* + * 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 {Callback} from './basic'; + +/** + * @since 8 + * @import router from '@ohos.router'; + */ +declare namespace router { + + /** + * @since 8 + */ + interface RouterOptions { + + /** + * URI of the destination page, which supports the following formats: + * 1. Absolute path of the page, which is provided by the pages list in the config.json file. + * Example: + * pages/index/index + * pages/detail/detail + * 2. Particular path. If the URI is a slash (/), the home page is displayed. + * @since 8 + */ + url: string; + + /** + * Data that needs to be passed to the destination page during navigation. + * After the destination page is displayed, the parameter can be directly used for the page. + * For example, this.data1 (data1 is the key value of the params used for page navigation.) + * @since 8 + */ + params?: Object; + } + + /** + * @since 8 + */ + interface BackRouterOptions { + + /** + * Returns to the page of the specified path. + * If the page with the specified path does not exist in the page stack, router.back() is called by default. + * @since 8 + */ + path?: string; + } + + /** + * @since 8 + */ + interface RouterState { + + /** + * Index of the current page in the stack. + * NOTE: The index starts from 1 from the bottom to the top of the stack. + * @since 8 + */ + index: number; + + /** + * Name of the current page, that is, the file name. + * @since 8 + */ + name: string; + + /** + * Path of the current page. + * @since 8 + */ + path: string; + } + + /** + * @since 8 + */ + interface EnableAlertOptions { + + /** + * dialog context. + * @since 8 + */ + message: string; + } + + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * @param options Options. + * @since 8 + */ + function push(options: RouterOptions):void; + + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * @param options Options. + * @since 8 + */ + function replace(options: RouterOptions):void; + + /** + * Returns to the previous page or a specified page. + * @param options Options. + * @since 8 + */ + function back(options: BackRouterOptions):void; + + /** + * Clears all historical pages and retains only the current page at the top of the stack. + * @since 8 + */ + function clear():void; + + /** + * Obtains the number of pages in the current stack. + * @returns Number of pages in the stack. The maximum value is 32. + * @since 8 + */ + function getLength():string; + + /** + * Obtains information about the current page state. + * @returns Page state. + * @since 8 + */ + function getState():RouterState; + + /** + * Pop up dialog to ask whether to back + * @param options Options. + * @since 8 + */ + function enableAlertBeforeBackPage(options: EnableAlertOptions):void; + + /** + * cancel enableAlertBeforeBackPage + * @since 8 + */ + function disableAlertBeforeBackPage():void; + + /** + * Obtains information about the current page params. + * @returns Page params. + * @since 8 + */ + function getParams(): Object; +} + +export default router;