mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-20 15:57:06 +08:00
fix(editor): type import in vite worker env (#10856)
The dependencies of `@blocksuite/affine-gfx-turbo-renderer` in work is now all type imports.
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import {
|
import type {
|
||||||
type BlockLayout,
|
BlockLayout,
|
||||||
type BlockLayoutPainter,
|
BlockLayoutPainter,
|
||||||
BlockLayoutPainterExtension,
|
TextRect,
|
||||||
type TextRect,
|
WorkerToHostMessage,
|
||||||
type WorkerToHostMessage,
|
|
||||||
} from '@blocksuite/affine-gfx-turbo-renderer';
|
} from '@blocksuite/affine-gfx-turbo-renderer';
|
||||||
|
import { BlockLayoutPainterExtension } from '@blocksuite/affine-gfx-turbo-renderer/painter';
|
||||||
|
|
||||||
interface SentenceLayout {
|
interface SentenceLayout {
|
||||||
text: string;
|
text: string;
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
import { createIdentifier } from '@blocksuite/global/di';
|
|
||||||
import type { ExtensionType } from '@blocksuite/store';
|
|
||||||
|
|
||||||
import type { BlockLayoutPainter } from '../types';
|
|
||||||
|
|
||||||
export const BlockPainterProvider = createIdentifier<BlockLayoutPainter>(
|
|
||||||
'block-painter-provider'
|
|
||||||
);
|
|
||||||
|
|
||||||
export const BlockLayoutPainterExtension = (
|
|
||||||
type: string,
|
|
||||||
painter: new () => BlockLayoutPainter
|
|
||||||
): ExtensionType => {
|
|
||||||
return {
|
|
||||||
setup: di => {
|
|
||||||
di.addImpl(BlockPainterProvider(type), painter);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
export * from './extension';
|
|
||||||
export * from './layout/block-layout-provider';
|
export * from './layout/block-layout-provider';
|
||||||
export * from './painter/painter.worker';
|
export * from './painter/painter.worker';
|
||||||
export * from './text-utils';
|
export * from './text-utils';
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import { Container, type ServiceProvider } from '@blocksuite/global/di';
|
import {
|
||||||
|
Container,
|
||||||
|
createIdentifier,
|
||||||
|
type ServiceProvider,
|
||||||
|
} from '@blocksuite/global/di';
|
||||||
import type { ExtensionType } from '@blocksuite/store';
|
import type { ExtensionType } from '@blocksuite/store';
|
||||||
|
|
||||||
import { BlockPainterProvider } from '../extension';
|
|
||||||
import type {
|
import type {
|
||||||
BlockLayoutPainter,
|
BlockLayoutPainter,
|
||||||
HostToWorkerMessage,
|
HostToWorkerMessage,
|
||||||
@@ -9,6 +12,21 @@ import type {
|
|||||||
WorkerToHostMessage,
|
WorkerToHostMessage,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
|
|
||||||
|
export const BlockPainterProvider = createIdentifier<BlockLayoutPainter>(
|
||||||
|
'block-painter-provider'
|
||||||
|
);
|
||||||
|
|
||||||
|
export const BlockLayoutPainterExtension = (
|
||||||
|
type: string,
|
||||||
|
painter: new () => BlockLayoutPainter
|
||||||
|
): ExtensionType => {
|
||||||
|
return {
|
||||||
|
setup: di => {
|
||||||
|
di.addImpl(BlockPainterProvider(type), painter);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export class ViewportLayoutPainter {
|
export class ViewportLayoutPainter {
|
||||||
private readonly canvas: OffscreenCanvas = new OffscreenCanvas(0, 0);
|
private readonly canvas: OffscreenCanvas = new OffscreenCanvas(0, 0);
|
||||||
private ctx: OffscreenCanvasRenderingContext2D | null = null;
|
private ctx: OffscreenCanvasRenderingContext2D | null = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user