refactor(editor): remove service global type (#10129)

Closes: [BS-2566](https://linear.app/affine-design/issue/BS-2566/remove-global-types-in-service)
This commit is contained in:
Saul-Mirone
2025-02-12 11:46:10 +00:00
parent 6730122108
commit e7cc710f8e
11 changed files with 14 additions and 77 deletions

View File

@@ -1,7 +1,3 @@
import type * as SurfaceEffects from '@blocksuite/affine-block-surface/effects';
declare type _GLOBAL_ = typeof SurfaceEffects;
export * from './adapters/notion-html';
export * from './attachment-block';
export * from './attachment-service';

View File

@@ -1,5 +1,3 @@
import type * as CommandsType from '@blocksuite/affine-shared/commands';
import { CodeBlockComponent } from './code-block';
import type { CodeBlockConfig } from './code-block-config';
import {
@@ -18,8 +16,6 @@ export function effects() {
customElements.define('affine-code', CodeBlockComponent);
}
declare type _GLOBAL_ = typeof CommandsType;
declare global {
namespace BlockSuite {
interface BlockConfigs {

View File

@@ -1,30 +1,18 @@
import type * as SurfaceEffects from '@blocksuite/affine-block-surface/effects';
import { EmbedFigmaBlockComponent } from './embed-figma-block';
import { EmbedEdgelessBlockComponent } from './embed-figma-block/embed-edgeless-figma-block';
import type { EmbedFigmaBlockService } from './embed-figma-block/embed-figma-service';
import {
EmbedGithubBlockComponent,
type EmbedGithubBlockService,
} from './embed-github-block';
import { EmbedGithubBlockComponent } from './embed-github-block';
import { EmbedEdgelessGithubBlockComponent } from './embed-github-block/embed-edgeless-github-block';
import { EmbedHtmlBlockComponent } from './embed-html-block';
import { EmbedHtmlFullscreenToolbar } from './embed-html-block/components/fullscreen-toolbar';
import { EmbedEdgelessHtmlBlockComponent } from './embed-html-block/embed-edgeless-html-block';
import { EmbedLinkedDocBlockComponent } from './embed-linked-doc-block';
import { EmbedEdgelessLinkedDocBlockComponent } from './embed-linked-doc-block/embed-edgeless-linked-doc-block';
import {
EmbedLoomBlockComponent,
type EmbedLoomBlockService,
} from './embed-loom-block';
import { EmbedLoomBlockComponent } from './embed-loom-block';
import { EmbedEdgelessLoomBlockComponent } from './embed-loom-block/embed-edgeless-loom-bock';
import { EmbedSyncedDocBlockComponent } from './embed-synced-doc-block';
import { EmbedSyncedDocCard } from './embed-synced-doc-block/components/embed-synced-doc-card';
import { EmbedEdgelessSyncedDocBlockComponent } from './embed-synced-doc-block/embed-edgeless-synced-doc-block';
import {
EmbedYoutubeBlockComponent,
type EmbedYoutubeBlockService,
} from './embed-youtube-block';
import { EmbedYoutubeBlockComponent } from './embed-youtube-block';
import { EmbedEdgelessYoutubeBlockComponent } from './embed-youtube-block/embed-edgeless-youtube-block';
export function effects() {
@@ -86,8 +74,6 @@ export function effects() {
);
}
declare type _GLOBAL = typeof SurfaceEffects;
declare global {
interface HTMLElementTagNameMap {
'affine-embed-figma-block': EmbedFigmaBlockComponent;
@@ -107,13 +93,4 @@ declare global {
'affine-embed-linked-doc-block': EmbedLinkedDocBlockComponent;
'affine-embed-edgeless-linked-doc-block': EmbedEdgelessLinkedDocBlockComponent;
}
namespace BlockSuite {
interface BlockServices {
'affine:embed-figma': EmbedFigmaBlockService;
'affine:embed-github': EmbedGithubBlockService;
'affine:embed-loom': EmbedLoomBlockService;
'affine:embed-youtube': EmbedYoutubeBlockService;
}
}
}

View File

@@ -1,7 +1,3 @@
import type * as SurfaceEffects from '@blocksuite/affine-block-surface/effects';
declare type _GLOBAL_ = typeof SurfaceEffects;
export * from './adapters';
export * from './commands';
export * from './image-block';

View File

@@ -7,7 +7,6 @@ import {
AFFINE_EDGELESS_NOTE,
EdgelessNoteBlockComponent,
} from './note-edgeless-block';
import type { NoteBlockService } from './note-service';
export function effects() {
customElements.define('affine-note', NoteBlockComponent);
@@ -19,9 +18,6 @@ export function effects() {
declare global {
namespace BlockSuite {
interface BlockServices {
'affine:note': NoteBlockService;
}
interface BlockConfigs {
'affine:note': NoteConfig;
}

View File

@@ -1,6 +1,5 @@
import { effects as ParagraphHeadingIconEffects } from './heading-icon.js';
import { ParagraphBlockComponent } from './paragraph-block.js';
import type { ParagraphBlockService } from './paragraph-service.js';
export function effects() {
ParagraphHeadingIconEffects();
@@ -8,11 +7,6 @@ export function effects() {
}
declare global {
namespace BlockSuite {
interface BlockServices {
'affine:paragraph': ParagraphBlockService;
}
}
interface HTMLElementTagNameMap {
'affine-paragraph': ParagraphBlockComponent;
}

View File

@@ -1,7 +1,3 @@
import type * as SurfaceEffects from '@blocksuite/affine-block-surface/effects';
declare type _GLOBAL_ = typeof SurfaceEffects;
export * from './consts';
export * from './drag-handle';
export * from './utils';