Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bump blocksuite #6010

Merged
merged 9 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/common/env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions packages/common/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
27 changes: 21 additions & 6 deletions packages/common/infra/src/initialization/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions packages/common/infra/src/workspace/global-schema.ts
Original file line number Diff line number Diff line change
@@ -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);
6 changes: 3 additions & 3 deletions packages/common/y-indexeddb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
80 changes: 63 additions & 17 deletions packages/common/y-indexeddb/src/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand All @@ -59,7 +74,7 @@ const rootDBName = DEFAULT_DB_NAME;

const schema = new Schema();

schema.register(AffineSchemas).register(__unstableSchemas);
schema.register(AffineSchemas);

beforeEach(() => {
id = nanoid();
Expand Down Expand Up @@ -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);
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/common/y-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions packages/frontend/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/core/.webpack/runtime-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
14 changes: 7 additions & 7 deletions packages/frontend/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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'] });
Expand Down
8 changes: 4 additions & 4 deletions packages/frontend/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading
Loading