Files
AFFiNE-Mirror/blocksuite/framework/store/src/model/doc.ts
Saul-Mirone 267bb3a975 refactor(editor): introduce store container to make implement doc easier (#12146)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Introduced a new store management system for handling document stores, improving efficiency and flexibility when working with document data.

- **Refactor**
  - Updated internal store handling to use a centralized store container, simplifying store retrieval and removal across various components.
  - Renamed and updated several store-related method signatures for consistency and clarity.
  - Replaced editor extension loading logic with a new local implementation for better modularity.

- **Chores**
  - Improved and streamlined the export of store-related modules for better maintainability.
  - Removed obsolete and redundant code related to previous store management approaches.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-07 06:08:43 +00:00

37 lines
932 B
TypeScript

import type * as Y from 'yjs';
import type { AwarenessStore } from '../yjs/awareness.js';
import type { YBlock } from './block/types.js';
import type { Store, StoreOptions } from './store/store.js';
import type { Workspace } from './workspace.js';
import type { DocMeta } from './workspace-meta.js';
export type GetStoreOptions = Omit<StoreOptions, 'schema' | 'doc'>;
export type RemoveStoreOptions = Pick<
StoreOptions,
'query' | 'id' | 'readonly'
>;
export interface Doc {
readonly id: string;
get meta(): DocMeta | undefined;
remove(): void;
load(initFn?: () => void): void;
get ready(): boolean;
dispose(): void;
clear(): void;
getStore(options?: GetStoreOptions): Store;
removeStore(options: RemoveStoreOptions): void;
get loaded(): boolean;
get awarenessStore(): AwarenessStore;
get workspace(): Workspace;
get rootDoc(): Y.Doc;
get spaceDoc(): Y.Doc;
get yBlocks(): Y.Map<YBlock>;
}