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
+2 -2
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"
+5 -5
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",
@@ -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
);
});
}
@@ -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'),
});
@@ -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();
@@ -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);
@@ -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);
+3 -3
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",
@@ -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);
+1 -1
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",