From e7831d14156ec12dbf36348d1a6b85cced691f09 Mon Sep 17 00:00:00 2001 From: sokolovairina Date: Tue, 12 Aug 2025 15:58:46 +0300 Subject: [PATCH] ArkUI: add new property decorators and BuilderLambda annotation, enforce Memo plugin hard requirement Signed-off-by: sokolovairina --- .../stateManagement/decorator.static.d.ets | 156 +++++++++++++++++- 1 file changed, 152 insertions(+), 4 deletions(-) diff --git a/api/arkui/stateManagement/decorator.static.d.ets b/api/arkui/stateManagement/decorator.static.d.ets index b45e059060..d52fe8fb7b 100644 --- a/api/arkui/stateManagement/decorator.static.d.ets +++ b/api/arkui/stateManagement/decorator.static.d.ets @@ -20,6 +20,8 @@ */ import { ExtendableComponent } from '../component/extendableComponent'; +import { LocalStorage } from './storage/localStorage'; +import { SubscribedAbstractProperty } from './storage/storageProperty' /** * Defining State annotation @@ -30,6 +32,20 @@ import { ExtendableComponent } from '../component/extendableComponent'; @Retention({policy: "SOURCE"}) export declare @interface State {}; +/** + * Defining BuilderLambda annotation + * BuilderLambda is used to mark a lambda function (builder function) that constructs + * and returns UI elements or components dynamically at runtime. + * The `name` property specifies the identifier of the builder, which can be + * referenced or invoked in other parts of the component or by the framework. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +@Retention({policy: "SOURCE"}) +export @interface BuilderLambda { + name: string +} + /** * Defining Prop annotation * Prop is an annotation which is mutable, and its changes will not be synchronized to the parent component. @@ -1245,10 +1261,6 @@ export declare interface AbstractProperty extends IDecoratedMutableVariable extends AbstractProperty { - aboutToBeDeleted(): void; -} - /** * Defines Computed decoration variable interface. * @@ -1301,3 +1313,139 @@ export declare interface IMonitorPathInfo { */ valueCallback: MonitorValueCallback; } + +export declare class PlainStructProperty implements SubscribedAbstractProperty { + constructor(name: string, value?: Value) + init(value: Value | undefined): void + info(): string + get(): Value + set(value: Value): void + subscribe(listener: () => void): void + unsubscribe(listener: () => void): void + aboutToBeDeleted(): void +} + +export declare class BuilderParamDecoratorProperty implements SubscribedAbstractProperty { + constructor(name: string, value?: Value) + init(value: Value | undefined): void + info(): string + get(): Value + set(value: Value): void + subscribe(listener: () => void): void + unsubscribe(listener: () => void): void + aboutToBeDeleted(): void +} + +export declare class LinkDecoratorProperty implements SubscribedAbstractProperty { + constructor(name: string, listener?: () => void) + linkTo(property: Value | SubscribedAbstractProperty | undefined): void + info(): string + get(): Value + set(value: Value): void + subscribe(listener: () => void): void + unsubscribe(listener: () => void): void + aboutToBeDeleted(): void +} + +export declare class StateDecoratorProperty implements SubscribedAbstractProperty { + constructor(name: string, listener?: () => void) + init(value?: Value, initial?: Value): void + info(): string + get(): Value + set(value: Value): void + subscribe(listener: () => void): void + unsubscribe(listener: () => void): void + aboutToBeDeleted(): void +} + +export declare class PropDecoratorProperty implements SubscribedAbstractProperty { + constructor(name: string, listener?: () => void) + init(value?: Value, initial?: Value): void + update(value?: Value): void + info(): string + get(): Value + set(value: Value): void + subscribe(listener: () => void): void + unsubscribe(listener: () => void): void + aboutToBeDeleted(): void +} + +export declare class ObjectLinkDecoratorProperty implements SubscribedAbstractProperty { + constructor(name: string, listener?: () => void) + init(value?: Value, initial?: Value): void + update(value?: Value): void + info(): string + get(): Value + set(value: Value): void + subscribe(listener: () => void): void + unsubscribe(listener: () => void): void + aboutToBeDeleted(): void +} + +export declare class ProvideDecoratorProperty implements SubscribedAbstractProperty { + constructor(name: string, listener?: () => void) + init(value?: Value, initial?: Value): void + provide(provideKey?: string): void + checkOverrides(provideKey?: string): void + info(): string + get(): Value + set(value: Value): void + subscribe(listener: () => void): void + unsubscribe(listener: () => void): void + aboutToBeDeleted(): void +} + +export declare class ConsumeDecoratorProperty implements SubscribedAbstractProperty { + constructor(name: string, listener?: () => void) + init(provideKey?: string): void + info(): string + get(): Value + set(value: Value): void + subscribe(listener: () => void): void + unsubscribe(listener: () => void): void + aboutToBeDeleted(): void +} + +export declare class StorageLinkDecoratorProperty implements SubscribedAbstractProperty { + constructor(name: string, listener?: () => void) + init(value: Value, storageKey?: string): void + info(): string + get(): Value + set(value: Value): void + subscribe(listener: () => void): void + unsubscribe(listener: () => void): void + aboutToBeDeleted(): void +} + +export declare class LocalStorageLinkDecoratorProperty implements SubscribedAbstractProperty { + constructor(name: string, listener?: () => void) + init(value: Value, storage: LocalStorage, storageKey?: string): void + info(): string + get(): Value + set(value: Value): void + subscribe(listener: () => void): void + unsubscribe(listener: () => void): void + aboutToBeDeleted(): void +} + +export declare class StoragePropDecoratorProperty implements SubscribedAbstractProperty { + constructor(name: string, listener?: () => void) + init(value: Value, storageKey?: string): void + info(): string + get(): Value + set(value: Value): void + subscribe(listener: () => void): void + unsubscribe(listener: () => void): void + aboutToBeDeleted(): void +} + +export declare class LocalStoragePropDecoratorProperty implements SubscribedAbstractProperty { + constructor(name: string, listener?: () => void) + init(value: Value, storage: LocalStorage, storageKey?: string): void + info(): string + get(): Value + set(value: Value): void + subscribe(listener: () => void): void + unsubscribe(listener: () => void): void + aboutToBeDeleted(): void +} \ No newline at end of file -- Gitee