feat: bump blocksuite (#6010)

This commit is contained in:
Chen
2024-03-05 14:19:11 +08:00
committed by GitHub
parent 43813d7f86
commit ebf7a74387
23 changed files with 328 additions and 190 deletions

View File

@@ -3,8 +3,8 @@
"private": true,
"type": "module",
"devDependencies": {
"@blocksuite/global": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/store": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/global": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/store": "0.12.0-canary-202403050308-3789d0e",
"react": "18.2.0",
"react-dom": "18.2.0",
"vitest": "1.3.1"

View File

@@ -17,9 +17,9 @@
"@affine/debug": "workspace:*",
"@affine/env": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/blocks": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/global": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/store": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/blocks": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/global": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/store": "0.12.0-canary-202403050308-3789d0e",
"foxact": "^0.2.31",
"jotai": "^2.6.5",
"jotai-effect": "^0.6.0",
@@ -33,8 +33,8 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/lit": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/presets": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/lit": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/presets": "0.12.0-canary-202403050308-3789d0e",
"@testing-library/react": "^14.2.1",
"async-call-rpc": "^6.4.0",
"react": "^18.2.0",

View File

@@ -15,12 +15,27 @@ import { replaceIdMiddleware } from './middleware';
export function initEmptyPage(page: Doc, title?: string) {
page.load(() => {
const pageBlockId = page.addBlock('affine:page', {
title: new page.Text(title ?? ''),
});
page.addBlock('affine:surface', {}, pageBlockId);
const noteBlockId = page.addBlock('affine:note', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, noteBlockId);
const pageBlockId = page.addBlock(
'affine:page' as keyof BlockSuite.BlockModels,
{
title: new page.Text(title ?? ''),
}
);
page.addBlock(
'affine:surface' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
const noteBlockId = page.addBlock(
'affine:note' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
page.addBlock(
'affine:paragraph' as keyof BlockSuite.BlockModels,
{},
noteBlockId
);
});
}

View File

@@ -26,7 +26,7 @@ describe('Workspace System', () => {
id: 'page0',
});
page.load();
page.addBlock('affine:page', {
page.addBlock('affine:page' as keyof BlockSuite.BlockModels, {
title: new page.Text('test-page'),
});

View File

@@ -46,12 +46,27 @@ describe('SyncEngine', () => {
id: 'page0',
});
page.load();
const pageBlockId = page.addBlock('affine:page', {
title: new page.Text(''),
});
page.addBlock('affine:surface', {}, pageBlockId);
const frameId = page.addBlock('affine:note', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId);
const pageBlockId = page.addBlock(
'affine:page' as keyof BlockSuite.BlockModels,
{
title: new page.Text(''),
}
);
page.addBlock(
'affine:surface' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
const frameId = page.addBlock(
'affine:note' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
page.addBlock(
'affine:paragraph' as keyof BlockSuite.BlockModels,
{},
frameId
);
await syncEngine.waitForSynced();
syncEngine.forceStop();
prev = workspace.doc.toJSON();

View File

@@ -39,12 +39,27 @@ describe('SyncPeer', () => {
id: 'page0',
});
page.load();
const pageBlockId = page.addBlock('affine:page', {
title: new page.Text(''),
});
page.addBlock('affine:surface', {}, pageBlockId);
const frameId = page.addBlock('affine:note', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId);
const pageBlockId = page.addBlock(
'affine:page' as keyof BlockSuite.BlockModels,
{
title: new page.Text(''),
}
);
page.addBlock(
'affine:surface' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
const frameId = page.addBlock(
'affine:note' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
page.addBlock(
'affine:paragraph' as keyof BlockSuite.BlockModels,
{},
frameId
);
await syncPeer.waitForSynced();
syncPeer.stop();
prev = workspace.doc.toJSON();
@@ -91,7 +106,7 @@ describe('SyncPeer', () => {
expect(syncPeer.status.step).toBe(SyncPeerStep.LoadingSubDoc);
page.load();
await syncPeer.waitForSynced();
page.addBlock('affine:page', {
page.addBlock('affine:page' as keyof BlockSuite.BlockModels, {
title: new page.Text(''),
});
expect(syncPeer.status.step).toBe(SyncPeerStep.Syncing);

View File

@@ -1,6 +1,6 @@
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import { AffineSchemas } from '@blocksuite/blocks/schemas';
import { Schema } from '@blocksuite/store';
export const globalBlockSuiteSchema = new Schema();
globalBlockSuiteSchema.register(AffineSchemas).register(__unstableSchemas);
globalBlockSuiteSchema.register(AffineSchemas);

View File

@@ -32,14 +32,14 @@
}
},
"dependencies": {
"@blocksuite/global": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/global": "0.12.0-canary-202403050308-3789d0e",
"idb": "^8.0.0",
"nanoid": "^5.0.6",
"y-provider": "workspace:*"
},
"devDependencies": {
"@blocksuite/blocks": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/store": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/blocks": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/store": "0.12.0-canary-202403050308-3789d0e",
"fake-indexeddb": "^5.0.2",
"vite": "^5.1.4",
"vite-plugin-dts": "3.7.3",

View File

@@ -5,7 +5,7 @@ import 'fake-indexeddb/auto';
import { setTimeout } from 'node:timers/promises';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import { AffineSchemas } from '@blocksuite/blocks/schemas';
import { assertExists } from '@blocksuite/global/utils';
import type { Doc } from '@blocksuite/store';
import { Schema, Workspace } from '@blocksuite/store';
@@ -28,12 +28,27 @@ import {
} from '../index';
function initEmptyPage(page: Doc) {
const pageBlockId = page.addBlock('affine:page', {
title: new page.Text(''),
});
const surfaceBlockId = page.addBlock('affine:surface', {}, pageBlockId);
const frameBlockId = page.addBlock('affine:note', {}, pageBlockId);
const paragraphBlockId = page.addBlock('affine:paragraph', {}, frameBlockId);
const pageBlockId = page.addBlock(
'affine:page' as keyof BlockSuite.BlockModels,
{
title: new page.Text(''),
}
);
const surfaceBlockId = page.addBlock(
'affine:surface' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
const frameBlockId = page.addBlock(
'affine:note' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
const paragraphBlockId = page.addBlock(
'affine:paragraph' as keyof BlockSuite.BlockModels,
{},
frameBlockId
);
return {
pageBlockId,
surfaceBlockId,
@@ -59,7 +74,7 @@ const rootDBName = DEFAULT_DB_NAME;
const schema = new Schema();
schema.register(AffineSchemas).register(__unstableSchemas);
schema.register(AffineSchemas);
beforeEach(() => {
id = nanoid();
@@ -101,9 +116,20 @@ describe('indexeddb provider', () => {
});
const page = workspace.createDoc({ id: 'page0' });
page.load();
const pageBlockId = page.addBlock('affine:page', {});
const frameId = page.addBlock('affine:note', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId);
const pageBlockId = page.addBlock(
'affine:page' as keyof BlockSuite.BlockModels,
{}
);
const frameId = page.addBlock(
'affine:note' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
page.addBlock(
'affine:paragraph' as keyof BlockSuite.BlockModels,
{},
frameId
);
}
await setTimeout(200);
{
@@ -149,9 +175,19 @@ describe('indexeddb provider', () => {
{
const page = workspace.createDoc({ id: 'page0' });
page.load();
const pageBlockId = page.addBlock('affine:page');
const frameId = page.addBlock('affine:note', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId);
const pageBlockId = page.addBlock(
'affine:page' as keyof BlockSuite.BlockModels
);
const frameId = page.addBlock(
'affine:note' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
page.addBlock(
'affine:paragraph' as keyof BlockSuite.BlockModels,
{},
frameId
);
}
{
const updates = await getUpdates(workspace.id);
@@ -204,10 +240,20 @@ describe('indexeddb provider', () => {
{
const page = workspace.createDoc({ id: 'page0' });
page.load();
const pageBlockId = page.addBlock('affine:page');
const frameId = page.addBlock('affine:note', {}, pageBlockId);
const pageBlockId = page.addBlock(
'affine:page' as keyof BlockSuite.BlockModels
);
const frameId = page.addBlock(
'affine:note' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
for (let i = 0; i < 99; i++) {
page.addBlock('affine:paragraph', {}, frameId);
page.addBlock(
'affine:paragraph' as keyof BlockSuite.BlockModels,
{},
frameId
);
}
}
await setTimeout(200);

View File

@@ -24,7 +24,7 @@
"build": "vite build"
},
"devDependencies": {
"@blocksuite/store": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/store": "0.12.0-canary-202403050308-3789d0e",
"vite": "^5.1.4",
"vite-plugin-dts": "3.7.3",
"vitest": "1.3.1",

View File

@@ -72,12 +72,12 @@
"uuid": "^9.0.1"
},
"devDependencies": {
"@blocksuite/blocks": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/global": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/blocks": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/global": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/icons": "2.1.44",
"@blocksuite/lit": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/presets": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/store": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/lit": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/presets": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/store": "0.12.0-canary-202403050308-3789d0e",
"@storybook/addon-actions": "^7.6.17",
"@storybook/addon-essentials": "^7.6.17",
"@storybook/addon-interactions": "^7.6.17",

View File

@@ -6,7 +6,7 @@ const require = createRequire(import.meta.url);
const packageJson = require('../package.json');
const editorFlags: BlockSuiteFeatureFlags = {
enable_synced_doc_block: false,
enable_synced_doc_block: true,
enable_expand_database_block: false,
enable_bultin_ledits: false,
};

View File

@@ -25,14 +25,14 @@
"@affine/i18n": "workspace:*",
"@affine/templates": "workspace:*",
"@affine/workspace-impl": "workspace:*",
"@blocksuite/block-std": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/blocks": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/global": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/block-std": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/blocks": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/global": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/icons": "2.1.44",
"@blocksuite/inline": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/lit": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/presets": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/store": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/inline": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/lit": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/presets": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/store": "0.12.0-canary-202403050308-3789d0e",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/modifiers": "^7.0.0",
"@dnd-kit/sortable": "^8.0.0",

View File

@@ -3,7 +3,7 @@
*/
import 'fake-indexeddb/auto';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import { AffineSchemas } from '@blocksuite/blocks/schemas';
import { assertExists } from '@blocksuite/global/utils';
import type { Doc } from '@blocksuite/store';
import { Schema, Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
@@ -16,7 +16,7 @@ import { useBlockSuitePagePreview } from '../use-block-suite-page-preview';
let blockSuiteWorkspace: BlockSuiteWorkspace;
const schema = new Schema();
schema.register(AffineSchemas).register(__unstableSchemas);
schema.register(AffineSchemas);
beforeEach(async () => {
vi.useFakeTimers({ toFake: ['requestIdleCallback'] });

View File

@@ -25,10 +25,10 @@
"@affine-test/kit": "workspace:*",
"@affine/env": "workspace:*",
"@affine/native": "workspace:*",
"@blocksuite/blocks": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/lit": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/presets": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/store": "0.12.0-canary-202402271448-6d3a709",
"@blocksuite/blocks": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/lit": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/presets": "0.12.0-canary-202403050308-3789d0e",
"@blocksuite/store": "0.12.0-canary-202403050308-3789d0e",
"@electron-forge/cli": "^7.3.0",
"@electron-forge/core": "^7.3.0",
"@electron-forge/core-utils": "^7.3.0",

View File

@@ -1,7 +1,7 @@
import { resolve } from 'node:path';
import { SqliteConnection } from '@affine/native';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import { AffineSchemas } from '@blocksuite/blocks/schemas';
import { Schema } from '@blocksuite/store';
import {
forceUpgradePages,
@@ -51,7 +51,7 @@ export const migrateToLatest = async (
await connection.setVersion(version);
}
const schema = new Schema();
schema.register(AffineSchemas).register(__unstableSchemas);
schema.register(AffineSchemas);
const rootDoc = new YDoc();
const downloadBinary = async (doc: YDoc, isRoot: boolean): Promise<void> => {
const update = (

View File

@@ -1,6 +1,6 @@
import 'fake-indexeddb/auto';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import { AffineSchemas } from '@blocksuite/blocks/schemas';
import { Schema, Workspace } from '@blocksuite/store';
import { SyncEngine, SyncEngineStep, SyncPeerStep } from '@toeverything/infra';
import { beforeEach, describe, expect, test, vi } from 'vitest';
@@ -11,7 +11,7 @@ import { createTestStorage } from './test-storage';
const schema = new Schema();
schema.register(AffineSchemas).register(__unstableSchemas);
schema.register(AffineSchemas);
beforeEach(() => {
vi.useFakeTimers({ toFake: ['requestIdleCallback'] });
@@ -41,12 +41,27 @@ describe('SyncEngine', () => {
id: 'page0',
});
page.load();
const pageBlockId = page.addBlock('affine:page', {
title: new page.Text(''),
});
page.addBlock('affine:surface', {}, pageBlockId);
const frameId = page.addBlock('affine:note', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId);
const pageBlockId = page.addBlock(
'affine:page' as keyof BlockSuite.BlockModels,
{
title: new page.Text(''),
}
);
page.addBlock(
'affine:surface' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
const frameId = page.addBlock(
'affine:note' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
page.addBlock(
'affine:paragraph' as keyof BlockSuite.BlockModels,
{},
frameId
);
await syncEngine.waitForSynced();
syncEngine.forceStop();
prev = workspace.doc.toJSON();

View File

@@ -1,6 +1,6 @@
import 'fake-indexeddb/auto';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import { AffineSchemas } from '@blocksuite/blocks/schemas';
import { Schema, Workspace } from '@blocksuite/store';
import { SyncPeer, SyncPeerStep } from '@toeverything/infra';
import { beforeEach, describe, expect, test, vi } from 'vitest';
@@ -9,7 +9,7 @@ import { IndexedDBSyncStorage } from '..';
const schema = new Schema();
schema.register(AffineSchemas).register(__unstableSchemas);
schema.register(AffineSchemas);
beforeEach(() => {
vi.useFakeTimers({ toFake: ['requestIdleCallback'] });
@@ -35,12 +35,27 @@ describe('SyncPeer', () => {
id: 'page0',
});
page.load();
const pageBlockId = page.addBlock('affine:page', {
title: new page.Text(''),
});
page.addBlock('affine:surface', {}, pageBlockId);
const frameId = page.addBlock('affine:note', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId);
const pageBlockId = page.addBlock(
'affine:page' as keyof BlockSuite.BlockModels,
{
title: new page.Text(''),
}
);
page.addBlock(
'affine:surface' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
const frameId = page.addBlock(
'affine:note' as keyof BlockSuite.BlockModels,
{},
pageBlockId
);
page.addBlock(
'affine:paragraph' as keyof BlockSuite.BlockModels,
{},
frameId
);
await syncPeer.waitForSynced();
syncPeer.stop();
prev = workspace.doc.toJSON();
@@ -85,7 +100,7 @@ describe('SyncPeer', () => {
expect(syncPeer.status.step).toBe(SyncPeerStep.LoadingSubDoc);
page.load();
await syncPeer.waitForSynced();
page.addBlock('affine:page', {
page.addBlock('affine:page' as keyof BlockSuite.BlockModels, {
title: new page.Text(''),
});
expect(syncPeer.status.step).toBe(SyncPeerStep.Syncing);