refactor(editor): reorg code structure of store package (#9525)

This commit is contained in:
Saul-Mirone
2025-01-05 12:49:02 +00:00
parent 1180e9bc15
commit 3d168ba2d2
55 changed files with 618 additions and 635 deletions

View File

@@ -1,4 +1,10 @@
export { createAutoIncrementIdGenerator } from '../utils/id-generator.js';
import type { IdGenerator } from '../utils/id-generator.js';
export * from './test-doc.js';
export * from './test-meta.js';
export * from './test-workspace.js';
export function createAutoIncrementIdGenerator(): IdGenerator {
let i = 0;
return () => (i++).toString();
}

View File

@@ -2,10 +2,10 @@ import { type Disposable, Slot } from '@blocksuite/global/utils';
import { signal } from '@preact/signals-core';
import * as Y from 'yjs';
import { Blocks } from '../store/doc/doc.js';
import type { YBlock } from '../store/doc/index.js';
import type { Query } from '../store/doc/query.js';
import type { Doc, GetBlocksOptions, Workspace } from '../store/workspace.js';
import type { YBlock } from '../model/block/types.js';
import { Blocks } from '../model/blocks/blocks.js';
import type { Query } from '../model/blocks/query.js';
import type { Doc, GetBlocksOptions, Workspace } from '../model/index.js';
import type { AwarenessStore } from '../yjs/index.js';
type DocOptions = {

View File

@@ -1,16 +1,18 @@
import { Slot } from '@blocksuite/global/utils';
import type * as Y from 'yjs';
import { COLLECTION_VERSION, PAGE_VERSION } from '../consts.js';
import { createYProxy } from '../reactive/proxy.js';
import type {
DocMeta,
DocsPropertiesMeta,
Workspace,
WorkspaceMeta,
} from '../store/workspace.js';
} from '../model/index.js';
import { createYProxy } from '../reactive/proxy.js';
export type DocCollectionMetaState = {
const COLLECTION_VERSION = 2;
const PAGE_VERSION = 2;
type DocCollectionMetaState = {
pages?: unknown[];
properties?: DocsPropertiesMeta;
workspaceVersion?: number;

View File

@@ -16,14 +16,14 @@ import merge from 'lodash.merge';
import { Awareness } from 'y-protocols/awareness.js';
import * as Y from 'yjs';
import type {
Blocks,
CreateBlocksOptions,
GetBlocksOptions,
Workspace,
WorkspaceMeta,
} from '../model/index.js';
import type { Schema } from '../schema/index.js';
import {
type Blocks,
type CreateBlocksOptions,
type GetBlocksOptions,
type Workspace,
type WorkspaceMeta,
} from '../store/index.js';
import { type IdGenerator, nanoid } from '../utils/id-generator.js';
import { AwarenessStore, type RawAwarenessState } from '../yjs/index.js';
import { TestDoc } from './test-doc.js';