From 653b8f73b738eb3a3ade4437f972d4c7fa98a56e Mon Sep 17 00:00:00 2001 From: kukixi Date: Thu, 20 Jan 2022 10:37:18 +0800 Subject: [PATCH 1/2] sync arkui api from yellow zone Signed-off-by: kukixi --- api/@ohos.animator.d.ts | 178 ++++++++++++++++++ .../@internal/dom.d.ts} | 71 +++---- api/common/@internal/index.d.ts | 3 +- api/common/@internal/viewmodel.d.ts | 24 +++ 4 files changed, 233 insertions(+), 43 deletions(-) create mode 100644 api/@ohos.animator.d.ts rename api/{@internal/component/ets/hyperlink.d.ts => common/@internal/dom.d.ts} (47%) diff --git a/api/@ohos.animator.d.ts b/api/@ohos.animator.d.ts new file mode 100644 index 0000000000..2f306abcc6 --- /dev/null +++ b/api/@ohos.animator.d.ts @@ -0,0 +1,178 @@ +/* + * 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. + */ + +/** + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ +export interface AnimatorOptions { + /** + * Duration of the animation, in milliseconds. + * The default value is 0. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + duration: number; + + /** + * Time curve of the animation. For details about the supported types. + * linear The animation speed keeps unchanged. + * ease The animation starts and ends at a low speed, cubic-bezier(0.25, 0.1, 0.25, 1.0). + * ease-in The animation starts at a low speed, cubic-bezier(0.42, 0.0, 1.0, 1.0). + * ease-out The animation ends at a low speed, cubic-bezier(0.0, 0.0, 0.58, 1.0). + * ease-in-out The animation starts and ends at a low speed, cubic-bezier(0.42, 0.0, 0.58, 1.0). + * fast-out-slow-in Standard curve, cubic-bezier(0.4, 0.0, 0.2, 1.0). + * linear-out-slow-in Deceleration curve, cubic-bezier(0.0, 0.0, 0.2, 1.0). + * fast-out-linear-in Acceleration curve, cubic-bezier(0.4, 0.0, 1.0, 1.0). + * friction Damping curve, cubic-bezier(0.2, 0.0, 0.2, 1.0). + * extreme-deceleration Extreme deceleration curve, cubic-bezier(0.0, 0.0, 0.0, 1.0). + * sharp Sharp curve, cubic-bezier(0.33, 0.0, 0.67, 1.0). + * rhythm Rhythm curve, cubic-bezier(0.7, 0.0, 0.2, 1.0). + * smooth Smooth curve, cubic-bezier(0.4, 0.0, 0.4, 1.0). + * cubic-bezier(x1, y1, x2, y2) You can customize an animation speed curve in the cubic-bezier() function. The x and y values of each input parameter must be between 0 and 1. + * Step curve. The number must be set and only an integer is supported, step-position is optional. It can be set to start or end. The default value is end. + * The default value is ease. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + easing: string; + + /** + * Delay for the animation start. The default value indicates no delay. + * The default value is 0. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + delay: number; + + /** + * Whether to resume to the initial state after the animation is executed. + * none: The initial state is restored after the animation is executed. + * forwards: The state at the end of the animation (defined in the last key frame) is retained after the animation is executed. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + fill: "none" | "forwards" | "backwards" | "both"; + + /** + * The animation playback mode. + * The default value is "normal". + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + direction: "normal" | "reverse" | "alternate" | "alternate-reverse"; + + /** + * Number of times the animation will be played. number indicates a fixed number of playback operations, and -1 an unlimited number of playback operations. + * The default value is 1. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + iterations: number; + + /** + * Starting point of animator interpolation. + * The default value is 0. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + begin: number; + + /** + * Ending point of Dynamic Interpolation + * The default value is 1. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + end: number; +} + +export interface AnimatorResult { + /** + * Update the options for current animator. + * @param options Options. + */ + update(options: AnimatorOptions): void; + /** + * Starts the animation. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + play(): void; + /** + * Ends the animation. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + finish(): void; + /** + * Pauses the animation. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + pause(): void; + /** + * Cancels the animation. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + cancel(): void; + /** + * Plays the animation in reverse direction. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + reverse(): void; + /** + * Trigger when vsync callback. + * @param progress The current progress of animtion + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + onframe: (progress: number) => void; + /** + * The animation is finished. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + onfinish: () => void; + /** + * The animation is canceled. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + oncancel: () => void; + /** + * The animation is repeated. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + onrepeat: () => void; +} + +/** + * @devices phone, tablet, wearable, tv, car + * @since 6 + * @import prompt from '@ohos.animator'; + */ +export default class Animator { + /** + * Create an animator object for custum animation. + * @param options Options. + * @devices phone, tablet, wearable, tv, car + * @since 6 + */ + static createAnimator(options: AnimatorOptions): AnimatorResult; +} diff --git a/api/@internal/component/ets/hyperlink.d.ts b/api/common/@internal/dom.d.ts similarity index 47% rename from api/@internal/component/ets/hyperlink.d.ts rename to api/common/@internal/dom.d.ts index f5c3dd4da0..39f358f314 100644 --- a/api/@internal/component/ets/hyperlink.d.ts +++ b/api/common/@internal/dom.d.ts @@ -1,42 +1,29 @@ -/* - * 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. - */ - -/** - * @since 7 - */ -interface HyperlinkInterface { - /** - * Return to get Hyperlink. - * address: Web page redirected by the hyperlink component. - * content: Hyperlinks in the hyperlink component display text. - * @since 7 - */ - (address: string | Resource, content?: string | Resource): HyperlinkAttribute; -} - -/** - * inheritance CommonMethod - * @since 7 - */ -declare class HyperlinkAttribute extends CommonMethod { - /** - * Set Color - * @since 7 - */ - color(value: ResourceColor): HyperlinkAttribute; -} - -declare const Hyperlink: HyperlinkInterface; -declare const HyperlinkInstance: HyperlinkAttribute; +/* + * 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. + */ + +export { Element } from './viewmodel'; + +/** + * global dom + * @since 8 + */ +export declare class dom { + /** + * create a dynamic dom by tag, rturn element + * @param tag dom tag + * @since 8 + */ + static createElement(tag: string): Element +} diff --git a/api/common/@internal/index.d.ts b/api/common/@internal/index.d.ts index 2b74cea7b7..93b43cc135 100644 --- a/api/common/@internal/index.d.ts +++ b/api/common/@internal/index.d.ts @@ -16,4 +16,5 @@ export * from './viewmodel'; export * from './featureability'; export * from './console'; -export * from './global'; \ No newline at end of file +export * from './global'; +export * from './dom'; \ No newline at end of file diff --git a/api/common/@internal/viewmodel.d.ts b/api/common/@internal/viewmodel.d.ts index 5c80a95a2c..385df1c155 100644 --- a/api/common/@internal/viewmodel.d.ts +++ b/api/common/@internal/viewmodel.d.ts @@ -487,6 +487,30 @@ export interface Element { * @param radios Scope of Monitoring components. */ createIntersectionObserver(param: {ratios: Array}): observer; + + /** + * Adds a node to the end of the child node list of the current node. + * @param child Subnode object to be added + * @since 8 + */ + addChild(child: Element): void + + /** + * Sets the value of an attribute on a specified element. If the attribute already exists, update the value. Otherwise, a new attribute is added with the specified name and value. + * @param name attribute name + * @param value attribute value¡¢ + * @since 8 + */ + setAttribute(name: string, value: string): void + + /** + * Sets a style value on a specified element. If the style exists and the style value is valid, the setting is successful. Otherwise, the setting is invalid. + * @param name style name + * @param value style value + * @returns If the setting is successful, true is returned. If the setting fails, false is returned. + * @since 8 + */ + setStyle(name: string, value: string): boolean } export interface observer { -- Gitee From 844566db4930bfc0812cd8b3888f64e963602b3b Mon Sep 17 00:00:00 2001 From: kukixi Date: Thu, 20 Jan 2022 19:52:07 +0800 Subject: [PATCH 2/2] add hyperlink.d.ts Signed-off-by: kukixi --- api/@internal/component/ets/hyperlink.d.ts | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 api/@internal/component/ets/hyperlink.d.ts diff --git a/api/@internal/component/ets/hyperlink.d.ts b/api/@internal/component/ets/hyperlink.d.ts new file mode 100644 index 0000000000..f5c3dd4da0 --- /dev/null +++ b/api/@internal/component/ets/hyperlink.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. + */ + +/** + * @since 7 + */ +interface HyperlinkInterface { + /** + * Return to get Hyperlink. + * address: Web page redirected by the hyperlink component. + * content: Hyperlinks in the hyperlink component display text. + * @since 7 + */ + (address: string | Resource, content?: string | Resource): HyperlinkAttribute; +} + +/** + * inheritance CommonMethod + * @since 7 + */ +declare class HyperlinkAttribute extends CommonMethod { + /** + * Set Color + * @since 7 + */ + color(value: ResourceColor): HyperlinkAttribute; +} + +declare const Hyperlink: HyperlinkInterface; +declare const HyperlinkInstance: HyperlinkAttribute; -- Gitee