Skip to content

Commit

Permalink
feat: bump blocksuite (#5812)
Browse files Browse the repository at this point in the history
  • Loading branch information
Flrande authored and pull[bot] committed Apr 24, 2024
1 parent 10caf7f commit e074727
Show file tree
Hide file tree
Showing 14 changed files with 161 additions and 158 deletions.
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-202402010557-e8d6e1d",
"@blocksuite/store": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/global": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/store": "0.12.0-canary-202402062232-9a8554c",
"react": "18.2.0",
"react-dom": "18.2.0",
"vitest": "1.2.2"
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-202402010557-e8d6e1d",
"@blocksuite/global": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/store": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/blocks": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/global": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/store": "0.12.0-canary-202402062232-9a8554c",
"foxact": "^0.2.20",
"jotai": "^2.5.1",
"jotai-effect": "^0.5.0",
Expand All @@ -33,8 +33,8 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/lit": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/presets": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/lit": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/presets": "0.12.0-canary-202402062232-9a8554c",
"@testing-library/react": "^14.0.0",
"async-call-rpc": "^6.3.1",
"react": "^18.2.0",
Expand Down
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-202402010557-e8d6e1d",
"@blocksuite/global": "0.12.0-canary-202402062232-9a8554c",
"idb": "^8.0.0",
"nanoid": "^5.0.3",
"y-provider": "workspace:*"
},
"devDependencies": {
"@blocksuite/blocks": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/store": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/blocks": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/store": "0.12.0-canary-202402062232-9a8554c",
"fake-indexeddb": "^5.0.0",
"vite": "^5.0.6",
"vite-plugin-dts": "3.7.2",
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-202402010557-e8d6e1d",
"@blocksuite/store": "0.12.0-canary-202402062232-9a8554c",
"vite": "^5.0.6",
"vite-plugin-dts": "3.7.2",
"vitest": "1.2.2",
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-202402010557-e8d6e1d",
"@blocksuite/global": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/blocks": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/global": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/icons": "2.1.44",
"@blocksuite/lit": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/presets": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/store": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/lit": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/presets": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/store": "0.12.0-canary-202402062232-9a8554c",
"@storybook/addon-actions": "^7.5.3",
"@storybook/addon-essentials": "^7.5.3",
"@storybook/addon-interactions": "^7.5.3",
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-202402010557-e8d6e1d",
"@blocksuite/blocks": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/global": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/block-std": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/blocks": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/global": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/icons": "2.1.44",
"@blocksuite/inline": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/lit": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/presets": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/store": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/inline": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/lit": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/presets": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/store": "0.12.0-canary-202402062232-9a8554c",
"@dnd-kit/core": "^6.0.8",
"@dnd-kit/sortable": "^8.0.0",
"@emotion/cache": "^11.11.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ const getOrCreateShellWorkspace = (workspaceId: string) => {
const blobStorage = new AffineCloudBlobStorage(workspaceId);
workspace = new Workspace({
id: workspaceId,
providerCreators: [],
blobStorages: [
() => ({
crud: blobStorage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ interface BlocksuiteEditorContainerProps {
// mimic the interface of the webcomponent and expose slots & host
type BlocksuiteEditorContainerRef = Pick<
(typeof AffineEditorContainer)['prototype'],
'mode' | 'page' | 'model' | 'slots' | 'host'
'mode' | 'page' | 'slots' | 'host'
> &
HTMLDivElement;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,23 @@ export type EditorProps = {
className?: string;
};

/**
* TODO: Defined async cache to support suspense, instead of reflect symbol to provider persistent error cache.
*/
const PAGE_LOAD_KEY = Symbol('PAGE_LOAD');
const PAGE_ROOT_KEY = Symbol('PAGE_ROOT');

function usePageRoot(page: Page) {
let load$ = Reflect.get(page, PAGE_LOAD_KEY);
if (!load$) {
load$ = page.load();
Reflect.set(page, PAGE_LOAD_KEY, load$);
if (!page.ready) {
use(page.load());
}
use(load$);

if (!page.root) {
let root$: Promise<void> | undefined = Reflect.get(page, PAGE_ROOT_KEY);
if (!root$) {
root$ = new Promise((resolve, reject) => {
use(
new Promise<void>((resolve, reject) => {
const disposable = page.slots.rootAdded.once(() => {
resolve();
});
window.setTimeout(() => {
disposable.dispose();
reject(new NoPageRootError(page));
}, 20 * 1000);
});
Reflect.set(page, PAGE_ROOT_KEY, root$);
}
use(root$);
})
);
}

return page.root;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type { BlockServiceOptions, BlockSpec } from '@blocksuite/block-std';
import type { ParagraphService } from '@blocksuite/blocks';
import type { BlockSpec } from '@blocksuite/block-std';
import type { PageService, ParagraphService } from '@blocksuite/blocks';
import {
AttachmentService,
CanvasTextFonts,
DocEditorBlockSpecs,
DocPageService,
EdgelessEditorBlockSpecs,
PageService,
EdgelessPageService,
} from '@blocksuite/blocks';
import bytes from 'bytes';
import { html, unsafeStatic } from 'lit/static-html.js';
Expand All @@ -18,23 +20,28 @@ class CustomAttachmentService extends AttachmentService {
}
}

class CustomPageService extends PageService {
constructor(opt: BlockServiceOptions) {
super(opt);
const officialDomains = new Set(['affine.pro', 'affine.fail']);
const load = this.fontLoader.load.bind(this.fontLoader);
this.fontLoader.load = function (fonts) {
if (!officialDomains.has(window.location.host)) {
return load(
fonts.map(f => ({
...f,
// self-hosted fonts are served from /assets
url: '/assets' + new URL(f.url).pathname.split('/').pop(),
}))
);
}
return load(fonts);
};
function customLoadFonts(service: PageService): void {
const officialDomains = new Set(['affine.pro', 'affine.fail']);
if (!officialDomains.has(window.location.host)) {
const fonts = CanvasTextFonts.map(font => ({
...font,
// self-hosted fonts are served from /assets
url: '/assets' + new URL(font.url).pathname.split('/').pop(),
}));
service.fontLoader.load(fonts);
} else {
service.fontLoader.load(CanvasTextFonts);
}
}

class CustomDocPageService extends DocPageService {
override loadFonts(): void {
customLoadFonts(this);
}
}
class CustomEdgelessPageService extends EdgelessPageService {
override loadFonts(): void {
customLoadFonts(this);
}
}

Expand Down Expand Up @@ -100,7 +107,7 @@ export const docModeSpecs = DocEditorBlockSpecs.map(spec => {
if (spec.schema.model.flavour === 'affine:page') {
return {
...spec,
service: CustomPageService,
service: CustomDocPageService,
};
}
return spec;
Expand All @@ -112,5 +119,11 @@ export const edgelessModeSpecs = EdgelessEditorBlockSpecs.map(spec => {
service: CustomAttachmentService,
};
}
if (spec.schema.model.flavour === 'affine:page') {
return {
...spec,
service: CustomEdgelessPageService,
};
}
return spec;
});
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-202402010557-e8d6e1d",
"@blocksuite/lit": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/presets": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/store": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/blocks": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/lit": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/presets": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/store": "0.12.0-canary-202402062232-9a8554c",
"@electron-forge/cli": "^7.2.0",
"@electron-forge/core": "^7.2.0",
"@electron-forge/core-utils": "^7.2.0",
Expand Down
5 changes: 4 additions & 1 deletion tests/affine-local/e2e/quick-search.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ test('assert the recent browse pages are on the recent list', async ({
{
const title = getBlockSuiteEditorTitle(page);
await title.click();
await page.waitForTimeout(200);
await title.pressSequentially('affine is the best', { delay: 100 });
await expect(title).toHaveText('affine is the best', { timeout: 500 });
}
Expand Down Expand Up @@ -419,7 +420,9 @@ test('can use cmdk to search page content and scroll to it, then the block will
page.locator('[data-affine-editor-container]').getByText('123456')
);
expect(isVisitable).toBe(true);
const selectionElement = page.locator('affine-block-selection');
const selectionElement = page.locator(
'affine-block-selection[style*="display: block;"]'
);
await expect(selectionElement).toBeVisible();
});

Expand Down
14 changes: 7 additions & 7 deletions tests/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"storybook-addon-react-router-v6": "^2.0.10"
},
"devDependencies": {
"@blocksuite/block-std": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/blocks": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/global": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/block-std": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/blocks": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/global": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/icons": "2.1.44",
"@blocksuite/inline": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/lit": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/presets": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/store": "0.12.0-canary-202402010557-e8d6e1d",
"@blocksuite/inline": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/lit": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/presets": "0.12.0-canary-202402062232-9a8554c",
"@blocksuite/store": "0.12.0-canary-202402062232-9a8554c",
"@storybook/addon-actions": "^7.5.3",
"@storybook/addon-essentials": "^7.5.3",
"@storybook/addon-interactions": "^7.5.3",
Expand Down
Loading

0 comments on commit e074727

Please sign in to comment.