From c4b3f2af594589e8b89ad3dfcaae90ffa6054882 Mon Sep 17 00:00:00 2001 From: QQ Date: Wed, 11 Nov 2026 22:28:28 +0800 Subject: [PATCH] Import lib/types/client/store-core.d.ts --- lib/types/client/store-core.d.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lib/types/client/store-core.d.ts diff --git a/lib/types/client/store-core.d.ts b/lib/types/client/store-core.d.ts new file mode 100644 index 0000000..4ad0661 --- /dev/null +++ b/lib/types/client/store-core.d.ts @@ -0,0 +1,25 @@ +/** + * Pure expansion-state transforms for the workspace-groups store. Kept free + * of any runtime import so both the store (which binds them via defineStore) + * and unit tests (which exercise them directly) share one implementation. + * + * Expansion semantics follow the official ui-workspace store: collapse + * WRITES `false` (never deletes the key). The browser's auto-expand guard + * uses `Object.hasOwn` — a present `false` means "user deliberately + * collapsed this" and must NOT be re-expanded; only a fully absent key means + * "never touched" and may auto-expand. (Earlier versions deleted the key on + * collapse, which made the current category/workspace impossible to fold.) + */ +/** Workspace-groups browser viewing state persisted across surface remounts and reloads. */ +export interface GroupsViewState { + /** Category folder expansion keyed by category label (absent = never touched). */ + categoryExpansion: Record; + /** Workspace folder expansion keyed by workspace id (absent = never touched). */ + workspaceExpansion: Record; +} +/** Collapse writes `false` (key retained); expand writes `true`. */ +export declare function setCategoryExpandedImpl(state: GroupsViewState, key: string, expanded: boolean): void; +/** Collapse writes `false` (key retained); expand writes `true`. */ +export declare function setWorkspaceExpandedImpl(state: GroupsViewState, key: string, expanded: boolean): void; +/** Drop expansion keys that no longer exist (renames/deletes/config edits). */ +export declare function retainKeysImpl(state: GroupsViewState, categoryKeys: readonly string[], workspaceKeys: readonly string[]): void;