chore: bump bs to lts (#8147)

This commit is contained in:
Saul-Mirone
2024-09-06 10:54:18 +00:00
parent e822bbd2dd
commit 84ebe62edc
12 changed files with 236 additions and 267 deletions

View File

@@ -3,8 +3,8 @@
"private": true,
"type": "module",
"devDependencies": {
"@blocksuite/global": "0.0.0-canary-20240905130451",
"@blocksuite/store": "0.0.0-canary-20240905130451",
"@blocksuite/global": "0.17.2",
"@blocksuite/store": "0.17.2",
"react": "18.3.1",
"react-dom": "18.3.1",
"vitest": "2.0.5"

View File

@@ -14,10 +14,10 @@
"@affine/debug": "workspace:*",
"@affine/env": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/blocks": "0.0.0-canary-20240905130451",
"@blocksuite/global": "0.0.0-canary-20240905130451",
"@blocksuite/presets": "0.0.0-canary-20240905130451",
"@blocksuite/store": "0.0.0-canary-20240905130451",
"@blocksuite/blocks": "0.17.2",
"@blocksuite/global": "0.17.2",
"@blocksuite/presets": "0.17.2",
"@blocksuite/store": "0.17.2",
"@datastructures-js/binary-search-tree": "^5.3.2",
"foxact": "^0.2.33",
"fuse.js": "^7.0.0",
@@ -34,8 +34,8 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/block-std": "0.0.0-canary-20240905130451",
"@blocksuite/presets": "0.0.0-canary-20240905130451",
"@blocksuite/block-std": "0.17.2",
"@blocksuite/presets": "0.17.2",
"@testing-library/react": "^16.0.0",
"async-call-rpc": "^6.4.0",
"fake-indexeddb": "^6.0.0",

View File

@@ -59,14 +59,6 @@ export const AFFINE_FLAGS = {
configurable: false,
defaultState: true,
},
enable_expand_database_block: {
category: 'blocksuite',
bsFlag: 'enable_expand_database_block',
displayName: 'Expand Database Block',
description: 'Enables expanding of database blocks.',
configurable: false,
defaultState: false,
},
enable_multi_view: {
category: 'affine',
displayName: 'Split View',

View File

@@ -81,12 +81,12 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@blocksuite/block-std": "0.0.0-canary-20240905130451",
"@blocksuite/blocks": "0.0.0-canary-20240905130451",
"@blocksuite/global": "0.0.0-canary-20240905130451",
"@blocksuite/block-std": "0.17.2",
"@blocksuite/blocks": "0.17.2",
"@blocksuite/global": "0.17.2",
"@blocksuite/icons": "2.1.67",
"@blocksuite/presets": "0.0.0-canary-20240905130451",
"@blocksuite/store": "0.0.0-canary-20240905130451",
"@blocksuite/presets": "0.17.2",
"@blocksuite/store": "0.17.2",
"@chromatic-com/storybook": "^1",
"@storybook/addon-actions": "^8.2.9",
"@storybook/addon-essentials": "^8.2.9",

View File

@@ -15,14 +15,14 @@
"@affine/graphql": "workspace:*",
"@affine/i18n": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/affine-block-surface": "0.0.0-canary-20240905130451",
"@blocksuite/block-std": "0.0.0-canary-20240905130451",
"@blocksuite/blocks": "0.0.0-canary-20240905130451",
"@blocksuite/global": "0.0.0-canary-20240905130451",
"@blocksuite/affine-block-surface": "0.17.2",
"@blocksuite/block-std": "0.17.2",
"@blocksuite/blocks": "0.17.2",
"@blocksuite/global": "0.17.2",
"@blocksuite/icons": "2.1.67",
"@blocksuite/inline": "0.0.0-canary-20240905130451",
"@blocksuite/presets": "0.0.0-canary-20240905130451",
"@blocksuite/store": "0.0.0-canary-20240905130451",
"@blocksuite/inline": "0.17.2",
"@blocksuite/presets": "0.17.2",
"@blocksuite/store": "0.17.2",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/modifiers": "^7.0.0",
"@dnd-kit/sortable": "^8.0.0",

View File

@@ -1,29 +1,11 @@
import {
BlockFlavourIdentifier,
BlockServiceIdentifier,
BlockViewIdentifier,
type ExtensionType,
StdIdentifier,
} from '@blocksuite/block-std';
import { PageEditorBlockSpecs, PageRootService } from '@blocksuite/blocks';
import { BlockViewIdentifier, type ExtensionType } from '@blocksuite/block-std';
import { PageEditorBlockSpecs } from '@blocksuite/blocks';
import { literal } from 'lit/static-html.js';
/**
* Custom PageRootService that does not load fonts
*/
class CustomPageRootService extends PageRootService {
override loadFonts() {}
}
export const CustomPageEditorBlockSpecs: ExtensionType[] = [
...PageEditorBlockSpecs,
{
setup: di => {
di.override(
BlockServiceIdentifier('affine:page'),
CustomPageRootService,
[StdIdentifier, BlockFlavourIdentifier('affine:page')]
);
di.override(
BlockViewIdentifier('affine:page'),
() => literal`affine-page-root`

View File

@@ -4,24 +4,17 @@ import {
} from '@affine/core/blocksuite/presets/ai';
import { mixpanel } from '@affine/core/mixpanel';
import { EditorSettingService } from '@affine/core/modules/editor-settting';
import { AffineCanvasTextFonts } from '@blocksuite/affine-block-surface';
import { ConfigExtension, type ExtensionType } from '@blocksuite/block-std';
import {
BlockFlavourIdentifier,
BlockServiceIdentifier,
ConfigExtension,
type ExtensionType,
StdIdentifier,
} from '@blocksuite/block-std';
import {
type RootService,
type TelemetryEventMap,
TelemetryProvider,
AffineCanvasTextFonts,
EdgelessRootBlockSpec,
FontLoaderService,
PageRootBlockSpec,
} from '@blocksuite/blocks';
import {
EdgelessRootBlockSpec,
EdgelessRootService,
PageRootBlockSpec,
PageRootService,
FontConfigExtension,
type TelemetryEventMap,
TelemetryProvider,
} from '@blocksuite/blocks';
import { type FrameworkProvider } from '@toeverything/infra';
@@ -29,61 +22,52 @@ import { createDatabaseOptionsConfig } from './database-block';
import { createLinkedWidgetConfig } from './widgets/linked';
import { createToolbarMoreMenuConfig } from './widgets/toolbar';
function customLoadFonts(service: RootService): void {
if (runtimeConfig.isSelfHosted) {
const fonts = AffineCanvasTextFonts.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(AffineCanvasTextFonts);
}
function getFontConfigExtension() {
return FontConfigExtension(
runtimeConfig.isSelfHosted
? AffineCanvasTextFonts.map(font => ({
...font,
// self-hosted fonts are served from /assets
url: '/assets/' + new URL(font.url).pathname.split('/').pop(),
}))
: AffineCanvasTextFonts
);
}
// TODO: make load fonts and telemetry service as BS extension
function withAffineRootService(Service: typeof PageRootService) {
return class extends Service {
override loadFonts(): void {
customLoadFonts(this);
}
function getTelemetryExtension(): ExtensionType {
return {
setup: di => {
di.addImpl(TelemetryProvider, () => ({
track: <T extends keyof TelemetryEventMap>(
eventName: T,
props: TelemetryEventMap[T]
) => {
mixpanel.track(eventName as string, props as Record<string, unknown>);
},
}));
},
};
}
function getEditorConfigExtension(framework: FrameworkProvider) {
const editorSettingService = framework.get(EditorSettingService);
return ConfigExtension('affine:page', {
linkedWidget: createLinkedWidgetConfig(framework),
editorSetting: editorSettingService.editorSetting.settingSignal,
toolbarMoreMenu: createToolbarMoreMenuConfig(framework),
databaseOptions: createDatabaseOptionsConfig(framework),
});
}
export function createPageRootBlockSpec(
framework: FrameworkProvider,
enableAI: boolean
): ExtensionType[] {
const editorSettingService = framework.get(EditorSettingService);
return [
...(enableAI ? AIPageRootBlockSpec : PageRootBlockSpec),
{
setup: di => {
di.override(
BlockServiceIdentifier('affine:page'),
withAffineRootService(PageRootService),
[StdIdentifier, BlockFlavourIdentifier('affine:page')]
);
di.addImpl(TelemetryProvider, () => ({
track: <T extends keyof TelemetryEventMap>(
eventName: T,
props: TelemetryEventMap[T]
) => {
mixpanel.track(
eventName as string,
props as Record<string, unknown>
);
},
}));
},
},
ConfigExtension('affine:page', {
linkedWidget: createLinkedWidgetConfig(framework),
editorSetting: editorSettingService.editorSetting.settingSignal,
toolbarMoreMenu: createToolbarMoreMenuConfig(framework),
databaseOptions: createDatabaseOptionsConfig(framework),
}),
FontLoaderService,
getTelemetryExtension(),
getEditorConfigExtension(framework),
];
}
@@ -91,23 +75,11 @@ export function createEdgelessRootBlockSpec(
framework: FrameworkProvider,
enableAI: boolean
): ExtensionType[] {
const editorSettingService = framework.get(EditorSettingService);
return [
...(enableAI ? AIEdgelessRootBlockSpec : EdgelessRootBlockSpec),
{
setup: di => {
di.override(
BlockServiceIdentifier('affine:page'),
withAffineRootService(EdgelessRootService as never),
[StdIdentifier, BlockFlavourIdentifier('affine:page')]
);
},
},
ConfigExtension('affine:page', {
linkedWidget: createLinkedWidgetConfig(framework),
editorSetting: editorSettingService.editorSetting.settingSignal,
toolbarMoreMenu: createToolbarMoreMenuConfig(framework),
databaseOptions: createDatabaseOptionsConfig(framework),
}),
FontLoaderService,
getFontConfigExtension(),
getTelemetryExtension(),
getEditorConfigExtension(framework),
];
}

View File

@@ -29,10 +29,10 @@
"@affine/env": "workspace:*",
"@affine/i18n": "workspace:*",
"@affine/native": "workspace:*",
"@blocksuite/block-std": "0.0.0-canary-20240905130451",
"@blocksuite/blocks": "0.0.0-canary-20240905130451",
"@blocksuite/presets": "0.0.0-canary-20240905130451",
"@blocksuite/store": "0.0.0-canary-20240905130451",
"@blocksuite/block-std": "0.17.2",
"@blocksuite/blocks": "0.17.2",
"@blocksuite/presets": "0.17.2",
"@blocksuite/store": "0.17.2",
"@electron-forge/cli": "^7.3.0",
"@electron-forge/core": "^7.3.0",
"@electron-forge/core-utils": "^7.3.0",