chore: bump version (#1618)

This commit is contained in:
Himself65 2023-03-20 00:07:54 -05:00 committed by GitHub
parent 4e7ff3862f
commit f6c1423361
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 199 additions and 833 deletions

View File

@ -14,15 +14,15 @@
"build:app": "tauri build"
},
"dependencies": {
"@blocksuite/blocks": "0.5.0-20230317014705-a881b9c",
"@blocksuite/editor": "0.5.0-20230317014705-a881b9c",
"@blocksuite/blocks": "0.5.0-20230320034723-8dfc65e",
"@blocksuite/editor": "0.5.0-20230320034723-8dfc65e",
"@blocksuite/icons": "2.0.17",
"@blocksuite/store": "0.5.0-20230317014705-a881b9c",
"@blocksuite/store": "0.5.0-20230320034723-8dfc65e",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@tauri-apps/api": "^1.2.0",
"json-schema-to-typescript": "^11.0.5",
"lib0": "^0.2.68",
"lib0": "^0.2.69",
"next": "=13.2.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",

View File

@ -14,11 +14,11 @@
"@affine/debug": "workspace:*",
"@affine/env": "workspace:*",
"@affine/i18n": "workspace:*",
"@blocksuite/blocks": "0.5.0-20230317014705-a881b9c",
"@blocksuite/editor": "0.5.0-20230317014705-a881b9c",
"@blocksuite/blocks": "0.5.0-20230320034723-8dfc65e",
"@blocksuite/editor": "0.5.0-20230320034723-8dfc65e",
"@blocksuite/icons": "2.0.23",
"@blocksuite/react": "0.5.0-20230317014705-a881b9c",
"@blocksuite/store": "0.5.0-20230317014705-a881b9c",
"@blocksuite/react": "0.5.0-20230320034723-8dfc65e",
"@blocksuite/store": "0.5.0-20230320034723-8dfc65e",
"@emotion/cache": "^11.10.5",
"@emotion/react": "^11.10.6",
"@emotion/server": "^11.10.0",

View File

@ -1,9 +1,9 @@
'use client';
import type { EditorContainer } from '@blocksuite/editor';
import type { Page } from '@blocksuite/store';
import { assertEquals, assertExists, Generator } from '@blocksuite/store';
import { Generator } from '@blocksuite/store';
import type React from 'react';
import { useCallback, useEffect, useRef, useState } from 'react';
import { useCallback, useRef } from 'react';
import { createEmptyBlockSuiteWorkspace } from '../../../utils';
import { BlockSuiteEditor } from '../../blocksuite/block-suite-editor';
@ -14,41 +14,21 @@ const blockSuiteWorkspace = createEmptyBlockSuiteWorkspace(
Generator.AutoIncrement
);
blockSuiteWorkspace.createPage('page0');
const page = blockSuiteWorkspace.createPage('page0');
const Editor: React.FC<{
onInit: (page: Page, editor: Readonly<EditorContainer>) => void;
testType: 'empty' | 'importMarkdown';
}> = ({ onInit, testType }) => {
const page = blockSuiteWorkspace.getPage('page0');
const [, rerender] = useState(false);
const onceRef = useRef(false);
if (!onceRef.current) {
if (testType === 'importMarkdown') {
if (page) {
page.workspace.meta.setPageMeta(page.id, {
init: true,
});
} else {
blockSuiteWorkspace.slots.pageAdded.on(id => {
const page = blockSuiteWorkspace.getPage(id);
assertExists(page);
assertEquals(id, 'page0');
page.workspace.meta.setPageMeta(page.id, {
init: true,
});
});
}
page.workspace.meta.setPageMeta(page.id, {
init: true,
});
}
}
useEffect(() => {
const cb = () => rerender(v => !v);
const dispose = blockSuiteWorkspace.slots.pageAdded.on(cb);
return () => {
dispose.dispose();
};
}, []);
const onLoad = useCallback((page: Page, editor: EditorContainer) => {
// @ts-ignore
globalThis.page = page;

View File

@ -5,7 +5,8 @@ import 'fake-indexeddb/auto';
import assert from 'node:assert';
import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import type { Page } from '@blocksuite/store';
import { assertExists } from '@blocksuite/store';
import { render, renderHook } from '@testing-library/react';
import { createStore, Provider } from 'jotai';
@ -74,29 +75,21 @@ async function getJotaiContext() {
}
beforeEach(async () => {
return new Promise<void>(resolve => {
blockSuiteWorkspace = new BlockSuiteWorkspace({ id: 'test' })
.register(builtInSchemas)
.register(__unstableSchemas);
blockSuiteWorkspace.slots.pageAdded.on(pageId => {
setTimeout(() => {
const page = blockSuiteWorkspace.getPage(pageId);
expect(page).not.toBeNull();
assertExists(page);
const pageBlockId = page.addBlockByFlavour('affine:page', {
title: new page.Text(''),
});
const frameId = page.addBlockByFlavour('affine:frame', {}, pageBlockId);
page.addBlockByFlavour('affine:paragraph', {}, frameId);
if (pageId === 'page2') {
resolve();
}
});
blockSuiteWorkspace = new BlockSuiteWorkspace({ id: 'test' })
.register(AffineSchemas)
.register(__unstableSchemas);
const initPage = (page: Page) => {
expect(page).not.toBeNull();
assertExists(page);
const pageBlockId = page.addBlock('affine:page', {
title: new page.Text(''),
});
blockSuiteWorkspace.createPage('page0');
blockSuiteWorkspace.createPage('page1');
blockSuiteWorkspace.createPage('page2');
});
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId);
};
initPage(blockSuiteWorkspace.createPage('page0'));
initPage(blockSuiteWorkspace.createPage('page1'));
initPage(blockSuiteWorkspace.createPage('page2'));
});
describe('usePageMetas', async () => {

View File

@ -3,7 +3,7 @@
*/
import 'fake-indexeddb/auto';
import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import type { Page } from '@blocksuite/store';
import { renderHook } from '@testing-library/react';
import { beforeEach, describe, expect, test, vi } from 'vitest';
@ -18,13 +18,13 @@ beforeEach(() => {
blockSuiteWorkspace = new BlockSuiteWorkspace({
id: 'test',
})
.register(builtInSchemas)
.register(AffineSchemas)
.register(__unstableSchemas);
blockSuiteWorkspace.slots.pageAdded.on(pageId => {
const page = blockSuiteWorkspace.getPage(pageId) as Page;
const pageBlockId = page.addBlockByFlavour('affine:page', { title: '' });
const frameId = page.addBlockByFlavour('affine:frame', {}, pageBlockId);
page.addBlockByFlavour('affine:paragraph', {}, frameId);
const pageBlockId = page.addBlock('affine:page', { title: '' });
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId);
});
blockSuiteWorkspace.createPage('page0');
blockSuiteWorkspace.createPage('page1');

View File

@ -12,7 +12,7 @@ export function useBlockSuiteWorkspacePageTitle(
useEffect(() => {
const page = blockSuiteWorkspace.getPage(pageId);
setTitle(page?.meta.title || 'AFFiNE');
const dispose = blockSuiteWorkspace.meta.pagesUpdated.on(() => {
const dispose = blockSuiteWorkspace.meta.pageMetasUpdated.on(() => {
const page = blockSuiteWorkspace.getPage(pageId);
assertExists(page);
setTitle(page?.meta.title || 'AFFiNE');

View File

@ -29,7 +29,7 @@ export function usePageMeta(
}
useEffect(() => {
if (blockSuiteWorkspace) {
const dispose = blockSuiteWorkspace.meta.pagesUpdated.on(() => {
const dispose = blockSuiteWorkspace.meta.pageMetasUpdated.on(() => {
setPageMeta(blockSuiteWorkspace.meta.pageMetas);
});
return () => {

View File

@ -1,3 +1,4 @@
import { ContentParser } from '@blocksuite/blocks/content-parser';
import type {
GetStaticPaths,
GetStaticProps,
@ -61,22 +62,16 @@ const PreviewPage: NextPage<PreviewPageProps> = ({
pageId="preview"
onInit={(page, editor) => {
blockSuiteWorkspace.setPageMeta(page.id, { title });
const pageBlockId = page.addBlockByFlavour('affine:page', {
const pageBlockId = page.addBlock('affine:page', {
title: new page.Text(title),
});
page.addBlockByFlavour('affine:surface', {}, null);
const frameId = page.addBlockByFlavour(
'affine:frame',
{},
pageBlockId
);
page.addBlockByFlavour('affine:paragraph', {}, frameId);
setTimeout(() => {
// hotfix: contentParser.importMarkdown is not working in the first render
editor.contentParser.importMarkdown(text, frameId).then(() => {
page.resetHistory();
});
}, 0);
page.addBlock('affine:surface', {}, null);
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId);
const contentParser = new ContentParser(page);
contentParser.importMarkdown(text, frameId).then(() => {
page.resetHistory();
});
}}
/>
<StyledToolWrapper>

View File

@ -1,6 +1,6 @@
import { useTranslation } from '@affine/i18n';
import { FolderIcon } from '@blocksuite/icons';
import { assertExists, nanoid } from '@blocksuite/store';
import { assertEquals, assertExists, nanoid } from '@blocksuite/store';
import Head from 'next/head';
import { useRouter } from 'next/router';
import React, { useCallback, useEffect } from 'react';
@ -44,14 +44,12 @@ const AllPage: NextPageWithLayout = () => {
if (currentWorkspace.blockSuiteWorkspace.isEmpty) {
// this is a new workspace, so we should redirect to the new page
const pageId = nanoid();
currentWorkspace.blockSuiteWorkspace.slots.pageAdded.once(id => {
currentWorkspace.blockSuiteWorkspace.setPageMeta(id, {
init: true,
});
assertExists(pageId, id);
jumpToPage(currentWorkspace.id, pageId);
const page = currentWorkspace.blockSuiteWorkspace.createPage(pageId);
assertEquals(page.id, pageId);
currentWorkspace.blockSuiteWorkspace.setPageMeta(page.id, {
init: true,
});
currentWorkspace.blockSuiteWorkspace.createPage(pageId);
jumpToPage(currentWorkspace.id, pageId);
}
};
provider.callbacks.add(callback);

View File

@ -1,5 +1,6 @@
import { DebugLogger } from '@affine/debug';
import markdown from '@affine/templates/Welcome-to-AFFiNE.md';
import { ContentParser } from '@blocksuite/blocks/content-parser';
import type { EditorContainer } from '@blocksuite/editor';
import type { Page } from '@blocksuite/store';
@ -30,12 +31,12 @@ export function initPage(page: Page, editor: Readonly<EditorContainer>): void {
}
export function _initEmptyPage(page: Page, _: Readonly<EditorContainer>) {
const pageBlockId = page.addBlockByFlavour('affine:page', {
const pageBlockId = page.addBlock('affine:page', {
title: new page.Text(''),
});
page.addBlockByFlavour('affine:surface', {}, null);
const frameId = page.addBlockByFlavour('affine:frame', {}, pageBlockId);
page.addBlockByFlavour('affine:paragraph', {}, frameId);
page.addBlock('affine:surface', {}, null);
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId);
}
export function _initPageWithDemoMarkdown(
@ -43,15 +44,13 @@ export function _initPageWithDemoMarkdown(
editor: Readonly<EditorContainer>
): void {
logger.debug('initPageWithDefaultMarkdown', page.id);
const pageBlockId = page.addBlockByFlavour('affine:page', {
const pageBlockId = page.addBlock('affine:page', {
title: new page.Text(demoTitle),
});
page.addBlockByFlavour('affine:surface', {}, null);
const frameId = page.addBlockByFlavour('affine:frame', {}, pageBlockId);
page.addBlockByFlavour('affine:paragraph', {}, frameId);
setTimeout(() => {
// hotfix: contentParser.importMarkdown is not working in the first render
editor.contentParser.importMarkdown(demoText, frameId);
}, 0);
page.addBlock('affine:surface', {}, null);
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId);
const contentParser = new ContentParser(page);
contentParser.importMarkdown(demoText, frameId);
page.workspace.setPageMeta(page.id, { demoTitle });
}

View File

@ -1,4 +1,4 @@
import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import type { BlobOptionsGetter, Generator } from '@blocksuite/store';
import { BlockSuiteWorkspace } from '../shared';
@ -39,7 +39,7 @@ export const createEmptyBlockSuiteWorkspace = (
blobOptionsGetter,
idGenerator,
})
.register(builtInSchemas)
.register(AffineSchemas)
.register(__unstableSchemas);
hashMap.set(id, workspace);
return workspace;

View File

@ -33,7 +33,7 @@
"@perfsee/sdk": "^1.5.1",
"@playwright/test": "^1.31.2",
"@testing-library/react": "^14.0.0",
"@types/eslint": "^8.21.2",
"@types/eslint": "^8.21.3",
"@types/node": "^18.15.3",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",

View File

@ -15,12 +15,12 @@
"dependencies": {
"@affine/debug": "workspace:*",
"@affine/i18n": "workspace:*",
"@blocksuite/blocks": "0.5.0-20230317014705-a881b9c",
"@blocksuite/editor": "0.5.0-20230317014705-a881b9c",
"@blocksuite/global": "0.5.0-20230317014705-a881b9c",
"@blocksuite/blocks": "0.5.0-20230320034723-8dfc65e",
"@blocksuite/editor": "0.5.0-20230320034723-8dfc65e",
"@blocksuite/global": "0.5.0-20230320034723-8dfc65e",
"@blocksuite/icons": "2.0.23",
"@blocksuite/react": "0.5.0-20230317014705-a881b9c",
"@blocksuite/store": "0.5.0-20230317014705-a881b9c",
"@blocksuite/react": "0.5.0-20230320034723-8dfc65e",
"@blocksuite/store": "0.5.0-20230320034723-8dfc65e",
"@emotion/cache": "^11.10.5",
"@emotion/react": "^11.10.6",
"@emotion/server": "^11.10.0",

View File

@ -1,5 +1,5 @@
/* deepscan-disable USELESS_ARROW_FUNC_BIND */
import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import type { EditorContainer } from '@blocksuite/editor';
import type { Page } from '@blocksuite/store';
import { Workspace } from '@blocksuite/store';
@ -12,12 +12,12 @@ import { BlockSuiteEditor } from '.';
function initPage(page: Page, editor: Readonly<EditorContainer>): void {
// Add page block and surface block at root level
const pageBlockId = page.addBlockByFlavour('affine:page', {
const pageBlockId = page.addBlock('affine:page', {
title: new page.Text(''),
});
page.addBlockByFlavour('affine:surface', {}, null);
const frameId = page.addBlockByFlavour('affine:frame', {}, pageBlockId);
page.addBlockByFlavour('affine:paragraph', {}, frameId);
page.addBlock('affine:surface', {}, null);
const frameId = page.addBlock('affine:frame', {}, pageBlockId);
page.addBlock('affine:paragraph', {}, frameId);
page.resetHistory();
}
@ -25,7 +25,7 @@ const blockSuiteWorkspace = new Workspace({
id: 'test',
blobOptionsGetter: () => void 0,
});
blockSuiteWorkspace.register(builtInSchemas).register(__unstableSchemas);
blockSuiteWorkspace.register(AffineSchemas).register(__unstableSchemas);
const promise = new Promise<void>(resolve => {
blockSuiteWorkspace.slots.pageAdded.once(() => {
resolve();

View File

@ -14,8 +14,8 @@
},
"dependencies": {
"@affine/debug": "workspace:*",
"@blocksuite/blocks": "0.5.0-20230317014705-a881b9c",
"@blocksuite/store": "0.5.0-20230317014705-a881b9c",
"@blocksuite/blocks": "0.5.0-20230320034723-8dfc65e",
"@blocksuite/store": "0.5.0-20230320034723-8dfc65e",
"@tauri-apps/api": "^1.2.0",
"encoding": "^0.1.13",
"firebase": "^9.18.0",
@ -23,7 +23,7 @@
"js-base64": "^3.7.5",
"ky": "^0.33.3",
"ky-universal": "^0.11.0",
"lib0": "^0.2.68",
"lib0": "^0.2.69",
"lit": "^2.6.1",
"y-protocols": "^1.0.5",
"yjs": "^13.5.50"

View File

@ -1,4 +1,4 @@
import { __unstableSchemas, builtInSchemas } from '@blocksuite/blocks/models';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import type { StoreOptions } from '@blocksuite/store';
import { Workspace as BlocksuiteWorkspace } from '@blocksuite/store';
@ -8,7 +8,7 @@ export const createBlocksuiteWorkspace = (options: StoreOptions) => {
isSSR: typeof window === 'undefined',
...options,
})
.register(builtInSchemas)
.register(AffineSchemas)
.register(__unstableSchemas);
};

View File

@ -9,7 +9,7 @@
"zod": "^3.21.3"
},
"dependencies": {
"@blocksuite/global": "0.5.0-20230317014705-a881b9c",
"@blocksuite/global": "0.5.0-20230320034723-8dfc65e",
"lit": "^2.6.1"
}
}

View File

@ -27,7 +27,7 @@
},
"dependencies": {
"@affine/debug": "workspace:*",
"i18next": "^22.4.11",
"i18next": "^22.4.12",
"react": "^18.2.0",
"react-i18next": "^12.2.0"
},

File diff suppressed because it is too large Load Diff

View File

@ -99,7 +99,7 @@ test.describe('Search and select', () => {
await openQuickSearchByShortcut(page);
await page.keyboard.insertText('test123456');
await page.waitForTimeout(50);
await assertResultList(page, ['test123456']);
await assertResultList(page, ["New 'test123456' page"]);
await page.keyboard.press('Enter');
await page.waitForTimeout(300);
await assertTitle(page, 'test123456');