From 1d774f2298d1b9f49945d0593d8ce224dac9618c Mon Sep 17 00:00:00 2001 From: s10021109 Date: Mon, 9 Jun 2025 15:02:11 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=94=AF=E6=8C=81@Builder=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: s10021109 --- api/@ohos.arkui.StateManagement.d.ts | 752 +++++++++++++++------------ 1 file changed, 433 insertions(+), 319 deletions(-) diff --git a/api/@ohos.arkui.StateManagement.d.ts b/api/@ohos.arkui.StateManagement.d.ts index a295917a69..20146f7416 100644 --- a/api/@ohos.arkui.StateManagement.d.ts +++ b/api/@ohos.arkui.StateManagement.d.ts @@ -1,320 +1,434 @@ -/* - * Copyright (C) 2024 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. - */ - -/** - * @file State management API file - * @kit ArkUI - */ - -import contextConstant from '@ohos.app.ability.contextConstant' - -/** - * Function that returns default creator. - * - * @typedef { function } StorageDefaultCreator - * @returns { T } default creator - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export declare type StorageDefaultCreator = () => T; - -/** - * Define class constructor with arbitrary parameters. - * @interface TypeConstructorWithArgs - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export interface TypeConstructorWithArgs { - /** - * @param { any } args the arguments of the constructor. - * @returns { T } return class instance. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - new(...args: any): T; -} - -/** - * Define ConnectOptions class. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 18 - */ -export class ConnectOptions { - /** - * @type { TypeConstructorWithArgs } type class type of the stored value. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 18 - */ - type: TypeConstructorWithArgs; - - /** - * Defines alias name of the key, or the function generating the default value. - * @type { ?string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 18 - */ - key?: string; - - /** - * Define the function generating the default value. - * @type { ?StorageDefaultCreator} - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 18 - */ - defaultCreator?: StorageDefaultCreator; - - /** - * Define encrypted partition for data storage. - * if not passed in, the defaule value is El2 - * - * @type { ?contextConstant.AreaMode} - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 18 - */ - areaMode?: contextConstant.AreaMode; -} - -/** - * AppStorageV2 is for UI state of app-wide access, has same life cycle as the app, - * and saves database content only in memory. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export declare class AppStorageV2 { - /** - * If used by persistenceV2, module-level storage path, different modules will have their own storage paths. - * If the value for the given key is already available, return the value. - * If not, add the key with value generated by calling defaultFunc and return it to caller. - * - * @param { TypeConstructorWithArgs } type class type of the stored value. - * @param { string | StorageDefaultCreator } [keyOrDefaultCreator] alias name of the key, or the function generating the default value. - * @param { StorageDefaultCreator } [defaultCreator] the function generating the default value - * @returns { T | undefined } the value of the existed key or the default value - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static connect( - type: TypeConstructorWithArgs, - keyOrDefaultCreator?: string | StorageDefaultCreator, - defaultCreator?: StorageDefaultCreator - ): T | undefined; - - /** - * Removes data with the given key or given class type. - * - * @param { string | TypeConstructorWithArgs } keyOrType key or class type removing - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static remove(keyOrType: string | TypeConstructorWithArgs): void; - - /** - * Return the array of all keys. - * - * @returns { Array } the array of all keys - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static keys(): Array; -} - -/** - * Function that returns reason type when error. - * - * @typedef { function } PersistenceErrorCallback - * @param { string } key persisted key when error - * @param { 'quota' | 'serialization' | 'unknown' } reason reason type when error - * @param { string } message more message when error - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export declare type PersistenceErrorCallback = (key: string, reason: 'quota' | 'serialization' | 'unknown', message: string) => void; - -/** - * PersistenceV2 is for UI state of app-wide access, available on app re-start, - * and saves database content in disk. - * - * @extends AppStorageV2 - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export declare class PersistenceV2 extends AppStorageV2 { - /** - * Application-level storage path, sharing a storage path for all modules under the application. - * If the value for the given key is already available, return the value. - * If not, add the key with value generated by calling defaultFunc and return it to caller. - * - * @param { ConnectOptions } type Application level storage parameters. - * @returns { T | undefined } the value of the existed key or the default value - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 18 - */ - static globalConnect( - type: ConnectOptions - ): T | undefined; - - /** - * Used to manually persist data changes to disks. - * - * @param { string | TypeConstructorWithArgs } keyOrType key or class type need to persist. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static save(keyOrType: string | TypeConstructorWithArgs): void; - - /** - * Be called when persisting has encountered an error. - * - * @param { PersistenceErrorCallback | undefined } callback called when error - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static notifyOnError(callback: PersistenceErrorCallback | undefined): void; -} - -/** - * Define TypeConstructor type. - * - * @interface TypeConstructor - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export interface TypeConstructor { - /** - * @returns { T } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - new(): T; -} - -/** - * Function that returns PropertyDecorator. - * - * @typedef { function } TypeDecorator - * @param { TypeConstructor } type type info - * @returns { PropertyDecorator } Type decorator - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export declare type TypeDecorator = (type: TypeConstructor) => PropertyDecorator; - -/** - * Define Type PropertyDecorator, adds type information to an object. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export declare const Type: TypeDecorator; - -/** - * UIUtils is a state management tool class for operating the observed data. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export declare class UIUtils { - /** - * Get raw object from the Object wrapped with an ObservedObject. - * If input parameter is a regular Object without ObservedObject, return Object itself. - * - * @param { T } source input source Object data. - * @returns { T } raw object from the Object wrapped with an ObservedObject. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static getTarget(source: T): T; - - /** - * Make non-observed data into V2 observed data. - * Support non-observed class, JSON.parse Object and Sendable class. - * - * @param { T } source input source object data. - * @returns { T } V2 proxy object from the source object data. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static makeObserved(source: T): T; - - /** - * Make non-observed data into V1 observed data. - * Support JS object, interface, class (non-@Observed, non-ObservedV2). - * - * @param { T } source input source object data. - * @returns { T } V1 proxy object from the source object data. - * @static - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 19 - */ - static makeV1Observed(source: T): T; - - /** - * Enables V2 compatibility on given viewmodel object or nested viewmodels, which are V1 observed object already. - * - * @param {T} source - The object to be made V2-compatible. - * @returns {T} The processed object with V2 compatibility enabled. - * @static - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 19 - */ - static enableV2Compatibility(source: T): T; +/* + * Copyright (C) 2024 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. + */ + +/** + * @file State management API file + * @kit ArkUI + */ + +import contextConstant from '@ohos.app.ability.contextConstant'; +/** + * Function that returns default creator. + * + * @typedef { function } StorageDefaultCreator + * @returns { T } default creator + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare type StorageDefaultCreator = () => T; + +/** + * Define class constructor with arbitrary parameters. + * @interface TypeConstructorWithArgs + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export interface TypeConstructorWithArgs { + /** + * @param { any } args the arguments of the constructor. + * @returns { T } return class instance. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + new(...args: any): T; +} + +/** + * AppStorageV2 is for UI state of app-wide access, has same life cycle as the app, + * and saves database content only in memory. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare class AppStorageV2 { + /** + * If used by persistenceV2, module-level storage path, different modules will have their own storage paths. + * If the value for the given key is already available, return the value. + * If not, add the key with value generated by calling defaultFunc and return it to caller. + * + * @param { TypeConstructorWithArgs } type class type of the stored value. + * @param { string | StorageDefaultCreator } [keyOrDefaultCreator] alias name of the key, or the function generating the default value. + * @param { StorageDefaultCreator } [defaultCreator] the function generating the default value + * @returns { T | undefined } the value of the existed key or the default value + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + static connect( + type: TypeConstructorWithArgs, + keyOrDefaultCreator?: string | StorageDefaultCreator, + defaultCreator?: StorageDefaultCreator + ): T | undefined; + + /** + * Removes data with the given key or given class type. + * + * @param { string | TypeConstructorWithArgs } keyOrType key or class type removing + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + static remove(keyOrType: string | TypeConstructorWithArgs): void; + + /** + * Return the array of all keys. + * + * @returns { Array } the array of all keys + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + static keys(): Array; +} + +/** + * Function that returns reason type when error. + * + * @typedef { function } PersistenceErrorCallback + * @param { string } key persisted key when error + * @param { 'quota' | 'serialization' | 'unknown' } reason reason type when error + * @param { string } message more message when error + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare type PersistenceErrorCallback = (key: string, reason: 'quota' | 'serialization' | 'unknown', message: string) => void; + +/** + * PersistenceV2 is for UI state of app-wide access, available on app re-start, + * and saves database content in disk. + * + * @extends AppStorageV2 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare class PersistenceV2 extends AppStorageV2 { + + /** + * Application-level storage path, sharing a storage path for all modules under the application. + * If the value for the given key is already available, return the value. + * If not, add the key with value generated by calling defaultFunc and return it to caller. + * + * @param { ConnectOptions } type Application level storage parameters. + * @returns { T | undefined } the value of the existed key or the default value + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 18 + */ + static globalConnect( + type: ConnectOptions + ): T | undefined; + /** + * Used to manually persist data changes to disks. + * + * @param { string | TypeConstructorWithArgs } keyOrType key or class type need to persist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + static save(keyOrType: string | TypeConstructorWithArgs): void; + + /** + * Be called when persisting has encountered an error. + * + * @param { PersistenceErrorCallback | undefined } callback called when error + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + static notifyOnError(callback: PersistenceErrorCallback | undefined): void; +} + +/** + * Define TypeConstructor type. + * + * @interface TypeConstructor + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export interface TypeConstructor { + /** + * @returns { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + new(): T; +} + +/** + * Function that returns PropertyDecorator. + * + * @typedef { function } TypeDecorator + * @param { TypeConstructor } type type info + * @returns { PropertyDecorator } Type decorator + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare type TypeDecorator = (type: TypeConstructor) => PropertyDecorator; + +/** + * Define Type PropertyDecorator, adds type information to an object. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare const Type: TypeDecorator; + +/** + * Getter callback type. It is used to get value. + * + * @typedef { function } GetterCallback + * @returns { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export declare type GetterCallback = () => T; + +/** + * Setter callback type. It is used to assign a new value. + * + * @typedef { function } SetterCallback + * @param { T } newValue - update the value with newValue. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export declare type SetterCallback = (newValue: T) => void; + +/** + * Represents a read-only data binding. + * Use with @Builder argument list for primitive types. Use makeBinding to pass values when calling the function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export declare class Binding { + /** + * Get function that can acquire the value. + * @returns T + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + get value(): T; +} + +/** + * Represents a mutable data binding allowing both read and write operations. + * Use with @Builder argument list for primitive types. Use makeBinding to pass values when calling the function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export declare class MutableBinding { + /** + * Get function that can acquire the value. + * @returns T + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + get value(): T; + /** + * Set function that can set the new value. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + set value(newValue: T): void; +} + +/** + * UIUtils is a state management tool class for operating the observed data. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare class UIUtils { + /** + * Get raw object from the Object wrapped with an ObservedObject. + * If input parameter is a regular Object without ObservedObject, return Object itself. + * + * @param { T } source input source Object data. + * @returns { T } raw object from the Object wrapped with an ObservedObject. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + static getTarget(source: T): T; + + /** + * Make non-observed data into V2 observed data. + * Support non-observed class, JSON.parse Object and Sendable class. + * + * @param { T } source input source object data. + * @returns { T } V2 proxy object from the source object data. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + static makeObserved(source: T): T; + + /** + * Make non-observed data into V1 observed data. + * Support JS object, interface, class (non-@Observed, non-ObservedV2). + * + * @param { T } source input source object data. + * @returns { T } V1 proxy object from the source object data. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 18 + */ + static makeV1Observed(source: T): T; + + /** + * Enables V2 compatibility on given viewmodel object or nested viewmodels, which are V1 observed object already. + * + * @param {T} source - The object to be made V2-compatible. + * @returns {T} The processed object with V2 compatibility enabled. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 18 + */ + static enableV2Compatibility(source: T): T; + + /** + * Creates read-only data binding. + * + * + * Example. UIUtils.makeBinding(()=>this.num); + * + * Supports simple getters for read-only data. + * Intended for primitive value parameters when calling a @Builder function where arguments are of type Binding. + * + * @param { GetterCallback } getter - A value or a function that returns the current value of type T. + * @returns { Binding } read-only data binding value + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + static makeBinding(getter: GetterCallback): Binding; + + /** + * Creates a mutable data binding. + * + * Two functions to implement function overloading. + * + * Example. UIUtils.makeBinding(()=>this.num, val => this.num = val); + * + * Supports getter-setter pairs for mutable data. + * Intended for primitive value parameters when calling a @Builder + * function where arguments are of type MutableBinding. + * + * @param { GetterCallback } getter - A value or a function that returns the current value of type T. + * @param { SetterCallback } [setter] - (Optional) A function to + * set a new value of type T. If provided, a MutableBinding is created. + * @returns { MutableBinding } mutable data binding value + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + static makeBinding(getter: GetterCallback, setter: SetterCallback): MutableBinding; +} + + +/** + * Define ConnectOptions class. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 18 + */ +export class ConnectOptions { + + /** + * @type { TypeConstructorWithArgs } type class type of the stored value. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 18 + */ + type: TypeConstructorWithArgs; + + /** + * Defines alias name of the key, or the function generating the default value. + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 18 + */ + key?: string; + /** + * Define the function generating the default value. + * @type { ?StorageDefaultCreator} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 18 + */ + defaultCreator?: StorageDefaultCreator; + + /** + * Define encrypted partition for data storage. + * if not passed in, the defaule value is El2 + * + * @type { ?contextConstant.AreaMode} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 18 + */ + areaMode?: contextConstant.AreaMode; } \ No newline at end of file -- Gitee From e37d9fc8c01e2aaca299f6a14e5fe95795154b21 Mon Sep 17 00:00:00 2001 From: chenbenzhi Date: Mon, 9 Jun 2025 07:50:38 +0000 Subject: [PATCH 2/5] =?UTF-8?q?update=20api/@ohos.arkui.StateManagement.d.?= =?UTF-8?q?ts.=20API18=E6=94=B9=E6=88=90API19?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chenbenzhi --- api/@ohos.arkui.StateManagement.d.ts | 95 ++++++++++++++-------------- 1 file changed, 47 insertions(+), 48 deletions(-) diff --git a/api/@ohos.arkui.StateManagement.d.ts b/api/@ohos.arkui.StateManagement.d.ts index 20146f7416..7cfc272a72 100644 --- a/api/@ohos.arkui.StateManagement.d.ts +++ b/api/@ohos.arkui.StateManagement.d.ts @@ -51,6 +51,51 @@ export interface TypeConstructorWithArgs { new(...args: any): T; } +/** + * Define ConnectOptions class. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 18 + */ +export class ConnectOptions { + + /** + * @type { TypeConstructorWithArgs } type class type of the stored value. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 18 + */ + type: TypeConstructorWithArgs; + + /** + * Defines alias name of the key, or the function generating the default value. + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 18 + */ + key?: string; + /** + * Define the function generating the default value. + * @type { ?StorageDefaultCreator} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 18 + */ + defaultCreator?: StorageDefaultCreator; + + /** + * Define encrypted partition for data storage. + * if not passed in, the defaule value is El2 + * + * @type { ?contextConstant.AreaMode} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 18 + */ + areaMode?: contextConstant.AreaMode; +} + /** * AppStorageV2 is for UI state of app-wide access, has same life cycle as the app, * and saves database content only in memory. @@ -327,7 +372,7 @@ export declare class UIUtils { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 19 */ static makeV1Observed(source: T): T; @@ -340,7 +385,7 @@ export declare class UIUtils { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 19 */ static enableV2Compatibility(source: T): T; @@ -385,50 +430,4 @@ export declare class UIUtils { * @since 20 */ static makeBinding(getter: GetterCallback, setter: SetterCallback): MutableBinding; -} - - -/** - * Define ConnectOptions class. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 18 - */ -export class ConnectOptions { - - /** - * @type { TypeConstructorWithArgs } type class type of the stored value. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 18 - */ - type: TypeConstructorWithArgs; - - /** - * Defines alias name of the key, or the function generating the default value. - * @type { ?string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 18 - */ - key?: string; - /** - * Define the function generating the default value. - * @type { ?StorageDefaultCreator} - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 18 - */ - defaultCreator?: StorageDefaultCreator; - - /** - * Define encrypted partition for data storage. - * if not passed in, the defaule value is El2 - * - * @type { ?contextConstant.AreaMode} - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 18 - */ - areaMode?: contextConstant.AreaMode; } \ No newline at end of file -- Gitee From 471710c728f3604a989913be0994a056586cb38f Mon Sep 17 00:00:00 2001 From: openharmony_devops Date: Mon, 9 Jun 2025 07:55:17 +0000 Subject: [PATCH 3/5] update api/@ohos.arkui.StateManagement.d.ts. Signed-off-by: openharmony_devops --- api/@ohos.arkui.StateManagement.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/@ohos.arkui.StateManagement.d.ts b/api/@ohos.arkui.StateManagement.d.ts index 20146f7416..9535729fcb 100644 --- a/api/@ohos.arkui.StateManagement.d.ts +++ b/api/@ohos.arkui.StateManagement.d.ts @@ -327,7 +327,7 @@ export declare class UIUtils { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 19 */ static makeV1Observed(source: T): T; @@ -340,7 +340,7 @@ export declare class UIUtils { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 19 */ static enableV2Compatibility(source: T): T; -- Gitee From 2c56b4c0241f100709b3845e0788ca9b12befd49 Mon Sep 17 00:00:00 2001 From: s10021109 Date: Thu, 12 Jun 2025 15:05:20 +0800 Subject: [PATCH 4/5] =?UTF-8?q?ArkTS1.2=E7=8A=B6=E6=80=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86API(1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: s10021109 --- api/@internal/component/ets/particle.d.ts | 450 +--- api/@ohos.arkui.stateManagement.d.ets | 59 +- api/arkui/component/customComponent.d.ets | 2218 ++++++++++++++++- api/arkui/component/interop.d.ets | 145 ++ api/arkui/stateManagement/decorator.d.ets | 740 ++++++ .../storage/appStorageV2.d.ets | 67 + .../stateManagement/storage/environment.d.ets | 92 + .../storage/persistenceV2.d.ets | 206 ++ .../storage/persistentStorage.d.ets | 144 ++ 9 files changed, 3676 insertions(+), 445 deletions(-) create mode 100644 api/arkui/component/interop.d.ets create mode 100644 api/arkui/stateManagement/decorator.d.ets create mode 100644 api/arkui/stateManagement/storage/appStorageV2.d.ets create mode 100644 api/arkui/stateManagement/storage/environment.d.ets create mode 100644 api/arkui/stateManagement/storage/persistenceV2.d.ets create mode 100644 api/arkui/stateManagement/storage/persistentStorage.d.ets diff --git a/api/@internal/component/ets/particle.d.ts b/api/@internal/component/ets/particle.d.ts index 4b1f524745..6c86b32a2b 100644 --- a/api/@internal/component/ets/particle.d.ts +++ b/api/@internal/component/ets/particle.d.ts @@ -1,23 +1,17 @@ -/* - * Copyright (c) 2023 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. - */ /** * @file * @kit ArkUI */ +/*** if arkts 1.2 */ +import { LengthMetrics, SizeT, PositionT } from '../../arkui/Graphics' +import { VP, ResourceStr,Dimension,ResourceColor } from './units'; +import { ImageFit, Curve } from './enums'; +import { ICurve, CommonMethod } from './common'; +import { ComponentBuilder } from './builder' +/*** endif */ + /** * Defines a pair of given type for particle. * @@ -25,7 +19,7 @@ * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ declare type ParticleTuple = [T1, T2]; @@ -36,7 +30,7 @@ declare type ParticleTuple = [T1, T2]; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ declare interface VelocityOptions { /** @@ -54,16 +48,6 @@ declare interface VelocityOptions { * @atomicservice * @since 11 */ - /** - * Particle speed. - * - * Anonymous Object Rectification. - * @type { ParticleTuple } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ speed: ParticleTuple; /** @@ -81,16 +65,6 @@ declare interface VelocityOptions { * @atomicservice * @since 11 */ - /** - * Angle of particle's direction. - * - * Anonymous Object Rectification. - * @type { ParticleTuple } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ angle: ParticleTuple; } @@ -101,7 +75,7 @@ declare interface VelocityOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ declare interface AccelerationOptions< ACC_SPEED_UPDATER extends ParticleUpdater, @@ -122,16 +96,6 @@ declare interface AccelerationOptions< * @atomicservice * @since 11 */ - /** - * Speed property options. - * - * Anonymous Object Rectification. - * @type { ?ParticlePropertyOptions } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ speed?: ParticlePropertyOptions; /** @@ -149,16 +113,6 @@ declare interface AccelerationOptions< * @atomicservice * @since 11 */ - /** - * Angle property options. - * - * Anonymous Object Rectification. - * @type { ?ParticlePropertyOptions } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ angle?: ParticlePropertyOptions; } @@ -279,14 +233,12 @@ interface ParticleOptions< */ /** * Particle velocity. - * - * Anonymous Object Rectification. * @type { ?VelocityOptions } * @default {speed:[0,0];angle:[0,0]} * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ velocity?: VelocityOptions; @@ -309,14 +261,12 @@ interface ParticleOptions< */ /** * Particle acceleration. - * - * Anonymous Object Rectification. * @type { ?AccelerationOptions } * @default {speed:{range:[0,0]};angle:{range:[0,0]}} * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ acceleration?: AccelerationOptions; @@ -424,13 +374,11 @@ interface ImageParticleParameters { */ /** * Particle image size. - * - * Anonymous Object Rectification. * @type { ParticleTuple } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ size: ParticleTuple; @@ -472,14 +420,14 @@ interface ImageParticleParameters { interface ParticleConfigs { /** * Point-like Particle. - * @type { PointParticleParameters } + * @type { PointParticleParameters } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Point-like Particle. - * @type { PointParticleParameters } + * @type { PointParticleParameters } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice @@ -489,14 +437,14 @@ interface ParticleConfigs { /** * Image-like Particle. - * @type { ImageParticleParameters } + * @type { ImageParticleParameters } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Image-like Particle. - * @type { ImageParticleParameters } + * @type { ImageParticleParameters } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice @@ -559,17 +507,6 @@ interface EmitterProperty { * @since 12 */ size?: SizeT; - - /** - * the description of the annulus region. This parameter is valid only for emitter whose shape is annulus. - * - * @type { ?ParticleAnnulusRegion } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - annulusRegion?: ParticleAnnulusRegion; } /** @@ -579,7 +516,7 @@ interface EmitterProperty { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ interface EmitterParticleOptions { /** @@ -597,16 +534,6 @@ interface EmitterParticleOptions { * @atomicservice * @since 11 */ - /** - * Particle type. - * - * Anonymous Object Rectification. - * @type { PARTICLE } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ type: PARTICLE; /** * Particle config. @@ -623,16 +550,6 @@ interface EmitterParticleOptions { * @atomicservice * @since 11 */ - /** - * Particle config. - * - * Anonymous Object Rectification. - * @type { ParticleConfigs[PARTICLE] } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ config: ParticleConfigs[PARTICLE]; /** @@ -650,16 +567,6 @@ interface EmitterParticleOptions { * @atomicservice * @since 11 */ - /** - * Particle count. - * - * Anonymous Object Rectification. - * @type { number } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ count: number; /** @@ -679,21 +586,10 @@ interface EmitterParticleOptions { * @atomicservice * @since 11 */ - /** - * Particle lifetime. - * - * Anonymous Object Rectification. - * @type { ?number } - * @default 1000 - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ lifetime?: number; /** - * Particle lifetimeRange,value range [0, ∞). + * Particle lifetimeRange,value range [0, ¡Þ). * when lifetimeRange>lifetime,minimum lifetime is 0. * @type { ?number } * @default 0 @@ -702,18 +598,6 @@ interface EmitterParticleOptions { * @atomicservice * @since 12 */ - /** - * Particle lifetimeRange,value range [0, ∞). - * when lifetimeRange>lifetime,minimum lifetime is 0. - * - * Anonymous Object Rectification. - * @type { ?number } - * @default 0 - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ lifetimeRange?: number; } @@ -735,14 +619,14 @@ interface EmitterParticleOptions { interface EmitterOptions { /** * Set particle config. - * @type { object } + * @type { object } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Set particle config. - * @type { object } + * @type { object } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice @@ -750,13 +634,11 @@ interface EmitterOptions { */ /** * Set particle config. - * - * Anonymous Object Rectification. * @type { EmitterParticleOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ particle: EmitterParticleOptions; @@ -823,14 +705,12 @@ interface EmitterOptions { * Position of emitter. * The first element means X-axis location. * The second element means the Y-axis location. - * - * Anonymous Object Rectification. * @type { ?ParticleTuple } * @default [0,0] * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ position?: ParticleTuple; @@ -859,28 +739,14 @@ interface EmitterOptions { * Size of emitter. * The first element means emitter width. * The second element means emitter height. - * - * Anonymous Object Rectification. * @type { ?ParticleTuple } * @default ['100%','100%'] * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ size?: ParticleTuple; - - /** - * the description of the annulus region. This parameter is valid only for emitter whose shape is annulus. - * - * @type { ?ParticleAnnulusRegion } - * @default {innerRadius:LengthMetrics.vp(0),outerRadius:LengthMetrics.vp(0)} - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - annulusRegion?: ParticleAnnulusRegion; } /** @@ -935,13 +801,11 @@ interface ParticlePropertyUpdaterConfigs { */ /** * Random effect of particle updater. - * - * Anonymous Object Rectification. * @type { ParticleTuple } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ [ParticleUpdater.RANDOM]: ParticleTuple; @@ -970,7 +834,7 @@ interface ParticlePropertyUpdaterConfigs { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ interface ParticleUpdaterOptions { /** @@ -988,16 +852,6 @@ interface ParticleUpdaterOptions { * @atomicservice * @since 11 */ - /** - * Particle updater type. - * - * Anonymous Object Rectification. - * @type { UPDATER } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ type: UPDATER; /** @@ -1015,16 +869,6 @@ interface ParticleUpdaterOptions { * @atomicservice * @since 11 */ - /** - * Particle updater configuration. - * - * Anonymous Object Rectification. - * @type { ParticlePropertyUpdaterConfigs[UPDATER] } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ config: ParticlePropertyUpdaterConfigs[UPDATER]; } @@ -1035,7 +879,7 @@ interface ParticleUpdaterOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ interface ParticleColorOptions { /** @@ -1053,16 +897,6 @@ interface ParticleColorOptions { * @atomicservice * @since 11 */ - /** - * Red component of particle color. - * - * Anonymous Object Rectification. - * @type { ParticleTuple } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ r: ParticleTuple; /** @@ -1080,16 +914,6 @@ interface ParticleColorOptions { * @atomicservice * @since 11 */ - /** - * Green component of particle color. - * - * Anonymous Object Rectification. - * @type { ParticleTuple } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ g: ParticleTuple; /** @@ -1107,16 +931,6 @@ interface ParticleColorOptions { * @atomicservice * @since 11 */ - /** - * Blue component of particle color. - * - * Anonymous Object Rectification. - * @type { ParticleTuple } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ b: ParticleTuple; /** @@ -1134,16 +948,6 @@ interface ParticleColorOptions { * @atomicservice * @since 11 */ - /** - * Opacity component of particle color. - * - * Anonymous Object Rectification. - * @type { ParticleTuple } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ a: ParticleTuple; } @@ -1154,7 +958,7 @@ interface ParticleColorOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ interface ParticleColorUpdaterOptions { /** @@ -1172,16 +976,6 @@ interface ParticleColorUpdaterOptions { * @atomicservice * @since 11 */ - /** - * Color updater. - * - * Anonymous Object Rectification. - * @type { UPDATER } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ type: UPDATER; /** @@ -1199,16 +993,6 @@ interface ParticleColorUpdaterOptions { * @atomicservice * @since 11 */ - /** - * Color updater configuration. - * - * Anonymous Object Rectification. - * @type { ParticleColorPropertyUpdaterConfigs[UPDATER] } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ config: ParticleColorPropertyUpdaterConfigs[UPDATER]; } @@ -1245,13 +1029,11 @@ interface ParticlePropertyOptions { */ /** * Initial range, within which the initial value are randomly generated. - * - * Anonymous Object Rectification. * @type { ParticleTuple } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ range: ParticleTuple; @@ -1274,14 +1056,12 @@ interface ParticlePropertyOptions { */ /** * Particle property updater. - * - * Anonymous Object Rectification. * @type { ?ParticleUpdaterOptions } * @default {type:UPDATER.NONE;config:ParticlePropertyUpdaterConfigs[UPDATER.NONE]} * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ updater?: ParticleUpdaterOptions; } @@ -1338,19 +1118,17 @@ interface ParticleColorPropertyUpdaterConfigs { */ /** * Random effect of particle color property updater. - * - * Anonymous Object Rectification. * @type { ParticleColorOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ [ParticleUpdater.RANDOM]: ParticleColorOptions; /** * Curve effect of particle color property updater. - * + * * @type { Array> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform @@ -1358,7 +1136,7 @@ interface ParticleColorPropertyUpdaterConfigs { */ /** * Curve effect of particle color property updater. - * + * * @type { Array> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform @@ -1401,13 +1179,11 @@ interface ParticleColorPropertyOptions { */ /** * Initial color range, within which the initial color is randomly generated. - * - * Anonymous Object Rectification. * @type { ParticleTuple } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ range: ParticleTuple; @@ -1441,14 +1217,12 @@ interface ParticleColorPropertyOptions { */ /** * Particle color property updater. - * - * Anonymous Object Rectification. * @type { ?ParticleColorUpdaterOptions } * @default {type:UPDATER.NONE;config:ParticleColorPropertyUpdaterConfigs[UPDATER.NONE]} * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ updater?: ParticleColorUpdaterOptions; } @@ -1470,14 +1244,14 @@ interface ParticleColorPropertyOptions { */ interface ParticlePropertyAnimation { /** - * Start position of the particle animation. + * Start position of the particle animation. * @type { T } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** - * Start position of the particle animation. + * Start position of the particle animation. * @type { T } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform @@ -1521,14 +1295,14 @@ interface ParticlePropertyAnimation { startMillis: number; /** - * End millis of the particle animation. + * End millis of the particle animation. * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** - * End millis of the particle animation. + * End millis of the particle animation. * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform @@ -1564,7 +1338,7 @@ interface ParticlePropertyAnimation { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ interface Particles< PARTICLE extends ParticleType, @@ -1590,16 +1364,6 @@ interface Particles< * @atomicservice * @since 11 */ - /** - * Array of particles. - * - * Anonymous Object Rectification. - * @type { Array> } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 18 - */ particles: Array< ParticleOptions< PARTICLE, @@ -1629,6 +1393,7 @@ interface Particles< * @since 11 */ interface ParticleInterface { + /** * create a particle array. * @param { object } value - Particle value @@ -1650,15 +1415,13 @@ interface ParticleInterface { */ /** * create a particle array. - * - * Anonymous Object Rectification. * @param { Particles } particles - Array of particles. * @returns { ParticleAttribute } Returns the particle attribute. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 18 + * @since 14 */ < PARTICLE extends ParticleType, @@ -1679,6 +1442,19 @@ interface ParticleInterface { >): ParticleAttribute; } +/** + * Defines Particle Component. + * + * @param { Particles } particles - Particle infomation. + * @returns { ParticleAttribute } Returns the particle attribute. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + * @arkts 1.2 + */ +export declare function Particle( + particles: Particles +): ParticleAttribute; + /** * Enumerates the particle types. * @enum { string } @@ -1723,7 +1499,7 @@ declare enum ParticleType { * @atomicservice * @since 11 */ - IMAGE = 'image', + IMAGE = 'image' } /** @@ -1785,21 +1561,12 @@ declare enum ParticleEmitterShape { * @atomicservice * @since 11 */ - ELLIPSE = 'ellipse', - - /** - * Annulus. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - ANNULUS = 'annulus', + ELLIPSE = 'ellipse' } /** * Enumerates the color distribution types of a particle. - * + * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform @@ -1809,7 +1576,7 @@ declare enum ParticleEmitterShape { declare enum DistributionType { /** * Uniform distribution. - * + * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice @@ -1819,13 +1586,13 @@ declare enum DistributionType { /** * Gaussian distribution. - * + * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ - GAUSSIAN = 1, + GAUSSIAN = 1 } /** @@ -1887,7 +1654,7 @@ declare enum ParticleUpdater { * @atomicservice * @since 11 */ - CURVE = 'curve', + CURVE = 'curve' } /** @@ -1901,7 +1668,7 @@ declare enum ParticleUpdater { */ declare type SizeT = import('../api/arkui/Graphics').SizeT; - /** +/** * Defines the PositionT type. * * @typedef { import('../api/arkui/Graphics').PositionT } @@ -2056,7 +1823,7 @@ declare interface DisturbanceFieldOptions { */ noiseScale?: number; - /** + /** * Noise frequency with a value greater or equal 0. * * @type { ?number } @@ -2100,9 +1867,9 @@ declare enum DisturbanceFieldShape { * @atomicservice * @since 12 */ - RECT, + RECT = 0, - /** + /** * Shape circle. * * @syscap SystemCapability.ArkUI.ArkUI.Full @@ -2110,7 +1877,7 @@ declare enum DisturbanceFieldShape { * @atomicservice * @since 12 */ - CIRCLE, + CIRCLE = 1, /** * Shape eclipse. @@ -2120,70 +1887,19 @@ declare enum DisturbanceFieldShape { * @atomicservice * @since 12 */ - ELLIPSE - -} - -/** - * Defines particle annuslus region params. - * @interface ParticleAnnulusRegion - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ -declare interface ParticleAnnulusRegion { - /** - * The coordinates of the center of the annulus - * - * @type { ?PositionT } - * @default {x:LengthMetrics.percent(0.5),y:LengthMetrics.percent(0.5)} - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - center?: PositionT, - /** - * The outer radius of the annulus - * - * @type { LengthMetrics } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - outerRadius: LengthMetrics, - /** - * The inner radius of the annulus - * - * @type { LengthMetrics } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - innerRadius: LengthMetrics, - /** - * The start angle of the annulus, in degree - * - * @type { ?number } - * @default 0 - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - startAngle?: number, - /** - * The end angle of the annulus, in degree - * - * @type { ?number } - * @default 360 - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - endAngle?: number, + ELLIPSE = 2 } +/* + * Copyright (c) 2023 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. + */ \ No newline at end of file diff --git a/api/@ohos.arkui.stateManagement.d.ets b/api/@ohos.arkui.stateManagement.d.ets index f29f2f0d28..1fe55fc73c 100644 --- a/api/@ohos.arkui.stateManagement.d.ets +++ b/api/@ohos.arkui.stateManagement.d.ets @@ -1,34 +1,25 @@ -/* - * Copyright (C) 2025 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. - */ - -/** - * @file State management API file - * @kit ArkUI - * @arkts 1.2 - */ - -export * from './arkui/stateManagement/common'; -export * from './arkui/stateManagement/runtime'; -export * from './arkui/stateManagement/storage'; -export * from './arkui/stateManagement/base/decoratorBase'; -export * from './arkui/stateManagement/base/iObservedObject'; -export * from './arkui/stateManagement/decorators/decoratorState'; -export * from './arkui/stateManagement/decorators/decoratorLink'; -export * from './arkui/stateManagement/decorators/decoratorProp'; -export * from './arkui/stateManagement/decorators/decoratorStorageLink'; -export * from './arkui/stateManagement/decorators/decoratorStorageProp'; -export * from './arkui/stateManagement/decorators/decoratorWatch'; -export * from './arkui/stateManagement/storages/appStorage'; -export * from './arkui/stateManagement/storages/localStorage'; \ No newline at end of file +/* + * Copyright (C) 2025 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. + */ + +/** + * @file State management API file + * @kit ArkUI + * @arkts 1.2 + */ + +export * from './arkui/stateManagement/decorator'; +export * from './arkui/stateManagement/runtime'; +export * from './arkui/stateManagement/storage'; +export * from './arkui/stateManagement/utils'; \ No newline at end of file diff --git a/api/arkui/component/customComponent.d.ets b/api/arkui/component/customComponent.d.ets index c91cb57c4f..94796bacd0 100644 --- a/api/arkui/component/customComponent.d.ets +++ b/api/arkui/component/customComponent.d.ets @@ -18,60 +18,2190 @@ * @arkts 1.2 */ -import { memo, ComponentBuilder, __memo_context_type, __memo_id_type } from "../stateManagement/runtime"; +import { ComponentBuilder, Builder } from './builder'; +import { ExtendableComponent } from './extendableComponent'; +import { LayoutPolicy, SafeAreaEdge, SafeAreaType, Rectangle, ConstraintSizeOptions, HitTestMode, ChainWeightOptions, LocalizedPadding, LengthMetrics, Padding, LocalizedMargin, Margin, BackgroundOptions, PixelRoundPolicy, ImageRepeat, BackgroundImageOptions, PixelMap, ResourceStr, ImageSize, SizeOptions, BackgroundBlurStyleOptions, BackgroundEffectOptions, BackgroundEffectOptions, ResizableOptions, ForegroundEffectOptions, VisualEffect, Filter, BlurStyle, ForegroundBlurStyleOptions, BorderOptions, ForegroundBlurStyleOptions, BlurStyle, BorderOptions, EdgeStyles, BorderStyle, LocalizedEdgeWidths, Length, EdgeWidths, LocalizedBorderRadiuses, BorderRadiuses, BorderImageOption, OutlineOptions, EdgeOutlineStyles, OutlineStyle, EdgeOutlineWidths, LocalizedEdgeColors, EdgeColors, OutlineRadiuses, Dimension, ColoringStrategy, ResourceColor, ClickEvent, OnHoverEventFunc, HoverEvent, AccessibilityCallback, HoverEffect, MouseEvent, CrownEvent, KeyEvent, FocusAxisEvent, AxisEvent, FocusMovement, FocusBoxStyle, FocusPriority, AnimateParam, TransitionFinishCallback, TransitionEffect, GestureType, GestureMask, EffectType, InvertOptions, Resource, Color, MotionBlurOptions, LinearGradientBlurOptions, BlurOptions, SystemAdaptiveOptions, TranslateOptions, ScaleOptions, +RotateOptions, Callback, Area, Visibility, ItemAlign, sharedTransitionOptions, Direction, Alignment, Position, Edges, LocalizedEdges, LocalizedPosition, AlignRuleOption, +LocalizedAlignRuleOptions, Axis, ChainStyle, ClickEffect, DragEvent, CustomBuilder, DragItemInfo, UniformDataType, PreviewConfiguration, DragPreviewOptions, DragInteractionOptions, + PreDragStatus, ComponentContent, OverlayOptions, LinearGradientOptions, SweepGradientOptions, RadialGradientOptions, MotionPathOptions, ShadowOptions, ShadowStyle, BlendMode, + BlendApplyType, Blender, CircleShape, EllipseShape, PathShape, RectShape, GeometryTransitionOptions, TipsMessageType, TipsOptions, PopupOptions, CustomPopupOptions, +MenuElement, MenuOptions, ResponseType, ContextMenuOptions, ModalTransition, ContentCoverOptions, SheetOptions, StateStyles, VisibleAreaChangeCallback, VisibleAreaEventOptions, +PixelStretchEffectOptions, FunctionKey, ModifierKey, AccessibilityOptions, AccessibilitySamePageMode, AccessibilityRoleType, ObscuredReasons, ReuseOptions, RenderFit, +GestureModifier, BackgroundBrightnessOptions, GestureRecognizerJudgeBeginCallback, TouchEvent, HitTestMode, SizeChangeCallback, PromptActionDialogController, GeometryInfo, Layoutable, Measurable, SizeResult } from './common'; +import { ConstraintSizeOptions } from './units'; +import { Callback_Void } from './abilityComponent'; -import { UIContext } from './../../../api/@ohos.arkui.UIContext' +/** + * Definition of base custom component, which is base class of custom component. + * + * @extends ExtendableComponent + * @implements CommonAttribute + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare abstract class BaseCustomComponent extends ExtendableComponent implements CommonAttribute { + /** + * aboutToRecycle Method. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + aboutToRecycle(): void; + /** + * Sets the width of the current component. + * + * @param { Length | undefined } value - width value + * @returns { this } custom component + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + width(value: Length | undefined): this; + /** + * Sets the width of the current component. + * + * @param { Length | LayoutPolicy | undefined } widthValue + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + width(widthValue: Length | LayoutPolicy | undefined): this; + /** + * Sets the height of the current component. + * + * @param { Length | undefined } value + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + height(value: Length | undefined): this; + /** + * Sets the height of the current component. + * + * @param { Length | LayoutPolicy | undefined } heightValue + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + height(heightValue: Length | LayoutPolicy | undefined): this; + /** + * Sets the drawModifier of the current component. + * + * @param { DrawModifier | undefined } modifier - drawModifier used to draw, or undefined if it is not available. + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + drawModifier(modifier: DrawModifier | undefined): this; + /** + * Sets the custom property of the current component. + * + * @param { string | undefined } name - the name of the custom property. + * @param { Object | undefined } value - the value of the custom property. + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + customProperty(name: string | undefined, value: Object | undefined): this; + /** + * Expands the safe area. + * + * @param { Array | undefined } [types] - Indicates the types of the safe area. + * @param { Array | undefined } [edges] - Indicates the edges of the safe area. + * @returns { this } The component instance. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + expandSafeArea(types?: Array | undefined, edges?: Array | undefined): this; + /** + * Sets the response region of the current component. + * + * @param { Array | Rectangle | undefined } value + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + responseRegion(value: Array | Rectangle | undefined): this; + /** + * Sets the mouse response region of current component + * + * @param { Array | Rectangle | undefined } value + * @returns { this } return the component attribute + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + mouseResponseRegion(value: Array | Rectangle | undefined): this; + /** + * The size of the current component. + * + * @param { SizeOptions | undefined } value + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + size(value: SizeOptions | undefined): this; + /** + * constraint Size: + * minWidth: minimum Width, maxWidth: maximum Width, minHeight: minimum Height, maxHeight: maximum Height. + * + * @param { ConstraintSizeOptions | undefined } value + * @returns { this } return custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + constraintSize(value: ConstraintSizeOptions | undefined): this; + /** + * Defines the component's hit test behavior in touch events. + * + * @param { HitTestMode | undefined } value - the hit test mode. + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + hitTestBehavior(value: HitTestMode | undefined): this; + /** + * Defines the pre-touch test of sub component in touch events. + * + * @param { TouchTestInfoFunc | undefined } event touch event callback + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onChildTouchTest(event: TouchTestInfoFunc | undefined): this; + /** + * Defines the weight of the component, according to which the remain part of main-axis is allocated self-adaptively + * + * @param { number | string | undefined } value the weight value + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + layoutWeight(value: number | string | undefined): this; + /** + * chain Weight + * + * @param { ChainWeightOptions | undefined } chainWeight - chainWeight + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + chainWeight(chainWeight: ChainWeightOptions | undefined): this; + /** + * Inner margin. + * + * @param { Padding | Length | LocalizedPadding | undefined } value inner margin + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + padding(value: Padding | Length | LocalizedPadding | undefined): this; + /** + * Inner safeArea padding. + * + * @param { Padding | LengthMetrics | LocalizedPadding | undefined } paddingValue - Indicates safeArea padding values + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + safeAreaPadding(paddingValue: Padding | LengthMetrics | LocalizedPadding | undefined): this; + /** + * Outer Margin. + * + * @param { Margin | Length | LocalizedMargin | undefined } value - magrin value + * @returns { this } custom componet instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + margin(value: Margin | Length | LocalizedMargin | undefined): this; + /** + * Background. + * + * @param { CustomBuilder | undefined } builder - custom builder + * @param { BackgroundOptions | undefined } [options] - background options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + background(builder: CustomBuilder | undefined, options?: BackgroundOptions | undefined): this; + /** + * Background color + * + * @param { ResourceColor | undefined } value - background color value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backgroundColor(value: ResourceColor | undefined): this; + /** + * PixelRound + * + * @param { PixelRoundPolicy | undefined } value - indicates the pixel round policy. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + pixelRound(value: PixelRoundPolicy | undefined): this; + /** + * Background image + * src: Image address url + * + * @param { ResourceStr | PixelMap | undefined } src + * @param { ImageRepeat | undefined } [repeat] image repeat + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backgroundImage(src: ResourceStr | PixelMap | undefined, repeat?: ImageRepeat | undefined): this; + /** + * Background image + * + * @param { ResourceStr | PixelMap | undefined } src - the background image source + * @param { BackgroundImageOptions | undefined } [options] - config the options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backgroundImage(src: ResourceStr | PixelMap | undefined, options?: BackgroundImageOptions | undefined): this; + /** + * Background image size + * + * @param { SizeOptions | ImageSize | undefined } value - background image size + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backgroundImageSize(value: SizeOptions | ImageSize | undefined): this; + /** + * Background image position + * x:Horizontal coordinate;y:Vertical axis coordinate. + * + * @param { Position | Alignment | undefined } value - background image position + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backgroundImagePosition(value: Position | Alignment | undefined): this; + /** + * Background blur style. + * blurStyle:Blur style type. + * + * @param { BlurStyle | undefined } value - background blur style + * @param { BackgroundBlurStyleOptions | undefined } [options] - background blur style options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backgroundBlurStyle(value: BlurStyle | undefined, options?: BackgroundBlurStyleOptions | undefined): this; + /** + * Background blur style. + * blurStyle:Blur style type. + * sysOptions: system adaptive options. + * + * @param { BlurStyle | undefined } style - blue style + * @param { BackgroundBlurStyleOptions | undefined } [options] - background blur style options + * @param { SystemAdaptiveOptions | undefined } [sysOptions] - system adaptive options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backgroundBlurStyle(style: BlurStyle | undefined, options?: BackgroundBlurStyleOptions | undefined, sysOptions?: SystemAdaptiveOptions | undefined): this; + /** + * options:background effect options. + * + * @param { BackgroundEffectOptions | undefined } options - options indicates the effect options. + * @returns { this } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backgroundEffect(options: BackgroundEffectOptions | undefined): this; + /** + * options:background effect options. + * sysOptions: system adaptive options. + * + * @param { BackgroundEffectOptions | undefined } options - options indicates the effect options. + * @param { SystemAdaptiveOptions | undefined } [ sysOptions ] - system adaptive options. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backgroundEffect(options: BackgroundEffectOptions | undefined, sysOptions?: SystemAdaptiveOptions | undefined): this; + /** + * Background image resizable. + * value:resizable options + * + * @param { ResizableOptions | undefined } value - Indicates the resizable options. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backgroundImageResizable(value: ResizableOptions | undefined): this; + /** + * Foreground effect. + * + * @param { ForegroundEffectOptions | undefined } options - options indicates the effect options. + * @returns { this } custom component + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + foregroundEffect(options: ForegroundEffectOptions | undefined): this; + /** + * Unified visual effect interface. + * + * @param { VisualEffect | undefined } effect - Visual effect parameters. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + visualEffect(effect: VisualEffect | undefined): this; + /** + * Filter applied to the background layer of the component. + * + * @param { Filter | undefined } filter - Filter effect parameters. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backgroundFilter(filter: Filter | undefined): this; + /** + * Filter applied to the foreground layer of the component. + * + * @param { Filter | undefined } filter - Filter effect parameters. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + foregroundFilter(filter: Filter | undefined): this; + /** + * Filter applied to the compositing layer of the component. + * + * @param { Filter | undefined } filter - Filter effect parameters. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + compositingFilter(filter: Filter | undefined): this; + /** + * Foreground blur style. + * blurStyle:Blur style type. + * + * @param { BlurStyle | undefined } value - blur style value + * @param { ForegroundBlurStyleOptions | undefined } [options] - foreground blur style + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + foregroundBlurStyle(value: BlurStyle | undefined, options?: ForegroundBlurStyleOptions | undefined): this; + /** + * Foreground blur style. + * blurStyle:Blur style type. + * sysOptions: system adaptive options. + * + * @param { BlurStyle | undefined } style - blur style + * @param { ForegroundBlurStyleOptions | undefined } [options] - foreground blur style options + * @param { SystemAdaptiveOptions | undefined } [sysOptions] - system adaptive options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + foregroundBlurStyle(style: BlurStyle | undefined, options?: ForegroundBlurStyleOptions | undefined, sysOptions?: SystemAdaptiveOptions | undefined): this; + /** + * Opacity + * + * @param { number | Resource | undefined } value - opacity value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + opacity(value: number | Resource | undefined): this; + /** + * Border + * width:Border width;color:Border color;radius:Border radius; + * + * @param { BorderOptions | undefined } value - border options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + border(value: BorderOptions | undefined): this; + /** + * Border style + * + * @param { BorderStyle | EdgeStyles | undefined } value - border style value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + borderStyle(value: BorderStyle | EdgeStyles | undefined): this; + /** + * Border width + * + * @param { Length | EdgeWidths | LocalizedEdgeWidths | undefined } value - border width + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + borderWidth(value: Length | EdgeWidths | LocalizedEdgeWidths | undefined): this; + /** + * Border color + * + * @param { ResourceColor | EdgeColors | LocalizedEdgeColors | undefined } value - border color + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + borderColor(value: ResourceColor | EdgeColors | LocalizedEdgeColors | undefined): this; + /** + * Border radius + * + * @param { Length | BorderRadiuses | LocalizedBorderRadiuses | undefined } value - border radius + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + borderRadius(value: Length | BorderRadiuses | LocalizedBorderRadiuses | undefined): this; + /** + * Border image + * + * @param { BorderImageOption | undefined } value - border image + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + borderImage(value: BorderImageOption | undefined): this; + /** + * Outline + * width:Outline width;color:Outline color;radius:Outline radius;style:Outline style; + * + * @param { OutlineOptions | undefined } value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + outline(value: OutlineOptions | undefined): this; + /** + * Outline style + * + * @param { OutlineStyle | EdgeOutlineStyles | undefined } value - outline style + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + outlineStyle(value: OutlineStyle | EdgeOutlineStyles | undefined): this; + /** + * Outline width + * + * @param { Dimension | EdgeOutlineWidths | undefined } value - outline width + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + outlineWidth(value: Dimension | EdgeOutlineWidths | undefined): this; + /** + * Outline color + * + * @param { ResourceColor | EdgeColors | LocalizedEdgeColors | undefined } value - outline color + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + outlineColor(value: ResourceColor | EdgeColors | LocalizedEdgeColors | undefined): this; + /** + * Outline radius + * + * @param { Dimension | OutlineRadiuses | undefined } value - outline radius + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + outlineRadius(value: Dimension | OutlineRadiuses | undefined): this; + /** + * Provides the general foreground color capability of UI components, and assigns color values + * according to the characteristics of components. + * + * @param { ResourceColor | ColoringStrategy | undefined } value - indicates the color or color selection strategy + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + foregroundColor(value: ResourceColor | ColoringStrategy | undefined): this; + /** + * Trigger a click event when a click is clicked. + * + * @param { OnClickFunc | undefined } event - onClick event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onClick(event: OnClickFunc | undefined): this; + /** + * Trigger a click event when a click is clicked, move distance should smaller than distanceThreshold. + * + * @param { Callback | undefined } event - this function callback executed when the click action is recognized + * @param { number | undefined } distanceThreshold - the distance threshold of finger's movement when detecting a click action + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onClick(event: Callback | undefined, distanceThreshold: number | undefined): this; + /** + * Trigger a hover event. + * + * @param { OnHoverEventFunc | undefined } event - onHover event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onHover(event: OnHoverEventFunc | undefined): this; + /** + * Trigger a hover move event. + * + * @param { Callback | undefined } event - on hover move event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onHoverMove(event: Callback | undefined): this; + /** + * Trigger a accessibility hover event. + * + * @param { AccessibilityCallback | undefined } callback - A callback instance used when the component is touched after accessibility mode is enabled. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onAccessibilityHover(callback: AccessibilityCallback | undefined): this; + /** + * Set hover effect. + * + * @param { HoverEffect | undefined } value - hover effect value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + hoverEffect(value: HoverEffect | undefined): this; + /** + * Trigger a mouse event. + * + * @param { Callback | undefined } event - mouse event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onMouse(event: Callback | undefined): this; + /** + * Trigger a touch event when touched. + * + * @param { Callback | undefined } event - touch event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onTouch(event: Callback | undefined): this; + /** + * Keyboard input + * + * @param { Callback | undefined } event - on key event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onKeyEvent(event: Callback | undefined): this; + /** + * Keyboard input + * + * @param { Callback | undefined } event - key event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onKeyEvent(event: Callback | undefined): this; + /** + * Digital crown input. + * + * @param { Callback | undefined } handler - crown event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDigitalCrown(handler: Callback | undefined): this; + /** + * Handle keyboard events before input method events. + * + * @param { Callback | undefined } event -on keyPreIme + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onKeyPreIme(event: Callback | undefined): this; + /** + * Customize the handling and distribution of key events. + * + * @param { Callback | undefined } event - on keyEventDispatch + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onKeyEventDispatch(event: Callback | undefined): this; + /** + * Trigger a FocusAxisEvent. + * + * @param { Callback | undefined } event - on FocusAxis event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onFocusAxisEvent(event: Callback | undefined): this; + /** + * Handle axis events. + * + * @param { Callback | undefined } event - on axis event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onAxisEvent(event: Callback | undefined): this; + /** + * Set focusable. + * + * @param { boolean | undefined } value - focusable status + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + focusable(value: boolean | undefined): this; + /** + * Set nextFocus. + * + * @param { FocusMovement | undefined } nextStep - next step count + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + nextFocus(nextStep: FocusMovement | undefined): this; + /** + * Set TabStop on component focus + * + * @param { boolean | undefined } isTabStop - isTabStop flag + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + tabStop(isTabStop: boolean | undefined): this; + /** + * Trigger a event when lose focus. + * + * @param { Callback | undefined } event - on blur event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onBlur(event: Callback | undefined): this; + /** + * Set focus index by key tab. + * + * @param { number | undefined } index - tab index + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + tabIndex(index: number | undefined): this; + /** + * Set default focused component when a page create. + * + * @param { boolean | undefined } value - default focus value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + defaultFocus(value: boolean | undefined): this; + /** + * Set default focused component when focus on a focus group. + * + * @param { boolean | undefined } value - group default focus value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + groupDefaultFocus(value: boolean | undefined): this; + /** + * Set a component focused when the component be touched. + * + * @param { boolean | undefined } value - focus on touch value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + focusOnTouch(value: boolean | undefined): this; + /** + * Set the component's focusBox style. + * + * @param { FocusBoxStyle | undefined } style - focus box style + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + focusBox(style: FocusBoxStyle | undefined): this; + /** + * Set container as a focus group with a specific identifier. + * + * @param { string | undefined } id - focus scope identifier. + * @param { boolean | undefined } [isGroup] - whether this scope is a focus group, the default value is false + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + focusScopeId(id: string | undefined, isGroup?: boolean | undefined): this; + /** + * Set container as a focus group with a specific identifier. + * + * @param { string | undefined } id - focus scope identifier. + * @param { boolean | undefined } [isGroup] - whether this scope is a focus group, the default value is false. + * @param { boolean | undefined } [arrowStepOut] - whether the arrow keys can move focus from inside the focus group to outside, + * only effective when isGroup is true, the default value is true. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + focusScopeId(id: string | undefined, isGroup?: boolean | undefined, arrowStepOut?: boolean | undefined): this; + /** + * Set the focus priority of component in a specific focus scope. + * + * @param { string | undefined } scopeId - scope id + * @param { FocusPriority | undefined } [priority] - the default value is AUTO + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + focusScopePriority(scopeId: string | undefined, priority?: FocusPriority | undefined): this; + /** + * animation + * + * @param { AnimateParam | undefined } value - animate param value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + animation(value: AnimateParam | undefined): this; + /** + * Set the transition effect of component when it appears and disappears. + * + * @param { TransitionEffect | undefined } value - transition effect + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + transition(value: TransitionEffect | undefined): this; + /** + * Set the transition effect of component when it appears and disappears. + * + * @param { TransitionEffect | undefined } effect - transition effect + * @param { TransitionFinishCallback | undefined } onFinish - transition finish callback. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + transition(effect: TransitionEffect | undefined, onFinish: TransitionFinishCallback | undefined): this; + /** + * Bind gesture recognition. + * gesture:Bound Gesture Type,mask:GestureMask; + * + * @param { GestureType | undefined } gesture + * @param { GestureMask | undefined } [mask] - gesture mask + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + gesture(gesture: GestureType | undefined, mask?: GestureMask | undefined): this; + /** + * Binding Preferential Recognition Gestures + * gesture:Bound Gesture Type,mask:GestureMask; + * + * @param { GestureType | undefined } gesture - gesture type + * @param { GestureMask | undefined } [mask] - gesture mask + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + priorityGesture(gesture: GestureType | undefined, mask?: GestureMask | undefined): this; + /** + * Binding gestures that can be triggered simultaneously with internal component gestures + * gesture:Bound Gesture Type,mask:GestureMask; + * + * @param { GestureType | undefined } gesture + * @param { GestureMask | undefined } [mask] - gesture mask + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + parallelGesture(gesture: GestureType | undefined, mask?: GestureMask | undefined): this; + /** + * Adds the content blurring effect for the current component. The input parameter is the blurring radius. + * The larger the blurring radius, the more blurring the content. + * If the value is 0, the content blurring effect is not blurring. + * + * @param { number | undefined } value - value indicates radius of backdrop blur. + * @param { BlurOptions | undefined } [options] - options indicates blur options. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + blur(value: number | undefined, options?: BlurOptions | undefined): this; + /** + * Adds the content blurring effect for the current component. The input parameter is the blurring radius. + * The larger the blurring radius, the more blurring the content. + * If the value is 0, the content blurring effect is not blurring. + * + * @param { number | undefined } blurRadius - value indicates radius of backdrop blur. + * @param { BlurOptions | undefined } [options] - options indicates blur options. + * @param { SystemAdaptiveOptions | undefined } [sysOptions] - system adaptive options. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + blur(blurRadius: number | undefined, options?: BlurOptions | undefined, sysOptions?: SystemAdaptiveOptions | undefined): this; + /** + * Adds the content linear gradient blurring effect for the current component. The input parameter is the blurring radius. + * + * @param { number | undefined } value - the blurring radius. + * The larger the blurring radius, the more blurring the content, and if the value is 0, the content blurring effect is not blurring. + * @param { LinearGradientBlurOptions | undefined } options - the linear gradient blur options. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + linearGradientBlur(value: number | undefined, options: LinearGradientBlurOptions | undefined): this; + /** + * Component motion blur interface. + * + * @param { MotionBlurOptions | undefined } value - the attributes of motion blur. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + motionBlur(value: MotionBlurOptions | undefined): this; + /** + * Adds a highlight effect to the current component. + * The input parameter is the highlight proportion. 0 indicates no highlight effect, and 1 indicates the maximum highlight proportion. + * The component is displayed as all white (percentage). + * + * @param { number | undefined } value - brightness value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + brightness(value: number | undefined): this; + /** + * Adds a contrast effect to the current component. The input parameter is the contrast value. + * A larger contrast value indicates a sharper image. When the contrast value is 0, the image becomes gray. (%) + * + * @param { number | undefined } value - contrast value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + contrast(value: number | undefined): this; + /** + * Adds a grayscale effect to the current component. + * The value is the gray scale conversion ratio. If the input parameter is 1.0, the gray scale image is completely converted to the gray scale image. If the input parameter is 0.0, the image does not change. + * If the input parameter is between 0.0 and 1.0, the effect changes. (Percentage) + * + * @param { number | undefined } value - grayscale value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + grayscale(value: number | undefined): this; + /** + * Adds a color overlay effect for the current component. The input parameter is the superimposed color. + * + * @param { Color | string | Resource | undefined } value - color blend value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + colorBlend(value: Color | string | Resource | undefined): this; + /** + * Adds a saturation effect to the current component. + * The saturation is the ratio of the color-containing component to the achromatic component (gray). + * The larger the color-containing component, the greater the saturation. + * The larger the achromatic component, the smaller the saturation. (Percentage) + * + * @param { number | undefined } value - saturate value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + saturate(value: number | undefined): this; + /** + * Converts the image to sepia. Value defines the scale of the conversion. + * A value of 1 is completely sepia, and a value of 0 does not change the image. (Percentage) + * + * @param { number | undefined } value - sepia value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + sepia(value: number | undefined): this; + /** + * Invert the input image. Value defines the scale of the conversion. 100% of the value is a complete reversal. + * A value of 0% does not change the image. (Percentage) + * + * @param { number | InvertOptions | undefined } value - value indicates the scale of the conversion or the options of invert. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + invert(value: number | InvertOptions | undefined): this; + /** + * Sets system bar effect to the component. + * + * @returns { this } custom component instance return the component attribute. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + systemBarEffect(): this; + /** + * Adds the hue rotation effect to the current component. + * The input parameter is the rotation angle. When the input parameter is 0deg, the image does not change (the default value is 0deg), and the input parameter does not have a maximum value. + * If the value exceeds 360deg, the image is circled again. + * + * @param { number | string | undefined } value - hue rotate value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + hueRotate(value: number | string | undefined): this; + /** + * Add an attribute to control whether the shadows of the child nodes overlap each other. + * + * @param { boolean | undefined } value - true means the shadows of the child nodes overlap each other effect and drawn in batches. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + useShadowBatching(value: boolean | undefined): this; + /** + * Sets whether the component should apply the effects template defined by the parent effectComponent or window. + * If multiple parent effectComponents are found, the nearest one will be used. + * If no parent effectComponent is found, this method has no effect. + * + * @param { boolean | undefined } useEffect - true means the component should apply the effects template defined by the parent effectComponent or window. + * @param { EffectType | undefined } effectType - the effect type of the effects template, defined by the parent effectComponent or window. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + useEffect(useEffect: boolean | undefined, effectType: EffectType | undefined): this; + /** + * Sets whether the component should apply the effects template defined by the parent effectComponent. + * If multiple parent effectComponents are found, the nearest one will be used. + * If no parent effectComponent is found, this method has no effect. + * + * @param { boolean | undefined } value - true means the component should apply the effects template. + * @returns { this } custom component instance return the component attribute. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + useEffect(value: boolean | undefined): this; + /** + * Adds the background blur effect for the current component. The input parameter is the blur radius. + * The larger the blur radius, the more blurred the background. If the value is 0, the background blur is not blurred. + * + * @param { number | undefined } value - value indicates radius of backdrop blur. + * @param { BlurOptions | undefined } [options] - options indicates the backdrop blur options. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backdropBlur(value: number | undefined, options?: BlurOptions | undefined): this; + /** + * Adds the background blur effect for the current component. The input parameter is the blur radius. + * The larger the blur radius, the more blurred the background. If the value is 0, the background blur is not blurred. + * + * @param { number | undefined } radius - radius indicates radius of backdrop blur. + * @param { BlurOptions | undefined } [options] - options indicates the backdrop blur options. + * @param { SystemAdaptiveOptions | undefined } [sysOptions] - system adaptive options. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backdropBlur(radius: number | undefined, options?: BlurOptions | undefined, sysOptions?: SystemAdaptiveOptions | undefined): this; + /** + * Composite the contents of this view and its children into an offscreen cache before display in the screen. + * + * @param { boolean | undefined } value - if this view and its children need to composite into an offscreen cache. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + renderGroup(value: boolean | undefined): this; + /** + * Sets whether the component should remain stationary, reusing the results of the current frame's off-screen rendering. + * If the input parameter is true, the component and subcomponent changes do not affect the display. + * + * @param { boolean | undefined } value - true means the component should remain stationary. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + freeze(value: boolean | undefined): this; + /** + * Set component translation. + * + * @param { TranslateOptions | undefined } value default:{x:0,y:0,z:0} + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + translate(value: TranslateOptions | undefined): this; + /** + * Set component scaling. + * + * @param { ScaleOptions | undefined } value default:{x:1,y:1,z:1,centerX:'50%',centerY:'50%'} + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + scale(value: ScaleOptions | undefined): this; + /** + * Set component rotation. + * + * @param { RotateOptions | undefined } value default:{x:0,y:0,z:0,centerX:'50%',centerY:'50%',centerZ:0,perspective:0} + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + rotate(value: RotateOptions | undefined): this; + /** + * Sets the transformation matrix for the current component. + * + * @param { object | undefined } value - transform value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + transform(value: object | undefined): this; + /** + * This callback is triggered when a component mounts a display. + * + * @param { Callback | undefined } event - onAppear event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onAppear(event: Callback | undefined): this; + /** + * This callback is triggered when component uninstallation disappears. + * + * @param { Callback | undefined } event - onDisAppear event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDisAppear(event: Callback | undefined): this; + /** + * This callback is triggered when a component mounts to view tree. + * + * @param { VoidCallback | undefined } callback - onAttach event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onAttach(callback: VoidCallback | undefined): this; + /** + * This callback is triggered when a component is detached from view tree. + * + * @param { VoidCallback | undefined } callback - onDetach event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDetach(callback: VoidCallback | undefined): this; + /** + * This callback is triggered when the size or position of this component change finished. + * + * @param { VoidCallback | undefined } event - event callback. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onAreaChange(event: VoidCallback | undefined): this; + /** + * Controls the display or hide of the current component. + * + * @param { Visibility | undefined } value - visibility value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + visibility(value: Visibility | undefined): this; + /** + * The percentage of the remaining space of the Flex container allocated to the component on which this property resides. + * + * @param { number | undefined } value - flew grow value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + flexGrow(value: number | undefined): this; + /** + * The proportion of the Flex container compression size assigned to the component on which this attribute resides. + * + * @param { number | undefined } value - flexShrink value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + flexShrink(value: number | undefined): this; + /** + * The base dimension of the assembly on which this attribute is located in the direction of the principal axis in the Flex container. + * + * @param { number | string | undefined } value - flex basis value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + flexBasis(value: number | string | undefined): this; + /** + * Overrides the default configuration of alignItems in the Flex Layout container. + * + * @param { ItemAlign | undefined } value - item align value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + alignSelf(value: ItemAlign | undefined): this; + /** + * Sets the current component and displays the priority in the layout container. This parameter is valid only in Row, Column, and Flex single-row layouts. + * + * @param { number | undefined } value - displayPriority value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + displayPriority(value: number | undefined): this; + /** + * The sibling components in the same container are hierarchically displayed. A larger value of z indicates a higher display level. + * + * @param { number | undefined } value - zIndex value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + zIndex(value: number | undefined): this; + /** + * If the components of the two pages are configured with the same ID, the shared element transition is performed during transition. If the parameter is set to an empty string, the shared element transition does not occur. For details about the options parameter, see the options parameter description. + * + * @param { string | undefined } id - sharedTransition id + * @param { sharedTransitionOptions | undefined } [options] sharedTransition Options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + sharedTransition(id: string | undefined, options?: sharedTransitionOptions | undefined): this; + /** + * Sets the sliding direction. The enumerated value supports logical AND (&) and logical OR (|). + * + * @param { Direction | undefined } value - direction value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + direction(value: Direction | undefined): this; + /** + * align + * + * @param { Alignment | undefined } value - alignment value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + align(value: Alignment | undefined): this; + /** + * position + * + * @param { Position | Edges | LocalizedEdges | undefined } value - position value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + position(value: Position | Edges | LocalizedEdges | undefined): this; + /** + * Sets the anchor point of the element when it is positioned. The base point is offset from the top start point of the element. + * + * @param { Position | LocalizedPosition | undefined } value - markAnchor value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + markAnchor(value: Position | LocalizedPosition | undefined): this; + /** + * Coordinate offset relative to the layout completion position. + * Setting this attribute does not affect the layout of the parent container. The position is adjusted only during drawing. + * + * @param { Position | Edges | LocalizedEdges | undefined } value - offset value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + offset(value: Position | Edges | LocalizedEdges | undefined): this; + /** + * If the value is true, the component is available and can respond to operations such as clicking. + * If it is set to false, click operations are not responded. + * + * @param { boolean | undefined } value - enabled value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + enabled(value: boolean | undefined): this; + /** + * Specifies the alignRules of relative container + * + * @param { AlignRuleOption | undefined } value - alignRules value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + alignRules(value: AlignRuleOption | undefined): this; + /** + * Specifies the localized alignRules of relative container + * + * @param { LocalizedAlignRuleOptions | undefined } alignRule - alignRule options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + alignRules(alignRule: LocalizedAlignRuleOptions | undefined): this; + /** + * Specifies the direction and style of chain in relative container + * + * @param { Axis | undefined } direction - indicates direction of the chain + * @param { ChainStyle | undefined } style - indicates style of the chain + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + chainMode(direction: Axis | undefined, style: ChainStyle | undefined): this; + /** + * Specifies the aspect ratio of the current component. + * + * @param { number | undefined } value - aspect ratio value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + aspectRatio(value: number | undefined): this; + /** + * The click effect level and scale number. + * + * @param { ClickEffect | null | undefined } value - clickEffect value + * @returns { this } custom component instance return the component attribute. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + clickEffect(value: ClickEffect | null | undefined): this; + /** + * After a listener is bound, the component can be dragged. After the drag occurs, a callback is triggered. + * (To be triggered, press and hold for 170 milliseconds (ms)) + * + * @param { OnDragEvent | undefined } event - onDragStart event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDragStart(event: OnDragEvent | undefined): this; + /** + * After binding, a callback is triggered when the component is dragged to the range of the component. + * + * @param { OnDragEventVoid | undefined } event - onDragEnter event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDragEnter(event: OnDragEventVoid | undefined): this; + /** + * After binding, a callback is triggered when the drag moves within the range of a placeable component. + * + * @param { OnDragEventVoid | undefined } event - onDragMove event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDragMove(event: OnDragEventVoid | undefined): this; + /** + * After binding, a callback is triggered when the component is dragged out of the component range. + * + * @param { OnDragEventVoid | undefined } event - onDragLeave event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDragLeave(event: OnDragEventVoid | undefined): this; + /** + * The component bound to this event can be used as the drag release target. + * This callback is triggered when the drag behavior is stopped within the scope of the component. + * + * @param { OnDragEventVoid | undefined } event - onDrop event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDrop(event: OnDragEventVoid | undefined): this; + /** + * The component bound to this event can be used as the drag release target. + * This callback is triggered when the drag behavior is stopped within the scope of the component. + * + * @param { OnDragEventVoid | undefined } eventCallback - event callback. + * @param { DropOptions | undefined } [dropOptions] - the drop handling options. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDrop(eventCallback: OnDragEventVoid | undefined, dropOptions?: DropOptions | undefined): this; + /** + * This function is called when the drag event is end. + * + * @param { OnDragEventVoid | undefined } event - indicates the function to be called. + * @returns { this } custom component instance property value of type T. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDragEnd(event: OnDragEventVoid | undefined): this; + /** + * Allowed drop uniformData type for this node. + * + * @param { Array | null | undefined } value - the uniformData type for this node. + * @returns { this } custom component instance property value of type T. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + allowDrop(value: Array | null | undefined): this; + /** + * Enable the selectable area can be dragged. + * + * @param { boolean | undefined } value - true means the area can be dragged, false means the area can't be dragged. + * @returns { this } custom component instance property value of type T. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + draggable(value: boolean | undefined): this; + /** + * Set preview of the component for dragging process + * + * @param { CustomBuilder | DragItemInfo | string | undefined } value - preview of the component for dragging process + * @returns { this } custom component instance property value of type T. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + dragPreview(value: CustomBuilder | DragItemInfo | string | undefined): this; + /** + * Set preview of the component for dragging process + * + * @param { CustomBuilder | DragItemInfo | string | undefined } preview - preview of the component for dragging process + * @param { PreviewConfiguration | undefined } [config] - drag preview configuration. + * @returns { this } custom component instance property value of type T. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + dragPreview(preview: CustomBuilder | DragItemInfo | string | undefined, config?: PreviewConfiguration | undefined): this; + /** + * Set the selectable area drag preview options. + * + * @param { DragPreviewOptions | undefined } value - preview options value. + * @param { DragInteractionOptions | undefined } [options] - drag interaction options value. + * @returns { this } custom component instance property value of type T. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + dragPreviewOptions(value: DragPreviewOptions | undefined, options?: DragInteractionOptions | undefined): this; + /** + * After binding, a callback is triggered when the preDrag status change finished. + * + * @param { Callback | undefined } callback callback - The callback will be triggered when the preDrag status change. + * @returns { this } custom component instance property value of type T. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onPreDrag(callback: Callback | undefined): this; + /** + * Add mask text to the current component. The layout is the same as that of the current component. + * + * @param { string | CustomBuilder | ComponentContent | undefined } value - overlay value + * @param { OverlayOptions | undefined } [options] - overlay options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + overlay(value: string | CustomBuilder | ComponentContent | undefined, options?: OverlayOptions | undefined): this; + /** + * Linear Gradient + * angle: Angle of Linear Gradient. The default value is 180; + * direction: Direction of Linear Gradient. The default value is GradientDirection.Bottom; + * colors: Color description for gradients. + * repeating: repeating. The default value is false + * + * Anonymous Object Rectification. + * @param { LinearGradientOptions | undefined } value - linearGradient options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + linearGradient(value: LinearGradientOptions | undefined): this; + /** + * Angle Gradient + * center:is the center point of the angle gradient + * start:Start point of angle gradient. The default value is 0 + * end:End point of angle gradient. The default value is 0 + * rotating:rotating. The default value is 0 + * colors:Color description for gradients + * repeating:repeating. The default value is false + * + * Anonymous Object Rectification. + * @param { SweepGradientOptions | undefined } value - sweepGradient options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + sweepGradient(value: SweepGradientOptions | undefined): this; + /** + * Radial Gradient + * center:Center point of radial gradient + * radius:Radius of Radial Gradient. value range [0, +¡Þ) + * colors:Color description for gradients + * repeating: Refill. The default value is false + * + * Anonymous Object Rectification. + * @param { RadialGradientOptions | undefined } value - radialGradient options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + radialGradient(value: RadialGradientOptions | undefined): this; + /** + * Set the motion path of the component + * path:Motion path for displacement animation, using the svg path string. + * from:Start point of the motion path. The default value is 0.0. + * to:End point of the motion path. The default value is 1.0. + * rotatable:Whether to follow the path for rotation. + * + * @param { MotionPathOptions | undefined } value - motionPath options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + motionPath(value: MotionPathOptions | undefined): this; + /** + * Add a shadow effect to the current component + * + * @param { ShadowOptions | ShadowStyle | undefined } value - shadow options or shadow style + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + shadow(value: ShadowOptions | ShadowStyle | undefined): this; + /** + * Add a blendMode effect to the current component + * + * @param { BlendMode | undefined } value - Different hybrid modes + * @param { BlendApplyType | undefined } [type] - Different blend apply type + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + blendMode(value: BlendMode | undefined, type?: BlendApplyType | undefined): this; + /** + * Add a blendMode effect to the current component.Cannot be used together with the blendMode interface. + * + * @param { BlendMode | Blender | undefined } effect - When the effect type is BlendMode type, define Different hybrid modes. + * When the effect type is Blender type, Define the corresponding blending effect. + * @param { BlendApplyType | undefined } [type] - Different blend apply type + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + advancedBlendMode(effect: BlendMode | Blender | undefined, type?: BlendApplyType | undefined): this; + /** + * Whether to crop the sub components beyond the current component range. + * + * @param { boolean | undefined } value - clip value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + clip(value: boolean | undefined): this; + /** + * The current component is cropped according to the specified shape. + * + * @param { CircleShape | EllipseShape | PathShape | RectShape | undefined } value - indicates the shape of the clip. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + clipShape(value: CircleShape | EllipseShape | PathShape | RectShape | undefined): this; + /** + * Sets the mask of the current component. + * + * @param { ProgressMask | undefined } value - progress mask + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + mask(value: ProgressMask | undefined): this; + /** + * Applies a mask of the specified shape to the current assembly. + * + * @param { CircleShape | EllipseShape | PathShape | RectShape | undefined } value - indicates the shape of the mask. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + maskShape(value: CircleShape | EllipseShape | PathShape | RectShape | undefined): this; + /** + * Key. User can set an key to the component to identify it. + * + * @param { string | undefined } value - key value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + * @test + */ + key(value: string | undefined): this; + /** + * Id. User can set an id to the component to identify it. + * + * @param { string | undefined } value - id value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + id(value: string | undefined): this; + /** + * geometryTransition + * + * @param { string | undefined } id - geometryTransition id + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + geometryTransition(id: string | undefined): this; + /** + * Shared geometry transition + * + * @param { string | undefined } id - geometry transition id + * @param { GeometryTransitionOptions | undefined } [options] - Indicates the options of geometry transition. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + geometryTransition(id: string | undefined, options?: GeometryTransitionOptions | undefined): this; + /** + * Tips control + * + * @param { TipsMessageType | undefined } message - tipsMessage Type + * @param { TipsOptions | undefined } [options] - tips options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + bindTips(message: TipsMessageType | undefined, options?: TipsOptions | undefined): this; + /** + * Popup control + * + * @param { boolean | undefined } show - true when bindPopup shows + * @param { PopupOptions | CustomPopupOptions | undefined } popup - popup options or custom popup options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + bindPopup(show: boolean | undefined, popup: PopupOptions | CustomPopupOptions | undefined): this; + /** + * Menu control + * + * @param { Array | CustomBuilder | undefined } content - Indicates the content of menu. + * @param { MenuOptions | undefined } [options] - Indicates the options of menu. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + bindMenu(content: Array | CustomBuilder | undefined, options?: MenuOptions | undefined): this; + /** + * Menu control + * + * @param { boolean | undefined } isShow - true means display menu, false means hide menu. + * @param { Array | CustomBuilder | undefined } content - Indicates the content of menu. + * @param { MenuOptions | undefined } [options] - Indicates the options of menu. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + bindMenu(isShow: boolean | undefined, content: Array | CustomBuilder | undefined, options?: MenuOptions | undefined): this; + /** + * ContextMenu control + * + * @param { CustomBuilder | undefined } content - Indicates the content of context menu. + * @param { ResponseType | undefined } responseType - Indicates response type of context menu. + * @param { ContextMenuOptions | undefined } [options] - Indicates the options of context menu. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + bindContextMenu(content: CustomBuilder | undefined, responseType: ResponseType | undefined, options?: ContextMenuOptions | undefined): this; + /** + * ContextMenu control + * + * @param { boolean | undefined } isShown - true means display content, false means hide content. + * @param { CustomBuilder | undefined } content - Indicates the content of context menu. + * @param { ContextMenuOptions | undefined } [options] - Indicates the options of context menu. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + bindContextMenu(isShown: boolean | undefined, content: CustomBuilder | undefined, options?: ContextMenuOptions | undefined): this; + /** + * Bind content cover + * + * @param { boolean | undefined } isShow - true means display content, false means hide content. + * @param { CustomBuilder | undefined } builder - the content to be displayed. + * @param { ModalTransition | undefined } [type] - transition type. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + bindContentCover(isShow: boolean | undefined, builder: CustomBuilder | undefined, type?: ModalTransition | undefined): this; + /** + * Bind content cover + * + * @param { boolean | undefined } isShow - true means display content, false means hide content. + * @param { CustomBuilder | undefined } builder - the content to be displayed. + * @param { ContentCoverOptions | undefined } [options] - options of content cover. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + bindContentCover(isShow: boolean | undefined, builder: CustomBuilder | undefined, options?: ContentCoverOptions | undefined): this; + /** + * Bind sheet + * + * @param { boolean | undefined } isShow - true means display sheet, false means hide sheet. + * @param { CustomBuilder | undefined } builder - the sheet to be displayed. + * @param { SheetOptions | undefined } [options] - options of sheet. + * @returns { this } custom component instance - template type + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + bindSheet(isShow: boolean | undefined, builder: CustomBuilder | undefined, options?: SheetOptions | undefined): this; + /** + * Sets styles for component state. + * + * @param { StateStyles | undefined } value - state style value + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + stateStyles(value: StateStyles | undefined): this; + /** + * id for distribute identification. + * + * @param { number | undefined } value - restore id + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + restoreId(value: number | undefined): this; + /** + * Trigger a visible area change event. + * + * @param { Array | undefined } ratios - the array of ratios + * @param { VisibleAreaChangeCallback | undefined } event + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onVisibleAreaChange(ratios: Array | undefined, event: VisibleAreaChangeCallback | undefined): this; -@Retention({policy: "SOURCE"}) -export declare @interface Component { - freezeWhenInactive: boolean = false; + /** + * Set or reset the callback which is triggered when the visibleArea of component changed. + * The interval between two visible area change callbacks will not be less than the expected update interval. + * + * @param { VisibleAreaEventOptions | undefined } options - The options for the visibility event. + * @param { VisibleAreaChangeCallback | undefined } event - The callback will be triggered when the visibleArea of component changed and get close to any number in ratios defined by options. + * If set undefined will reset the target callback. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onVisibleAreaApproximateChange(options: VisibleAreaEventOptions | undefined, event: VisibleAreaChangeCallback | undefined): this; + /** + * Set the spherical effect of the component. + * + * @param { number | undefined } value - set the degree of spherical effect, value range [0, 1]. + * If the value is 0, the component keep same, else the value is 1, component are fully spherical. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + sphericalEffect(value: number | undefined): this; + /** + * Set the light up effect of the component + * + * @param { number | undefined } value - set the degree to which the component lights up, value range [0, 1]. + * The color brightness in the component rendering content area is greater than the value and can be displayed, otherwise it will not be displayed. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + lightUpEffect(value: number | undefined): this; + /** + * Set the edge pixel stretch effect of the Component. + * + * @param { PixelStretchEffectOptions | undefined } options - pixelStretchEffect options + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + pixelStretchEffect(options: PixelStretchEffectOptions | undefined): this; + /** + * Sets hot keys + * + * @param { string | FunctionKey | undefined } value - Character of the combination key. + * @param { Array | undefined } keys - The modifier keys modify the action of key when the key are pressed at the same time. + * @param { Callback_Void | undefined } [action] - Callback function, triggered when the shortcut keyboard is pressed. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + keyboardShortcut(value: string | FunctionKey | undefined, keys: Array | undefined, action?: Callback_Void | undefined): this; + /** + * Sets accessibilityGroup + * + * @param { boolean | undefined } value - set group with accessibility + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityGroup(value: boolean | undefined): this; + /** + * Sets accessibilityGroup + * + * @param { boolean | undefined } isGroup - set group with accessibility + * @param { AccessibilityOptions | undefined } accessibilityOptions - accessibilityOptions for accessibility + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityGroup(isGroup: boolean | undefined, accessibilityOptions: AccessibilityOptions | undefined): this; + /** + * Sets accessibilityText + * + * @param { string | undefined } value - set accessibility text + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityText(value: string | undefined): this; + /** + * Sets accessibility next focus id + * @param { string | undefined } nextId - set component next accessibility focus id + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityNextFocusId(nextId: string | undefined): this; + /** + * Sets the accessibility default foucs flag + * @param { boolean | undefined } focus - if the component is accessibility default focus,focus set true + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityDefaultFocus(focus: boolean | undefined): this; + /** + * Sets accessibility same page mode + * @param { AccessibilitySamePageMode | undefined } pageMode - accessibility same page mode + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityUseSamePage(pageMode: AccessibilitySamePageMode | undefined): this; + /** + * Sets accessibilityScrollTriggerable + * @param { boolean | undefined } isTriggerable - set property of supporting scroll in accessibility + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityScrollTriggerable(isTriggerable: boolean | undefined): this; + /** + * Sets accessibilityText + * + * @param { Resource | undefined } text - set accessibility text + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityText(text: Resource | undefined): this; + /** + * Sets accessibility role,role indicates the custom type of the component + * @param { AccessibilityRoleType | undefined } role - set accessibility component type + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityRole(role: AccessibilityRoleType | undefined): this; + /** + * Register accessibility focus callback,when the component is focused or out of focus,the callback will be executed + * @param { Callback | undefined } callback - accessibility focus callback function + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onAccessibilityFocus(callback: Callback | undefined): this; + /** + * Sets accessibilityTextHint + * + * @param { string | undefined } value - set accessibility text hint + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityTextHint(value: string | undefined): this; + /** + * Sets accessibilityDescription + * + * @param { string | undefined } value - set description of accessibility + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityDescription(value: string | undefined): this; + /** + * Sets accessibilityDescription + * + * @param { Resource | undefined } description - set description of accessibility + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityDescription(description: Resource | undefined): this; + /** + * Sets accessibilityLevel + * + * @param { string | undefined } value - set accessibility level + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityLevel(value: string | undefined): this; + /** + * Sets accessibilityVirtualNode + * + * @param { CustomBuilder | undefined } builder - set virtual node of accessibility + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityVirtualNode(builder: CustomBuilder | undefined): this; + /** + * Sets accessibilityChecked + * + * @param { boolean | undefined } isCheck - set accessibility checked status + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityChecked(isCheck: boolean | undefined): this; + /** + * Sets accessibilitySelected + * + * @param { boolean | undefined } isSelect - set accessibility selected status + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilitySelected(isSelect: boolean | undefined): this; + /** + * Sets obscured + * + * @param { Array | undefined } reasons - reasons of obscuration + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + obscured(reasons: Array | undefined): this; + /** + * Reuse id is used for identify the reuse type for each custom node. + * + * @param { string | undefined } id - The id for reusable custom node. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + reuseId(id: string | undefined): this; + /** + * Reuse id is used for identify the reuse type of each @ComponentV2 custom component, which can give user control of sub-component recycle and reuse. + * + * @param { ReuseOptions | undefined } options - The configuration parameter for reusable custom component. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + reuse(options: ReuseOptions | undefined): this; + /** + * Sets how content is drawn within nodes duration animation + * + * @param { RenderFit | undefined } fitMode - The render fit mode of content. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + renderFit(fitMode: RenderFit | undefined): this; + /** + * Sets the gesture modifier. + * + * @param { GestureModifier | undefined } modifier - gesture modifier + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + gestureModifier(modifier: GestureModifier | undefined): this; + /** + * Adds a background dynamic light up effect to the current component. + * + * @param { BackgroundBrightnessOptions | undefined } params - params indicates BackgroundBrightnessOptions + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + backgroundBrightness(params: BackgroundBrightnessOptions | undefined): this; + /** + * When a gesture bound to this component will be accepted, a user-defined callback is triggered to get the result + * + * @param { OnGestureJudgeCallback | undefined } callback - A callback instance used when a gesture bound to this component will be accepted. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onGestureJudgeBegin(callback: OnGestureJudgeCallback | undefined): this; + /** + * When a gesture bound to this component will be accepted, a user-defined callback is triggered to get the result + * + * @param { GestureRecognizerJudgeBeginCallback | undefined } callback - A callback instance used when a gesture bound to this component will be accepted. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onGestureRecognizerJudgeBegin(callback: GestureRecognizerJudgeBeginCallback | undefined): this; + /** + * When a gesture bound to this component will be accepted, a user-defined callback is triggered to get the result + * + * @param { GestureRecognizerJudgeBeginCallback | undefined } callback - A callback instance used when a gesture bound to this component will be accepted. + * @param { boolean | undefined } exposeInnerGesture - This parameter is a flag. This flag determines whether to expose internal gestures. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onGestureRecognizerJudgeBegin(callback: GestureRecognizerJudgeBeginCallback | undefined, exposeInnerGesture: boolean | undefined): this; + /** + * In the touch test phase, the recognizer is selected to form a parallel relationship with other recognizers on the response chain. + * + * @param { ShouldBuiltInRecognizerParallelWithCallback | undefined } callback - A callback instance used when a component is doing touch test. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + shouldBuiltInRecognizerParallelWith(callback: ShouldBuiltInRecognizerParallelWithCallback | undefined): this; + /** + * Events are monopolized by components. + * + * @param { boolean | undefined } monopolize - indicate the monopoly of events + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + monopolizeEvents(monopolize: boolean | undefined): this; + /** + * When the component does a touch test, a user-defined callback is triggered. + * + * @param { Callback | undefined } callback - A callback instance used when the component does a touch test. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onTouchIntercept(callback: Callback | undefined): this; + /** + * This callback is triggered when the size of this component change finished. + * + * @param { SizeChangeCallback | undefined } event - event callback. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onSizeChange(event: SizeChangeCallback | undefined): this; + /** + * Accessibility focus draw level, and the default value is FocusDrawLevel.SELF. + * + * @param { FocusDrawLevel | undefined } drawLevel - indicates accessibility focus draw level. + * @returns { this } custom component instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + accessibilityFocusDrawLevel(drawLevel: FocusDrawLevel | undefined): this; +} + +/** + * Definition of custom component class. + * + * @extends BaseCustomComponent + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare abstract class CustomComponent, T_Options> extends BaseCustomComponent { + /** + * aboutToReuse Method + * + * @param { Record } params - Custom component init params. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + aboutToReuse(params: Record): void; } -@Retention({policy: "SOURCE"}) -export declare @interface Entry { - routeName: string = ""; - storage: string = ""; - useSharedStorage: boolean = false; +/** + * Definition of V2 custom component class. + * + * @extends BaseCustomComponent + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare abstract class CustomComponentV2, T_Options> extends BaseCustomComponent { + /** + * aboutToReuse Method + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + aboutToReuse(): void; } -@Retention({policy: "SOURCE"}) -export declare @interface Reusable {} +/** + * Defining of entry of page + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare abstract class EntryPoint { -export interface CustomBuild { - @memo - build(): void; + /** + * Define entry function of page + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + @Builder + entry(): void; } -export interface CustomLayout { +/** + * Defining interface of PageLifeCycle for custom component, when decorate with @Entry. + * + * @typedef PageLifeCycle + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface PageLifeCycle {} +/** + * Definition of custom dialog, which is base class of all the custom dialogs. + * + * @extends ExtendableComponent + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare abstract class CustomDialog, T_Options> extends ExtendableComponent { + /** + * The dialog controller of the custom component. + * + * @returns { PromptActionDialogController | undefined } The controller of dialog, or undefined if it is not available + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + getDialogController(): PromptActionDialogController | undefined; } -export declare abstract class CustomComponent, T_Options> { - - @memo - @ComponentBuilder - static $_instantiate, S_Options>( - factory: () => S, - initializers?: S_Options, - @memo - content?: () => void, - reuseKey?: string - ): S; - - // Life cycle for custom component - aboutToAppear(): void - aboutToDisappear(): void - onDidBuild(): void - - onPageShow(): void - onPageHide(): void - onBackPress(): boolean - getUIContext(): UIContext - - @memo - build(): void; - - aboutToReuse(): void - aboutToRecycle(): void -} \ No newline at end of file +/** + * Defining interface of LayoutCallbacks for custom component, when decorate with @Layoutable. + * + * @typedef LayoutCallbacks + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface LayoutCallbacks {} + +/** + * Define touch test info function. + * + * @typedef { function } TouchTestInfoFunc + * @param { Array } value - touch test value + * @returns { TouchResult } - Touch test result. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare type TouchTestInfoFunc = (value: Array) => TouchResult; + +/** + * Define onClick event function. + * + * @typedef { function } OnClickFunc + * @param { ClickEvent } event - click event value + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare type OnClickFunc = (event: ClickEvent) => void; + +/** + * Define onHover event function. + * + * @typedef { function } OnHoverEventFunc + * @param { boolean } isHover - used to judge whether the component is hover + * @param { HoverEvent } event - hover event + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare type OnHoverEventFunc = (isHover: boolean, event: HoverEvent) => void; + +/** + * Define onDragEventVoid function. + * + * @typedef { function } OnDragEventVoid + * @param { DragEvent } event - drag event + * @param { string } [extraParams] - extra parameters + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare type OnDragEventVoid = (event: DragEvent, extraParams?: string) => void; + +/** + * Define OnDragEvent function. + * + * @typedef { function } OnDragEvent + * @param { DragEvent } event - drag event + * @param { string } [extraParams] - extra parameters + * @returns { CustomBuilder | DragItemInfo } get CustomBuilder or DragItemInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare type OnDragEvent = (event: DragEvent, extraParams?: string) => CustomBuilder | DragItemInfo; + +/** + * Define OnGestureJudgeCallback function. + * + * @typedef { function } OnGestureJudgeCallback + * @param { GestureInfo } gestureInfo - gesture info + * @param { BaseGestureEvent } event - base gesture event + * @returns { GestureJudgeResult } get gesture judge result + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare type OnGestureJudgeCallback = (gestureInfo: GestureInfo, event: BaseGestureEvent) => GestureJudgeResult; \ No newline at end of file diff --git a/api/arkui/component/interop.d.ets b/api/arkui/component/interop.d.ets new file mode 100644 index 0000000000..cf69f16734 --- /dev/null +++ b/api/arkui/component/interop.d.ets @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2025 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. + */ +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +/** + * Defines the info of compatible custom component. + * + * @typedef CompatibleComponentInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface CompatibleComponentInfo { + /** + * the name of compatible custom component + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + name: string; + + /** + * the compatible custom component + * + * @type { Object } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + component: Object; +} + +/** + * Defines the callback for initializing compatible custom component. + * + * @typedef { function } CompatibleInitCallback + * @returns { CompatibleComponentInfo } the info of compatible custom component + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type CompatibleInitCallback = () => CompatibleComponentInfo; + +/** + * Defines the callback for updating compatible custom component. + * + * @typedef { function } CompatibleUpdateCallback + * @param { Object } component - the compatible custom component + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type CompatibleUpdateCallback = (component: Object) => void; + +/** + * Obtains the compatible custom component. + * + * @param { CompatibleInitCallback } init - the callback for initializing compatible custom component + * @param { CompatibleUpdateCallback } update - the callback for updating compatible custom component + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +@Builder +export declare function compatibleComponent( + init: CompatibleInitCallback, + update: CompatibleUpdateCallback +): void; + +/** + * Defines the callback for notifying compatible state to set new value. + * + * @typedef { function } CompatibleStateSetCallback + * @param { T } value - the new value + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type CompatibleStateSetCallback = (value: T) => void; + +/** + * Binds the source state with the compatible state. + * + * @param { StateDecoratedVariable | ProvideDecoratedVariable | PropDecoratedVariable } state - the source + * @param { Object } proxy - the proxy of the compatible state + * @param {CompatibleStateSetCallback } compatibleStateSetCallback - the callback for notifying compatible state to set new value + * @param { WatchFuncType } compatibleStateChangeCallback - the callback for notifying compatible state to update + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare function bindCompatibleState( + state: StateDecoratedVariable | ProvideDecoratedVariable | PropDecoratedVariable, + proxy: Object, + compatibleStateSetCallback: CompatibleStateSetCallback, + compatibleStateChangeCallback: WatchFuncType +): void; + +/** + * Finds the custom component's provide property. + * + * @param { BaseCustomComponent } component - the custom component + * @param { string } provideName - the provide property's name + * @returns { ProvideDecoratedVariable } the provide property + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare function findCustomComponentProvide( + component: BaseCustomComponent, + provideName: string +): ProvideDecoratedVariable; + +/** + * Obtains the proxy of the source state. + * + * @param { StateDecoratedVariable | ProvideDecoratedVariable | PropDecoratedVariable } state - the source state + * @returns { Object | undefined } if exists, returns the proxy of the compatible state; otherwise, returns undefined. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare function getCompatibleState( + state: StateDecoratedVariable | ProvideDecoratedVariable | PropDecoratedVariable +): Object | undefined; + +/** + * Binds the source state with the link property. + * + * @param { LinkDecoratedVariable } link - the link property + * @returns { IDecoratedMutableVariable } the source state, like state, provide and prop. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare function findBindingSourceState( + link: LinkDecoratedVariable +): IDecoratedMutableVariable; \ No newline at end of file diff --git a/api/arkui/stateManagement/decorator.d.ets b/api/arkui/stateManagement/decorator.d.ets new file mode 100644 index 0000000000..19d0f6f80e --- /dev/null +++ b/api/arkui/stateManagement/decorator.d.ets @@ -0,0 +1,740 @@ +/* + * Copyright (C) 2025 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. + */ +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +import { ExtendableComponent } from '../component/extendableComponent'; + +/** + * Define decorated variable interface. + * + * @interface IDecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IDecoratedVariable { + /** + * Decorated variable name. + * + * @type { string } + * @readonly + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + readonly varName: string; +} + +/** + * Define V1 decorated variable interface. + * + * @extends IDecoratedVariable + * @interface IDecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IDecoratedV1Variable extends IDecoratedVariable { + /** + * Registers the watch callback function with the data source. + * + * @param { IDecoratedV1Variable } decoratedVar + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + registerWatchToSource(decoratedVar: IDecoratedV1Variable): void; +} + +/** + * Define decorated immutable variable interface. + * + * @interface IDecoratedImmutableVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IDecoratedImmutableVariable { + /** + * Get the state variable. + * + * @returns { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + get(): T; +} + +/** + * Define decorated mutable variable interface. + * + * @interface IDecoratedMutableVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IDecoratedMutableVariable { + /** + * Get the state variable. + * + * @returns { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + get(): T; + /** + * Set the state variable with a new Value. + * + * @param { T } newValue + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + set(newValue: T): void; +} + +/** + * Define decorated updatable variable interface. + * + * @interface IDecoratedUpdatableVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IDecoratedUpdatableVariable { + /** + * Update the state variable with a new Value. + * + * @param { T } newValue + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + update(newValue: T): void; +} + +/** + * Define state decoration variable interface. + * + * @extends IDecoratedMutableVariable, IDecoratedV1Variable + * @interface IStateDecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IStateDecoratedVariable extends IDecoratedMutableVariable, IDecoratedV1Variable {} + +/** + * Define PropRef decoration variable interface. + * + * @extends IDecoratedMutableVariable, IDecoratedUpdatableVariable, IDecoratedV1Variable + * @interface IPropRefDecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IPropRefDecoratedVariable extends IDecoratedMutableVariable, + IDecoratedUpdatableVariable, IDecoratedV1Variable {} + +/** + * Define Link decoration variable interface. + * + * @extends IDecoratedMutableVariable, IDecoratedV1Variable + * @interface ILinkDecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface ILinkDecoratedVariable extends IDecoratedMutableVariable, IDecoratedV1Variable {} + +/** + * Define Provide decoration variable interface. + * + * @extends IDecoratedMutableVariable, IDecoratedV1Variable + * @interface IProvideDecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IProvideDecoratedVariable extends IDecoratedMutableVariable, IDecoratedV1Variable {} + +/** + * Define Consume decoration variable interface. + * + * @extends IDecoratedMutableVariable, IDecoratedV1Variable + * @interface IConsumeDecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IConsumeDecoratedVariable extends IDecoratedMutableVariable, IDecoratedV1Variable {} + +/** + * Define ObjectLink decoration variable interface. + * + * @extends IDecoratedImmutableVariable, IDecoratedUpdatableVariable, IDecoratedV1Variable + * @interface IObjectLinkDecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IObjectLinkDecoratedVariable extends IDecoratedImmutableVariable, + IDecoratedUpdatableVariable, IDecoratedV1Variable {} + +/** + * Define StorageLink decoration variable interface. + * + * @extends IDecoratedMutableVariable, IDecoratedV1Variable + * @interface IStorageLinkDecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IStorageLinkDecoratedVariable extends IDecoratedMutableVariable, IDecoratedV1Variable {} + +/** + * Define StoragePropRef decoration variable interface. + * + * @extends IDecoratedMutableVariable, IDecoratedV1Variable + * @interface IStoragePropRefDecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IStoragePropDecoratedVariable extends IDecoratedMutableVariable, IDecoratedV1Variable {} + +/** + * Define Link source type. + * + * @typedef { IDecoratedV1Variable } LinkSourceType + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type LinkSourceType = IDecoratedV1Variable; + +/** + * Define Local decoration variable interface. + * + * @extends IDecoratedMutableVariable, IDecoratedV2Variable + * @interface ILocalDecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface ILocalDecoratedVariable extends IDecoratedMutableVariable, IDecoratedV2Variable {} + +/** + * Define mutable state meta interface. + * + * @interface IMutableStateMeta + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IMutableStateMeta { + /** + * Collect the dependancy for UI component with state variable + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + addRef(): void; + /** + * Notify UI component to update when state variable is changed + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + fireChange(): void; +} + +/** + * Define V2 decorated variable interface. + * + * @extends IDecoratedVariable + * @interface IDecoratedV2Variable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface IDecoratedV2Variable extends IDecoratedVariable {} + +/** + * Define mutable state meta interface with key. + * + * @interface IMutableKeyedStateMeta + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IMutableKeyedStateMeta { + /** + * Collect the dependancy for UI component with state variable based on given key + * + * @param { string } key + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + addRef(key: string): void; + /** + * Collect the dependancy for UI component with state variable based on given key + * + * @param { int } index + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + addRef(index: int): void; + /** + * Notify UI component with given key to update when state variable is changed + * + * @param { string } key + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + fireChange(key: string): void; + /** + * Notify UI component with given key to update when state variable is changed + * + * @param { int } index + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + fireChange(index: int): void; +} + +/** + * Define Param decoration variable interface. + * + * @extends IDecoratedImmutableVariable, IDecoratedUpdatableVariable, IDecoratedV2Variable + * @interface IParamV2DecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IParamV2DecoratedVariable extends IDecoratedImmutableVariable, IDecoratedUpdatableVariable, IDecoratedV2Variable {} + +/** + * Define IObserve interface. + * + * @interface IObserve + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IObserve { + /** + * Rendering component. + * + * @type { number } + * @readonly + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + readonly renderingComponent: number; + /** + * Rendering component id. + * + * @type { RenderIdType } + * @readonly + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + readonly renderingId: RenderIdType; + /** + * Collect the dependancy for UI component with state variable + * + * @param { RenderIdType } iObjectsRenderId + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + shouldAddRef(iObjectsRenderId: RenderIdType): boolean; +} + +/** + * Define Param Once decoration variable interface. + * + * @extends IDecoratedMutableVariable, IDecoratedV2Variable + * @interface IParamOnceV2DecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IParamOnceV2DecoratedVariable extends IDecoratedMutableVariable, IDecoratedV2Variable {} + +/** + * Define OBSERVED. + * + * @type { IObserve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare const OBSERVE: IObserve; + +/** + * Define Provider decoration variable interface. + * + * @extends IDecoratedMutableVariable, IDecoratedV2Variable + * @interface IProviderDecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IProviderDecoratedVariable extends IDecoratedMutableVariable, IDecoratedV2Variable {} + +/** + * Define int alias. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type RenderIdType = int; + +/** + * Define Consumer decoration variable interface. + * + * @extends IDecoratedMutableVariable, IDecoratedV2Variable + * @interface IConsumerDecoratedVariable + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IConsumerDecoratedVariable extends IDecoratedMutableVariable, IDecoratedV2Variable {} + +/** + * Define IObservedObject interface. + * + * @extends IWatchSubscriberRegister + * @interface IObservedObject + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IObservedObject extends IWatchSubscriberRegister { + /** + * Set V1 renderId + * + * @param { RenderIdType } renderId + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setV1RenderId(renderId: RenderIdType): void; +} + +/** + * Define STATE_MGMT_FACTORY. + * + * @type { IStateMgmtFactory } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare const STATE_MGMT_FACTORY: IStateMgmtFactory; + +/** + * Define IStateMgmtFactory interface. + * + * @interface IStateMgmtFactory + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IStateMgmtFactory { + /** + * get mutable state meta + * + * @returns { IMutableStateMeta } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeMutableStateMeta(): IMutableStateMeta; + /** + * get subscribed watches + * + * @returns { ISubscribedWatches } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeSubscribedWatches(): ISubscribedWatches; + /** + * Create a State variable instance. + * + * @param { ExtendableComponent } owningView - custom component. + * @param { string } varName - state variable name. + * @param { T } initValue - state variable initValue. + * @param { WatchFuncType } [watchFunc] - watch type + * @returns { IStateDecoratedVariable } State instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeState(owningView: ExtendableComponent, varName: string, initValue: T, + watchFunc?: WatchFuncType): IStateDecoratedVariable; + /** + * Create a PropRef variable instance. + * + * @param { ExtendableComponent } owningView - custom component. + * @param { string } varName - state variable name. + * @param { T } initValue - state variable initValue. + * @param { WatchFuncType } [watchFunc] - watch type + * @returns { IPropRefDecoratedVariable } PropRef instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makePropRef(owningView: ExtendableComponent, varName: string, initValue: T, + watchFunc?: WatchFuncType): IPropRefDecoratedVariable; + + /** + * Create a Link variable instance. + * + * @param { ExtendableComponent } owningView - custom component. + * @param { string } varName - state variable name. + * @param { LinkSourceType } source - state variable sync source. + * @param { WatchFuncType } [watchFunc] - watch type + * @returns { ILinkDecoratedVariable } PropRef instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeLink(owningView: ExtendableComponent, varName: string, source: LinkSourceType, + watchFunc?: WatchFuncType): ILinkDecoratedVariable; + + /** + * Create a Provide variable instance. + * + * @param { ExtendableComponent } owningView - custom component. + * @param { string } varName - state variable name. + * @param { string } provideAlias - provide alias. + * @param { T } initValue - init value. + * @param { boolean } allowOverride - Override the @Provide of any parent or parent of parent @Component.@Provide({allowOverride: "name"}) is + * also allowed to be used even when there is no ancestor @Component whose @Provide would be overridden. + * @param { WatchFuncType } [wathcFunc] - watch type + * @returns { IProvideDecoratedVariable } Provide instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeProvide(owningView: ExtendableComponent, varName: string, provideAlias: string, + initValue: T, allowOverride: boolean, wathcFunc?: WatchFuncType): IProvideDecoratedVariable; + + /** + * Create a Consume variable instance. + * + * @param { ExtendableComponent } owningView - custom component. + * @param { string } varName - state variable name. + * @param { string } provideAlias - provide alias. + * @param { WatchFuncType } [watchFunc] - watch type + * @returns { IConsumeDecoratedVariable } Consume instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeConsume(owningView: ExtendableComponent, varName: string, + provideAlias: string, watchFunc?: WatchFuncType): IConsumeDecoratedVariable; + + /** + * Create a ObjectLink variable instance. + * + * @param { ExtendableComponent } owningView - custom component. + * @param { string } varName - state variable name. + * @param { T } initValue - init value. + * @param { WatchFuncType } [wathcFunc] - watch type + * @returns { IObjectLinkDecoratedVariable } ObjectLink instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeObjectLink(owningView: ExtendableComponent, varName: string, + initValue: T, wathcFunc?: WatchFuncType): IObjectLinkDecoratedVariable; + + /** + * Create a StorageLink variable instance. + * + * @param { ExtendableComponent } owningView - custom component. + * @param { string } propName - property name. + * @param { string } varName - state variable name. + * @param { T } initValue - init value. + * @param { WatchFuncType } [watchFunc] - watch type + * @returns { IStorageLinkDecoratedVariable } StorageLink instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeStorageLink(owningView: ExtendableComponent, propName: string, + varName: string, initValue: T, watchFunc?: WatchFuncType): IStorageLinkDecoratedVariable; + + /** + * Create a StoragePropRef variable instance. + * + * @param { ExtendableComponent } owningView - custom component. + * @param { string } propName - property name. + * @param { string } varName - state variable name. + * @param { T } initValue - init value. + * @param { WatchFuncType } [watchFunc] - watch type + * @returns { IStoragePropRefDecoratedVariable } StoragePropRef instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeStoragePropRef(owningView: ExtendableComponent, propName: string, + varName: string, initValue: T, watchFunc?: WatchFuncType): IStoragePropRefDecoratedVariable; + + /** + * Create a Local variable instance. + * + * @param { ExtendableComponent } owningView - custom component. + * @param { string } varName - state variable name. + * @param { T } localInitValue - state variable initValue. + * @returns { ILocalDecoratedVariable } Local instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeLocal(owningView: ExtendableComponent, varName: string, localInitValue: T): ILocalDecoratedVariable; + + /** + * Create a Param variable instance. + * + * @param { ExtendableComponent } owningView - custom component. + * @param { string } varName - state variable name. + * @param { T } initValue - param variable initValue. + * @returns { IParamDecoratedVariable } Param instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeParam(owningView: ExtendableComponent, varName: string, initValue: T): IParamDecoratedVariable; + + /** + * Create a param once variable instance. + * + * @param { ExtendableComponent } owningView - custom component. + * @param { string } varName - state variable name. + * @param { T } initValue - param once variable initValue. + * @returns { IParamOnceV2DecoratedVariable } Param Once instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeParamOnce(owningView: ExtendableComponent, varName: string, initValue: T): IParamOnceV2DecoratedVariable; + + /** + * Create a provider variable instance. + * + * @param { ExtendableComponent } owningView - custom component. + * @param { string } varName - provider variable name. + * @param { string } providerAlias - provider alias. + * @param { T } localInitValue - provider local variable value. + * @returns { IProviderDecoratedVariable } Provider instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeProvider(owningView: ExtendableComponent, varName: string, providerAlias: string, localInitValue: T ): IProviderDecoratedVariable; + + /** + * Create a consumer variable instance. + * + * @param { ExtendableComponent } owningView - custom component. + * @param { string } varName - consumer variable name. + * @param { string } providerAlias - consumer alias. + * @param { T } defaultValue - consumer default value. + * @returns { IConsumerDecoratedVariable } Consumer instance + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + makeConsumer(owningView: ExtendableComponent, varName: string, providerAlias: string, defaultValue: T): IConsumerDecoratedVariable; +} + +/** + * Defines the callback that is called when state variable is change + * @typedef { function } WatchFuncType + * @param {string} propertyName - property name + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type WatchFuncType = (propertyName: string) => void; + +/** + * Define int alias. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type WatchIdType = int; + +/** + * Define IWatchSubscriberRegister interface. + * + * @interface IWatchSubscriberRegister + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface IWatchSubscriberRegister { + /** + * Registers the watch function callback. + * + * @param { WatchIdType } watchId - the watch function id + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + addWatchSubscriber(watchId: WatchIdType): void; + /** + * UnRegister the watch function callback. + * + * @param { WatchIdType } watchId - the watch function id + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + removeWatchSubscriber(watchId: WatchIdType): boolean; +} + +/** + * Define ISubscribedWatches interface. + * + * @extends IWatchSubscriberRegister + * @interface ISubscribedWatches + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface ISubscribedWatches extends IWatchSubscriberRegister { + /** + * Execute the watch function callback. + * + * @param { string } propertyName - property name + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + executeOnSubscribingWatches(propertyName: string): void; +} + +/** + * Define AbstractProperty interface. + * + * AbstractProperty can be understood as a handler or an alias + * to a property inside LocalStorage / AppStorage singleton + * allows to read the value with @see get and to change the + * value with @see set. + * + * @extends IDecoratedMutableVariable + * @interface AbstractProperty + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface AbstractProperty extends IDecoratedMutableVariable { + /** + * returns the name of the referenced property + * + * @returns { string } name of the referenced property + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + info(): string; +} + +/** + * SubscribedAbstractProperty is the return value of + * - AppStorage static functions Link(), Prop(), SetAndLink(), and SetAndProp() + * - LocalStorage member methods link(), prop(), setAndLink(), and setAndProp() + * 'T' can be boolean, string, number or custom class. + * Main functions + * see get() reads the linked AppStorage/LocalStorage property value, + * see set(newValue) write a new value to the synched AppStorage/LocalStorage property + * see aboutToBeDeleted() ends the sync relationship with the AppStorage/LocalStorage property + * The app must call this function before the SubscribedAbstractProperty object + * goes out of scope. + * + * @extends AbstractProperty + * @interface SubscribedAbstractProperty + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface SubscribedAbstractProperty extends AbstractProperty { + /** + * An app needs to call this function before the instance of SubscribedAbstractProperty + * goes out of scope / is subject to garbage collection. Its purpose is to unregister the + * variable from the two-way/one-way sync relationship that AppStorage/LocalStorage.link()/prop() + * and related functions create. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + aboutToBeDeleted(): void; +} \ No newline at end of file diff --git a/api/arkui/stateManagement/storage/appStorageV2.d.ets b/api/arkui/stateManagement/storage/appStorageV2.d.ets new file mode 100644 index 0000000000..07f9e6a93c --- /dev/null +++ b/api/arkui/stateManagement/storage/appStorageV2.d.ets @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2025 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. + */ + +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +/** + * AppStorageV2 is for UI state of app-wide access, has same life cycle as the app, + * and saves database content only in memory. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class AppStorageV2 { + /** + * If used by persistenceV2, module-level storage path, different modules will have their own storage paths. + * If the value for the given key is already available, return the value. + * If not, add the key with value generated by calling defaultFunc and return it to caller. + * + * @param { Type } ttype class type of the stored value. + * @param { string | StorageDefaultCreator } [keyOrDefaultCreator] alias name of the key, or the function generating the default value. + * @param { StorageDefaultCreator } [defaultCreator] the function generating the default value + * @returns { T | undefined } the value of the existed key or the default value + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static connect( + ttype: Type, + keyOrDefaultCreator?: string | StorageDefaultCreator, + defaultCreator?: StorageDefaultCreator + ): T | undefined; + + /** + * Removes data with the given key or given class type. + * + * @param { string | Type } keyOrType key or class type removing + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static remove(keyOrType: string | Type): void; + /** + * Return the array of all keys. + * + * @returns { Array } the array of all keys + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static keys(): Array; +} \ No newline at end of file diff --git a/api/arkui/stateManagement/storage/environment.d.ets b/api/arkui/stateManagement/storage/environment.d.ets new file mode 100644 index 0000000000..798c1f0048 --- /dev/null +++ b/api/arkui/stateManagement/storage/environment.d.ets @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2025 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. + */ + +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +/** + * EnvProps object + * + * @interface EnvPropsOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface EnvPropsOptions { + + /** + * Property name of Environment variable + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + key: string; + + /** + * DefaultValue is the default value if cannot get the environment property value + * + * @type { number | string | boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + defaultValue: number | string | boolean; +} + +/** + * Defines the Environment interface. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class Environment { + + /** + * Creates a new property in AppStorage. The UI framework implementation takes care of updating + * its value whenever the named device environment property changes. Recommended use is at app startup. + * The function call fails and returns false if a property with given name exists in AppStorage already. + * It is wrong API use to access a property with given name in AppStorage before calling Environment.envProp. + * + * @param { string } key - environment property + * @param { S } value - is the default value if cannot get the environment property value + * @returns { boolean } false if method failed + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static envProp(key: string, value: S): boolean; + + /** + * Called when multiple property values are added to Environment. + * + * @param { EnvPropsOptions[] } props environment parameter + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static envProps(props: EnvPropsOptions[]): void; + + /** + * returns an Array of all environment property keys + * + * @returns { Array } all environment property keys + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static keys(): Array; +} \ No newline at end of file diff --git a/api/arkui/stateManagement/storage/persistenceV2.d.ets b/api/arkui/stateManagement/storage/persistenceV2.d.ets new file mode 100644 index 0000000000..f7a0793349 --- /dev/null +++ b/api/arkui/stateManagement/storage/persistenceV2.d.ets @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2025 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. + */ + +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +import contextConstant from '@ohos.app.ability.contextConstant'; +import {ToJSONType, FromJSONType } from './persistentStorage'; + +/** + * Function that returns default creator. + * + * @typedef { function } StorageDefaultCreator + * @returns { T } default creator + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare type StorageDefaultCreator = () => T; + +/** + * Define ConnectOptions class. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export class ConnectOptions { + /** + * Define class constructor + * @type { Type } type class type of the stored value. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + type: Type; + /** + * Defines alias name of the key, or the function generating the default value. + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + key?: string; + /** + * Define the function generating the default value. + * @type { ?StorageDefaultCreator} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + defaultCreator?: StorageDefaultCreator; + /** + * Define encrypted partition for data storage. + * if not passed in, the defaule value is El2 + * + * @type { ?contextConstant.AreaMode} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + areaMode?: contextConstant.AreaMode; +} + +/** + * Function that returns reason type when error. + * + * @typedef { function } PersistenceErrorCallback + * @param { string } key persisted key when error + * @param { 'quota' | 'serialization' | 'unknown' } reason reason type when error + * @param { string } message more message when error + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare type PersistenceErrorCallback = (key: string, reason: 'quota' | 'serialization' | 'unknown', message: string) => void; + +/** + * Defines Serializable object + * + * @extends JsonElementSerializable, JsonElementDeserializable + * @interface SerializableObject + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface SerializableObject extends JsonElementSerializable, JsonElementDeserializable {} + + +/** + * PersistenceV2 is for UI state of app-wide access, available on app re-start, + * and saves database content in disk. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class PersistenceV2 { + /** + * If used by persistenceV2, module-level storage path, different modules will have their own storage paths. + * If the value for the given key is already available, return the value. + * If not, add the key with value generated by calling defaultFunc and return it to caller. + * + * @param { Type } ttype class type of the stored value. + * @param { string | StorageDefaultCreator } [keyOrDefaultCreator] alias name of the key, or the function generating the default value. + * @param { StorageDefaultCreator } [defaultCreator] the function generating the default value + * @returns { T | undefined } the value of the existed key or the default value + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static connect>(ttype: Type, + keyOrDefaultCreator?: string | StorageDefaultCreator, defaultCreator?: StorageDefaultCreator): T | undefined; + + /** + * If used by persistenceV2, module-level storage path, different modules will have their own storage paths. + * If the value for the given key is already available, return the value. + * If not, add the key with value generated by calling defaultFunc and return it to caller. + * + * @param { Type } ttype class type of the stored value. + * @param { ToJSONType } toJson to Json function. + * @param { FromJSONType } fromJson serializable function. + * @param { string | StorageDefaultCreator } [keyOrDefaultCreator] alias name of the key, or the function generating the default value. + * @param { StorageDefaultCreator } [defaultCreator] the function generating the default value + * @returns { T | undefined } the value of the existed key or the default value + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static connect(ttype: Type, toJson: ToJSONType, fromJson: FromJSONType, + keyOrDefaultCreator?: string | StorageDefaultCreator, defaultCreator?: StorageDefaultCreator): T | undefined; + + /** + * Application-level storage path, sharing a storage path for all modules under the application. + * If the value for the given key is already available, return the value. + * If not, add the key with value generated by calling defaultFunc and return it to caller. + * + * @param { ConnectOptions } connectOptions Application level storage parameters. + * @returns { T | undefined } the value of the existed key or the default value + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static globalConnect>(connectOptions: ConnectOptions): T | undefined; + + /** + * Application-level storage path, sharing a storage path for all modules under the application. + * If the value for the given key is already available, return the value. + * If not, add the key with value generated by calling defaultFunc and return it to caller. + * + * @param { ConnectOptions } connectOptions Application level storage parameters. + * @param { ToJSONType } toJson to Json function. + * @param { FromJSONType } fromJson serializable function. + * @returns { T | undefined } the value of the existed key or the default value + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static globalConnect(connectOptions: ConnectOptions, + toJson: ToJSONType, fromJson: FromJSONType): T | undefined; + + /** + * Used to manually persist data changes to disks. + * + * @param { string | Type } keyOrType key or class type need to persist. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static save(keyOrType: string | Type): void; + + /** + * Be called when persisting has encountered an error. + * + * @param { PersistenceErrorCallback | undefined } callback called when error + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static notifyOnError(callback: PersistenceErrorCallback | undefined): void; + + /** + * Removes data with the given key or given class type. + * + * @param { string | Type } keyOrType key or class type removing + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static remove(keyOrType: string | Type): void; + + /** + * Return the array of all keys. + * + * @returns { Array } the array of all keys + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static keys(): Array; +} \ No newline at end of file diff --git a/api/arkui/stateManagement/storage/persistentStorage.d.ets b/api/arkui/stateManagement/storage/persistentStorage.d.ets new file mode 100644 index 0000000000..0164c6fd8c --- /dev/null +++ b/api/arkui/stateManagement/storage/persistentStorage.d.ets @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2025 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. + */ + +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +/** + * EnvProps object + * + * @interface PersistPropsOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare interface PersistPropsOptions { + + /** + * Property name + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + key: string; + + /** + * If AppStorage does not include this property it will be initialized with this value + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + defaultValue: T; + + /** + * Used to serialize data + * + * @type { ?ToJSONType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + toJson?: ToJSONType; + + /** + * Used to deserialize data + * + * @type { ?FromJSONType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + fromJson?: FromJSONType; +} + +/** + * Define toJson type function. + * + * @typedef { function } ToJSONType + * @param { T } value toJson value + * @returns { JsonElement } Json stringify element object + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare type ToJSONType = (value: T) => JsonElement; + +/** + * Define fromJson type function. + * + * @typedef { function } FromJSONType + * @param { JsonElement } element json element + * @returns { T } deserialization result + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare type FromJSONType = (element: JsonElement) => T; + +/** + * Defines the PersistentStorage interface. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class PersistentStorage { + /** + * Add property 'key' to AppStorage properties whose current value will be + * persistent. + * If AppStorage does not include this property it will be added and initializes + * with given value + * + * @param { string } key - property name + * @param { T } defaultValue - If AppStorage does not include this property it will be initialized with this value + * @param { ToJSONType } [toJson] - serialization function + * @param { FromJSONType } [fromJson] - deserialization function + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static persistProp(key: string, defaultValue: T, toJson?: ToJSONType, fromJson?: FromJSONType): void; + + /** + * Reverse of @see persistProp + * + * @param { string } key - no longer persist the property named key + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static deleteProp(key: string): void; + + /** + * Persist given AppStorage properties with given names. + * If a property does not exist in AppStorage, add it and initialize it with given value + * works as @see persistProp for multiple properties. + * + * @param { Array> } props persistent parameter + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static persistProps(props: Array>): void; + + /** + * Inform persisted AppStorage property names + * + * @returns { Array } array of AppStorage keys + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + static keys(): Array; +} \ No newline at end of file -- Gitee From b4c510622e36c885aba24c9393cd535d89db0b95 Mon Sep 17 00:00:00 2001 From: s10021109 Date: Thu, 12 Jun 2025 15:18:14 +0800 Subject: [PATCH 5/5] =?UTF-8?q?ArkTS1.2=E7=8A=B6=E6=80=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86API(1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: s10021109 --- api/@ohos.arkui.component.d.ets | 36 +- api/arkui/component/builder.d.ets | 31 + api/arkui/component/extendableComponent.d.ets | 105 +++ api/arkui/component/forEach.d.ets | 51 +- api/arkui/component/lazyForEach.d.ets | 870 ++++++++---------- api/arkui/component/repeat.d.ets | 178 ++++ api/arkui/incremental/annotation/index.d.ets | 21 + api/arkui/incremental/runtime/state.d.ets | 154 ++++ api/arkui/stateManagement/runtime.d.ets | 62 +- .../stateManagement/storage/appStorage.d.ets | 178 ++++ api/arkui/stateManagement/storage/index.d.ets | 22 + .../storage/localStorage.d.ets | 193 ++++ 12 files changed, 1308 insertions(+), 593 deletions(-) create mode 100644 api/arkui/component/builder.d.ets create mode 100644 api/arkui/component/extendableComponent.d.ets create mode 100644 api/arkui/component/repeat.d.ets create mode 100644 api/arkui/incremental/annotation/index.d.ets create mode 100644 api/arkui/incremental/runtime/state.d.ets create mode 100644 api/arkui/stateManagement/storage/appStorage.d.ets create mode 100644 api/arkui/stateManagement/storage/index.d.ets create mode 100644 api/arkui/stateManagement/storage/localStorage.d.ets diff --git a/api/@ohos.arkui.component.d.ets b/api/@ohos.arkui.component.d.ets index 90c190a547..a9148b8145 100644 --- a/api/@ohos.arkui.component.d.ets +++ b/api/@ohos.arkui.component.d.ets @@ -17,37 +17,5 @@ * @kit ArkUI * @arkts 1.2 */ -export * from './arkui/UserView'; -export * from './arkui/component/text'; -export * from './arkui/component/enums'; -export * from './arkui/component/units'; -export * from './arkui/component/blank'; -export * from './arkui/component/button'; -export * from './arkui/component/column'; -export * from './arkui/component/row'; -export * from './arkui/component/common'; -export * from './arkui/component/customComponent'; -export * from './arkui/component/enums'; -export * from './arkui/component/forEach'; -export * from './arkui/component/gesture'; -export * from './arkui/component/grid'; -export * from './arkui/component/griditem'; -export * from './arkui/component/image'; -export * from './arkui/component/imageCommon'; -export * from './arkui/component/lazyForEach'; -export * from './arkui/component/list'; -export * from './arkui/component/mediaCachedImage'; -export * from './arkui/component/navigation'; -export * from './arkui/component/progress'; -export * from './arkui/component/scroll'; -export * from './arkui/component/scrollBar'; -export * from './arkui/component/stack'; -export * from './arkui/component/symbolglyph'; -export * from './arkui/component/units'; -export * from './arkui/component/resources'; -export * from './arkui/component/locationButton'; -export * from './arkui/component/pasteButton'; -export * from './arkui/component/saveButton'; -export * from './arkui/component/securityComponent'; -export * from './arkui/component/web'; -export * from './arkui/component/textCommon'; \ No newline at end of file + +export * from './arkui/component/extendableComponent'; \ No newline at end of file diff --git a/api/arkui/component/builder.d.ets b/api/arkui/component/builder.d.ets new file mode 100644 index 0000000000..7ae276ec5d --- /dev/null +++ b/api/arkui/component/builder.d.ets @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2025 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. + */ + +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +import { Memo } from "@ohos.arkui.stateManagement"; + +/** + * Defining wrapBuilder function. + * @param { T } builder + * @returns { WrappedBuilder } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare function wrapBuilder(builder: T): WrappedBuilder; \ No newline at end of file diff --git a/api/arkui/component/extendableComponent.d.ets b/api/arkui/component/extendableComponent.d.ets new file mode 100644 index 0000000000..09c6fc89c9 --- /dev/null +++ b/api/arkui/component/extendableComponent.d.ets @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2025 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. + */ + +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ +import { Builder } from './builder'; +import { Theme } from '@ohos.arkui.theme'; +import { UIContext } from '@ohos.arkui.UIContext'; +import { Optional, NavDestinationInfo, NavigationInfo, RouterPageInfo } from './common'; +/** + * Defining interface of LifeCycle for custom component and custom dialog + * + * @typedef LifeCycle + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface LifeCycle {} + +/** + * Definition of extendable component, which is base class of custom component and custom dialog. + * + * @implements LifeCycle + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare abstract class ExtendableComponent implements LifeCycle { + /** + * The onWillApplyTheme function is a custom hook to get active theme object from the context. + * + * @param { Theme } theme - Custom theme init params. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onWillApplyTheme(theme: Theme): void; + + /** + * Get current UIContext. + * + * @returns { UIContext } The UIContext that the custom component belongs to. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + getUIContext(): UIContext; + + /** + * Get uniqueId of the custom component. + * + * @returns { int } - The uniqueId of the custom component. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + getUniqueId(): int; + + /** + * Queries the navigation destination information. + * + * @returns { NavDestinationInfo | undefined } The navigation destination information, or undefined if it is not available. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + queryNavDestinationInfo(): NavDestinationInfo | undefined; + + /** + * Queries the navigation destination information. + * + * @param { Optional } isInner + * @returns { NavDestinationInfo | undefined } The navigation destination information, or undefined if it is not available. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + queryNavDestinationInfo(isInner: Optional): NavDestinationInfo | undefined; + + /** + * Query the navigation information of the current custom component. + * + * @returns { NavigationInfo | undefined } The navigation information, or undefined if it is not available + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + queryNavigationInfo(): NavigationInfo | undefined; + + /** + * Query the router page information of the current custom component. + * + * @returns { RouterPageInfo | undefined } The router page information, or undefined if it is not available. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + queryRouterPageInfo(): RouterPageInfo | undefined; +} \ No newline at end of file diff --git a/api/arkui/component/forEach.d.ets b/api/arkui/component/forEach.d.ets index c3430f872d..e93855dbaa 100644 --- a/api/arkui/component/forEach.d.ets +++ b/api/arkui/component/forEach.d.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 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 @@ -12,46 +12,49 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - -// HADWRITTEN, DO NOT REGENERATE - /** * @file * @kit ArkUI * @arkts 1.2 */ -import { memo, ComponentBuilder, __memo_context_type, __memo_id_type } from './../stateManagement/runtime' +import { Builder } from './builder'; + +/** + * Define item generator function. + * + * @typedef { function } ItemGeneratorFunc + * @param { T } item - item in an array + * @param { number } index - index corresponding to an array item. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare type ItemGeneratorFunc = (item: T, index: number) => void; /** - * declare ForEachAttribute + * Define key generator function. * + * @typedef { function } KeyGeneratorFunc + * @param { T } item - item in an array + * @param { number } index - index corresponding to an array item. + * @returns {string} Character string generated based on item and index * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @form - * @atomicservice * @since 20 */ -export interface ForEachAttribute {} +declare type KeyGeneratorFunc = (item: T, index: number) => string; /** * Defines ForEach Component. * - * @param { Array } arr - * @param { function } itemGenerator - * @param { function } keyGenerator - * @returns { ForEachAttribute } + * @param { Array } arr - the array collection to be used in UI + * @param { ItemGeneratorFunc } itemGenerator - item generator function + * @param { KeyGeneratorFunc } [keyGenerator] - key generator function * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @form - * @atomicservice * @since 20 */ -@memo -@ComponentBuilder +@Builder export declare function ForEach(arr: Array, - @memo - itemGenerator: (item: T, index: number) => void, - keyGenerator?: (item: T, index: number) => string, -): ForEachAttribute \ No newline at end of file + @Builder + itemGenerator: ItemGeneratorFunc, + keyGenerator?: KeyGeneratorFunc, +): void; \ No newline at end of file diff --git a/api/arkui/component/lazyForEach.d.ets b/api/arkui/component/lazyForEach.d.ets index 1d7d311c0e..391d00cff9 100644 --- a/api/arkui/component/lazyForEach.d.ets +++ b/api/arkui/component/lazyForEach.d.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. + * Copyright (c) 2025 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 @@ -12,82 +12,64 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - -// HADWRITTEN, DO NOT REGENERATE - /** * @file * @kit ArkUI * @arkts 1.2 */ -import { memo, ComponentBuilder, __memo_context_type, __memo_id_type } from './../stateManagement/runtime' +import { ComponentBuilder, Builder } from './builder'; /** * Defines type to operation data source. * * @enum { string } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export enum DataOperationType { - /** - * Add data. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - ADD = 'add', - /** - * Delete data. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - DELETE = 'delete', - /** - * Exchange data. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - EXCHANGE = 'exchange', - /** - * Move data. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - MOVE = 'move', - /** - * Change data. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - CHANGE = 'change', - /** - * Reload data. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - RELOAD = 'reload' + /** + * Add data. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + ADD = 'add', + /** + * Delete data. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + DELETE = 'delete', + /** + * Exchange data. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + EXCHANGE = 'exchange', + /** + * Move data. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + MOVE = 'move', + /** + * Change data. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + CHANGE = 'change', + /** + * Reload data. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + RELOAD = 'reload' } /** @@ -95,53 +77,43 @@ export enum DataOperationType { * * @interface DataAddOperation * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export interface DataAddOperation { - /** - * How to operate added data. - * - * @type { DataOperationType.ADD } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - type: DataOperationType; - /** - * Index of added data. - * - * @type { number } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - index: number; - /** - * Count of added data in one operation - * Only validate for ADD and DELETE. - * - * @type { ?number } - * @default 1 - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - count?: number; - /** - * Key of added data. - * - * @type { ?(string | Array) } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - key?: string | Array; + /** + * How to operate added data. + * + * @type { DataOperationType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + type: DataOperationType; + /** + * Index of added data. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + index: number; + /** + * Count of added data in one operation + * Only validate for ADD and DELETE. + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + count?: number; + /** + * Key of added data. + * + * @type { ?(string | Array) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + key?: string | Array; } /** @@ -149,43 +121,35 @@ export interface DataAddOperation { * * @interface DataDeleteOperation * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export interface DataDeleteOperation { - /** - * How to operate deleted data. - * - * @type { DataOperationType.DELETE } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - type: DataOperationType; - /** - * Index of deleted data. - * - * @type { number } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - index: number; - /** - * Count of deleted data in one operation - * Only validate for ADD and DELETE. - * - * @type { ?number } - * @default 1 - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - count?: number; + /** + * How to operate deleted data. + * + * @type { DataOperationType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + type: DataOperationType; + /** + * Index of deleted data. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + index: number; + /** + * Count of deleted data in one operation + * Only validate for ADD and DELETE. + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + count?: number; } /** @@ -193,41 +157,33 @@ export interface DataDeleteOperation { * * @interface DataChangeOperation * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export interface DataChangeOperation { - /** - * How to operate changed data. - * - * @type { DataOperationType.CHANGE } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - type: DataOperationType; - /** - * Index of changed data. - * - * @type { number } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - index: number; - /** - * Key of changed data. - * - * @type { ?string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - key?: string; + /** + * How to operate changed data. + * + * @type { DataOperationType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + type: DataOperationType; + /** + * Index of changed data. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + index: number; + /** + * Key of changed data. + * + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + key?: string; } /** @@ -235,31 +191,25 @@ export interface DataChangeOperation { * * @interface MoveIndex * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export interface MoveIndex { - /** - * Index of moved data. - * - * @type { number } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - from: number; - /** - * Destination of moved data. - * - * @type { number } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - to: number; + /** + * Index of moved data. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + from: number; + /** + * Destination of moved data. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + to: number; } /** @@ -267,31 +217,25 @@ export interface MoveIndex { * * @interface ExchangeIndex * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export interface ExchangeIndex { - /** - * Index of the first exchange data. - * - * @type { number } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - start: number; - /** - * Index of the second exchange data. - * - * @type { number } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - end: number; + /** + * Index of the first exchange data. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + start: number; + /** + * Index of the second exchange data. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + end: number; } /** @@ -299,31 +243,25 @@ export interface ExchangeIndex { * * @interface ExchangeKey * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export interface ExchangeKey { - /** - * Key of the first exchange data. - * - * @type { string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - start: string; - /** - * Key of the second exchange data. - * - * @type { string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - end: string; + /** + * Key of the first exchange data. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + start: string; + /** + * Key of the second exchange data. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + end: string; } /** @@ -331,41 +269,33 @@ export interface ExchangeKey { * * @interface DataMoveOperation * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export interface DataMoveOperation { - /** - * How to operate moved data. - * - * @type { DataOperationType.MOVE } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - type: DataOperationType; - /** - * Index of moved data. - * - * @type { MoveIndex } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - index: MoveIndex; - /** - * Key of moved data. - * - * @type { ?string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - key?: string; + /** + * How to operate moved data. + * + * @type { DataOperationType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + type: DataOperationType; + /** + * Index of moved data. + * + * @type { MoveIndex } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + index: MoveIndex; + /** + * Key of moved data. + * + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + key?: string; } /** @@ -373,41 +303,33 @@ export interface DataMoveOperation { * * @interface DataExchangeOperation * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export interface DataExchangeOperation { - /** - * How to operate exchange data. - * - * @type { DataOperationType.EXCHANGE } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - type: DataOperationType; - /** - * Index of exchange data. - * - * @type { ExchangeIndex } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - index: ExchangeIndex; - /** - * Key of exchange data. - * - * @type { ?ExchangeKey } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - key?: ExchangeKey; + /** + * How to operate exchange data. + * + * @type { DataOperationType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + type: DataOperationType; + /** + * Index of exchange data. + * + * @type { ExchangeIndex } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + index: ExchangeIndex; + /** + * Key of exchange data. + * + * @type { ?ExchangeKey } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + key?: ExchangeKey; } /** @@ -415,21 +337,17 @@ export interface DataExchangeOperation { * * @interface DataReloadOperation * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export interface DataReloadOperation { - /** - * How to operate reload data. - * - * @type { DataOperationType.RELOAD } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - type: DataOperationType; + /** + * How to operate reload data. + * + * @type { DataOperationType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + type: DataOperationType; } /** @@ -438,8 +356,6 @@ export interface DataReloadOperation { * @typedef { DataAddOperation | DataDeleteOperation | DataChangeOperation | DataMoveOperation | DataExchangeOperation * | DataReloadOperation } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export type DataOperation = DataAddOperation | DataDeleteOperation | DataChangeOperation | DataMoveOperation | @@ -450,112 +366,98 @@ export type DataOperation = DataAddOperation | DataDeleteOperation | DataChangeO * * @interface DataChangeListener * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export interface DataChangeListener { - /** - * Data ready. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - onDataReloaded(): void - /** - * Data added. - * - * @param { number } index - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - * @deprecated since 8 - * @useinstead onDataAdd - */ - onDataAdded(index: number): void - /** - * Data added. - * - * @param { number } index - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - onDataAdd(index: number): void - /** - * Data moved. - * - * @param { number } from - * @param { number } to - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - * @deprecated since 8 - * @useinstead onDataMove - */ - onDataMoved(from: number, to: number): void - /** - * Data moved. - * - * @param { number } from - * @param { number } to - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - onDataMove(from: number, to: number): void - /** - * Data deleted. - * - * @param { number } index - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - * @deprecated since 8 - * @useinstead onDataDelete - */ - onDataDeleted(index: number): void - /** - * Data deleted. - * - * @param { number } index - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - onDataDelete(index: number): void - /** - * Call when has data change. - * - * @param { number } index - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - * @deprecated since 8 - * @useinstead onDataChange - */ - onDataChanged(index: number): void - /** - * Call when has data change. - * - * @param { number } index - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - onDataChange(index: number): void - /** - * Call when multiple data change. - * - * @param { DataOperation[] } dataOperations - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - onDatasetChange(dataOperations: Array): void + /** + * Data ready. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDataReloaded(): void; + /** + * Data added. + * + * @param { number } index + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + * @deprecated since 8 + * @useinstead onDataAdd + */ + onDataAdded(index: number): void; + /** + * Data added. + * + * @param { number } index + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDataAdd(index: number): void; + /** + * Data moved. + * + * @param { number } from + * @param { number } to + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + * @deprecated since 8 + * @useinstead onDataMove + */ + onDataMoved(from: number, to: number): void; + /** + * Data moved. + * + * @param { number } from + * @param { number } to + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDataMove(from: number, to: number): void; + /** + * Data deleted. + * + * @param { number } index + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + * @deprecated since 8 + * @useinstead onDataDelete + */ + onDataDeleted(index: number): void; + /** + * Data deleted. + * + * @param { number } index + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDataDelete(index: number): void; + /** + * Call when has data change. + * + * @param { number } index + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + * @deprecated since 8 + * @useinstead onDataChange + */ + onDataChanged(index: number): void; + /** + * Call when has data change. + * + * @param { number } index + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDataChange(index: number): void; + /** + * Call when multiple data change. + * + * @param { Array } dataOperations + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDatasetChange(dataOperations: Array): void; } /** @@ -563,80 +465,98 @@ export interface DataChangeListener { * * @interface IDataSource * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export interface IDataSource { - /** - * Total data count. - * - * @returns { number } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - totalCount(): number; - /** - * Return the data of index. - * - * @param { number } index - * @returns { any } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - getData(index: number): T; - /** - * Register data change listener. - * - * @param { DataChangeListener } listener - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - registerDataChangeListener(listener: DataChangeListener): void; - /** - * Unregister data change listener. - * - * @param { DataChangeListener } listener - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - */ - unregisterDataChangeListener(listener: DataChangeListener): void; + /** + * Total data count. + * + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + totalCount(): number; + /** + * Return the data of index. + * + * @param { number } index + * @returns { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + getData(index: number): T; + /** + * Register data change listener. + * + * @param { DataChangeListener } listener + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + registerDataChangeListener(listener: DataChangeListener): void; + /** + * Unregister data change listener. + * + * @param { DataChangeListener } listener + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + unregisterDataChangeListener(listener: DataChangeListener): void; } /** * declare ForEachAttribute * + * @interface LazyForEachAttribute * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ export interface LazyForEachAttribute {} +/** + * declare UILazyForEachAttribute + * + * @interface UILazyForEachAttribute + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface UILazyForEachAttribute {} + +/** + * Define item generator function. + * + * @typedef { function } ItemGeneratorFunc + * @param { T } item - item in an array + * @param { number } index - index corresponding to an array item. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare type ItemGeneratorFunc = (item: T, index: number) => void; + +/** + * Define key generator function. + * + * @typedef { function } KeyGeneratorFunc + * @param { T } item - item in an array + * @param { number } index - index corresponding to an array item. + * @returns {string} Character string generated based on item and index + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare type KeyGeneratorFunc = (item: T, index: number) => string; + /** * Enter the value to obtain the LazyForEach. * - * @param { IDataSource } dataSource - * @param { function } itemGenerator - * @param { function } keyGenerator - * @returns { LazyForEachAttribute } + * @param { IDataSource } dataSource - the array collection to be used in UI + * @param { ItemGeneratorFunc } itemGenerator - item generator function + * @param { KeyGeneratorFunc } [keyGenerator] - key generator function + * @returns { UILazyForEachAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ -@memo @ComponentBuilder export declare function LazyForEach(dataSource: IDataSource, - @memo - itemGenerator: (item: T, index: number) => void, - keyGenerator?: (item: T, index: number) => string, -): LazyForEachAttribute \ No newline at end of file + @Builder + itemGenerator: ItemGeneratorFunc, + keyGenerator?: KeyGeneratorFunc, +): UILazyForEachAttribute; \ No newline at end of file diff --git a/api/arkui/component/repeat.d.ets b/api/arkui/component/repeat.d.ets new file mode 100644 index 0000000000..d07b790666 --- /dev/null +++ b/api/arkui/component/repeat.d.ets @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2025 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. + */ +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + + +import { ComponentBuilder, Builder } from './builder'; + +/** + * Indicates the type of Repeat's Data Source. + * + * @typedef { Array | ReadonlyArray | Readonly> } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +type RepeatArray = Array | ReadonlyArray | Readonly>; +/** + * Function that return typed string to render one template. + * + * @typedef {function} TemplateTypedFunc + * @param { T } item - data item. + * @param { number } index - data index number in array. + * @returns { string } template type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +type TemplateTypedFunc = (item: T, index: number) => string; +/** + * Define builder function to render one template type. + * + * @typedef {function} RepeatItemBuilder + * @param { RepeatItem } repeatItem - the repeat item builder function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +@Builder +type RepeatItemBuilder = (repeatItem: RepeatItem) => void; + +/** + * Construct a new type for each item. + * + * @interface RepeatItem + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface RepeatItem { + /** + * The origin data. + * + * @type { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + item: T; + /** + * index of each item. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + index: number; +} + +/** + * Function that is used to do lazy loading. + * + * @typedef {function} OnLazyLoadingFunc + * @param { number } index - data index. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +type OnLazyLoadingFunc = (index: number) => void; + +/** + * Function that is used to get total count. + * + * @typedef {function} OnTotalCountFunc + * @returns { number } Returns the total data count + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +type OnTotalCountFunc = () => number; + +/** + * Define the options of repeat virtualScroll to implement reuse and lazy loading. + * + * @interface VirtualScrollOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface VirtualScrollOptions { + /** + * Total data count. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + totalCount?: number; + /** + * Reuse or not. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + reusable?: boolean; + /** + * Data lazy loading + * + * @type { ?OnLazyLoadingFunc } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onLazyLoading?: OnLazyLoadingFunc; + /** + * The function of total data count. + * + * @type { ?OnTotalCountFunc } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onTotalCount?: OnTotalCountFunc; +} + +/** + * Define a builder template option parameter. + * + * @interface TemplateOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface TemplateOptions { + /** + * The cached number of each template. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + cachedCount?: number; +} + +/** + * Defines the Repeat component attribute functions. + * + * @typedef UIRepeatAttribute + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface UIRepeatAttribute {} + +/** + * Indicates the type of Repeat. + * + * @param { RepeatArray } arr - The Data Source + * @returns { UIRepeatAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +@ComponentBuilder +export declare function Repeat(arr: RepeatArray): UIRepeatAttribute; \ No newline at end of file diff --git a/api/arkui/incremental/annotation/index.d.ets b/api/arkui/incremental/annotation/index.d.ets new file mode 100644 index 0000000000..b2135faa2d --- /dev/null +++ b/api/arkui/incremental/annotation/index.d.ets @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2025 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. + */ +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +import { __memo_context_type, __memo_id_type } from '../runtime/state'; \ No newline at end of file diff --git a/api/arkui/incremental/runtime/state.d.ets b/api/arkui/incremental/runtime/state.d.ets new file mode 100644 index 0000000000..a82332445e --- /dev/null +++ b/api/arkui/incremental/runtime/state.d.ets @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2025 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. + */ +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +/** + * Define the State interface to observed date changes. + * + * @interface State + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +interface State { + + /** + * Judge whether the state variable is modified. + * + * @type { boolean } + * @readonly + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + readonly modified: boolean; + + /** + * Get state variable value. + * + * @type { T } + * @readonly + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + readonly value: T; +} + +/** + * Define int alias. + * + * @typedef { int } __memo_id_type + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type __memo_id_type = int; + +/** + * Determine whether two values are equal. + * @typedef {function} Equivalent + * @param { T } oldV - the old value + * @param { T } newV - the new value + * @returns { boolean } - Returns the comparison result between old value and new value, + * if they are equal, return true; otherwise, return false. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type Equivalent = (oldV: T, newV: T) => boolean; + +/** + * Define the InternalScope interface to manage state management. + * + * @interface InternalScope + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface InternalScope { + + /** + * Get the flag whether the state variable is changed, true if internal value can be returned as is + * + * @type { boolean } + * @readonly + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + readonly unchanged: boolean; + + /** + * State variable cache, internal value if it is already computed + * + * @type { Value } + * @readonly + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + readonly cached: Value; + + /** + * Internal value updated after the computation. + * + * @param { Value } [newValue] - new value + * @returns { Value } return the Value from cached + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + recache(newValue?: Value): Value; + + /** + * Internal state for parameter. + * + * @param {int} index - index + * @param {T} value - the value to be updated + * @param {Equivalent} [equivalent] - determine whether two values are equal + * @param {string} [name] - state variable name + * @param {boolean} [contextLocal] - whether can get local context + * @returns {State} return state variable Value + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + param(index: int, value: T, equivalent?: Equivalent, name?: string, contextLocal?: boolean): State; +} + +/** + * Context of a state, keeping track of changes in the given scope. + * + * @interface StateContext + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export interface StateContext { + + /** + * The scope which is used to track the changes of state context. + * + * @param {int} id - state cotext id + * @param {T} paramCount - the count of param + * @returns {InternalScope} return state scope + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + scope(id: int, paramCount: int): InternalScope; +} + +/** + * Define StateContext alias. + * + * @typedef { StateContext } __memo_context_type + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export type __memo_context_type = StateContext; \ No newline at end of file diff --git a/api/arkui/stateManagement/runtime.d.ets b/api/arkui/stateManagement/runtime.d.ets index 6dddf7b14a..e705e39229 100644 --- a/api/arkui/stateManagement/runtime.d.ets +++ b/api/arkui/stateManagement/runtime.d.ets @@ -18,63 +18,5 @@ * @arkts 1.2 */ -import { LocalStorage } from '@ohos.arkui.stateManagement' -import { StateContext } from '../runtime-api/@koalaui.runtime.states.State' -// From incremental engine -@Retention({policy: "SOURCE"}) -export declare @interface memo {}; - -@Retention({policy: "SOURCE"}) -export @interface ComponentBuilder {} - -export type __memo_context_type = StateContext; -export type __memo_id_type = MemoCallSiteKey; - -export type MemoCallSiteKey = int; - -export interface Disposable { - readonly disposed: boolean; - dispose(): void; -} - -interface State { - readonly modified: boolean; - readonly value: T; -} - -export interface MutableState extends Disposable, State { - value: T; -} - -export type Equivalent = (oldV: T, newV: T) => boolean; - -export interface InternalScope { - readonly unchanged: boolean; - readonly cached: Value; - recache(newValue?: Value): Value; - param(index: int, value: T, equivalent?: Equivalent, name?: string, contextLocal?: boolean): State; -} - -// export interface StateContext { -// scope(id: MemoCallSiteKey, paramCount?: int): InternalScope; -// } - -// From Arkoala -export declare function propState(value?: T): SyncedProperty; -export declare function objectLinkState(value?: T): SyncedProperty; -export declare function stateOf(value: T): MutableState; -export declare function contextLocalStateOf(value: string, key: () => T): MutableState; -export declare function contextLocal(value: string): MutableState; -export declare function observableProxy(value: T): T; -export declare function StorageLinkState(storage: LocalStorage, name: string, value: T): MutableState -export declare function AppStorageLinkState(name: string, value: T): MutableState; - -export declare class SyncedProperty implements MutableState { - constructor(value: T | undefined, deepCopyOnUpdate: boolean); - dispose(): void; - get disposed(): boolean; - get modified(): boolean; - get value(): T; - set value(value: T); - update(value?: T): void; -} +export * from '../incremental/annotation/index'; +export * from '../incremental/runtime/state'; \ No newline at end of file diff --git a/api/arkui/stateManagement/storage/appStorage.d.ets b/api/arkui/stateManagement/storage/appStorage.d.ets new file mode 100644 index 0000000000..8ac2340a05 --- /dev/null +++ b/api/arkui/stateManagement/storage/appStorage.d.ets @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2025 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. + */ +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +import { LocalStorage } from './localStorage'; +import { AbstractProperty, SubscribedAbstractProperty } from '../decorator'; + +/** + * AppStorage singleton is sub-class of see LocalStorage for + * UI state of app-wide access and same life cycle as the app. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class AppStorage extends LocalStorage { + /** + * Obtain a handler or an alias to AppStorage property with given name. + * + * @param { string } propName AppStorage property name + * @param {Type} type - the data type + * @returns { AbstractProperty | undefined } AbstractProperty object if property with given name exists + * return undefined otherwise + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public static ref(propName: string, ttype: Type): AbstractProperty | undefined; + /** + * Obtain a handler or an alias to AppStorage property with given name. + * + * If property does not exist in AppStorage, create it with given default value. + * + * @param { string } propName AppStorage property name + * @param {T} defaultValue - default value + * @param {Type} ttype - data type + * @returns { AbstractProperty } AbstractProperty object + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public static setAndRef(propName: string, defaultValue: T, ttype: Type): AbstractProperty; + /** + * Create and return a two-way sync ("link") to named property + * + * @param { string } propName - name of source property in AppStorage + * @param {Type} ttype - data type + * @returns { SubscribedAbstractProperty } instance of SubscribedAbstractProperty + * return 'undefined' if named property does not already exist in AppStorage + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public static link(propName: string, ttype: Type): SubscribedAbstractProperty | undefined; + /** + * Create and initialize a new source property in AppStorage if missing + * Same as see LocalStorage.setAndLink() + * + * @param { string } propName - name of source property in AppStorage + * default value must be of type T, can be undefined or null. + * @param { T } defaultValue - value to be used for initializing new property in AppStorage + * @param {Type} type - data type + * @returns { SubscribedAbstractProperty } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public static setAndLink(propName: string, defaultValue: T, ttype: Type): SubscribedAbstractProperty; + /** + * Checks if AppStorage has a property with given name + * returns true if property with given name exists + * same as ES6 Map.prototype.has() + * Same as see LocalStorage.has() + * + * @param { string } propName - searched property + * @returns { boolean } true if property with such name exists in AppStorage + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public static has(propName: string): boolean; + /** + * Same as see LocalStorage.get() + * Obtain the value of property with given name, returns undefined if the property does not exist in AppStorage. + * + * @param { string } propName- property name + * @param {Type} type - data type + * @returns { T | undefined } property value of type T if found or undefined + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public static get(propName: string, ttype: Type): T | undefined; + /** + * Set value of given property in AppStorage + * Method sets nothing and returns false if property with this name does not exist in AppStorage + * newValue can be undefined or null from API 12. + * Same as see LocalStorage.set() + * + * @param { string } propName + * @param { T } newValue - must be of type T, can be undefined or null + * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public static set(propName: string, newValue: T): boolean; + /** + * Set value of given property, if it exists, see set() . + * Add property if no property with given name in AppStorage, and initialize with given value. + * newValue can be undefined or null from API 12 + * see LocalStorage.setOrCreate() + * + * @param { string } propName + * @param { T } newValue - must be of type T, can be undefined or null + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public static setOrCreate(propName: string, newValue: T): void; + /** + * Provide names of all properties in AppStorage + * same as ES6 Map.prototype.keys() + * Same as see LocalStorage.keys() + * + * @returns { IterableIterator } return a Map Iterator + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public static keys(): IterableIterator; + + /** + * Method returns the number of properties currently in AppStorage + * + * @returns { number } Returns the number of properties currently in AppStorage + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public static size(): number; + /** + * Delete property with given name from AppStorage + * Use with caution: + * Before deleting a prop from AppStorage all its subscribers need to + * unsubscribe from the property. + * This method fails and returns false if given property still has subscribers + * Another reason for failing is unknown property name. + * Developer advise: + * Subscribers to a property in AppStorage are created with see link(), see prop() + * and also via @StorageLink and @StorageProp state variable decorators. + * That means as long as their is a @Component instance that uses such decorated variable + * or a sync relationship with a SubscribedAbstractProperty variable the property can not + * (and also should not!) be deleted from AppStorage. + * Same as see LocalStorage.delete() + * + * @param { string } propName + * @returns { boolean } false if method failed + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public static delete(propName: string): boolean; + /** + * Delete all properties from the AppStorage. + * Precondition is that there are no subscribers, see Delete(). + * + * @returns { boolean } false and deletes no properties if there is any property + * that still has subscribers. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public static clear(): boolean; +} \ No newline at end of file diff --git a/api/arkui/stateManagement/storage/index.d.ets b/api/arkui/stateManagement/storage/index.d.ets new file mode 100644 index 0000000000..dc20e33a0b --- /dev/null +++ b/api/arkui/stateManagement/storage/index.d.ets @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2025 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. + */ +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +export * from './appStorage'; +export * from './localStorage'; \ No newline at end of file diff --git a/api/arkui/stateManagement/storage/localStorage.d.ets b/api/arkui/stateManagement/storage/localStorage.d.ets new file mode 100644 index 0000000000..560516123a --- /dev/null +++ b/api/arkui/stateManagement/storage/localStorage.d.ets @@ -0,0 +1,193 @@ +/* + * Copyright (C) 2025 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. + */ +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +import { AbstractProperty, SubscribedAbstractProperty } from '../decorator'; + +/** + * LocalStorage + * Class implements a Map of ObservableObjectBase UI state variables. + * Instances can be created to manage UI state within a limited "local" + * access, and life cycle as defined by the app. + * AppStorage singleton is sub-class of LocalStorage for + * UI state of app-wide access and same life cycle as the app. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class LocalStorage { + /** + * Construct new instance of LocalStorage + * initialize with all properties and their values that Object.keys(params) returns + * Property values must not be undefined. + * + * @param { Record } [initializingProperties] - Record containing keys and values. see set() for valid values + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public constructor(initializingProperties?: Record); + /** + * Obtain a handler or an alias to LocalStorage property with given name. + * + * @param { string } propName LocalStorage property name + * @param {Type} ttype - data type + * @returns { AbstractProperty | undefined } AbstractProperty object if property with given name exists + * return undefined otherwise. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public ref(propName: string, ttype: Type): AbstractProperty | undefined; + /** + * Obtain a handler or an alias to LocalStorage property with given name. + * + * If property does not exist in LocalStorage, create it with given default value. + * + * @param { string } propName LocalStorage property name + * @param { T } defaultValue If property does not exist in LocalStorage, + * create it with given default value. + * @param {Type} ttype - data type + * @returns { AbstractProperty } AbstractProperty object + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public setAndRef(propName: string, defaultValue: T, ttype: Type): AbstractProperty; + /** + * Create and return a two-way sync "(link") to named property + * + * @param { string } propName - name of source property in LocalStorage + * @param { Type } ttype - data type + * @returns { SubscribedAbstractProperty | undefined } instance of SubscribedAbstractProperty + * return undefined if named property does not already exist in LocalStorage + * Apps can use SDK functions of base class SubscribedPropertyAbstract + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 20 + */ + public link(propName: string, ttype: Type): SubscribedAbstractProperty | undefined; + + /** + * Like see link(), but will create and initialize a new source property in LocalStorage if missing + * + * @param { string } propName - name of source property in LocalStorage + * @param { T } defaultValue - value to be used for initializing new property in LocalStorage + * default value must be of type T, can be undefined or null. + * @param { Type } ttype - data type + * @returns { SubscribedAbstractProperty } instance of SubscribedAbstractProperty + * Apps can use SDK functions of base class SubscribedAbstractProperty + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public setAndLink(propName: string, defaultValue: T, ttype: Type): SubscribedAbstractProperty; + + /** + * Check if LocalStorage has a property with given name + * return true if property with given name exists + * same as ES6 Map.prototype.has() + * + * @param { string } propName - searched property + * @returns { boolean } true if property with such name exists in LocalStorage + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public has(propName: string): boolean; + /** + * Returns value of given property + * return undefined if no property with this name + * + * @param { string } propName - property name + * @param {Type} ttype - data type + * @returns { T | undefined } property value if found or undefined + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public get(propName: string, ttype: Type): T | undefined; + /** + * Set value of given property in LocalStorage + * Method sets nothing and returns false if property with this name does not exist in LocalStorage + * newValue can be undefined or null from API 20. + * + * @param { string } propName + * @param { T } newValue - must be of type T, can be undefined or null + * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public set(propName: string, newValue: T): boolean; + /** + * Set value of given property, if it exists, see set() . + * Add property if no property with given name and initialize with given value. + * newValue can be undefined or null from API 12 + * + * @param { string } propName + * @param { T } newValue - must be of type T, can be undefined or null + * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public setOrCreate(propName: string, newValue: T): boolean; + /** + * Provide names of all properties in LocalStorage + * same as ES6 Map.prototype.keys() + * + * @returns { IterableIterator } return a Map Iterator + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public keys(): IterableIterator; + /** + * Returns number of properties in LocalStorage + * same as Map.prototype.size() + * + * @returns { number } return number of properties + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public size(): number; + /** + * Delete property from StorageBase + * Use with caution: + * Before deleting a prop from LocalStorage all its subscribers need to + * unsubscribe from the property. + * This method fails and returns false if given property still has subscribers + * Another reason for failing is unknown property. + * Developer advise: + * Subscribers are created with see link(), see prop() + * and also via @LocalStorageLink and @LocalStorageProp state variable decorators. + * That means as long as their is a @Component instance that uses such decorated variable + * or a sync relationship with a SubscribedAbstractProperty variable the property can nit + * (and also should not!) be deleted from LocalStorage. + * + * @param { string } propName + * @returns { boolean } false if method failed + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public delete(propName: string): boolean; + /** + * Delete all properties from the LocalStorage instance + * Precondition is that there are no subscribers. + * method returns false and deletes no properties if there is any property + * that still has subscribers + * + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public clear(): boolean; +} \ No newline at end of file -- Gitee