From 46b2879ffa726ca931bd93925b258c7a7341f0ea Mon Sep 17 00:00:00 2001 From: chenbenzhi Date: Thu, 21 Aug 2025 11:53:00 +0800 Subject: [PATCH] add StateMgmet 12 0728 Signed-off-by: chenbenzhi --- .../component/ets/state_management.d.ts | 37 ++++++------------- api/@ohos.arkui.component.d.ets | 1 - ... @ohos.arkui.stateManagement.static.d.ets} | 1 + .../{builder.d.ets => builder.static.d.ets} | 1 + api/arkui/component/interop.static.d.ets | 1 + ...decorator.d.ets => decorator.static.d.ets} | 1 + ...pStorage.d.ets => appStorage.static.d.ets} | 11 +++++- ...ronment.d.ets => environment.static.d.ets} | 1 + ...torage.d.ets => localStorage.static.d.ets} | 1 + ...e.d.ets => persistentStorage.static.d.ets} | 1 + ...rty.d.ets => storageProperty.static.d.ets} | 3 +- .../{utils.d.ets => utils.static.d.ets} | 0 12 files changed, 31 insertions(+), 28 deletions(-) rename api/{@ohos.arkui.stateManagement.d.ets => @ohos.arkui.stateManagement.static.d.ets} (96%) rename api/arkui/component/{builder.d.ets => builder.static.d.ets} (95%) rename api/arkui/stateManagement/{decorator.d.ets => decorator.static.d.ets} (99%) rename api/arkui/stateManagement/storage/{appStorage.d.ets => appStorage.static.d.ets} (71%) rename api/arkui/stateManagement/storage/{environment.d.ets => environment.static.d.ets} (99%) rename api/arkui/stateManagement/storage/{localStorage.d.ets => localStorage.static.d.ets} (99%) rename api/arkui/stateManagement/storage/{persistentStorage.d.ets => persistentStorage.static.d.ets} (99%) rename api/arkui/stateManagement/storage/{storageProperty.d.ets => storageProperty.static.d.ets} (96%) rename api/arkui/stateManagement/{utils.d.ets => utils.static.d.ets} (100%) diff --git a/api/@internal/component/ets/state_management.d.ts b/api/@internal/component/ets/state_management.d.ts index 9edb4e29fa..8fa2bcf540 100644 --- a/api/@internal/component/ets/state_management.d.ts +++ b/api/@internal/component/ets/state_management.d.ts @@ -31,8 +31,7 @@ * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ declare enum ColorMode { /** @@ -46,8 +45,7 @@ declare enum ColorMode { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ LIGHT = 0, @@ -62,8 +60,7 @@ declare enum ColorMode { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ DARK, } @@ -81,8 +78,7 @@ declare enum ColorMode { * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ declare enum LayoutDirection { /** @@ -96,8 +92,7 @@ declare enum LayoutDirection { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ LTR, @@ -112,8 +107,7 @@ declare enum LayoutDirection { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ RTL, @@ -128,8 +122,7 @@ declare enum LayoutDirection { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ Auto, } @@ -139,8 +132,7 @@ declare enum LayoutDirection { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ declare class Storage { /** @@ -150,8 +142,7 @@ declare class Storage { * @param { string } file * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ constructor(needCrossThread?: boolean, file?: string); @@ -162,8 +153,7 @@ declare class Storage { * @returns { string | undefined } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ get(key: string): string | undefined; @@ -186,7 +176,6 @@ declare class Storage { * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi * @since 20 - * @arkts 1.2 */ set(key: string, val: Object | undefined | null): void; @@ -195,8 +184,7 @@ declare class Storage { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ clear(): void; @@ -206,8 +194,7 @@ declare class Storage { * @param { string } key * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ delete(key: string): void; } diff --git a/api/@ohos.arkui.component.d.ets b/api/@ohos.arkui.component.d.ets index 5a7ce4bda1..d3b2e5e162 100644 --- a/api/@ohos.arkui.component.d.ets +++ b/api/@ohos.arkui.component.d.ets @@ -126,7 +126,6 @@ export * from './arkui/component/sidebar'; export * from './arkui/component/slider'; export * from './arkui/component/span'; export * from './arkui/component/stack'; -export * from './arkui/component/stateManagement'; export * from './arkui/component/stepper'; export * from './arkui/component/stepperItem'; export * from './arkui/component/styledString'; diff --git a/api/@ohos.arkui.stateManagement.d.ets b/api/@ohos.arkui.stateManagement.static.d.ets similarity index 96% rename from api/@ohos.arkui.stateManagement.d.ets rename to api/@ohos.arkui.stateManagement.static.d.ets index 94b7c1ab1e..4f8e84173b 100644 --- a/api/@ohos.arkui.stateManagement.d.ets +++ b/api/@ohos.arkui.stateManagement.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/component/builder.d.ets b/api/arkui/component/builder.static.d.ets similarity index 95% rename from api/arkui/component/builder.d.ets rename to api/arkui/component/builder.static.d.ets index fcebce52ef..1095b64dd5 100755 --- a/api/arkui/component/builder.d.ets +++ b/api/arkui/component/builder.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/component/interop.static.d.ets b/api/arkui/component/interop.static.d.ets index f03275f6d8..3bffbf685c 100644 --- a/api/arkui/component/interop.static.d.ets +++ b/api/arkui/component/interop.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/stateManagement/decorator.d.ets b/api/arkui/stateManagement/decorator.static.d.ets similarity index 99% rename from api/arkui/stateManagement/decorator.d.ets rename to api/arkui/stateManagement/decorator.static.d.ets index 90e4d70514..11bdf1cccb 100644 --- a/api/arkui/stateManagement/decorator.d.ets +++ b/api/arkui/stateManagement/decorator.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/stateManagement/storage/appStorage.d.ets b/api/arkui/stateManagement/storage/appStorage.static.d.ets similarity index 71% rename from api/arkui/stateManagement/storage/appStorage.d.ets rename to api/arkui/stateManagement/storage/appStorage.static.d.ets index 5d4694d004..03ae064a18 100644 --- a/api/arkui/stateManagement/storage/appStorage.d.ets +++ b/api/arkui/stateManagement/storage/appStorage.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,4 +21,12 @@ import { LocalStorage } from './localStorage'; -export const AppStorage: LocalStorage = new LocalStorage(); \ No newline at end of file +/** + * AppStorage singleton is sub-class of see LocalStorage for + * UI state of app-wide access and same life cycle as the app. + * + * @type { LocalStorage } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare const AppStorage: LocalStorage; \ No newline at end of file diff --git a/api/arkui/stateManagement/storage/environment.d.ets b/api/arkui/stateManagement/storage/environment.static.d.ets similarity index 99% rename from api/arkui/stateManagement/storage/environment.d.ets rename to api/arkui/stateManagement/storage/environment.static.d.ets index 0a5fef29db..fd11a44bf7 100644 --- a/api/arkui/stateManagement/storage/environment.d.ets +++ b/api/arkui/stateManagement/storage/environment.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"), diff --git a/api/arkui/stateManagement/storage/localStorage.d.ets b/api/arkui/stateManagement/storage/localStorage.static.d.ets similarity index 99% rename from api/arkui/stateManagement/storage/localStorage.d.ets rename to api/arkui/stateManagement/storage/localStorage.static.d.ets index 5a02a1a379..0e0c051f9d 100644 --- a/api/arkui/stateManagement/storage/localStorage.d.ets +++ b/api/arkui/stateManagement/storage/localStorage.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/stateManagement/storage/persistentStorage.d.ets b/api/arkui/stateManagement/storage/persistentStorage.static.d.ets similarity index 99% rename from api/arkui/stateManagement/storage/persistentStorage.d.ets rename to api/arkui/stateManagement/storage/persistentStorage.static.d.ets index b9bda0af68..724d5aa379 100644 --- a/api/arkui/stateManagement/storage/persistentStorage.d.ets +++ b/api/arkui/stateManagement/storage/persistentStorage.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"), diff --git a/api/arkui/stateManagement/storage/storageProperty.d.ets b/api/arkui/stateManagement/storage/storageProperty.static.d.ets similarity index 96% rename from api/arkui/stateManagement/storage/storageProperty.d.ets rename to api/arkui/stateManagement/storage/storageProperty.static.d.ets index 56e874225e..bbff562c81 100644 --- a/api/arkui/stateManagement/storage/storageProperty.d.ets +++ b/api/arkui/stateManagement/storage/storageProperty.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -57,7 +58,7 @@ export interface AbstractProperty { * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 20 */ - get(): T { return undefined; }; + get(): T; /** * Assign a new value to the referenced property diff --git a/api/arkui/stateManagement/utils.d.ets b/api/arkui/stateManagement/utils.static.d.ets similarity index 100% rename from api/arkui/stateManagement/utils.d.ets rename to api/arkui/stateManagement/utils.static.d.ets -- Gitee