There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
refactor(editor): add gfx entry in bs global package (#10612)
Saul-Mirone66d9d576e0af
diff --git a/blocksuite/affine/all/package.json b/blocksuite/affine/all/package.jsonindex 46d893e4c0..2c1b265582 100644--- a/blocksuite/affine/all/package.json+++ b/blocksuite/affine/all/package.json@@ -31,6 +31,7 @@"./global/exceptions": "./src/global/exceptions.ts","./global/di": "./src/global/di.ts","./global/types": "./src/global/types.ts",+ "./global/gfx": "./src/global/gfx.ts","./store": "./src/store/index.ts","./store/test": "./src/store/test.ts","./inline": "./src/inline/index.ts",@@ -69,6 +70,9 @@"global/types": ["dist/global/types.d.ts"],+ "global/gfx": [+ "dist/global/gfx.d.ts"+ ],"store": ["dist/store/index.d.ts"],diff --git a/blocksuite/affine/all/src/global/gfx.ts b/blocksuite/affine/all/src/global/gfx.tsnew file mode 100644index 0000000000..656f9c29b1--- /dev/null+++ b/blocksuite/affine/all/src/global/gfx.ts@@ -0,0 +1 @@+export * from '@blocksuite/global/gfx';diff --git a/blocksuite/affine/block-attachment/src/components/options.ts b/blocksuite/affine/block-attachment/src/components/options.tsindex bf27cc8782..f23b43db99 100644--- a/blocksuite/affine/block-attachment/src/components/options.ts+++ b/blocksuite/affine/block-attachment/src/components/options.ts@@ -18,7 +18,7 @@ import {EMBED_CARD_HEIGHT,EMBED_CARD_WIDTH,} from '@blocksuite/affine-shared/consts';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import { ArrowDownSmallIcon, MoreVerticalIcon } from '@blocksuite/icons/lit';import { flip, offset } from '@floating-ui/dom';import { html, nothing } from 'lit';diff --git a/blocksuite/affine/block-attachment/src/embed.ts b/blocksuite/affine/block-attachment/src/embed.tsindex 54906e0d9e..14b59c5af0 100644--- a/blocksuite/affine/block-attachment/src/embed.ts+++ b/blocksuite/affine/block-attachment/src/embed.ts@@ -12,7 +12,7 @@ import {import { type BlockStdScope, StdIdentifier } from '@blocksuite/block-std';import type { Container } from '@blocksuite/global/di';import { createIdentifier } from '@blocksuite/global/di';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import type { ExtensionType } from '@blocksuite/store';import { Extension } from '@blocksuite/store';import type { TemplateResult } from 'lit';diff --git a/blocksuite/affine/block-attachment/src/utils.ts b/blocksuite/affine/block-attachment/src/utils.tsindex 3cf5891d47..99b7da35b8 100644--- a/blocksuite/affine/block-attachment/src/utils.ts+++ b/blocksuite/affine/block-attachment/src/utils.ts@@ -15,7 +15,7 @@ import {import { humanFileSize } from '@blocksuite/affine-shared/utils';import type { BlockStdScope, EditorHost } from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';-import { Bound, type IVec, Point, Vec } from '@blocksuite/global/utils';+import { Bound, type IVec, Point, Vec } from '@blocksuite/global/gfx';import type { BlockModel } from '@blocksuite/store';import type { AttachmentBlockComponent } from './attachment-block.js';diff --git a/blocksuite/affine/block-database/src/database-block.ts b/blocksuite/affine/block-database/src/database-block.tsindex 12c5e6b17c..bc8b81e6e1 100644--- a/blocksuite/affine/block-database/src/database-block.ts+++ b/blocksuite/affine/block-database/src/database-block.ts@@ -36,7 +36,7 @@ import {uniMap,} from '@blocksuite/data-view';import { widgetPresets } from '@blocksuite/data-view/widget-presets';-import { Rect } from '@blocksuite/global/utils';+import { Rect } from '@blocksuite/global/gfx';import {CopyIcon,DeleteIcon,diff --git a/blocksuite/affine/block-database/src/properties/converts.ts b/blocksuite/affine/block-database/src/properties/converts.tsindex 912ff79f8f..0a38007367 100644--- a/blocksuite/affine/block-database/src/properties/converts.ts+++ b/blocksuite/affine/block-database/src/properties/converts.ts@@ -5,7 +5,7 @@ import {} from '@blocksuite/data-view';import { presetPropertyConverts } from '@blocksuite/data-view/property-presets';import { propertyModelPresets } from '@blocksuite/data-view/property-pure-presets';-import { clamp } from '@blocksuite/global/utils';+import { clamp } from '@blocksuite/global/gfx';import { nanoid, Text } from '@blocksuite/store';import { richTextPropertyModelConfig } from './rich-text/define.js';diff --git a/blocksuite/affine/block-edgeless-text/src/commands/insert-edgeless-text.ts b/blocksuite/affine/block-edgeless-text/src/commands/insert-edgeless-text.tsindex c6832f56bb..7f21eb0b2b 100644--- a/blocksuite/affine/block-edgeless-text/src/commands/insert-edgeless-text.ts+++ b/blocksuite/affine/block-edgeless-text/src/commands/insert-edgeless-text.ts@@ -5,7 +5,7 @@ import {import { focusTextModel } from '@blocksuite/affine-components/rich-text';import type { Command } from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import {EDGELESS_TEXT_BLOCK_MIN_HEIGHT,diff --git a/blocksuite/affine/block-edgeless-text/src/edgeless-text-block.ts b/blocksuite/affine/block-edgeless-text/src/edgeless-text-block.tsindex 48bf034f24..d376c74af0 100644--- a/blocksuite/affine/block-edgeless-text/src/edgeless-text-block.ts+++ b/blocksuite/affine/block-edgeless-text/src/edgeless-text-block.ts@@ -13,7 +13,7 @@ import {GfxBlockComponent,TextSelection,} from '@blocksuite/block-std';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import { css, html } from 'lit';import { query, state } from 'lit/decorators.js';import { type StyleInfo, styleMap } from 'lit/directives/style-map.js';diff --git a/blocksuite/affine/block-embed/src/common/insert-embed-card.ts b/blocksuite/affine/block-embed/src/common/insert-embed-card.tsindex 82add7b2fb..ead7ccb42d 100644--- a/blocksuite/affine/block-embed/src/common/insert-embed-card.ts+++ b/blocksuite/affine/block-embed/src/common/insert-embed-card.ts@@ -14,7 +14,7 @@ import {TextSelection,} from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';-import { Bound, Vec } from '@blocksuite/global/utils';+import { Bound, Vec } from '@blocksuite/global/gfx';interface EmbedCardProperties {flavour: string;diff --git a/blocksuite/affine/block-embed/src/common/to-edgeless-embed-block.ts b/blocksuite/affine/block-embed/src/common/to-edgeless-embed-block.tsindex 2606b8fa2f..58e7173688 100644--- a/blocksuite/affine/block-embed/src/common/to-edgeless-embed-block.ts+++ b/blocksuite/affine/block-embed/src/common/to-edgeless-embed-block.ts@@ -10,7 +10,7 @@ import type {GfxBlockElementModel,GfxCompatibleProps,} from '@blocksuite/block-std/gfx';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import type { StyleInfo } from 'lit/directives/style-map.js';import type { EmbedBlockComponent } from './embed-block-element.js';diff --git a/blocksuite/affine/block-embed/src/embed-linked-doc-block/embed-edgeless-linked-doc-block.ts b/blocksuite/affine/block-embed/src/embed-linked-doc-block/embed-edgeless-linked-doc-block.tsindex 18f2ac6af9..a30de9ed21 100644--- a/blocksuite/affine/block-embed/src/embed-linked-doc-block/embed-edgeless-linked-doc-block.ts+++ b/blocksuite/affine/block-embed/src/embed-linked-doc-block/embed-edgeless-linked-doc-block.ts@@ -11,7 +11,7 @@ import {isNewTabTrigger,isNewViewTrigger,} from '@blocksuite/affine-shared/utils';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import { toEdgelessEmbedBlock } from '../common/to-edgeless-embed-block.js';import { EmbedLinkedDocBlockComponent } from './embed-linked-doc-block.js';diff --git a/blocksuite/affine/block-embed/src/embed-linked-doc-block/embed-linked-doc-block.ts b/blocksuite/affine/block-embed/src/embed-linked-doc-block/embed-linked-doc-block.tsindex df3c9cbcfd..b740f88431 100644--- a/blocksuite/affine/block-embed/src/embed-linked-doc-block/embed-linked-doc-block.ts+++ b/blocksuite/affine/block-embed/src/embed-linked-doc-block/embed-linked-doc-block.ts@@ -27,7 +27,8 @@ import {referenceToNode,} from '@blocksuite/affine-shared/utils';import { BlockSelection } from '@blocksuite/block-std';-import { Bound, throttle } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { throttle } from '@blocksuite/global/utils';import { Text } from '@blocksuite/store';import { computed } from '@preact/signals-core';import { html, nothing } from 'lit';diff --git a/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-edgeless-synced-doc-block.ts b/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-edgeless-synced-doc-block.tsindex 3aac6d2163..72b3b177c7 100644--- a/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-edgeless-synced-doc-block.ts+++ b/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-edgeless-synced-doc-block.ts@@ -12,7 +12,7 @@ import {ThemeProvider,} from '@blocksuite/affine-shared/services';import { BlockStdScope } from '@blocksuite/block-std';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import { html, nothing } from 'lit';import { choose } from 'lit/directives/choose.js';import { classMap } from 'lit/directives/class-map.js';diff --git a/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-synced-doc-block.ts b/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-synced-doc-block.tsindex 2737312812..ad41893107 100644--- a/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-synced-doc-block.ts+++ b/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-synced-doc-block.ts@@ -34,7 +34,8 @@ import {GfxControllerIdentifier,GfxExtension,} from '@blocksuite/block-std/gfx';-import { assertExists, Bound, getCommonBound } from '@blocksuite/global/utils';+import { Bound, getCommonBound } from '@blocksuite/global/gfx';+import { assertExists } from '@blocksuite/global/utils';import { type GetBlocksOptions, type Query, Text } from '@blocksuite/store';import { computed, signal } from '@preact/signals-core';import { html, nothing, type PropertyValues } from 'lit';diff --git a/blocksuite/affine/block-frame/src/frame-block.ts b/blocksuite/affine/block-frame/src/frame-block.tsindex dac2749ede..2b914e7826 100644--- a/blocksuite/affine/block-frame/src/frame-block.ts+++ b/blocksuite/affine/block-frame/src/frame-block.ts@@ -1,7 +1,7 @@import { DefaultTheme, type FrameBlockModel } from '@blocksuite/affine-model';import { ThemeProvider } from '@blocksuite/affine-shared/services';import { GfxBlockComponent } from '@blocksuite/block-std';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import { cssVarV2 } from '@toeverything/theme/v2';import { html } from 'lit';import { state } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-frame/src/frame-manager.ts b/blocksuite/affine/block-frame/src/frame-manager.tsindex 24cf5971b3..b7543e92a1 100644--- a/blocksuite/affine/block-frame/src/frame-manager.ts+++ b/blocksuite/affine/block-frame/src/frame-manager.ts@@ -17,10 +17,10 @@ import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';import {Bound,deserializeXYWH,- DisposableGroup,type IVec,type SerializedXYWH,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';+import { DisposableGroup } from '@blocksuite/global/utils';import { type BlockModel, Text } from '@blocksuite/store';import * as Y from 'yjs';diff --git a/blocksuite/affine/block-image/src/utils.ts b/blocksuite/affine/block-image/src/utils.tsindex 3c70f2fa9d..7e13bfb050 100644--- a/blocksuite/affine/block-image/src/utils.ts+++ b/blocksuite/affine/block-image/src/utils.ts@@ -18,7 +18,7 @@ import {} from '@blocksuite/affine-shared/utils';import type { BlockStdScope, EditorHost } from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';-import { Bound, type IVec, Point, Vec } from '@blocksuite/global/utils';+import { Bound, type IVec, Point, Vec } from '@blocksuite/global/gfx';import type { BlockModel } from '@blocksuite/store';import {diff --git a/blocksuite/affine/block-note/src/components/edgeless-note-background.ts b/blocksuite/affine/block-note/src/components/edgeless-note-background.tsindex 88f838098e..066dbf55ed 100644--- a/blocksuite/affine/block-note/src/components/edgeless-note-background.ts+++ b/blocksuite/affine/block-note/src/components/edgeless-note-background.ts@@ -22,12 +22,8 @@ import {TextSelection,} from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';-import {- clamp,- Point,- SignalWatcher,- WithDisposable,-} from '@blocksuite/global/utils';+import { clamp, Point } from '@blocksuite/global/gfx';+import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';import type { BlockModel } from '@blocksuite/store';import { consume } from '@lit/context';import { computed } from '@preact/signals-core';diff --git a/blocksuite/affine/block-note/src/components/edgeless-note-mask.ts b/blocksuite/affine/block-note/src/components/edgeless-note-mask.tsindex dbda1eefce..1764da6c91 100644--- a/blocksuite/affine/block-note/src/components/edgeless-note-mask.ts+++ b/blocksuite/affine/block-note/src/components/edgeless-note-mask.ts@@ -1,11 +1,7 @@import type { NoteBlockModel } from '@blocksuite/affine-model';import { type EditorHost, ShadowlessElement } from '@blocksuite/block-std';-import {- almostEqual,- Bound,- SignalWatcher,- WithDisposable,-} from '@blocksuite/global/utils';+import { almostEqual, Bound } from '@blocksuite/global/gfx';+import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';import { html } from 'lit';import { property } from 'lit/decorators.js';import { styleMap } from 'lit/directives/style-map.js';diff --git a/blocksuite/affine/block-note/src/note-edgeless-block.ts b/blocksuite/affine/block-note/src/note-edgeless-block.tsindex 4374ed8906..d331d1f0f8 100644--- a/blocksuite/affine/block-note/src/note-edgeless-block.ts+++ b/blocksuite/affine/block-note/src/note-edgeless-block.ts@@ -5,7 +5,7 @@ import { EDGELESS_BLOCK_CHILD_PADDING } from '@blocksuite/affine-shared/consts';import { TelemetryProvider } from '@blocksuite/affine-shared/services';import { stopPropagation } from '@blocksuite/affine-shared/utils';import { toGfxBlockComponent } from '@blocksuite/block-std';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import { html, nothing, type PropertyValues } from 'lit';import { query, state } from 'lit/decorators.js';import { classMap } from 'lit/directives/class-map.js';diff --git a/blocksuite/affine/block-root/src/edgeless/clipboard/clipboard.ts b/blocksuite/affine/block-root/src/edgeless/clipboard/clipboard.tsindex 58262c93bc..ca97ca9fd0 100644--- a/blocksuite/affine/block-root/src/edgeless/clipboard/clipboard.ts+++ b/blocksuite/affine/block-root/src/edgeless/clipboard/clipboard.ts@@ -49,15 +49,19 @@ import {SortOrder,} from '@blocksuite/block-std/gfx';import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';-import type { IBound, IVec, SerializedXYWH } from '@blocksuite/global/utils';+import {+ Bound,+ getCommonBound,+ type IBound,+ type IVec,+ type SerializedXYWH,+ Vec,+} from '@blocksuite/global/gfx';import {assertExists,assertType,- Bound,DisposableGroup,- getCommonBound,nToLast,- Vec,} from '@blocksuite/global/utils';import {type BlockSnapshot,diff --git a/blocksuite/affine/block-root/src/edgeless/components/auto-complete/auto-complete-panel.ts b/blocksuite/affine/block-root/src/edgeless/components/auto-complete/auto-complete-panel.tsindex a9346b121f..6e9097ae51 100644--- a/blocksuite/affine/block-root/src/edgeless/components/auto-complete/auto-complete-panel.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/auto-complete/auto-complete-panel.ts@@ -29,17 +29,16 @@ import {import { captureEventTarget } from '@blocksuite/affine-shared/utils';import { type BlockStdScope, stdContext } from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';-import type { XYWH } from '@blocksuite/global/utils';+import type { XYWH } from '@blocksuite/global/gfx';import {- assertInstanceOf,Bound,clamp,normalizeDegAngle,serializeXYWH,toDegree,Vec,- WithDisposable,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';+import { assertInstanceOf, WithDisposable } from '@blocksuite/global/utils';import { FrameIcon, PageIcon } from '@blocksuite/icons/lit';import { consume } from '@lit/context';import { baseTheme } from '@toeverything/theme';diff --git a/blocksuite/affine/block-root/src/edgeless/components/auto-complete/edgeless-auto-complete.ts b/blocksuite/affine/block-root/src/edgeless/components/auto-complete/edgeless-auto-complete.tsindex ff50f7d2be..4c382a3ed4 100644--- a/blocksuite/affine/block-root/src/edgeless/components/auto-complete/edgeless-auto-complete.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/auto-complete/edgeless-auto-complete.ts@@ -25,11 +25,11 @@ import {import { handleNativeRangeAtPoint } from '@blocksuite/affine-shared/utils';import { type BlockStdScope, stdContext } from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';-import type { Bound, IVec } from '@blocksuite/global/utils';+import type { Bound, IVec } from '@blocksuite/global/gfx';+import { Vec } from '@blocksuite/global/gfx';import {assertExists,DisposableGroup,- Vec,WithDisposable,} from '@blocksuite/global/utils';import {diff --git a/blocksuite/affine/block-root/src/edgeless/components/auto-complete/utils.ts b/blocksuite/affine/block-root/src/edgeless/components/auto-complete/utils.tsindex 8e62fb666d..bb77f3c978 100644--- a/blocksuite/affine/block-root/src/edgeless/components/auto-complete/utils.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/auto-complete/utils.ts@@ -15,8 +15,8 @@ import {} from '@blocksuite/affine-model';import type { GfxController, GfxModel } from '@blocksuite/block-std/gfx';import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';-import type { XYWH } from '@blocksuite/global/utils';-import { assertType, Bound, normalizeDegAngle } from '@blocksuite/global/utils';+import { Bound, normalizeDegAngle, type XYWH } from '@blocksuite/global/gfx';+import { assertType } from '@blocksuite/global/utils';import * as Y from 'yjs';import type { EdgelessRootBlockComponent } from '../../edgeless-root-block.js';diff --git a/blocksuite/affine/block-root/src/edgeless/components/connector/connector-handle.ts b/blocksuite/affine/block-root/src/edgeless/components/connector/connector-handle.tsindex 327b49326b..c315c529ac 100644--- a/blocksuite/affine/block-root/src/edgeless/components/connector/connector-handle.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/connector/connector-handle.ts@@ -9,7 +9,8 @@ import {stdContext,} from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';-import { DisposableGroup, Vec, WithDisposable } from '@blocksuite/global/utils';+import { Vec } from '@blocksuite/global/gfx';+import { DisposableGroup, WithDisposable } from '@blocksuite/global/utils';import type { Store } from '@blocksuite/store';import { consume } from '@lit/context';import { css, html, LitElement } from 'lit';diff --git a/blocksuite/affine/block-root/src/edgeless/components/frame/frame-preview.ts b/blocksuite/affine/block-root/src/edgeless/components/frame/frame-preview.tsindex ba771cf798..ffc4bd7740 100644--- a/blocksuite/affine/block-root/src/edgeless/components/frame/frame-preview.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/frame/frame-preview.ts@@ -7,10 +7,9 @@ import {ShadowlessElement,} from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';+import { Bound, deserializeXYWH } from '@blocksuite/global/gfx';import {- Bound,debounce,- deserializeXYWH,DisposableGroup,WithDisposable,} from '@blocksuite/global/utils';diff --git a/blocksuite/affine/block-root/src/edgeless/components/note-slicer/index.ts b/blocksuite/affine/block-root/src/edgeless/components/note-slicer/index.tsindex 2976227825..693bf042ec 100644--- a/blocksuite/affine/block-root/src/edgeless/components/note-slicer/index.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/note-slicer/index.ts@@ -10,12 +10,8 @@ import { TelemetryProvider } from '@blocksuite/affine-shared/services';import { getRectByBlockComponent } from '@blocksuite/affine-shared/utils';import { WidgetComponent } from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';-import {- deserializeXYWH,- DisposableGroup,- Point,- serializeXYWH,-} from '@blocksuite/global/utils';+import { deserializeXYWH, Point, serializeXYWH } from '@blocksuite/global/gfx';+import { DisposableGroup } from '@blocksuite/global/utils';import { ScissorsIcon } from '@blocksuite/icons/lit';import { css, html, nothing, type PropertyValues } from 'lit';import { state } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-root/src/edgeless/components/presentation/edgeless-navigator-black-background.ts b/blocksuite/affine/block-root/src/edgeless/components/presentation/edgeless-navigator-black-background.tsindex 2f95398fc5..44d4598899 100644--- a/blocksuite/affine/block-root/src/edgeless/components/presentation/edgeless-navigator-black-background.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/presentation/edgeless-navigator-black-background.ts@@ -2,7 +2,7 @@ import type { FrameBlockModel, RootBlockModel } from '@blocksuite/affine-model';import { EditPropsStore } from '@blocksuite/affine-shared/services';import { WidgetComponent } from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import { effect } from '@preact/signals-core';import { css, html, nothing } from 'lit';import { state } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-root/src/edgeless/components/rects/edgeless-selected-rect.ts b/blocksuite/affine/block-root/src/edgeless/components/rects/edgeless-selected-rect.tsindex e91092e0b7..a931df65c0 100644--- a/blocksuite/affine/block-root/src/edgeless/components/rects/edgeless-selected-rect.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/rects/edgeless-selected-rect.ts@@ -49,20 +49,14 @@ import {type GfxModel,type GfxPrimitiveElementModel,} from '@blocksuite/block-std/gfx';-import type {- Disposable,- IPoint,- IVec,- PointLocation,-} from '@blocksuite/global/utils';+import type { IPoint, IVec, PointLocation } from '@blocksuite/global/gfx';import {- assertType,Bound,deserializeXYWH,normalizeDegAngle,- pickValues,- Slot,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';+import type { Disposable } from '@blocksuite/global/utils';+import { assertType, pickValues, Slot } from '@blocksuite/global/utils';import { css, html, nothing } from 'lit';import { state } from 'lit/decorators.js';import { ifDefined } from 'lit/directives/if-defined.js';diff --git a/blocksuite/affine/block-root/src/edgeless/components/resize/resize-handles.ts b/blocksuite/affine/block-root/src/edgeless/components/resize/resize-handles.tsindex 5e988044a6..6ed52aa8e0 100644--- a/blocksuite/affine/block-root/src/edgeless/components/resize/resize-handles.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/resize/resize-handles.ts@@ -1,4 +1,4 @@-import type { IVec } from '@blocksuite/global/utils';+import type { IVec } from '@blocksuite/global/gfx';import { html, nothing } from 'lit';export enum HandleDirection {diff --git a/blocksuite/affine/block-root/src/edgeless/components/resize/resize-manager.ts b/blocksuite/affine/block-root/src/edgeless/components/resize/resize-manager.tsindex 312f760a79..debf1c7350 100644--- a/blocksuite/affine/block-root/src/edgeless/components/resize/resize-manager.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/resize/resize-manager.ts@@ -1,13 +1,13 @@import { NOTE_MIN_WIDTH } from '@blocksuite/affine-model';import {- assertExists,Bound,getQuadBoundWithRotation,type IPoint,type IVec,type PointLocation,rotatePoints,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';+import { assertExists } from '@blocksuite/global/utils';import type { SelectableProps } from '../../utils/query.js';import { HandleDirection, type ResizeMode } from './resize-handles.js';diff --git a/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-connector-label-editor.ts b/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-connector-label-editor.tsindex b4b7bf3308..64155a5242 100644--- a/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-connector-label-editor.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-connector-label-editor.ts@@ -10,12 +10,8 @@ import {RANGE_SYNC_EXCLUDE_ATTR,ShadowlessElement,} from '@blocksuite/block-std';-import {- assertExists,- Bound,- Vec,- WithDisposable,-} from '@blocksuite/global/utils';+import { Bound, Vec } from '@blocksuite/global/gfx';+import { assertExists, WithDisposable } from '@blocksuite/global/utils';import { css, html, nothing } from 'lit';import { property, query } from 'lit/decorators.js';import { styleMap } from 'lit/directives/style-map.js';diff --git a/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-frame-title-editor.ts b/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-frame-title-editor.tsindex a40b1f877f..38f001950c 100644--- a/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-frame-title-editor.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-frame-title-editor.ts@@ -9,7 +9,8 @@ import {RANGE_SYNC_EXCLUDE_ATTR,ShadowlessElement,} from '@blocksuite/block-std';-import { assertExists, Bound, WithDisposable } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { assertExists, WithDisposable } from '@blocksuite/global/utils';import { cssVarV2 } from '@toeverything/theme/v2';import { css, html, nothing } from 'lit';import { property, query } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-group-title-editor.ts b/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-group-title-editor.tsindex b818cd72bb..00ccd84483 100644--- a/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-group-title-editor.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-group-title-editor.ts@@ -9,7 +9,8 @@ import {RANGE_SYNC_EXCLUDE_ATTR,ShadowlessElement,} from '@blocksuite/block-std';-import { assertExists, Bound, WithDisposable } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { assertExists, WithDisposable } from '@blocksuite/global/utils';import { html, nothing } from 'lit';import { property, query } from 'lit/decorators.js';import { styleMap } from 'lit/directives/style-map.js';diff --git a/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-shape-text-editor.ts b/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-shape-text-editor.tsindex 760da7d905..0b41ce91d2 100644--- a/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-shape-text-editor.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-shape-text-editor.ts@@ -11,13 +11,8 @@ import {RANGE_SYNC_EXCLUDE_ATTR,ShadowlessElement,} from '@blocksuite/block-std';-import {- assertExists,- Bound,- toRadian,- Vec,- WithDisposable,-} from '@blocksuite/global/utils';+import { Bound, toRadian, Vec } from '@blocksuite/global/gfx';+import { assertExists, WithDisposable } from '@blocksuite/global/utils';import { html, nothing } from 'lit';import { property, query } from 'lit/decorators.js';import { styleMap } from 'lit/directives/style-map.js';diff --git a/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-text-editor.ts b/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-text-editor.tsindex ab0b592efe..983ca0e536 100644--- a/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-text-editor.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/text/edgeless-text-editor.ts@@ -10,13 +10,8 @@ import {RANGE_SYNC_EXCLUDE_ATTR,ShadowlessElement,} from '@blocksuite/block-std';-import {- assertExists,- Bound,- toRadian,- Vec,- WithDisposable,-} from '@blocksuite/global/utils';+import { Bound, toRadian, Vec } from '@blocksuite/global/gfx';+import { assertExists, WithDisposable } from '@blocksuite/global/utils';import { css, html, nothing } from 'lit';import { property, query } from 'lit/decorators.js';import { styleMap } from 'lit/directives/style-map.js';diff --git a/blocksuite/affine/block-root/src/edgeless/components/toolbar/common/draggable/draggable-element.controller.ts b/blocksuite/affine/block-root/src/edgeless/components/toolbar/common/draggable/draggable-element.controller.tsindex 67d1a4b4e9..a0aa59500f 100644--- a/blocksuite/affine/block-root/src/edgeless/components/toolbar/common/draggable/draggable-element.controller.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/toolbar/common/draggable/draggable-element.controller.ts@@ -2,7 +2,8 @@ import {EditPropsStore,ThemeProvider,} from '@blocksuite/affine-shared/services';-import { assertExists, Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { assertExists } from '@blocksuite/global/utils';import {type ReactiveController,type ReactiveControllerHost,diff --git a/blocksuite/affine/block-root/src/edgeless/components/toolbar/common/draggable/types.ts b/blocksuite/affine/block-root/src/edgeless/components/toolbar/common/draggable/types.tsindex d8926b9264..bece03ac68 100644--- a/blocksuite/affine/block-root/src/edgeless/components/toolbar/common/draggable/types.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/toolbar/common/draggable/types.ts@@ -1,4 +1,5 @@-import type { Bound, DisposableClass } from '@blocksuite/global/utils';+import type { Bound } from '@blocksuite/global/gfx';+import type { DisposableClass } from '@blocksuite/global/utils';import type { TemplateResult } from 'lit';import type { EdgelessRootBlockComponent } from '../../../../edgeless-root-block.js';diff --git a/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/basket-elements.ts b/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/basket-elements.tsindex 2c62ae832f..bb549e0a0c 100644--- a/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/basket-elements.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/basket-elements.ts@@ -12,7 +12,8 @@ import {TelemetryProvider,} from '@blocksuite/affine-shared/services';import { openFileOrFiles } from '@blocksuite/affine-shared/utils';-import { assertInstanceOf, Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { assertInstanceOf } from '@blocksuite/global/utils';import type { TemplateResult } from 'lit';import * as Y from 'yjs';diff --git a/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/mindmap-menu.ts b/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/mindmap-menu.tsindex 674da9597f..14054f416a 100644--- a/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/mindmap-menu.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/mindmap-menu.ts@@ -8,7 +8,7 @@ import {import type { BlockStdScope } from '@blocksuite/block-std';import { modelContext, stdContext } from '@blocksuite/block-std';import { ErrorCode } from '@blocksuite/global/exceptions';-import type { Bound } from '@blocksuite/global/utils';+import type { Bound } from '@blocksuite/global/gfx';import { SignalWatcher } from '@blocksuite/global/utils';import type { BlockModel } from '@blocksuite/store';import { consume } from '@lit/context';diff --git a/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/mindmap-tool-button.ts b/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/mindmap-tool-button.tsindex d41a4efb3b..04a31fb71b 100644--- a/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/mindmap-tool-button.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/mindmap-tool-button.ts@@ -8,7 +8,7 @@ import {ThemeProvider,} from '@blocksuite/affine-shared/services';import type { GfxToolsFullOptionValue } from '@blocksuite/block-std/gfx';-import type { Bound } from '@blocksuite/global/utils';+import type { Bound } from '@blocksuite/global/gfx';import { SignalWatcher } from '@blocksuite/global/utils';import { computed } from '@preact/signals-core';import { css, html, LitElement, nothing } from 'lit';diff --git a/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/utils/import-mindmap.ts b/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/utils/import-mindmap.tsindex 5d18d18889..3429a2d22a 100644--- a/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/utils/import-mindmap.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/toolbar/mindmap/utils/import-mindmap.ts@@ -1,6 +1,6 @@import { openFileOrFiles } from '@blocksuite/affine-shared/utils';import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';-import type { Bound } from '@blocksuite/global/utils';+import type { Bound } from '@blocksuite/global/gfx';import c from 'simple-xml-to-json';type MindMapNode = {diff --git a/blocksuite/affine/block-root/src/edgeless/components/toolbar/presentation-toolbar.ts b/blocksuite/affine/block-root/src/edgeless/components/toolbar/presentation-toolbar.tsindex d1a056119e..bb9edbf1d0 100644--- a/blocksuite/affine/block-root/src/edgeless/components/toolbar/presentation-toolbar.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/toolbar/presentation-toolbar.ts@@ -6,7 +6,8 @@ import { toast } from '@blocksuite/affine-components/toast';import type { FrameBlockModel } from '@blocksuite/affine-model';import { EditPropsStore } from '@blocksuite/affine-shared/services';import type { GfxToolsFullOptionValue } from '@blocksuite/block-std/gfx';-import { Bound, clamp, SignalWatcher } from '@blocksuite/global/utils';+import { Bound, clamp } from '@blocksuite/global/gfx';+import { SignalWatcher } from '@blocksuite/global/utils';import {EndPointArrowIcon,ExpandCloseIcon,diff --git a/blocksuite/affine/block-root/src/edgeless/components/toolbar/shape/shape-tool-element.ts b/blocksuite/affine/block-root/src/edgeless/components/toolbar/shape/shape-tool-element.tsindex 2b92787861..57bf1ab563 100644--- a/blocksuite/affine/block-root/src/edgeless/components/toolbar/shape/shape-tool-element.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/toolbar/shape/shape-tool-element.ts@@ -8,7 +8,8 @@ import {type ShapeName,type ShapeStyle,} from '@blocksuite/affine-model';-import { Bound, sleep, WithDisposable } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { sleep, WithDisposable } from '@blocksuite/global/utils';import {css,html,diff --git a/blocksuite/affine/block-root/src/edgeless/components/toolbar/template/template-panel.ts b/blocksuite/affine/block-root/src/edgeless/components/toolbar/template/template-panel.tsindex 8e1639e23c..1fe5c60c43 100644--- a/blocksuite/affine/block-root/src/edgeless/components/toolbar/template/template-panel.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/toolbar/template/template-panel.ts@@ -10,7 +10,8 @@ import {requestConnectedFrame,stopPropagation,} from '@blocksuite/affine-shared/utils';-import { type Bound, WithDisposable } from '@blocksuite/global/utils';+import type { Bound } from '@blocksuite/global/gfx';+import { WithDisposable } from '@blocksuite/global/utils';import { baseTheme } from '@toeverything/theme';import { css, html, LitElement, nothing, unsafeCSS } from 'lit';import { property, state } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-root/src/edgeless/components/utils.ts b/blocksuite/affine/block-root/src/edgeless/components/utils.tsindex 3ec17f23ed..b2276c12da 100644--- a/blocksuite/affine/block-root/src/edgeless/components/utils.ts+++ b/blocksuite/affine/block-root/src/edgeless/components/utils.ts@@ -1,9 +1,9 @@import type { CursorType, StandardCursor } from '@blocksuite/block-std/gfx';-import type { IVec } from '@blocksuite/global/utils';-import { assertExists, normalizeDegAngle, Vec } from '@blocksuite/global/utils';+import type { IVec } from '@blocksuite/global/gfx';+import { normalizeDegAngle, Vec } from '@blocksuite/global/gfx';+import { assertExists } from '@blocksuite/global/utils';import { css, html } from 'lit';-// "<svg width='32' height='32' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'><g><path fill='white' d='M13.7,18.5h3.9l0-1.5c0-1.4-1.2-2.6-2.6-2.6h-1.5v3.9l-5.8-5.8l5.8-5.8v3.9h2.3c3.1,0,5.6,2.5,5.6,5.6v2.3h3.9l-5.8,5.8L13.7,18.5z'/><path d='M20.4,19.4v-3.2c0-2.6-2.1-4.7-4.7-4.7h-3.2l0,0V9L9,12.6l3.6,3.6v-2.6l0,0H15c1.9,0,3.5,1.6,3.5,3.5v2.4l0,0h-2.6l3.6,3.6l3.6-3.6L20.4,19.4L20.4,19.4z'/></g></svg>";export function generateCursorUrl(angle = 0,fallback: StandardCursor = 'default'diff --git a/blocksuite/affine/block-root/src/edgeless/edgeless-keyboard.ts b/blocksuite/affine/block-root/src/edgeless/edgeless-keyboard.tsindex f93d12f5fc..d5f3e40681 100644--- a/blocksuite/affine/block-root/src/edgeless/edgeless-keyboard.ts+++ b/blocksuite/affine/block-root/src/edgeless/edgeless-keyboard.ts@@ -29,7 +29,7 @@ import {isGfxGroupCompatibleModel,} from '@blocksuite/block-std/gfx';import { IS_MAC } from '@blocksuite/global/env';-import { Bound, getCommonBound } from '@blocksuite/global/utils';+import { Bound, getCommonBound } from '@blocksuite/global/gfx';import { PageKeyboardManager } from '../keyboard/keyboard-manager.js';import type { EdgelessRootBlockComponent } from './edgeless-root-block.js';diff --git a/blocksuite/affine/block-root/src/edgeless/edgeless-root-block.ts b/blocksuite/affine/block-root/src/edgeless/edgeless-root-block.tsindex 657342c0a3..eaec5b706b 100644--- a/blocksuite/affine/block-root/src/edgeless/edgeless-root-block.ts+++ b/blocksuite/affine/block-root/src/edgeless/edgeless-root-block.ts@@ -39,7 +39,8 @@ import {type GfxViewportElement,} from '@blocksuite/block-std/gfx';import { IS_WINDOWS } from '@blocksuite/global/env';-import { assertExists, Bound, Point, Vec } from '@blocksuite/global/utils';+import { Bound, Point, Vec } from '@blocksuite/global/gfx';+import { assertExists } from '@blocksuite/global/utils';import { effect } from '@preact/signals-core';import { css, html } from 'lit';import { query } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-root/src/edgeless/edgeless-root-service.ts b/blocksuite/affine/block-root/src/edgeless/edgeless-root-service.tsindex 3d84fbd6e0..70fb66a557 100644--- a/blocksuite/affine/block-root/src/edgeless/edgeless-root-service.ts+++ b/blocksuite/affine/block-root/src/edgeless/edgeless-root-service.ts@@ -32,7 +32,7 @@ import {ZOOM_STEP,} from '@blocksuite/block-std/gfx';import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';-import { Bound, getCommonBound } from '@blocksuite/global/utils';+import { Bound, getCommonBound } from '@blocksuite/global/gfx';import { effect } from '@preact/signals-core';import clamp from 'lodash-es/clamp';diff --git a/blocksuite/affine/block-root/src/edgeless/gfx-tool/brush-tool.ts b/blocksuite/affine/block-root/src/edgeless/gfx-tool/brush-tool.tsindex 67390bd508..9fa9c34c16 100644--- a/blocksuite/affine/block-root/src/edgeless/gfx-tool/brush-tool.ts+++ b/blocksuite/affine/block-root/src/edgeless/gfx-tool/brush-tool.ts@@ -3,7 +3,7 @@ import type { BrushElementModel } from '@blocksuite/affine-model';import { TelemetryProvider } from '@blocksuite/affine-shared/services';import type { PointerEventState } from '@blocksuite/block-std';import { BaseTool } from '@blocksuite/block-std/gfx';-import type { IVec } from '@blocksuite/global/utils';+import type { IVec } from '@blocksuite/global/gfx';import { assertExists } from '@blocksuite/global/utils';export class BrushTool extends BaseTool {diff --git a/blocksuite/affine/block-root/src/edgeless/gfx-tool/connector-tool.ts b/blocksuite/affine/block-root/src/edgeless/gfx-tool/connector-tool.tsindex e5821ee29d..9e1b5d2b92 100644--- a/blocksuite/affine/block-root/src/edgeless/gfx-tool/connector-tool.ts+++ b/blocksuite/affine/block-root/src/edgeless/gfx-tool/connector-tool.ts@@ -19,8 +19,8 @@ import {import { TelemetryProvider } from '@blocksuite/affine-shared/services';import type { PointerEventState } from '@blocksuite/block-std';import { BaseTool, type GfxModel } from '@blocksuite/block-std/gfx';-import type { IBound, IVec } from '@blocksuite/global/utils';-import { Bound } from '@blocksuite/global/utils';+import type { IBound, IVec } from '@blocksuite/global/gfx';+import { Bound } from '@blocksuite/global/gfx';enum ConnectorToolMode {// Dragging connectdiff --git a/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/event-ext.ts b/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/event-ext.tsindex 882d905d9d..93edd78a0a 100644--- a/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/event-ext.ts+++ b/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/event-ext.ts@@ -1,6 +1,7 @@import type { PointerEventState } from '@blocksuite/block-std';import type { GfxElementModelView } from '@blocksuite/block-std/gfx';-import { Bound, last } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { last } from '@blocksuite/global/utils';import { DefaultModeDragType, DefaultToolExt } from './ext.js';diff --git a/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/mind-map-ext/drag-utils.ts b/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/mind-map-ext/drag-utils.tsindex 63a680d4e3..29e4250d45 100644--- a/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/mind-map-ext/drag-utils.ts+++ b/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/mind-map-ext/drag-utils.ts@@ -8,7 +8,8 @@ import {type MindmapNode,type MindmapRoot,} from '@blocksuite/affine-model';-import { Bound, last } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { last } from '@blocksuite/global/utils';const isOnEdge = (node: MindmapNode, direction: 'tail' | 'head') => {let current = node;diff --git a/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/mind-map-ext/indicator-overlay.ts b/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/mind-map-ext/indicator-overlay.tsindex 53632b3429..0a97547429 100644--- a/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/mind-map-ext/indicator-overlay.ts+++ b/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/mind-map-ext/indicator-overlay.ts@@ -15,11 +15,11 @@ import {type Bound,isVecZero,type IVec,- last,PointLocation,toRadian,Vec,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';+import { last } from '@blocksuite/global/utils';export class MindMapIndicatorOverlay extends Overlay {static INDICATOR_SIZE = [48, 22];diff --git a/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/mind-map-ext/mind-map-ext.ts b/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/mind-map-ext/mind-map-ext.tsindex b99fadff27..927feaf6e6 100644--- a/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/mind-map-ext/mind-map-ext.ts+++ b/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool-ext/mind-map-ext/mind-map-ext.ts@@ -17,7 +17,7 @@ import {type GfxPrimitiveElementModel,isGfxGroupCompatibleModel,} from '@blocksuite/block-std/gfx';-import type { Bound, IVec } from '@blocksuite/global/utils';+import type { Bound, IVec } from '@blocksuite/global/gfx';import { isSingleMindMapNode } from '../../../utils/mindmap.js';import { isMindmapNode } from '../../../utils/query.js';diff --git a/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool.ts b/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool.tsindex 3d4199aae2..8d99b6fb40 100644--- a/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool.ts+++ b/blocksuite/affine/block-root/src/edgeless/gfx-tool/default-tool.ts@@ -41,15 +41,9 @@ import {isGfxGroupCompatibleModel,type PointTestOptions,} from '@blocksuite/block-std/gfx';-import type { IVec } from '@blocksuite/global/utils';-import {- Bound,- DisposableGroup,- getCommonBoundWithRotation,- last,- noop,- Vec,-} from '@blocksuite/global/utils';+import type { IVec } from '@blocksuite/global/gfx';+import { Bound, getCommonBoundWithRotation, Vec } from '@blocksuite/global/gfx';+import { DisposableGroup, last, noop } from '@blocksuite/global/utils';import { effect } from '@preact/signals-core';import clamp from 'lodash-es/clamp';diff --git a/blocksuite/affine/block-root/src/edgeless/gfx-tool/eraser-tool.ts b/blocksuite/affine/block-root/src/edgeless/gfx-tool/eraser-tool.tsindex f0432aa4c3..ebca03b45a 100644--- a/blocksuite/affine/block-root/src/edgeless/gfx-tool/eraser-tool.ts+++ b/blocksuite/affine/block-root/src/edgeless/gfx-tool/eraser-tool.ts@@ -12,7 +12,7 @@ import {getSvgPathFromStroke,type IVec,linePolygonIntersects,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';class EraserOverlay extends Overlay {d = '';diff --git a/blocksuite/affine/block-root/src/edgeless/gfx-tool/frame-tool.ts b/blocksuite/affine/block-root/src/edgeless/gfx-tool/frame-tool.tsindex 196fb4c28a..0e3782cb76 100644--- a/blocksuite/affine/block-root/src/edgeless/gfx-tool/frame-tool.ts+++ b/blocksuite/affine/block-root/src/edgeless/gfx-tool/frame-tool.ts@@ -14,8 +14,8 @@ import {getTopElements,GfxExtensionIdentifier,} from '@blocksuite/block-std/gfx';-import type { IPoint, IVec } from '@blocksuite/global/utils';-import { Bound, Vec } from '@blocksuite/global/utils';+import type { IPoint, IVec } from '@blocksuite/global/gfx';+import { Bound, Vec } from '@blocksuite/global/gfx';import { Text } from '@blocksuite/store';import * as Y from 'yjs';diff --git a/blocksuite/affine/block-root/src/edgeless/gfx-tool/lasso-tool.ts b/blocksuite/affine/block-root/src/edgeless/gfx-tool/lasso-tool.tsindex f579bfb48e..822cabe978 100644--- a/blocksuite/affine/block-root/src/edgeless/gfx-tool/lasso-tool.ts+++ b/blocksuite/affine/block-root/src/edgeless/gfx-tool/lasso-tool.ts@@ -6,7 +6,7 @@ import { ThemeProvider } from '@blocksuite/affine-shared/services';import { LassoMode } from '@blocksuite/affine-shared/types';import type { PointerEventState } from '@blocksuite/block-std';import { BaseTool } from '@blocksuite/block-std/gfx';-import type { IPoint, IVec } from '@blocksuite/global/utils';+import type { IPoint, IVec } from '@blocksuite/global/gfx';import {Bound,getBoundFromPoints,@@ -16,7 +16,7 @@ import {pointInPolygon,rotatePoints,Vec,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';class LassoOverlay extends Overlay {d = '';diff --git a/blocksuite/affine/block-root/src/edgeless/gfx-tool/note-tool.ts b/blocksuite/affine/block-root/src/edgeless/gfx-tool/note-tool.tsindex fe1cc5de39..abf1311aa9 100644--- a/blocksuite/affine/block-root/src/edgeless/gfx-tool/note-tool.ts+++ b/blocksuite/affine/block-root/src/edgeless/gfx-tool/note-tool.ts@@ -9,7 +9,7 @@ import type { NoteChildrenFlavour } from '@blocksuite/affine-shared/types';import { hasClassNameInList } from '@blocksuite/affine-shared/utils';import type { PointerEventState } from '@blocksuite/block-std';import { BaseTool } from '@blocksuite/block-std/gfx';-import { Point } from '@blocksuite/global/utils';+import { Point } from '@blocksuite/global/gfx';import { effect } from '@preact/signals-core';import { EXCLUDING_MOUSE_OUT_CLASS_LIST } from '../utils/consts.js';diff --git a/blocksuite/affine/block-root/src/edgeless/gfx-tool/shape-tool.ts b/blocksuite/affine/block-root/src/edgeless/gfx-tool/shape-tool.tsindex 996a82f54c..3d905993fc 100644--- a/blocksuite/affine/block-root/src/edgeless/gfx-tool/shape-tool.ts+++ b/blocksuite/affine/block-root/src/edgeless/gfx-tool/shape-tool.ts@@ -12,8 +12,8 @@ import {import { hasClassNameInList } from '@blocksuite/affine-shared/utils';import type { PointerEventState } from '@blocksuite/block-std';import { BaseTool } from '@blocksuite/block-std/gfx';-import type { IBound } from '@blocksuite/global/utils';-import { Bound } from '@blocksuite/global/utils';+import type { IBound } from '@blocksuite/global/gfx';+import { Bound } from '@blocksuite/global/gfx';import { effect } from '@preact/signals-core';import {diff --git a/blocksuite/affine/block-root/src/edgeless/gfx-tool/text-tool.ts b/blocksuite/affine/block-root/src/edgeless/gfx-tool/text-tool.tsindex 644b365b3e..c728f7a29d 100644--- a/blocksuite/affine/block-root/src/edgeless/gfx-tool/text-tool.ts+++ b/blocksuite/affine/block-root/src/edgeless/gfx-tool/text-tool.ts@@ -6,7 +6,7 @@ import {} from '@blocksuite/affine-shared/services';import type { PointerEventState } from '@blocksuite/block-std';import { BaseTool, type GfxController } from '@blocksuite/block-std/gfx';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import * as Y from 'yjs';import type { EdgelessRootBlockComponent } from '../edgeless-root-block.js';diff --git a/blocksuite/affine/block-root/src/edgeless/services/template-middlewares.ts b/blocksuite/affine/block-root/src/edgeless/services/template-middlewares.tsindex 7e4720a3ae..5c2325d231 100644--- a/blocksuite/affine/block-root/src/edgeless/services/template-middlewares.ts+++ b/blocksuite/affine/block-root/src/edgeless/services/template-middlewares.ts@@ -1,6 +1,7 @@import { generateElementId, sortIndex } from '@blocksuite/affine-block-surface';import type { ConnectorElementModel } from '@blocksuite/affine-model';-import { assertExists, assertType, Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { assertExists, assertType } from '@blocksuite/global/utils';import type { BlockSnapshot, SnapshotNode } from '@blocksuite/store';import type { SlotBlockPayload, TemplateJob } from './template.js';diff --git a/blocksuite/affine/block-root/src/edgeless/services/template.ts b/blocksuite/affine/block-root/src/edgeless/services/template.tsindex ccae73170b..34c377ad4b 100644--- a/blocksuite/affine/block-root/src/edgeless/services/template.ts+++ b/blocksuite/affine/block-root/src/edgeless/services/template.ts@@ -3,13 +3,8 @@ import type {SurfaceBlockTransformer,} from '@blocksuite/affine-block-surface';import type { ConnectorElementModel } from '@blocksuite/affine-model';-import {- assertExists,- assertType,- Bound,- getCommonBound,- Slot,-} from '@blocksuite/global/utils';+import { Bound, getCommonBound } from '@blocksuite/global/gfx';+import { assertExists, assertType, Slot } from '@blocksuite/global/utils';import {type BlockModel,type BlockSnapshot,diff --git a/blocksuite/affine/block-root/src/edgeless/utils/bound-utils.ts b/blocksuite/affine/block-root/src/edgeless/utils/bound-utils.tsindex ce5d4e40dd..5bcb1451f7 100644--- a/blocksuite/affine/block-root/src/edgeless/utils/bound-utils.ts+++ b/blocksuite/affine/block-root/src/edgeless/utils/bound-utils.ts@@ -1,5 +1,5 @@import type { SerializedElement } from '@blocksuite/block-std/gfx';-import { Bound, getBoundWithRotation } from '@blocksuite/global/utils';+import { Bound, getBoundWithRotation } from '@blocksuite/global/gfx';import { type BlockSnapshot, BlockSnapshotSchema } from '@blocksuite/store';export function getBoundFromSerializedElement(element: SerializedElement) {diff --git a/blocksuite/affine/block-root/src/edgeless/utils/clipboard-utils.ts b/blocksuite/affine/block-root/src/edgeless/utils/clipboard-utils.tsindex 1cac5f9acf..1eab8d3fdc 100644--- a/blocksuite/affine/block-root/src/edgeless/utils/clipboard-utils.ts+++ b/blocksuite/affine/block-root/src/edgeless/utils/clipboard-utils.ts@@ -18,7 +18,8 @@ import {type GfxModel,type SerializedElement,} from '@blocksuite/block-std/gfx';-import { getCommonBoundWithRotation, groupBy } from '@blocksuite/global/utils';+import { getCommonBoundWithRotation } from '@blocksuite/global/gfx';+import { groupBy } from '@blocksuite/global/utils';import { type BlockSnapshot, BlockSnapshotSchema } from '@blocksuite/store';import type { EdgelessRootBlockComponent } from '../edgeless-root-block.js';diff --git a/blocksuite/affine/block-root/src/edgeless/utils/panning-utils.ts b/blocksuite/affine/block-root/src/edgeless/utils/panning-utils.tsindex 0272d42571..06956f29b3 100644--- a/blocksuite/affine/block-root/src/edgeless/utils/panning-utils.ts+++ b/blocksuite/affine/block-root/src/edgeless/utils/panning-utils.ts@@ -1,6 +1,6 @@import type { PointerEventState } from '@blocksuite/block-std';import type { Viewport } from '@blocksuite/block-std/gfx';-import type { IVec } from '@blocksuite/global/utils';+import type { IVec } from '@blocksuite/global/gfx';const PANNING_DISTANCE = 30;diff --git a/blocksuite/affine/block-root/src/edgeless/utils/query.ts b/blocksuite/affine/block-root/src/edgeless/utils/query.tsindex 980460e55c..346c6c2d54 100644--- a/blocksuite/affine/block-root/src/edgeless/utils/query.ts+++ b/blocksuite/affine/block-root/src/edgeless/utils/query.ts@@ -29,8 +29,8 @@ import type {GfxToolsFullOptionValue,Viewport,} from '@blocksuite/block-std/gfx';-import type { PointLocation } from '@blocksuite/global/utils';-import { Bound } from '@blocksuite/global/utils';+import type { PointLocation } from '@blocksuite/global/gfx';+import { Bound } from '@blocksuite/global/gfx';import type { BlockModel } from '@blocksuite/store';export function isMindmapNode(element: GfxBlockElementModel | GfxModel | null) {diff --git a/blocksuite/affine/block-root/src/edgeless/utils/snap-manager.ts b/blocksuite/affine/block-root/src/edgeless/utils/snap-manager.tsindex 6352176b23..7816f7f439 100644--- a/blocksuite/affine/block-root/src/edgeless/utils/snap-manager.ts+++ b/blocksuite/affine/block-root/src/edgeless/utils/snap-manager.ts@@ -1,7 +1,7 @@import { Overlay } from '@blocksuite/affine-block-surface';import { ConnectorElementModel } from '@blocksuite/affine-model';import type { GfxModel } from '@blocksuite/block-std/gfx';-import { almostEqual, Bound, Point } from '@blocksuite/global/utils';+import { almostEqual, Bound, Point } from '@blocksuite/global/gfx';interface Distance {horiz?: {diff --git a/blocksuite/affine/block-root/src/edgeless/utils/text.ts b/blocksuite/affine/block-root/src/edgeless/utils/text.tsindex a3063295fc..38dceb771c 100644--- a/blocksuite/affine/block-root/src/edgeless/utils/text.ts+++ b/blocksuite/affine/block-root/src/edgeless/utils/text.ts@@ -12,8 +12,9 @@ import type {import { ShapeElementModel, TextElementModel } from '@blocksuite/affine-model';import type { PointerEventState } from '@blocksuite/block-std';import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';-import type { IVec } from '@blocksuite/global/utils';-import { assertInstanceOf, Bound } from '@blocksuite/global/utils';+import type { IVec } from '@blocksuite/global/gfx';+import { Bound } from '@blocksuite/global/gfx';+import { assertInstanceOf } from '@blocksuite/global/utils';import * as Y from 'yjs';import { EdgelessConnectorLabelEditor } from '../components/text/edgeless-connector-label-editor.js';diff --git a/blocksuite/affine/block-root/src/edgeless/utils/tool-overlay.ts b/blocksuite/affine/block-root/src/edgeless/utils/tool-overlay.tsindex 7f1f12e133..86a4a4fb57 100644--- a/blocksuite/affine/block-root/src/edgeless/utils/tool-overlay.ts+++ b/blocksuite/affine/block-root/src/edgeless/utils/tool-overlay.ts@@ -12,10 +12,10 @@ import {} from '@blocksuite/affine-model';import { ThemeProvider } from '@blocksuite/affine-shared/services';import type { GfxController, GfxToolsMap } from '@blocksuite/block-std/gfx';-import type { XYWH } from '@blocksuite/global/utils';+import type { XYWH } from '@blocksuite/global/gfx';+import { Bound } from '@blocksuite/global/gfx';import {assertType,- Bound,DisposableGroup,noop,Slot,diff --git a/blocksuite/affine/block-root/src/page/page-root-block.ts b/blocksuite/affine/block-root/src/page/page-root-block.tsindex 97226410fb..98d6d4a099 100644--- a/blocksuite/affine/block-root/src/page/page-root-block.ts+++ b/blocksuite/affine/block-root/src/page/page-root-block.ts@@ -23,7 +23,7 @@ import {BlockSelection,TextSelection,} from '@blocksuite/block-std';-import { Point } from '@blocksuite/global/utils';+import { Point } from '@blocksuite/global/gfx';import type { BlockModel, Text } from '@blocksuite/store';import { css, html } from 'lit';import { query } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-root/src/widgets/element-toolbar/add-frame-button.ts b/blocksuite/affine/block-root/src/widgets/element-toolbar/add-frame-button.tsindex bb0335d1c5..80cbf4c6ce 100644--- a/blocksuite/affine/block-root/src/widgets/element-toolbar/add-frame-button.ts+++ b/blocksuite/affine/block-root/src/widgets/element-toolbar/add-frame-button.ts@@ -1,7 +1,8 @@import { MindmapElementModel } from '@blocksuite/affine-model';import { TelemetryProvider } from '@blocksuite/affine-shared/services';import type { GfxModel } from '@blocksuite/block-std/gfx';-import { Bound, WithDisposable } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { WithDisposable } from '@blocksuite/global/utils';import { FrameIcon } from '@blocksuite/icons/lit';import { css, html, LitElement, nothing } from 'lit';import { property } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-root/src/widgets/element-toolbar/align-button.ts b/blocksuite/affine/block-root/src/widgets/element-toolbar/align-button.tsindex 93a89eb68c..8d3b70e122 100644--- a/blocksuite/affine/block-root/src/widgets/element-toolbar/align-button.ts+++ b/blocksuite/affine/block-root/src/widgets/element-toolbar/align-button.ts@@ -6,7 +6,8 @@ import {} from '@blocksuite/affine-block-surface';import { MindmapElementModel } from '@blocksuite/affine-model';import type { GfxModel } from '@blocksuite/block-std/gfx';-import { Bound, WithDisposable } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { WithDisposable } from '@blocksuite/global/utils';import {AlignBottomIcon,AlignHorizontalCenterIcon,diff --git a/blocksuite/affine/block-root/src/widgets/element-toolbar/change-attachment-button.ts b/blocksuite/affine/block-root/src/widgets/element-toolbar/change-attachment-button.tsindex 7f95ed668d..68c093ec7e 100644--- a/blocksuite/affine/block-root/src/widgets/element-toolbar/change-attachment-button.ts+++ b/blocksuite/affine/block-root/src/widgets/element-toolbar/change-attachment-button.ts@@ -18,7 +18,8 @@ import {EMBED_CARD_WIDTH,} from '@blocksuite/affine-shared/consts';import { ThemeProvider } from '@blocksuite/affine-shared/services';-import { Bound, WithDisposable } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { WithDisposable } from '@blocksuite/global/utils';import type { TemplateResult } from 'lit';import { html, LitElement, nothing } from 'lit';import { property } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-root/src/widgets/element-toolbar/change-embed-card-button.ts b/blocksuite/affine/block-root/src/widgets/element-toolbar/change-embed-card-button.tsindex cdea84b52d..4870f932da 100644--- a/blocksuite/affine/block-root/src/widgets/element-toolbar/change-embed-card-button.ts+++ b/blocksuite/affine/block-root/src/widgets/element-toolbar/change-embed-card-button.ts@@ -54,7 +54,8 @@ import {} from '@blocksuite/affine-shared/services';import { getHostName, referenceToNode } from '@blocksuite/affine-shared/utils';import type { BlockStdScope } from '@blocksuite/block-std';-import { Bound, WithDisposable } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { WithDisposable } from '@blocksuite/global/utils';import { css, html, LitElement, nothing, type TemplateResult } from 'lit';import { property, state } from 'lit/decorators.js';import { ifDefined } from 'lit/directives/if-defined.js';diff --git a/blocksuite/affine/block-root/src/widgets/element-toolbar/change-frame-button.ts b/blocksuite/affine/block-root/src/widgets/element-toolbar/change-frame-button.tsindex 70b7648e48..cc8d1aba1f 100644--- a/blocksuite/affine/block-root/src/widgets/element-toolbar/change-frame-button.ts+++ b/blocksuite/affine/block-root/src/widgets/element-toolbar/change-frame-button.ts@@ -22,13 +22,8 @@ import { FeatureFlagService } from '@blocksuite/affine-shared/services';import type { ColorEvent } from '@blocksuite/affine-shared/utils';import { matchModels } from '@blocksuite/affine-shared/utils';import { GfxExtensionIdentifier } from '@blocksuite/block-std/gfx';-import {- countBy,- deserializeXYWH,- maxBy,- serializeXYWH,- WithDisposable,-} from '@blocksuite/global/utils';+import { deserializeXYWH, serializeXYWH } from '@blocksuite/global/gfx';+import { countBy, maxBy, WithDisposable } from '@blocksuite/global/utils';import { EditIcon, PageIcon, UngroupIcon } from '@blocksuite/icons/lit';import { html, LitElement, nothing } from 'lit';import { property, query } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-root/src/widgets/element-toolbar/change-group-button.ts b/blocksuite/affine/block-root/src/widgets/element-toolbar/change-group-button.tsindex 592425b104..b1cff00381 100644--- a/blocksuite/affine/block-root/src/widgets/element-toolbar/change-group-button.ts+++ b/blocksuite/affine/block-root/src/widgets/element-toolbar/change-group-button.ts@@ -7,11 +7,8 @@ import {NoteDisplayMode,} from '@blocksuite/affine-model';import { matchModels } from '@blocksuite/affine-shared/utils';-import {- deserializeXYWH,- serializeXYWH,- WithDisposable,-} from '@blocksuite/global/utils';+import { deserializeXYWH, serializeXYWH } from '@blocksuite/global/gfx';+import { WithDisposable } from '@blocksuite/global/utils';import { EditIcon, PageIcon, UngroupIcon } from '@blocksuite/icons/lit';import { html, LitElement, nothing } from 'lit';import { property } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-root/src/widgets/element-toolbar/change-note-button.ts b/blocksuite/affine/block-root/src/widgets/element-toolbar/change-note-button.tsindex 4ec137a818..ae7dd6bb1d 100644--- a/blocksuite/affine/block-root/src/widgets/element-toolbar/change-note-button.ts+++ b/blocksuite/affine/block-root/src/widgets/element-toolbar/change-note-button.ts@@ -30,12 +30,8 @@ import {TelemetryProvider,ThemeProvider,} from '@blocksuite/affine-shared/services';-import {- Bound,- countBy,- maxBy,- WithDisposable,-} from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { countBy, maxBy, WithDisposable } from '@blocksuite/global/utils';import {AutoHeightIcon,CornerIcon,diff --git a/blocksuite/affine/block-root/src/widgets/element-toolbar/change-text-menu.ts b/blocksuite/affine/block-root/src/widgets/element-toolbar/change-text-menu.tsindex a3b8bcebab..0333bacdd8 100644--- a/blocksuite/affine/block-root/src/widgets/element-toolbar/change-text-menu.ts+++ b/blocksuite/affine/block-root/src/widgets/element-toolbar/change-text-menu.ts@@ -31,12 +31,8 @@ import {} from '@blocksuite/affine-model';import { FeatureFlagService } from '@blocksuite/affine-shared/services';import type { ColorEvent } from '@blocksuite/affine-shared/utils';-import {- Bound,- countBy,- maxBy,- WithDisposable,-} from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { countBy, maxBy, WithDisposable } from '@blocksuite/global/utils';import {TextAlignCenterIcon,TextAlignLeftIcon,diff --git a/blocksuite/affine/block-root/src/widgets/element-toolbar/index.ts b/blocksuite/affine/block-root/src/widgets/element-toolbar/index.tsindex c8a4d0dd5e..e9ddc6aee9 100644--- a/blocksuite/affine/block-root/src/widgets/element-toolbar/index.ts+++ b/blocksuite/affine/block-root/src/widgets/element-toolbar/index.ts@@ -30,13 +30,8 @@ import { ThemeProvider } from '@blocksuite/affine-shared/services';import { requestConnectedFrame } from '@blocksuite/affine-shared/utils';import { WidgetComponent } from '@blocksuite/block-std';import type { GfxModel } from '@blocksuite/block-std/gfx';-import {- atLeastNMatches,- clamp,- getCommonBoundWithRotation,- groupBy,- pickValues,-} from '@blocksuite/global/utils';+import { clamp, getCommonBoundWithRotation } from '@blocksuite/global/gfx';+import { atLeastNMatches, groupBy, pickValues } from '@blocksuite/global/utils';import { ConnectorCIcon } from '@blocksuite/icons/lit';import { css, html, nothing, type TemplateResult, unsafeCSS } from 'lit';import { property, state } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-root/src/widgets/element-toolbar/more-menu/config.ts b/blocksuite/affine/block-root/src/widgets/element-toolbar/more-menu/config.tsindex cd41553480..1f32c33abb 100644--- a/blocksuite/affine/block-root/src/widgets/element-toolbar/more-menu/config.ts+++ b/blocksuite/affine/block-root/src/widgets/element-toolbar/more-menu/config.ts@@ -16,7 +16,7 @@ import {OpenDocExtensionIdentifier,TelemetryProvider,} from '@blocksuite/affine-shared/services';-import { Bound, getCommonBoundWithRotation } from '@blocksuite/global/utils';+import { Bound, getCommonBoundWithRotation } from '@blocksuite/global/gfx';import {ArrowDownBigBottomIcon,ArrowDownBigIcon,diff --git a/blocksuite/affine/block-root/src/widgets/surface-ref-toolbar/utils.ts b/blocksuite/affine/block-root/src/widgets/surface-ref-toolbar/utils.tsindex a5a63b7553..543d3625d9 100644--- a/blocksuite/affine/block-root/src/widgets/surface-ref-toolbar/utils.ts+++ b/blocksuite/affine/block-root/src/widgets/surface-ref-toolbar/utils.ts@@ -7,7 +7,8 @@ import {GfxControllerIdentifier,type GfxModel,} from '@blocksuite/block-std/gfx';-import { assertExists, Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { assertExists } from '@blocksuite/global/utils';export const edgelessToBlob = async (host: EditorHost,diff --git a/blocksuite/affine/block-surface-ref/src/portal/generic-block.ts b/blocksuite/affine/block-surface-ref/src/portal/generic-block.tsindex 422f774a7e..2700bc5b09 100644--- a/blocksuite/affine/block-surface-ref/src/portal/generic-block.ts+++ b/blocksuite/affine/block-surface-ref/src/portal/generic-block.ts@@ -11,7 +11,8 @@ import type {ImageBlockModel,} from '@blocksuite/affine-model';import { ShadowlessElement } from '@blocksuite/block-std';-import { Bound, WithDisposable } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { WithDisposable } from '@blocksuite/global/utils';import type { BlockModel } from '@blocksuite/store';import { css, type TemplateResult } from 'lit';import { property } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-surface-ref/src/portal/note.ts b/blocksuite/affine/block-surface-ref/src/portal/note.tsindex 29890ba8ba..b7568f8bce 100644--- a/blocksuite/affine/block-surface-ref/src/portal/note.ts+++ b/blocksuite/affine/block-surface-ref/src/portal/note.ts@@ -17,7 +17,8 @@ import {RANGE_QUERY_EXCLUDE_ATTR,ShadowlessElement,} from '@blocksuite/block-std';-import { deserializeXYWH, WithDisposable } from '@blocksuite/global/utils';+import { deserializeXYWH } from '@blocksuite/global/gfx';+import { WithDisposable } from '@blocksuite/global/utils';import { type BlockModel, type Query } from '@blocksuite/store';import { css, nothing } from 'lit';import { property } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-surface-ref/src/surface-ref-block.ts b/blocksuite/affine/block-surface-ref/src/surface-ref-block.tsindex a3aa4f8bc5..d24545b7c6 100644--- a/blocksuite/affine/block-surface-ref/src/surface-ref-block.ts+++ b/blocksuite/affine/block-surface-ref/src/surface-ref-block.ts@@ -37,12 +37,11 @@ import {} from '@blocksuite/block-std/gfx';import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';import {- assertExists,Bound,deserializeXYWH,- DisposableGroup,type SerializedXYWH,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';+import { assertExists, DisposableGroup } from '@blocksuite/global/utils';import { DeleteIcon, EdgelessIcon, FrameIcon } from '@blocksuite/icons/lit';import type { BaseSelection, Store } from '@blocksuite/store';import { css, html, nothing, type TemplateResult } from 'lit';diff --git a/blocksuite/affine/block-surface/src/__tests__/a-star.unit.spec.ts b/blocksuite/affine/block-surface/src/__tests__/a-star.unit.spec.tsindex 276b2f599d..5e87b826dc 100644--- a/blocksuite/affine/block-surface/src/__tests__/a-star.unit.spec.ts+++ b/blocksuite/affine/block-surface/src/__tests__/a-star.unit.spec.ts@@ -1,5 +1,5 @@-import type { IVec, IVec3 } from '@blocksuite/global/utils';-import { almostEqual } from '@blocksuite/global/utils';+import type { IVec, IVec3 } from '@blocksuite/global/gfx';+import { almostEqual } from '@blocksuite/global/gfx';import { describe, expect, it } from 'vitest';import { AStarRunner } from '../utils/a-star.js';@@ -55,7 +55,7 @@ describe('a* algorithm', () => {let path: IVec[] | IVec3[] = aStar.path;path.pop();path.shift();- path = mergePath(path);+ path = mergePath(path as IVec3[]);const expected = [[0, 0],[100, 0],diff --git a/blocksuite/affine/block-surface/src/__tests__/bound.unit.spec.ts b/blocksuite/affine/block-surface/src/__tests__/bound.unit.spec.tsindex 5d4fa4fdfc..10c5b2e4b8 100644--- a/blocksuite/affine/block-surface/src/__tests__/bound.unit.spec.ts+++ b/blocksuite/affine/block-surface/src/__tests__/bound.unit.spec.ts@@ -3,7 +3,7 @@ import {getCommonBound,inflateBound,transformPointsToNewBound,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import { describe, expect, it } from 'vitest';describe('bound utils', () => {diff --git a/blocksuite/affine/block-surface/src/__tests__/graph.unit.spec.ts b/blocksuite/affine/block-surface/src/__tests__/graph.unit.spec.tsindex fc3c4117ce..ad14ed5993 100644--- a/blocksuite/affine/block-surface/src/__tests__/graph.unit.spec.ts+++ b/blocksuite/affine/block-surface/src/__tests__/graph.unit.spec.ts@@ -1,4 +1,4 @@-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import { describe, expect, it } from 'vitest';import { Graph } from '../utils/graph.js';diff --git a/blocksuite/affine/block-surface/src/__tests__/math-utils.unit.spec.ts b/blocksuite/affine/block-surface/src/__tests__/math-utils.unit.spec.tsindex e5f8e0b790..229b8d0c6c 100644--- a/blocksuite/affine/block-surface/src/__tests__/math-utils.unit.spec.ts+++ b/blocksuite/affine/block-surface/src/__tests__/math-utils.unit.spec.ts@@ -1,6 +1,5 @@import {almostEqual,- assertExists,isPointOnLineSegment,type IVec,lineEllipseIntersects,@@ -12,7 +11,8 @@ import {rotatePoints,toDegree,toRadian,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';+import { assertExists } from '@blocksuite/global/utils';import { describe, expect, it } from 'vitest';describe('Line', () => {diff --git a/blocksuite/affine/block-surface/src/commands/auto-align.ts b/blocksuite/affine/block-surface/src/commands/auto-align.tsindex 80a5fdf55e..5c76c2e0a4 100644--- a/blocksuite/affine/block-surface/src/commands/auto-align.ts+++ b/blocksuite/affine/block-surface/src/commands/auto-align.ts@@ -9,7 +9,7 @@ import {GfxControllerIdentifier,type GfxModel,} from '@blocksuite/block-std/gfx';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import chunk from 'lodash.chunk';const ALIGN_HEIGHT = 200;diff --git a/blocksuite/affine/block-surface/src/extensions/export-manager/export-manager.ts b/blocksuite/affine/block-surface/src/extensions/export-manager/export-manager.tsindex 0ff12d41ac..d48d5c8bba 100644--- a/blocksuite/affine/block-surface/src/extensions/export-manager/export-manager.ts+++ b/blocksuite/affine/block-surface/src/extensions/export-manager/export-manager.ts@@ -28,8 +28,8 @@ import {type GfxPrimitiveElementModel,} from '@blocksuite/block-std/gfx';import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';-import type { IBound } from '@blocksuite/global/utils';-import { Bound, deserializeXYWH } from '@blocksuite/global/utils';+import type { IBound } from '@blocksuite/global/gfx';+import { Bound, deserializeXYWH } from '@blocksuite/global/gfx';import type { ExtensionType, Store } from '@blocksuite/store';import { SurfaceElementModel } from '../../element-model/base.js';diff --git a/blocksuite/affine/block-surface/src/managers/connector-manager.ts b/blocksuite/affine/block-surface/src/managers/connector-manager.tsindex 637997e61a..afe71a7752 100644--- a/blocksuite/affine/block-surface/src/managers/connector-manager.ts+++ b/blocksuite/affine/block-surface/src/managers/connector-manager.ts@@ -12,12 +12,9 @@ import type {GfxLocalElementModel,GfxModel,} from '@blocksuite/block-std/gfx';-import type { IBound, IVec, IVec3 } from '@blocksuite/global/utils';+import type { IBound, IVec, IVec3 } from '@blocksuite/global/gfx';import {almostEqual,- assertEquals,- assertExists,- assertType,Bound,clamp,getBezierCurveBoundingBox,@@ -27,13 +24,18 @@ import {getPointFromBoundsWithRotation,isOverlap,isVecZero,- last,lineIntersects,PI2,PointLocation,sign,toRadian,Vec,+} from '@blocksuite/global/gfx';+import {+ assertEquals,+ assertExists,+ assertType,+ last,} from '@blocksuite/global/utils';import { effect } from '@preact/signals-core';diff --git a/blocksuite/affine/block-surface/src/renderer/canvas-renderer.ts b/blocksuite/affine/block-surface/src/renderer/canvas-renderer.tsindex 549c4316e8..e503c19227 100644--- a/blocksuite/affine/block-surface/src/renderer/canvas-renderer.ts+++ b/blocksuite/affine/block-surface/src/renderer/canvas-renderer.ts@@ -6,14 +6,9 @@ import type {SurfaceBlockModel,Viewport,} from '@blocksuite/block-std/gfx';-import type { IBound } from '@blocksuite/global/utils';-import {- DisposableGroup,- getBoundWithRotation,- intersects,- last,- Slot,-} from '@blocksuite/global/utils';+import type { IBound } from '@blocksuite/global/gfx';+import { getBoundWithRotation, intersects } from '@blocksuite/global/gfx';+import { DisposableGroup, last, Slot } from '@blocksuite/global/utils';import type { SurfaceElementModel } from '../element-model/base.js';import { RoughCanvas } from '../utils/rough/canvas.js';diff --git a/blocksuite/affine/block-surface/src/renderer/elements/connector/index.ts b/blocksuite/affine/block-surface/src/renderer/elements/connector/index.tsindex 0c9aabc27b..7341b2a574 100644--- a/blocksuite/affine/block-surface/src/renderer/elements/connector/index.ts+++ b/blocksuite/affine/block-surface/src/renderer/elements/connector/index.ts@@ -8,7 +8,7 @@ import {import {getBezierParameters,type PointLocation,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import { deltaInsertsToChunks } from '@blocksuite/inline';import { isConnectorWithLabel } from '../../../managers/connector-manager.js';diff --git a/blocksuite/affine/block-surface/src/renderer/elements/connector/utils.ts b/blocksuite/affine/block-surface/src/renderer/elements/connector/utils.tsindex 7ecdf23a60..89d4eb79e0 100644--- a/blocksuite/affine/block-surface/src/renderer/elements/connector/utils.ts+++ b/blocksuite/affine/block-surface/src/renderer/elements/connector/utils.ts@@ -7,12 +7,12 @@ import type {BezierCurveParameters,IVec,PointLocation,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import {getBezierParameters,getBezierTangent,Vec,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import type { RoughCanvas } from '../../../utils/rough/canvas.js';diff --git a/blocksuite/affine/block-surface/src/renderer/elements/group/index.ts b/blocksuite/affine/block-surface/src/renderer/elements/group/index.tsindex a2c4ce71fa..7bfc7f7842 100644--- a/blocksuite/affine/block-surface/src/renderer/elements/group/index.ts+++ b/blocksuite/affine/block-surface/src/renderer/elements/group/index.ts@@ -1,5 +1,5 @@import type { GroupElementModel } from '@blocksuite/affine-model';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import type { CanvasRenderer } from '../../canvas-renderer.js';import { titleRenderParams } from './utils.js';diff --git a/blocksuite/affine/block-surface/src/renderer/elements/group/utils.ts b/blocksuite/affine/block-surface/src/renderer/elements/group/utils.tsindex eea058d098..a0b8a4febf 100644--- a/blocksuite/affine/block-surface/src/renderer/elements/group/utils.ts+++ b/blocksuite/affine/block-surface/src/renderer/elements/group/utils.ts@@ -1,6 +1,6 @@import type { GroupElementModel } from '@blocksuite/affine-model';import { FontWeight } from '@blocksuite/affine-model';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import {getFontString,diff --git a/blocksuite/affine/block-surface/src/renderer/elements/index.ts b/blocksuite/affine/block-surface/src/renderer/elements/index.tsindex 719aef4486..4a74ce018b 100644--- a/blocksuite/affine/block-surface/src/renderer/elements/index.ts+++ b/blocksuite/affine/block-surface/src/renderer/elements/index.ts@@ -1,5 +1,5 @@import type { GfxPrimitiveElementModel } from '@blocksuite/block-std/gfx';-import type { IBound } from '@blocksuite/global/utils';+import type { IBound } from '@blocksuite/global/gfx';import type { RoughCanvas } from '../../index.js';import type { CanvasRenderer } from '../canvas-renderer.js';diff --git a/blocksuite/affine/block-surface/src/renderer/elements/mindmap.ts b/blocksuite/affine/block-surface/src/renderer/elements/mindmap.tsindex c505b98bd9..f8aac70546 100644--- a/blocksuite/affine/block-surface/src/renderer/elements/mindmap.ts+++ b/blocksuite/affine/block-surface/src/renderer/elements/mindmap.ts@@ -3,7 +3,7 @@ import type {MindmapNode,} from '@blocksuite/affine-model';import type { GfxModel } from '@blocksuite/block-std/gfx';-import type { IBound } from '@blocksuite/global/utils';+import type { IBound } from '@blocksuite/global/gfx';import { ConnectorPathGenerator } from '../../managers/connector-manager.js';import type { RoughCanvas } from '../../utils/rough/canvas.js';diff --git a/blocksuite/affine/block-surface/src/renderer/elements/shape/index.ts b/blocksuite/affine/block-surface/src/renderer/elements/shape/index.tsindex 5d8d09ad10..3e809ed28a 100644--- a/blocksuite/affine/block-surface/src/renderer/elements/shape/index.ts+++ b/blocksuite/affine/block-surface/src/renderer/elements/shape/index.ts@@ -4,8 +4,8 @@ import type {ShapeType,} from '@blocksuite/affine-model';import { DefaultTheme, TextAlign } from '@blocksuite/affine-model';-import type { IBound } from '@blocksuite/global/utils';-import { Bound } from '@blocksuite/global/utils';+import type { IBound } from '@blocksuite/global/gfx';+import { Bound } from '@blocksuite/global/gfx';import { deltaInsertsToChunks } from '@blocksuite/inline';import type { RoughCanvas } from '../../../utils/rough/canvas.js';diff --git a/blocksuite/affine/block-surface/src/renderer/elements/shape/utils.ts b/blocksuite/affine/block-surface/src/renderer/elements/shape/utils.tsindex 153a770ad4..57e80ec92b 100644--- a/blocksuite/affine/block-surface/src/renderer/elements/shape/utils.ts+++ b/blocksuite/affine/block-surface/src/renderer/elements/shape/utils.ts@@ -5,7 +5,7 @@ import type {TextVerticalAlign,} from '@blocksuite/affine-model';import { FeatureFlagService } from '@blocksuite/affine-shared/services';-import type { Bound, SerializedXYWH } from '@blocksuite/global/utils';+import type { Bound, SerializedXYWH } from '@blocksuite/global/gfx';import { deltaInsertsToChunks } from '@blocksuite/inline';import type { CanvasRenderer } from '../../canvas-renderer.js';diff --git a/blocksuite/affine/block-surface/src/renderer/elements/text/utils.ts b/blocksuite/affine/block-surface/src/renderer/elements/text/utils.tsindex 623cc59236..e01a244a75 100644--- a/blocksuite/affine/block-surface/src/renderer/elements/text/utils.ts+++ b/blocksuite/affine/block-surface/src/renderer/elements/text/utils.ts@@ -4,11 +4,11 @@ import type {FontWeight,TextElementModel,} from '@blocksuite/affine-model';-import type { Bound } from '@blocksuite/global/utils';+import type { Bound } from '@blocksuite/global/gfx';import {getPointsFromBoundWithRotation,rotatePoints,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import { deltaInsertsToChunks } from '@blocksuite/inline';import type * as Y from 'yjs';diff --git a/blocksuite/affine/block-surface/src/surface-block.ts b/blocksuite/affine/block-surface/src/surface-block.tsindex d68662c445..2300f47176 100644--- a/blocksuite/affine/block-surface/src/surface-block.ts+++ b/blocksuite/affine/block-surface/src/surface-block.ts@@ -6,8 +6,8 @@ import {GfxControllerIdentifier,type Viewport,} from '@blocksuite/block-std/gfx';+import { Bound } from '@blocksuite/global/gfx';import type { Slot } from '@blocksuite/global/utils';-import { Bound } from '@blocksuite/global/utils';import { css, html } from 'lit';import { query } from 'lit/decorators.js';diff --git a/blocksuite/affine/block-surface/src/utils/a-star.ts b/blocksuite/affine/block-surface/src/utils/a-star.tsindex ce56976a3f..8bfb4495ed 100644--- a/blocksuite/affine/block-surface/src/utils/a-star.ts+++ b/blocksuite/affine/block-surface/src/utils/a-star.ts@@ -1,5 +1,6 @@-import type { Bound, IVec3 } from '@blocksuite/global/utils';-import { almostEqual, assertExists } from '@blocksuite/global/utils';+import type { Bound, IVec3 } from '@blocksuite/global/gfx';+import { almostEqual } from '@blocksuite/global/gfx';+import { assertExists } from '@blocksuite/global/utils';import { Graph } from './graph.js';import { PriorityQueue } from './priority-queue.js';diff --git a/blocksuite/affine/block-surface/src/utils/add-note.ts b/blocksuite/affine/block-surface/src/utils/add-note.tsindex e0888606d7..af355fbe9f 100644--- a/blocksuite/affine/block-surface/src/utils/add-note.ts+++ b/blocksuite/affine/block-surface/src/utils/add-note.ts@@ -14,11 +14,7 @@ import {type GfxBlockElementModel,GfxControllerIdentifier,} from '@blocksuite/block-std/gfx';-import {- type IPoint,- type Point,- serializeXYWH,-} from '@blocksuite/global/utils';+import { type IPoint, type Point, serializeXYWH } from '@blocksuite/global/gfx';import { DEFAULT_NOTE_OFFSET_X, DEFAULT_NOTE_OFFSET_Y } from '../consts';import { EdgelessCRUDIdentifier } from '../extensions/crud-extension';diff --git a/blocksuite/affine/block-surface/src/utils/get-bg-grip-gap.ts b/blocksuite/affine/block-surface/src/utils/get-bg-grip-gap.tsindex aebe5693a1..69e0c3ec9b 100644--- a/blocksuite/affine/block-surface/src/utils/get-bg-grip-gap.ts+++ b/blocksuite/affine/block-surface/src/utils/get-bg-grip-gap.ts@@ -1,4 +1,4 @@-import { clamp } from '@blocksuite/global/utils';+import { clamp } from '@blocksuite/global/gfx';import { GRID_GAP_MAX, GRID_GAP_MIN } from '../consts';diff --git a/blocksuite/affine/block-surface/src/utils/graph.ts b/blocksuite/affine/block-surface/src/utils/graph.tsindex 3d57875960..e621139684 100644--- a/blocksuite/affine/block-surface/src/utils/graph.ts+++ b/blocksuite/affine/block-surface/src/utils/graph.ts@@ -1,9 +1,9 @@-import type { Bound, IVec, IVec3 } from '@blocksuite/global/utils';+import type { Bound, IVec, IVec3 } from '@blocksuite/global/gfx';import {almostEqual,isOverlap as _isOverlap,linePolygonIntersects,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';function isOverlap(line: IVec[], line2: IVec[]) {if (diff --git a/blocksuite/affine/block-surface/src/utils/mindmap/layout.ts b/blocksuite/affine/block-surface/src/utils/mindmap/layout.tsindex 2328084706..1e275592a0 100644--- a/blocksuite/affine/block-surface/src/utils/mindmap/layout.ts+++ b/blocksuite/affine/block-surface/src/utils/mindmap/layout.ts@@ -4,8 +4,8 @@ import {type MindmapNode,type MindmapRoot,} from '@blocksuite/affine-model';-import type { SerializedXYWH } from '@blocksuite/global/utils';-import { Bound } from '@blocksuite/global/utils';+import type { SerializedXYWH } from '@blocksuite/global/gfx';+import { Bound } from '@blocksuite/global/gfx';export const NODE_VERTICAL_SPACING = 45;export const NODE_HORIZONTAL_SPACING = 110;diff --git a/blocksuite/affine/block-surface/src/utils/mindmap/utils.ts b/blocksuite/affine/block-surface/src/utils/mindmap/utils.tsindex a96b047835..8e6b349105 100644--- a/blocksuite/affine/block-surface/src/utils/mindmap/utils.ts+++ b/blocksuite/affine/block-surface/src/utils/mindmap/utils.ts@@ -13,7 +13,8 @@ import {generateKeyBetween,type SurfaceBlockModel,} from '@blocksuite/block-std/gfx';-import { assertType, isEqual, type IVec, last } from '@blocksuite/global/utils';+import type { IVec } from '@blocksuite/global/gfx';+import { assertType, isEqual, last } from '@blocksuite/global/utils';import * as Y from 'yjs';import { fitContent } from '../../renderer/elements/shape/utils.js';diff --git a/blocksuite/affine/block-surface/src/utils/update-xywh.ts b/blocksuite/affine/block-surface/src/utils/update-xywh.tsindex ba8eb333f6..6474bb1614 100644--- a/blocksuite/affine/block-surface/src/utils/update-xywh.ts+++ b/blocksuite/affine/block-surface/src/utils/update-xywh.ts@@ -10,7 +10,7 @@ import {type GfxModel,isGfxGroupCompatibleModel,} from '@blocksuite/block-std/gfx';-import { Bound, clamp } from '@blocksuite/global/utils';+import { Bound, clamp } from '@blocksuite/global/gfx';import type { BlockModel, BlockProps } from '@blocksuite/store';function updatChildElementsXYWH(diff --git a/blocksuite/affine/components/src/color-picker/color-picker.ts b/blocksuite/affine/components/src/color-picker/color-picker.tsindex a002ff6a43..27bd4652b0 100644--- a/blocksuite/affine/components/src/color-picker/color-picker.ts+++ b/blocksuite/affine/components/src/color-picker/color-picker.ts@@ -1,6 +1,7 @@import type { Color } from '@blocksuite/affine-model';import { on, once, stopPropagation } from '@blocksuite/affine-shared/utils';-import { clamp, SignalWatcher, WithDisposable } from '@blocksuite/global/utils';+import { clamp } from '@blocksuite/global/gfx';+import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';import { batch, computed, signal } from '@preact/signals-core';import { html, LitElement } from 'lit';import { property, query } from 'lit/decorators.js';diff --git a/blocksuite/affine/components/src/color-picker/utils.ts b/blocksuite/affine/components/src/color-picker/utils.tsindex 0712a6adfa..85c4319c8e 100644--- a/blocksuite/affine/components/src/color-picker/utils.ts+++ b/blocksuite/affine/components/src/color-picker/utils.ts@@ -1,7 +1,7 @@// https://www.w3.org/TR/css-color-4/import type { Color, ColorScheme } from '@blocksuite/affine-model';-import { clamp } from '@blocksuite/global/utils';+import { clamp } from '@blocksuite/global/gfx';import { COLORS, FIRST_COLOR } from './consts.js';import type {diff --git a/blocksuite/affine/components/src/date-picker/date-picker.ts b/blocksuite/affine/components/src/date-picker/date-picker.tsindex a4f51d45a9..6e14f1ce2f 100644--- a/blocksuite/affine/components/src/date-picker/date-picker.ts+++ b/blocksuite/affine/components/src/date-picker/date-picker.ts@@ -1,4 +1,5 @@-import { clamp, WithDisposable } from '@blocksuite/global/utils';+import { clamp } from '@blocksuite/global/gfx';+import { WithDisposable } from '@blocksuite/global/utils';import { isSameDay, isSameMonth, isToday } from 'date-fns';import {html,diff --git a/blocksuite/affine/components/src/drop-indicator/drop-indicator.ts b/blocksuite/affine/components/src/drop-indicator/drop-indicator.tsindex cf5941a0dd..1baf1ab399 100644--- a/blocksuite/affine/components/src/drop-indicator/drop-indicator.ts+++ b/blocksuite/affine/components/src/drop-indicator/drop-indicator.ts@@ -1,4 +1,4 @@-import type { Rect } from '@blocksuite/global/utils';+import { type Rect } from '@blocksuite/global/gfx';import { css, html, LitElement } from 'lit';import { property, state } from 'lit/decorators.js';import { styleMap } from 'lit/directives/style-map.js';diff --git a/blocksuite/affine/components/src/drop-indicator/file-drop-manager.ts b/blocksuite/affine/components/src/drop-indicator/file-drop-manager.tsindex e8f27eee12..dfb14258eb 100644--- a/blocksuite/affine/components/src/drop-indicator/file-drop-manager.ts+++ b/blocksuite/affine/components/src/drop-indicator/file-drop-manager.ts@@ -14,8 +14,9 @@ import {} from '@blocksuite/block-std';import { SurfaceBlockModel } from '@blocksuite/block-std/gfx';import { createIdentifier } from '@blocksuite/global/di';-import type { IVec } from '@blocksuite/global/utils';-import { Point, throttle } from '@blocksuite/global/utils';+import type { IVec } from '@blocksuite/global/gfx';+import { Point } from '@blocksuite/global/gfx';+import { throttle } from '@blocksuite/global/utils';import type { BlockModel, ExtensionType } from '@blocksuite/store';import { computed, signal } from '@preact/signals-core';diff --git a/blocksuite/affine/data-view/src/property-presets/converts.ts b/blocksuite/affine/data-view/src/property-presets/converts.tsindex 54b94823d9..8927488d22 100644--- a/blocksuite/affine/data-view/src/property-presets/converts.ts+++ b/blocksuite/affine/data-view/src/property-presets/converts.ts@@ -1,4 +1,4 @@-import { clamp } from '@blocksuite/global/utils';+import { clamp } from '@blocksuite/global/gfx';import { createPropertyConvert } from '../core/index.js';import { multiSelectPropertyModelConfig } from './multi-select/define.js';diff --git a/blocksuite/affine/data-view/src/view-presets/kanban/pc/controller/drag.ts b/blocksuite/affine/data-view/src/view-presets/kanban/pc/controller/drag.tsindex 74c216a134..decda0736e 100644--- a/blocksuite/affine/data-view/src/view-presets/kanban/pc/controller/drag.ts+++ b/blocksuite/affine/data-view/src/view-presets/kanban/pc/controller/drag.ts@@ -1,5 +1,6 @@import type { InsertToPosition } from '@blocksuite/affine-shared/utils';-import { assertExists, Point, Rect } from '@blocksuite/global/utils';+import { Point, Rect } from '@blocksuite/global/gfx';+import { assertExists } from '@blocksuite/global/utils';import { computed } from '@preact/signals-core';import type { ReactiveController } from 'lit';diff --git a/blocksuite/affine/fragment-frame-panel/src/body/frame-panel-body.ts b/blocksuite/affine/fragment-frame-panel/src/body/frame-panel-body.tsindex fa6ddeb562..dff58016ca 100644--- a/blocksuite/affine/fragment-frame-panel/src/body/frame-panel-body.ts+++ b/blocksuite/affine/fragment-frame-panel/src/body/frame-panel-body.ts@@ -9,8 +9,8 @@ import {generateKeyBetweenV2,GfxControllerIdentifier,} from '@blocksuite/block-std/gfx';+import { Bound } from '@blocksuite/global/gfx';import {- Bound,DisposableGroup,SignalWatcher,WithDisposable,diff --git a/blocksuite/affine/fragment-outline/src/body/outline-panel-body.ts b/blocksuite/affine/fragment-outline/src/body/outline-panel-body.tsindex b0da8c260a..f96aa0a3c5 100644--- a/blocksuite/affine/fragment-outline/src/body/outline-panel-body.ts+++ b/blocksuite/affine/fragment-outline/src/body/outline-panel-body.ts@@ -4,7 +4,8 @@ import { DocModeProvider } from '@blocksuite/affine-shared/services';import { matchModels } from '@blocksuite/affine-shared/utils';import { ShadowlessElement, SurfaceSelection } from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';-import { Bound, SignalWatcher, WithDisposable } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';+import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';import type { BlockModel } from '@blocksuite/store';import { consume } from '@lit/context';import { effect, signal } from '@preact/signals-core';diff --git a/blocksuite/affine/fragment-outline/src/utils/scroll.ts b/blocksuite/affine/fragment-outline/src/utils/scroll.tsindex f21d633273..ee2bfbee11 100644--- a/blocksuite/affine/fragment-outline/src/utils/scroll.ts+++ b/blocksuite/affine/fragment-outline/src/utils/scroll.ts@@ -3,7 +3,8 @@ import { NoteDisplayMode } from '@blocksuite/affine-model';import { DocModeProvider } from '@blocksuite/affine-shared/services';import type { Viewport } from '@blocksuite/affine-shared/types';import type { EditorHost } from '@blocksuite/block-std';-import { clamp, DisposableGroup } from '@blocksuite/global/utils';+import { clamp } from '@blocksuite/global/gfx';+import { DisposableGroup } from '@blocksuite/global/utils';import { getHeadingBlocksFromDoc } from './query.js';diff --git a/blocksuite/affine/model/src/blocks/frame/frame-model.ts b/blocksuite/affine/model/src/blocks/frame/frame-model.tsindex 1670d48d8e..cda24f1f3b 100644--- a/blocksuite/affine/model/src/blocks/frame/frame-model.ts+++ b/blocksuite/affine/model/src/blocks/frame/frame-model.ts@@ -14,7 +14,7 @@ import {gfxGroupCompatibleSymbol,hasDescendantElementImpl,} from '@blocksuite/block-std/gfx';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import {BlockModel,BlockSchemaExtension,diff --git a/blocksuite/affine/model/src/blocks/note/note-model.ts b/blocksuite/affine/model/src/blocks/note/note-model.tsindex 9f8ee66c2b..65ca43cca1 100644--- a/blocksuite/affine/model/src/blocks/note/note-model.ts+++ b/blocksuite/affine/model/src/blocks/note/note-model.ts@@ -3,7 +3,7 @@ import type {GfxElementGeometry,} from '@blocksuite/block-std/gfx';import { GfxCompatible } from '@blocksuite/block-std/gfx';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import {BlockModel,BlockSchemaExtension,diff --git a/blocksuite/affine/model/src/elements/brush/brush.ts b/blocksuite/affine/model/src/elements/brush/brush.tsindex 0768927b2b..6d6d9badbd 100644--- a/blocksuite/affine/model/src/elements/brush/brush.ts+++ b/blocksuite/affine/model/src/elements/brush/brush.ts@@ -26,7 +26,7 @@ import {type SerializedXYWH,transformPointsToNewBound,Vec,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import { type Color, DefaultTheme } from '../../themes/index';diff --git a/blocksuite/affine/model/src/elements/connector/connector.ts b/blocksuite/affine/model/src/elements/connector/connector.tsindex 230fceed53..a9e7e73008 100644--- a/blocksuite/affine/model/src/elements/connector/connector.ts+++ b/blocksuite/affine/model/src/elements/connector/connector.ts@@ -9,7 +9,7 @@ import {GfxPrimitiveElementModel,local,} from '@blocksuite/block-std/gfx';-import type { IVec, SerializedXYWH, XYWH } from '@blocksuite/global/utils';+import type { IVec, SerializedXYWH, XYWH } from '@blocksuite/global/gfx';import {Bound,curveIntersects,@@ -22,7 +22,7 @@ import {Polyline,polyLineNearestPoint,Vec,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import * as Y from 'yjs';import {@@ -293,6 +293,10 @@ export class ConnectorElementModel extends GfxPrimitiveElementModel<ConnectorEle? getBezierNearestPoint(getBezierParameters(path), currentPoint): polyLineNearestPoint(path, currentPoint);+ if (!point) {+ return false;+ }+return (Vec.dist(point, currentPoint) <(options?.hitThreshold ? strokeWidth / 2 : 0) + 8diff --git a/blocksuite/affine/model/src/elements/connector/local-connector.ts b/blocksuite/affine/model/src/elements/connector/local-connector.tsindex 6092494d16..bb13cc6695 100644--- a/blocksuite/affine/model/src/elements/connector/local-connector.ts+++ b/blocksuite/affine/model/src/elements/connector/local-connector.ts@@ -1,5 +1,5 @@import { GfxLocalElementModel } from '@blocksuite/block-std/gfx';-import type { PointLocation } from '@blocksuite/global/utils';+import type { PointLocation } from '@blocksuite/global/gfx';import {ConnectorMode,diff --git a/blocksuite/affine/model/src/elements/group/group.ts b/blocksuite/affine/model/src/elements/group/group.tsindex 760ed7213b..c3bcfccc4f 100644--- a/blocksuite/affine/model/src/elements/group/group.ts+++ b/blocksuite/affine/model/src/elements/group/group.ts@@ -10,8 +10,9 @@ import {local,observe,} from '@blocksuite/block-std/gfx';-import type { IVec, PointLocation } from '@blocksuite/global/utils';-import { Bound, keys, linePolygonIntersects } from '@blocksuite/global/utils';+import type { IVec, PointLocation } from '@blocksuite/global/gfx';+import { Bound, linePolygonIntersects } from '@blocksuite/global/gfx';+import { keys } from '@blocksuite/global/utils';import * as Y from 'yjs';type GroupElementProps = BaseElementProps & {diff --git a/blocksuite/affine/model/src/elements/mindmap/mindmap.ts b/blocksuite/affine/model/src/elements/mindmap/mindmap.tsindex 01d57ec1bc..3765c4014d 100644--- a/blocksuite/affine/model/src/elements/mindmap/mindmap.ts+++ b/blocksuite/affine/model/src/elements/mindmap/mindmap.ts@@ -12,15 +12,9 @@ import {observe,watch,} from '@blocksuite/block-std/gfx';-import type { Bound, SerializedXYWH, XYWH } from '@blocksuite/global/utils';-import {- assertType,- deserializeXYWH,- keys,- last,- noop,- pick,-} from '@blocksuite/global/utils';+import type { Bound, SerializedXYWH, XYWH } from '@blocksuite/global/gfx';+import { deserializeXYWH } from '@blocksuite/global/gfx';+import { assertType, keys, last, noop, pick } from '@blocksuite/global/utils';import { generateKeyBetween } from 'fractional-indexing';import * as Y from 'yjs';import { z } from 'zod';diff --git a/blocksuite/affine/model/src/elements/shape/api/diamond.ts b/blocksuite/affine/model/src/elements/shape/api/diamond.tsindex 2c76487217..704c12fb3b 100644--- a/blocksuite/affine/model/src/elements/shape/api/diamond.ts+++ b/blocksuite/affine/model/src/elements/shape/api/diamond.ts@@ -1,5 +1,5 @@import type { PointTestOptions } from '@blocksuite/block-std/gfx';-import type { IBound, IVec } from '@blocksuite/global/utils';+import type { IBound, IVec } from '@blocksuite/global/gfx';import {Bound,getCenterAreaBounds,@@ -11,7 +11,7 @@ import {polygonGetPointTangent,polygonNearestPoint,rotatePoints,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import { DEFAULT_CENTRAL_AREA_RATIO } from '../../../consts/index.js';import type { ShapeElementModel } from '../shape.js';diff --git a/blocksuite/affine/model/src/elements/shape/api/ellipse.ts b/blocksuite/affine/model/src/elements/shape/api/ellipse.tsindex 203338b9c1..8e397c7ff2 100644--- a/blocksuite/affine/model/src/elements/shape/api/ellipse.ts+++ b/blocksuite/affine/model/src/elements/shape/api/ellipse.ts@@ -12,7 +12,7 @@ import {rotatePoints,toRadian,Vec,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import { DEFAULT_CENTRAL_AREA_RATIO } from '../../../consts/index.js';import type { ShapeElementModel } from '../shape.js';diff --git a/blocksuite/affine/model/src/elements/shape/api/rect.ts b/blocksuite/affine/model/src/elements/shape/api/rect.tsindex 1092d965cb..4e8804edf9 100644--- a/blocksuite/affine/model/src/elements/shape/api/rect.ts+++ b/blocksuite/affine/model/src/elements/shape/api/rect.ts@@ -1,5 +1,5 @@import type { PointTestOptions } from '@blocksuite/block-std/gfx';-import type { IBound, IVec } from '@blocksuite/global/utils';+import type { IBound, IVec } from '@blocksuite/global/gfx';import {Bound,getCenterAreaBounds,@@ -11,7 +11,7 @@ import {polygonGetPointTangent,polygonNearestPoint,rotatePoints,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import { DEFAULT_CENTRAL_AREA_RATIO } from '../../../consts/index.js';import type { ShapeElementModel } from '../shape.js';diff --git a/blocksuite/affine/model/src/elements/shape/api/triangle.ts b/blocksuite/affine/model/src/elements/shape/api/triangle.tsindex e4cc04d9b6..2e8e6f514b 100644--- a/blocksuite/affine/model/src/elements/shape/api/triangle.ts+++ b/blocksuite/affine/model/src/elements/shape/api/triangle.ts@@ -1,5 +1,5 @@import type { PointTestOptions } from '@blocksuite/block-std/gfx';-import type { IBound, IVec } from '@blocksuite/global/utils';+import type { IBound, IVec } from '@blocksuite/global/gfx';import {Bound,getCenterAreaBounds,@@ -11,7 +11,7 @@ import {polygonGetPointTangent,polygonNearestPoint,rotatePoints,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import { DEFAULT_CENTRAL_AREA_RATIO } from '../../../consts/index.js';import type { ShapeElementModel } from '../shape.js';diff --git a/blocksuite/affine/model/src/elements/shape/shape.ts b/blocksuite/affine/model/src/elements/shape/shape.tsindex 59b56790af..4ba356efa2 100644--- a/blocksuite/affine/model/src/elements/shape/shape.ts+++ b/blocksuite/affine/model/src/elements/shape/shape.ts@@ -15,7 +15,7 @@ import type {IVec,PointLocation,SerializedXYWH,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import * as Y from 'yjs';import {diff --git a/blocksuite/affine/model/src/elements/text/text.ts b/blocksuite/affine/model/src/elements/text/text.tsindex 5422b9b66b..10053a4e12 100644--- a/blocksuite/affine/model/src/elements/text/text.ts+++ b/blocksuite/affine/model/src/elements/text/text.ts@@ -1,13 +1,13 @@import type { BaseElementProps } from '@blocksuite/block-std/gfx';import { field, GfxPrimitiveElementModel } from '@blocksuite/block-std/gfx';-import type { IVec, SerializedXYWH } from '@blocksuite/global/utils';+import type { IVec, SerializedXYWH } from '@blocksuite/global/gfx';import {Bound,getPointsFromBoundWithRotation,linePolygonIntersects,pointInPolygon,polygonNearestPoint,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import * as Y from 'yjs';import {diff --git a/blocksuite/affine/shared/src/__tests__/utils/rect.unit.spec.ts b/blocksuite/affine/shared/src/__tests__/utils/rect.unit.spec.tsindex cf1a41aefe..f5620d5ea3 100644--- a/blocksuite/affine/shared/src/__tests__/utils/rect.unit.spec.ts+++ b/blocksuite/affine/shared/src/__tests__/utils/rect.unit.spec.ts@@ -1,4 +1,4 @@-import { Point } from '@blocksuite/global/utils';+import { Point } from '@blocksuite/global/gfx';import { describe, expect, it } from 'vitest';describe('Point', () => {diff --git a/blocksuite/affine/shared/src/utils/dnd/calc-drop-target.ts b/blocksuite/affine/shared/src/utils/dnd/calc-drop-target.tsindex 11142f915e..5ab2b14f7f 100644--- a/blocksuite/affine/shared/src/utils/dnd/calc-drop-target.ts+++ b/blocksuite/affine/shared/src/utils/dnd/calc-drop-target.ts@@ -1,6 +1,6 @@import { DatabaseBlockModel, ListBlockModel } from '@blocksuite/affine-model';import type { BlockComponent } from '@blocksuite/block-std';-import { type Point, Rect } from '@blocksuite/global/utils';+import { type Point, Rect } from '@blocksuite/global/gfx';import type { BlockModel } from '@blocksuite/store';import { BLOCK_CHILDREN_CONTAINER_PADDING_LEFT } from '../../consts/index.js';diff --git a/blocksuite/affine/shared/src/utils/dnd/get-drop-rect-by-point.ts b/blocksuite/affine/shared/src/utils/dnd/get-drop-rect-by-point.tsindex e8280a38cc..825a6bbc9e 100644--- a/blocksuite/affine/shared/src/utils/dnd/get-drop-rect-by-point.ts+++ b/blocksuite/affine/shared/src/utils/dnd/get-drop-rect-by-point.ts@@ -1,6 +1,6 @@import { DatabaseBlockModel } from '@blocksuite/affine-model';import { BLOCK_ID_ATTR } from '@blocksuite/block-std';-import type { Point } from '@blocksuite/global/utils';+import type { Point } from '@blocksuite/global/gfx';import type { BlockModel } from '@blocksuite/store';import { getRectByBlockComponent } from '../dom/index.js';diff --git a/blocksuite/affine/shared/src/utils/dnd/types.ts b/blocksuite/affine/shared/src/utils/dnd/types.tsindex c4fa1e6978..8456a8ac56 100644--- a/blocksuite/affine/shared/src/utils/dnd/types.ts+++ b/blocksuite/affine/shared/src/utils/dnd/types.ts@@ -1,5 +1,5 @@import type { BlockComponent } from '@blocksuite/block-std';-import type { Rect } from '@blocksuite/global/utils';+import type { Rect } from '@blocksuite/global/gfx';import type { BlockModel } from '@blocksuite/store';export interface EditingState {diff --git a/blocksuite/affine/shared/src/utils/dom/point-to-block.ts b/blocksuite/affine/shared/src/utils/dom/point-to-block.tsindex 5ff1bd22fe..cf910bb0e6 100644--- a/blocksuite/affine/shared/src/utils/dom/point-to-block.ts+++ b/blocksuite/affine/shared/src/utils/dom/point-to-block.ts@@ -1,7 +1,7 @@import { NoteBlockModel, RootBlockModel } from '@blocksuite/affine-model';import { BLOCK_ID_ATTR, type BlockComponent } from '@blocksuite/block-std';import { SurfaceBlockModel } from '@blocksuite/block-std/gfx';-import { clamp, type Point, type Rect } from '@blocksuite/global/utils';+import { clamp, type Point, type Rect } from '@blocksuite/global/gfx';import type { BlockModel } from '@blocksuite/store';import { BLOCK_CHILDREN_CONTAINER_PADDING_LEFT } from '../../consts/index.js';diff --git a/blocksuite/affine/shared/src/utils/edgeless.ts b/blocksuite/affine/shared/src/utils/edgeless.tsindex ff8c4b6fac..93f3e11596 100644--- a/blocksuite/affine/shared/src/utils/edgeless.ts+++ b/blocksuite/affine/shared/src/utils/edgeless.ts@@ -3,7 +3,7 @@ import type { GfxBlockElementModel, GfxModel } from '@blocksuite/block-std/gfx';import {deserializeXYWH,getQuadBoundWithRotation,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import type { BlockModel } from '@blocksuite/store';export function getSelectedRect(selected: GfxModel[]): DOMRect {diff --git a/blocksuite/affine/widget-drag-handle/src/drag-handle.ts b/blocksuite/affine/widget-drag-handle/src/drag-handle.tsindex a41bdc28af..6c8fef0d61 100644--- a/blocksuite/affine/widget-drag-handle/src/drag-handle.ts+++ b/blocksuite/affine/widget-drag-handle/src/drag-handle.ts@@ -7,12 +7,8 @@ import {} from '@blocksuite/affine-shared/utils';import { type BlockComponent, WidgetComponent } from '@blocksuite/block-std';import type { GfxModel } from '@blocksuite/block-std/gfx';-import {- DisposableGroup,- type IVec,- type Point,- type Rect,-} from '@blocksuite/global/utils';+import type { IVec, Point, Rect } from '@blocksuite/global/gfx';+import { DisposableGroup } from '@blocksuite/global/utils';import { computed, type ReadonlySignal, signal } from '@preact/signals-core';import { html, nothing } from 'lit';import { query, state } from 'lit/decorators.js';diff --git a/blocksuite/affine/widget-drag-handle/src/helpers/rect-helper.ts b/blocksuite/affine/widget-drag-handle/src/helpers/rect-helper.tsindex cda56cb865..5429c19629 100644--- a/blocksuite/affine/widget-drag-handle/src/helpers/rect-helper.ts+++ b/blocksuite/affine/widget-drag-handle/src/helpers/rect-helper.ts@@ -1,6 +1,6 @@import { getCurrentNativeRange } from '@blocksuite/affine-shared/utils';import type { BlockComponent } from '@blocksuite/block-std';-import { Rect } from '@blocksuite/global/utils';+import { Rect } from '@blocksuite/global/gfx';import {DRAG_HANDLE_CONTAINER_WIDTH,diff --git a/blocksuite/affine/widget-drag-handle/src/middleware/blocks-filter.ts b/blocksuite/affine/widget-drag-handle/src/middleware/blocks-filter.tsindex 10dfc3e534..794c3489ef 100644--- a/blocksuite/affine/widget-drag-handle/src/middleware/blocks-filter.ts+++ b/blocksuite/affine/widget-drag-handle/src/middleware/blocks-filter.ts@@ -6,11 +6,8 @@ import {type GfxModel,isGfxGroupCompatibleModel,} from '@blocksuite/block-std/gfx';-import {- assertType,- type IVec,- type SerializedXYWH,-} from '@blocksuite/global/utils';+import type { IVec, SerializedXYWH } from '@blocksuite/global/gfx';+import { assertType } from '@blocksuite/global/utils';import type { TransformerMiddleware } from '@blocksuite/store';/**diff --git a/blocksuite/affine/widget-drag-handle/src/utils.ts b/blocksuite/affine/widget-drag-handle/src/utils.tsindex 7a2a99f19e..0e76fe04a9 100644--- a/blocksuite/affine/widget-drag-handle/src/utils.ts+++ b/blocksuite/affine/widget-drag-handle/src/utils.ts@@ -23,7 +23,7 @@ import {Point,Rect,type SerializedXYWH,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import type {BaseSelection,BlockModel,diff --git a/blocksuite/affine/widget-drag-handle/src/watchers/drag-event-watcher.ts b/blocksuite/affine/widget-drag-handle/src/watchers/drag-event-watcher.tsindex 46aa7804e4..5472845dfc 100644--- a/blocksuite/affine/widget-drag-handle/src/watchers/drag-event-watcher.ts+++ b/blocksuite/affine/widget-drag-handle/src/watchers/drag-event-watcher.ts@@ -48,15 +48,13 @@ import {SurfaceBlockModel,} from '@blocksuite/block-std/gfx';import {- assertType,Bound,- groupBy,type IVec,- last,Point,Rect,type SerializedXYWH,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';+import { assertType, groupBy, last } from '@blocksuite/global/utils';import {type BlockModel,type BlockSnapshot,diff --git a/blocksuite/affine/widget-drag-handle/src/watchers/edgeless-watcher.ts b/blocksuite/affine/widget-drag-handle/src/watchers/edgeless-watcher.tsindex 3b28d0adbd..dd42d8613f 100644--- a/blocksuite/affine/widget-drag-handle/src/watchers/edgeless-watcher.ts+++ b/blocksuite/affine/widget-drag-handle/src/watchers/edgeless-watcher.ts@@ -7,7 +7,7 @@ import {GfxControllerIdentifier,type GfxToolsFullOptionValue,} from '@blocksuite/block-std/gfx';-import { type IVec, Rect } from '@blocksuite/global/utils';+import { type IVec, Rect } from '@blocksuite/global/gfx';import { effect } from '@preact/signals-core';import {diff --git a/blocksuite/affine/widget-drag-handle/src/watchers/pointer-event-watcher.ts b/blocksuite/affine/widget-drag-handle/src/watchers/pointer-event-watcher.tsindex 423cf25890..fda2548ce9 100644--- a/blocksuite/affine/widget-drag-handle/src/watchers/pointer-event-watcher.ts+++ b/blocksuite/affine/widget-drag-handle/src/watchers/pointer-event-watcher.ts@@ -7,7 +7,8 @@ import {type UIEventHandler,} from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';-import { Point, throttle } from '@blocksuite/global/utils';+import { Point } from '@blocksuite/global/gfx';+import { throttle } from '@blocksuite/global/utils';import { computed } from '@preact/signals-core';import {diff --git a/blocksuite/affine/widget-edgeless-auto-connect/src/index.ts b/blocksuite/affine/widget-edgeless-auto-connect/src/index.tsindex 01b857d8aa..52efed8a7c 100644--- a/blocksuite/affine/widget-edgeless-auto-connect/src/index.ts+++ b/blocksuite/affine/widget-edgeless-auto-connect/src/index.ts@@ -18,7 +18,7 @@ import {type GfxController,GfxControllerIdentifier,} from '@blocksuite/block-std/gfx';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import {ArrowLeftSmallIcon,ArrowRightSmallIcon,diff --git a/blocksuite/affine/widget-frame-title/src/frame-title.ts b/blocksuite/affine/widget-frame-title/src/frame-title.tsindex 8efb9cf764..6bef64f62f 100644--- a/blocksuite/affine/widget-frame-title/src/frame-title.ts+++ b/blocksuite/affine/widget-frame-title/src/frame-title.ts@@ -12,12 +12,8 @@ import {stdContext,} from '@blocksuite/block-std';import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';-import {- Bound,- type SerializedXYWH,- SignalWatcher,- WithDisposable,-} from '@blocksuite/global/utils';+import { Bound, type SerializedXYWH } from '@blocksuite/global/gfx';+import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';import { consume } from '@lit/context';import { themeToVar } from '@toeverything/theme/v2';import { LitElement } from 'lit';diff --git a/blocksuite/affine/widget-scroll-anchoring/src/scroll-anchoring.ts b/blocksuite/affine/widget-scroll-anchoring/src/scroll-anchoring.tsindex 17f38507a9..9bdb22b215 100644--- a/blocksuite/affine/widget-scroll-anchoring/src/scroll-anchoring.ts+++ b/blocksuite/affine/widget-scroll-anchoring/src/scroll-anchoring.ts@@ -5,7 +5,7 @@ import {GfxControllerIdentifier,type GfxModel,} from '@blocksuite/block-std/gfx';-import { Bound, deserializeXYWH } from '@blocksuite/global/utils';+import { Bound, deserializeXYWH } from '@blocksuite/global/gfx';import { computed, signal } from '@preact/signals-core';import { cssVarV2 } from '@toeverything/theme/v2';import { css, html, nothing, unsafeCSS } from 'lit';diff --git a/blocksuite/framework/block-std/src/event/control/pointer.ts b/blocksuite/framework/block-std/src/event/control/pointer.tsindex c4200e3b20..3b86c0ca06 100644--- a/blocksuite/framework/block-std/src/event/control/pointer.ts+++ b/blocksuite/framework/block-std/src/event/control/pointer.ts@@ -1,5 +1,6 @@import { IS_IPAD } from '@blocksuite/global/env';-import { nextTick, Vec } from '@blocksuite/global/utils';+import { Vec } from '@blocksuite/global/gfx';+import { nextTick } from '@blocksuite/global/utils';import { UIEventState, UIEventStateContext } from '../base.js';import type { UIEventDispatcher } from '../dispatcher.js';diff --git a/blocksuite/framework/block-std/src/event/utils.ts b/blocksuite/framework/block-std/src/event/utils.tsindex cfd25d2144..425671bce1 100644--- a/blocksuite/framework/block-std/src/event/utils.ts+++ b/blocksuite/framework/block-std/src/event/utils.ts@@ -1,4 +1,4 @@-import type { IPoint } from '@blocksuite/global/utils';+import type { IPoint } from '@blocksuite/global/gfx';export function isFarEnough(a: IPoint, b: IPoint) {const dx = a.x - b.x;diff --git a/blocksuite/framework/block-std/src/gfx/controller.ts b/blocksuite/framework/block-std/src/gfx/controller.tsindex 25b7ead368..5634767a7e 100644--- a/blocksuite/framework/block-std/src/gfx/controller.ts+++ b/blocksuite/framework/block-std/src/gfx/controller.ts@@ -1,12 +1,10 @@import {- assertType,Bound,- DisposableGroup,getCommonBound,getCommonBoundWithRotation,type IBound,- last,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';+import { assertType, DisposableGroup, last } from '@blocksuite/global/utils';import type { BlockModel } from '@blocksuite/store';import { Signal } from '@preact/signals-core';diff --git a/blocksuite/framework/block-std/src/gfx/grid.ts b/blocksuite/framework/block-std/src/gfx/grid.tsindex 6db5a420ac..460aeec60b 100644--- a/blocksuite/framework/block-std/src/gfx/grid.ts+++ b/blocksuite/framework/block-std/src/gfx/grid.ts@@ -1,9 +1,9 @@-import type { IBound } from '@blocksuite/global/utils';+import type { IBound } from '@blocksuite/global/gfx';import {Bound,getBoundWithRotation,intersects,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import type { BlockModel, Store } from '@blocksuite/store';import { compare } from '../utils/layer.js';diff --git a/blocksuite/framework/block-std/src/gfx/layer.ts b/blocksuite/framework/block-std/src/gfx/layer.tsindex 85f1fb4073..15bd9bff13 100644--- a/blocksuite/framework/block-std/src/gfx/layer.ts+++ b/blocksuite/framework/block-std/src/gfx/layer.ts@@ -1,6 +1,6 @@+import { Bound } from '@blocksuite/global/gfx';import {assertType,- Bound,DisposableGroup,last,Slot,diff --git a/blocksuite/framework/block-std/src/gfx/model/base.ts b/blocksuite/framework/block-std/src/gfx/model/base.tsindex 66ceee9216..4977f6f716 100644--- a/blocksuite/framework/block-std/src/gfx/model/base.ts+++ b/blocksuite/framework/block-std/src/gfx/model/base.ts@@ -5,7 +5,7 @@ import type {PointLocation,SerializedXYWH,XYWH,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import type { EditorHost } from '../../view/element/lit-host.js';import type { GfxGroupModel, GfxModel } from './model.js';diff --git a/blocksuite/framework/block-std/src/gfx/model/gfx-block-model.ts b/blocksuite/framework/block-std/src/gfx/model/gfx-block-model.tsindex 4174a53eb0..2649559ea9 100644--- a/blocksuite/framework/block-std/src/gfx/model/gfx-block-model.ts+++ b/blocksuite/framework/block-std/src/gfx/model/gfx-block-model.ts@@ -1,10 +1,5 @@import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';-import type {- Constructor,- IVec,- SerializedXYWH,- XYWH,-} from '@blocksuite/global/utils';+import type { IVec, SerializedXYWH, XYWH } from '@blocksuite/global/gfx';import {Bound,deserializeXYWH,@@ -15,7 +10,8 @@ import {polygonGetPointTangent,polygonNearestPoint,rotatePoints,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';+import type { Constructor } from '@blocksuite/global/utils';import { BlockModel } from '@blocksuite/store';import {diff --git a/blocksuite/framework/block-std/src/gfx/model/surface/element-model.ts b/blocksuite/framework/block-std/src/gfx/model/surface/element-model.tsindex f4a32ced40..43a7d575ba 100644--- a/blocksuite/framework/block-std/src/gfx/model/surface/element-model.ts+++ b/blocksuite/framework/block-std/src/gfx/model/surface/element-model.ts@@ -1,10 +1,8 @@import {Bound,deserializeXYWH,- DisposableGroup,getBoundWithRotation,getPointsFromBoundWithRotation,- isEqual,type IVec,linePolygonIntersects,PointLocation,@@ -13,9 +11,9 @@ import {randomSeed,rotatePoints,type SerializedXYWH,- Slot,type XYWH,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';+import { DisposableGroup, isEqual, Slot } from '@blocksuite/global/utils';import { createMutex } from 'lib0/mutex';import * as Y from 'yjs';diff --git a/blocksuite/framework/block-std/src/gfx/model/surface/local-element-model.ts b/blocksuite/framework/block-std/src/gfx/model/surface/local-element-model.tsindex b975710e72..e09773b2b2 100644--- a/blocksuite/framework/block-std/src/gfx/model/surface/local-element-model.ts+++ b/blocksuite/framework/block-std/src/gfx/model/surface/local-element-model.ts@@ -1,4 +1,4 @@-import type { IVec, SerializedXYWH, XYWH } from '@blocksuite/global/utils';+import type { IVec, SerializedXYWH, XYWH } from '@blocksuite/global/gfx';import {Bound,deserializeXYWH,@@ -8,7 +8,7 @@ import {polygonGetPointTangent,polygonNearestPoint,rotatePoints,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';import { mutex } from 'lib0';import type { EditorHost } from '../../../view/index.js';diff --git a/blocksuite/framework/block-std/src/gfx/selection.ts b/blocksuite/framework/block-std/src/gfx/selection.tsindex 21c38f78e0..acfbfc2fd5 100644--- a/blocksuite/framework/block-std/src/gfx/selection.ts+++ b/blocksuite/framework/block-std/src/gfx/selection.ts@@ -1,9 +1,11 @@+import {+ getCommonBoundWithRotation,+ type IPoint,+} from '@blocksuite/global/gfx';import {assertType,DisposableGroup,- getCommonBoundWithRotation,groupBy,- type IPoint,Slot,} from '@blocksuite/global/utils';diff --git a/blocksuite/framework/block-std/src/gfx/tool/tool-controller.ts b/blocksuite/framework/block-std/src/gfx/tool/tool-controller.tsindex b57695f7c6..a6be3795ab 100644--- a/blocksuite/framework/block-std/src/gfx/tool/tool-controller.ts+++ b/blocksuite/framework/block-std/src/gfx/tool/tool-controller.ts@@ -1,11 +1,7 @@import type { ServiceIdentifier } from '@blocksuite/global/di';import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';-import {- DisposableGroup,- type IBound,- type IPoint,- Slot,-} from '@blocksuite/global/utils';+import type { IBound, IPoint } from '@blocksuite/global/gfx';+import { DisposableGroup, Slot } from '@blocksuite/global/utils';import { Signal } from '@preact/signals-core';import type { PointerEventState } from '../../event/index.js';diff --git a/blocksuite/framework/block-std/src/gfx/view/view.ts b/blocksuite/framework/block-std/src/gfx/view/view.tsindex ec02a8c13b..00607d517a 100644--- a/blocksuite/framework/block-std/src/gfx/view/view.ts+++ b/blocksuite/framework/block-std/src/gfx/view/view.ts@@ -1,10 +1,7 @@import { type Container, createIdentifier } from '@blocksuite/global/di';import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';-import {- type Bound,- DisposableGroup,- type IVec,-} from '@blocksuite/global/utils';+import type { Bound, IVec } from '@blocksuite/global/gfx';+import { DisposableGroup } from '@blocksuite/global/utils';import type { Extension } from '@blocksuite/store';import type { PointerEventState } from '../../event/index.js';diff --git a/blocksuite/framework/block-std/src/gfx/viewport.ts b/blocksuite/framework/block-std/src/gfx/viewport.tsindex 83206c6040..e41054946c 100644--- a/blocksuite/framework/block-std/src/gfx/viewport.ts+++ b/blocksuite/framework/block-std/src/gfx/viewport.ts@@ -1,12 +1,11 @@import {Bound,clamp,- debounce,type IPoint,type IVec,- Slot,Vec,-} from '@blocksuite/global/utils';+} from '@blocksuite/global/gfx';+import { debounce, Slot } from '@blocksuite/global/utils';import { signal } from '@preact/signals-core';import type { GfxViewportElement } from '.';diff --git a/blocksuite/framework/block-std/src/view/element/gfx-block-component.ts b/blocksuite/framework/block-std/src/view/element/gfx-block-component.tsindex 9c63990065..3bf504015c 100644--- a/blocksuite/framework/block-std/src/view/element/gfx-block-component.ts+++ b/blocksuite/framework/block-std/src/view/element/gfx-block-component.ts@@ -1,5 +1,5 @@import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import { computed } from '@preact/signals-core';import { nothing } from 'lit';diff --git a/blocksuite/framework/global/package.json b/blocksuite/framework/global/package.jsonindex fcabaee681..cfa18c93d3 100644--- a/blocksuite/framework/global/package.json+++ b/blocksuite/framework/global/package.json@@ -15,7 +15,8 @@"./env": "./src/env/index.ts","./exceptions": "./src/exceptions/index.ts","./di": "./src/di/index.ts",- "./types": "./src/types/index.ts"+ "./types": "./src/types/index.ts",+ "./gfx": "./src/gfx/index.ts"},"typesVersions": {"*": {@@ -30,6 +31,12 @@],"di": ["dist/di/index.d.ts"+ ],+ "types": [+ "dist/types/index.d.ts"+ ],+ "gfx": [+ "dist/gfx/index.d.ts"]}},diff --git a/blocksuite/framework/global/src/utils/bound.ts b/blocksuite/framework/global/src/gfx/bound.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/bound.tsrename to blocksuite/framework/global/src/gfx/bound.tsdiff --git a/blocksuite/framework/global/src/utils/curve.ts b/blocksuite/framework/global/src/gfx/curve.tssimilarity index 98%rename from blocksuite/framework/global/src/utils/curve.tsrename to blocksuite/framework/global/src/gfx/curve.tsindex 16637cb2e4..ac08d00fbd 100644--- a/blocksuite/framework/global/src/utils/curve.ts+++ b/blocksuite/framework/global/src/gfx/curve.ts@@ -1,5 +1,4 @@// control coords are not relative to start or end-import { assertExists } from './assert.js';import { CURVETIME_EPSILON, isZero } from './math.js';import { Bound, type IVec, PointLocation, Vec } from './model/index.js';@@ -111,7 +110,7 @@ export function getBezierNearestTime(function refine(t: number) {if (t >= 0 && t <= 1) {const tmpPoint = getBezierPoint(values, t);- assertExists(tmpPoint);+ if (!tmpPoint) return false;const dist = Vec.dist2(point, tmpPoint);if (dist < minDist) {minDist = dist;@@ -137,7 +136,6 @@ export function getBezierNearestPoint() {const t = getBezierNearestTime(values, point);const pointOnCurve = getBezierPoint(values, t);- assertExists(pointOnCurve);return pointOnCurve;}diff --git a/blocksuite/framework/global/src/gfx/index.ts b/blocksuite/framework/global/src/gfx/index.tsnew file mode 100644index 0000000000..37b0ea9b72--- /dev/null+++ b/blocksuite/framework/global/src/gfx/index.ts@@ -0,0 +1,7 @@+export * from './bound.js';+export * from './curve.js';+export * from './math.js';+export * from './model/index.js';+export * from './perfect-freehand/index.js';+export * from './polyline.js';+export * from './xywh.js';diff --git a/blocksuite/framework/global/src/utils/math.ts b/blocksuite/framework/global/src/gfx/math.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/math.tsrename to blocksuite/framework/global/src/gfx/math.tsdiff --git a/blocksuite/framework/global/src/utils/model/bound.ts b/blocksuite/framework/global/src/gfx/model/bound.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/model/bound.tsrename to blocksuite/framework/global/src/gfx/model/bound.tsdiff --git a/blocksuite/framework/global/src/utils/model/index.ts b/blocksuite/framework/global/src/gfx/model/index.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/model/index.tsrename to blocksuite/framework/global/src/gfx/model/index.tsdiff --git a/blocksuite/framework/global/src/utils/model/point-location.ts b/blocksuite/framework/global/src/gfx/model/point-location.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/model/point-location.tsrename to blocksuite/framework/global/src/gfx/model/point-location.tsdiff --git a/blocksuite/framework/global/src/utils/model/point.ts b/blocksuite/framework/global/src/gfx/model/point.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/model/point.tsrename to blocksuite/framework/global/src/gfx/model/point.tsdiff --git a/blocksuite/framework/global/src/utils/model/vec.ts b/blocksuite/framework/global/src/gfx/model/vec.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/model/vec.tsrename to blocksuite/framework/global/src/gfx/model/vec.tsdiff --git a/blocksuite/framework/global/src/utils/perfect-freehand/LICENSE b/blocksuite/framework/global/src/gfx/perfect-freehand/LICENSEsimilarity index 100%rename from blocksuite/framework/global/src/utils/perfect-freehand/LICENSErename to blocksuite/framework/global/src/gfx/perfect-freehand/LICENSEdiff --git a/blocksuite/framework/global/src/utils/perfect-freehand/get-solid-stroke-points.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/get-solid-stroke-points.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/perfect-freehand/get-solid-stroke-points.tsrename to blocksuite/framework/global/src/gfx/perfect-freehand/get-solid-stroke-points.tsdiff --git a/blocksuite/framework/global/src/utils/perfect-freehand/get-stroke-outline-points.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke-outline-points.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/perfect-freehand/get-stroke-outline-points.tsrename to blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke-outline-points.tsdiff --git a/blocksuite/framework/global/src/utils/perfect-freehand/get-stroke-points.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke-points.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/perfect-freehand/get-stroke-points.tsrename to blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke-points.tsdiff --git a/blocksuite/framework/global/src/utils/perfect-freehand/get-stroke-radius.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke-radius.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/perfect-freehand/get-stroke-radius.tsrename to blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke-radius.tsdiff --git a/blocksuite/framework/global/src/utils/perfect-freehand/get-stroke.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/perfect-freehand/get-stroke.tsrename to blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke.tsdiff --git a/blocksuite/framework/global/src/utils/perfect-freehand/index.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/index.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/perfect-freehand/index.tsrename to blocksuite/framework/global/src/gfx/perfect-freehand/index.tsdiff --git a/blocksuite/framework/global/src/utils/perfect-freehand/types.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/types.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/perfect-freehand/types.tsrename to blocksuite/framework/global/src/gfx/perfect-freehand/types.tsdiff --git a/blocksuite/framework/global/src/utils/perfect-freehand/vec.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/vec.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/perfect-freehand/vec.tsrename to blocksuite/framework/global/src/gfx/perfect-freehand/vec.tsdiff --git a/blocksuite/framework/global/src/utils/polyline.ts b/blocksuite/framework/global/src/gfx/polyline.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/polyline.tsrename to blocksuite/framework/global/src/gfx/polyline.tsdiff --git a/blocksuite/framework/global/src/utils/xywh.ts b/blocksuite/framework/global/src/gfx/xywh.tssimilarity index 100%rename from blocksuite/framework/global/src/utils/xywh.tsrename to blocksuite/framework/global/src/gfx/xywh.tsdiff --git a/blocksuite/framework/global/src/utils/index.ts b/blocksuite/framework/global/src/utils/index.tsindex a207a0e2fe..fed9102456 100644--- a/blocksuite/framework/global/src/utils/index.ts+++ b/blocksuite/framework/global/src/utils/index.ts@@ -1,18 +1,10 @@export * from './assert.js';-export * from './bound.js';export * from './crypto.js';-export * from './curve.js';export * from './disposable.js';export * from './function.js';export * from './iterable.js';export * from './logger.js';-export * from './math.js';-export * from './model/index.js';-export * from './perfect-freehand/index.js';-export * from './polyline.js';export * from './signal-watcher.js';export * from './slot.js';export * from './types.js';export * from './with-disposable.js';-export type { SerializedXYWH, XYWH } from './xywh.js';-export { deserializeXYWH, serializeXYWH } from './xywh.js';diff --git a/blocksuite/integration-test/src/__tests__/edgeless/mindmap.spec.ts b/blocksuite/integration-test/src/__tests__/edgeless/mindmap.spec.tsindex fd3499430f..0465b27e93 100644--- a/blocksuite/integration-test/src/__tests__/edgeless/mindmap.spec.ts+++ b/blocksuite/integration-test/src/__tests__/edgeless/mindmap.spec.ts@@ -1,7 +1,7 @@import type { MindmapElementModel } from '@blocksuite/affine-model';import type { GfxController } from '@blocksuite/block-std/gfx';import { LayoutType, type MindMapView } from '@blocksuite/blocks';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import { beforeEach, describe, expect, test } from 'vitest';import { click, pointermove, wait } from '../utils/common.js';diff --git a/blocksuite/integration-test/src/__tests__/main/snapshot.spec.ts b/blocksuite/integration-test/src/__tests__/main/snapshot.spec.tsindex 43b395f4cd..1c24dc8c76 100644--- a/blocksuite/integration-test/src/__tests__/main/snapshot.spec.ts+++ b/blocksuite/integration-test/src/__tests__/main/snapshot.spec.ts@@ -3,7 +3,7 @@ import {type SurfaceBlockModel,ZipTransformer,} from '@blocksuite/blocks';-import type { PointLocation } from '@blocksuite/global/utils';+import type { PointLocation } from '@blocksuite/global/gfx';import { Schema } from '@blocksuite/store';import { beforeEach, expect, test } from 'vitest';diff --git a/blocksuite/integration-test/src/__tests__/utils/common.ts b/blocksuite/integration-test/src/__tests__/utils/common.tsindex 748fea9740..cb6cca0a17 100644--- a/blocksuite/integration-test/src/__tests__/utils/common.ts+++ b/blocksuite/integration-test/src/__tests__/utils/common.ts@@ -1,4 +1,4 @@-import type { Point } from '@blocksuite/global/utils';+import type { Point } from '@blocksuite/global/gfx';export function wait(time: number = 0) {return new Promise(resolve => {diff --git a/blocksuite/playground/apps/_common/components/starter-debug-menu.ts b/blocksuite/playground/apps/_common/components/starter-debug-menu.tsindex 8c36e57f16..89ea1ddea2 100644--- a/blocksuite/playground/apps/_common/components/starter-debug-menu.ts+++ b/blocksuite/playground/apps/_common/components/starter-debug-menu.ts@@ -46,7 +46,7 @@ import {ZipTransformer,} from '@blocksuite/blocks';import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';-import type { SerializedXYWH } from '@blocksuite/global/utils';+import type { SerializedXYWH } from '@blocksuite/global/gfx';import type { DeltaInsert } from '@blocksuite/inline/types';import { TestAffineEditorContainer } from '@blocksuite/integration-test';import { Text, type Workspace } from '@blocksuite/store';diff --git a/blocksuite/playground/apps/starter/data/heavy-whiteboard.ts b/blocksuite/playground/apps/starter/data/heavy-whiteboard.tsindex 01b3f279d0..511017c778 100644--- a/blocksuite/playground/apps/starter/data/heavy-whiteboard.ts+++ b/blocksuite/playground/apps/starter/data/heavy-whiteboard.ts@@ -1,5 +1,5 @@import { DEFAULT_ROUGHNESS } from '@blocksuite/affine-model';-import type { SerializedXYWH } from '@blocksuite/global/utils';+import type { SerializedXYWH } from '@blocksuite/global/gfx';import {Boxed,nanoid,diff --git a/blocksuite/tests-legacy/e2e/edgeless/edgeless-text.spec.ts b/blocksuite/tests-legacy/e2e/edgeless/edgeless-text.spec.tsindex 7b36f353c3..876a9b8f52 100644--- a/blocksuite/tests-legacy/e2e/edgeless/edgeless-text.spec.ts+++ b/blocksuite/tests-legacy/e2e/edgeless/edgeless-text.spec.ts@@ -1,5 +1,5 @@import type { EdgelessTextBlockComponent } from '@blocksuite/affine-block-edgeless-text';-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import { expect, type Page } from '@playwright/test';import {diff --git a/blocksuite/tests-legacy/e2e/edgeless/frame/frame.spec.ts b/blocksuite/tests-legacy/e2e/edgeless/frame/frame.spec.tsindex e3e71048d6..84e6951e80 100644--- a/blocksuite/tests-legacy/e2e/edgeless/frame/frame.spec.ts+++ b/blocksuite/tests-legacy/e2e/edgeless/frame/frame.spec.ts@@ -1,4 +1,4 @@-import { Bound } from '@blocksuite/global/utils';+import { Bound } from '@blocksuite/global/gfx';import { expect, type Page } from '@playwright/test';import { clickView } from '../../utils/actions/click.js';diff --git a/blocksuite/tests-legacy/e2e/utils/actions/click.ts b/blocksuite/tests-legacy/e2e/utils/actions/click.tsindex c346ed7c73..e96bbde50b 100644--- a/blocksuite/tests-legacy/e2e/utils/actions/click.ts+++ b/blocksuite/tests-legacy/e2e/utils/actions/click.ts@@ -1,4 +1,4 @@-import type { IPoint } from '@blocksuite/global/utils';+import type { IPoint } from '@blocksuite/global/gfx';import type { Store } from '@blocksuite/store';import type { Page } from '@playwright/test';diff --git a/blocksuite/tests-legacy/e2e/utils/actions/edgeless.ts b/blocksuite/tests-legacy/e2e/utils/actions/edgeless.tsindex 5eba77b6cf..9ae4f4b444 100644--- a/blocksuite/tests-legacy/e2e/utils/actions/edgeless.ts+++ b/blocksuite/tests-legacy/e2e/utils/actions/edgeless.ts@@ -1,7 +1,7 @@import '../declare-test-window.js';import type { NoteBlockModel, NoteDisplayMode } from '@blocksuite/affine-model';-import type { IPoint, IVec } from '@blocksuite/global/utils';+import type { IPoint, IVec } from '@blocksuite/global/gfx';import { assertExists, sleep } from '@blocksuite/global/utils';import type { Locator, Page } from '@playwright/test';import { expect } from '@playwright/test';diff --git a/blocksuite/tests-legacy/e2e/utils/bs-alternative.ts b/blocksuite/tests-legacy/e2e/utils/bs-alternative.tsindex 0781d02be4..cfdbff43b1 100644--- a/blocksuite/tests-legacy/e2e/utils/bs-alternative.ts+++ b/blocksuite/tests-legacy/e2e/utils/bs-alternative.ts@@ -1,4 +1,4 @@-import { clamp } from '@blocksuite/global/utils';+import { clamp } from '@blocksuite/global/gfx';export const BLOCK_CHILDREN_CONTAINER_PADDING_LEFT = 24;export const NOTE_MIN_WIDTH = 450 + 24 * 2;diff --git a/packages/frontend/core/src/blocksuite/ai/_common/chat-actions-handle.ts b/packages/frontend/core/src/blocksuite/ai/_common/chat-actions-handle.tsindex 2497331189..89d4ad7330 100644--- a/packages/frontend/core/src/blocksuite/ai/_common/chat-actions-handle.ts+++ b/packages/frontend/core/src/blocksuite/ai/_common/chat-actions-handle.ts@@ -23,7 +23,7 @@ import {Bound,getCommonBoundWithRotation,type SerializedXYWH,-} from '@blocksuite/affine/global/utils';+} from '@blocksuite/affine/global/gfx';import type { Store } from '@blocksuite/affine/store';import type { TemplateResult } from 'lit';diff --git a/packages/frontend/core/src/blocksuite/ai/actions/edgeless-response.ts b/packages/frontend/core/src/blocksuite/ai/actions/edgeless-response.tsindex 97a8c5f8d5..b31d1e1fd9 100644--- a/packages/frontend/core/src/blocksuite/ai/actions/edgeless-response.ts+++ b/packages/frontend/core/src/blocksuite/ai/actions/edgeless-response.ts@@ -22,7 +22,8 @@ import {ResetIcon,TelemetryProvider,} from '@blocksuite/affine/blocks';-import { assertExists, Bound } from '@blocksuite/affine/global/utils';+import { Bound } from '@blocksuite/affine/global/gfx';+import { assertExists } from '@blocksuite/affine/global/utils';import { html, type TemplateResult } from 'lit';import { styleMap } from 'lit/directives/style-map.js';diff --git a/packages/frontend/core/src/blocksuite/ai/actions/page-response.ts b/packages/frontend/core/src/blocksuite/ai/actions/page-response.tsindex 5465211bf8..fcdf30bec8 100644--- a/packages/frontend/core/src/blocksuite/ai/actions/page-response.ts+++ b/packages/frontend/core/src/blocksuite/ai/actions/page-response.ts@@ -15,7 +15,7 @@ import {TelemetryProvider,uploadBlobForImage,} from '@blocksuite/affine/blocks';-import { Bound, getCommonBound } from '@blocksuite/affine/global/utils';+import { Bound, getCommonBound } from '@blocksuite/affine/global/gfx';import { type BlockProps, Text } from '@blocksuite/affine/store';import * as Y from 'yjs';diff --git a/packages/frontend/core/src/blocksuite/ai/ai-panel.ts b/packages/frontend/core/src/blocksuite/ai/ai-panel.tsindex 8adeb658b7..021941362c 100644--- a/packages/frontend/core/src/blocksuite/ai/ai-panel.ts+++ b/packages/frontend/core/src/blocksuite/ai/ai-panel.ts@@ -8,7 +8,8 @@ import {NoteBlockModel,NoteDisplayMode,} from '@blocksuite/affine/blocks';-import { assertExists, Bound } from '@blocksuite/affine/global/utils';+import { Bound } from '@blocksuite/affine/global/gfx';+import { assertExists } from '@blocksuite/affine/global/utils';import type { FrameworkProvider } from '@toeverything/infra';import type { TemplateResult } from 'lit';diff --git a/packages/frontend/core/src/blocksuite/ai/blocks/ai-chat-block/ai-chat-edgeless-block.ts b/packages/frontend/core/src/blocksuite/ai/blocks/ai-chat-block/ai-chat-edgeless-block.tsindex de4aab7f07..0434a2a301 100644--- a/packages/frontend/core/src/blocksuite/ai/blocks/ai-chat-block/ai-chat-edgeless-block.ts+++ b/packages/frontend/core/src/blocksuite/ai/blocks/ai-chat-block/ai-chat-edgeless-block.ts@@ -1,5 +1,5 @@import { toGfxBlockComponent } from '@blocksuite/affine/block-std';-import { Bound } from '@blocksuite/affine/global/utils';+import { Bound } from '@blocksuite/affine/global/gfx';import { html } from 'lit';import { styleMap } from 'lit/directives/style-map.js';diff --git a/packages/frontend/core/src/blocksuite/ai/mini-mindmap/surface-block.ts b/packages/frontend/core/src/blocksuite/ai/mini-mindmap/surface-block.tsindex 15a94a191b..2b23313d36 100644--- a/packages/frontend/core/src/blocksuite/ai/mini-mindmap/surface-block.ts+++ b/packages/frontend/core/src/blocksuite/ai/mini-mindmap/surface-block.ts@@ -12,7 +12,7 @@ import {fitContent,ThemeProvider,} from '@blocksuite/affine/blocks';-import type { Bound } from '@blocksuite/affine/global/utils';+import type { Bound } from '@blocksuite/affine/global/gfx';import { html } from 'lit';import { query } from 'lit/decorators.js';diff --git a/packages/frontend/core/src/blocksuite/ai/peek-view/utils.ts b/packages/frontend/core/src/blocksuite/ai/peek-view/utils.tsindex dd4ce71eee..3eb3038679 100644--- a/packages/frontend/core/src/blocksuite/ai/peek-view/utils.ts+++ b/packages/frontend/core/src/blocksuite/ai/peek-view/utils.ts@@ -3,7 +3,7 @@ import {EdgelessCRUDIdentifier,getSurfaceBlock,} from '@blocksuite/affine/blocks';-import { Bound } from '@blocksuite/affine/global/utils';+import { Bound } from '@blocksuite/affine/global/gfx';import {type AIChatBlockModel,diff --git a/packages/frontend/core/src/blocksuite/ai/slides/template.ts b/packages/frontend/core/src/blocksuite/ai/slides/template.tsindex a727675c95..12a59a9bda 100644--- a/packages/frontend/core/src/blocksuite/ai/slides/template.ts+++ b/packages/frontend/core/src/blocksuite/ai/slides/template.ts@@ -1,4 +1,4 @@-import { Bound } from '@blocksuite/affine/global/utils';+import { Bound } from '@blocksuite/affine/global/gfx';import { nanoid } from '@blocksuite/affine/store';import { AIProvider } from '../provider';diff --git a/packages/frontend/core/src/blocksuite/ai/tool/copilot-tool.ts b/packages/frontend/core/src/blocksuite/ai/tool/copilot-tool.tsindex 65220492df..257475409d 100644--- a/packages/frontend/core/src/blocksuite/ai/tool/copilot-tool.ts+++ b/packages/frontend/core/src/blocksuite/ai/tool/copilot-tool.ts@@ -9,8 +9,8 @@ import { IS_MAC } from '@blocksuite/affine/global/env';import {Bound,getCommonBoundWithRotation,- Slot,-} from '@blocksuite/affine/global/utils';+} from '@blocksuite/affine/global/gfx';+import { Slot } from '@blocksuite/affine/global/utils';import {AFFINE_AI_PANEL_WIDGET,diff --git a/packages/frontend/core/src/blocksuite/ai/utils/context.ts b/packages/frontend/core/src/blocksuite/ai/utils/context.tsindex 553d11a474..ad3ddfbc72 100644--- a/packages/frontend/core/src/blocksuite/ai/utils/context.ts+++ b/packages/frontend/core/src/blocksuite/ai/utils/context.ts@@ -1,6 +1,6 @@import type { GfxModel } from '@blocksuite/affine/block-std/gfx';import type { MindmapStyle } from '@blocksuite/affine/blocks';-import type { SerializedXYWH } from '@blocksuite/affine/global/utils';+import type { SerializedXYWH } from '@blocksuite/affine/global/gfx';import type { TemplateImage } from '../slides/template';diff --git a/packages/frontend/core/src/blocksuite/ai/utils/template-job.ts b/packages/frontend/core/src/blocksuite/ai/utils/template-job.tsindex b8e0ed1715..eee588e229 100644--- a/packages/frontend/core/src/blocksuite/ai/utils/template-job.ts+++ b/packages/frontend/core/src/blocksuite/ai/utils/template-job.ts@@ -5,11 +5,8 @@ import {TemplateJob,TemplateMiddlewares,} from '@blocksuite/affine/blocks';-import {- assertExists,- Bound,- getCommonBound,-} from '@blocksuite/affine/global/utils';+import { Bound, getCommonBound } from '@blocksuite/affine/global/gfx';+import { assertExists } from '@blocksuite/affine/global/utils';export function createTemplateJob(host: EditorHost) {const surface = getSurfaceBlock(host.doc);diff --git a/packages/frontend/core/src/blocksuite/ai/widgets/edgeless-copilot/index.ts b/packages/frontend/core/src/blocksuite/ai/widgets/edgeless-copilot/index.tsindex 36050f54a4..240b2703bd 100644--- a/packages/frontend/core/src/blocksuite/ai/widgets/edgeless-copilot/index.ts+++ b/packages/frontend/core/src/blocksuite/ai/widgets/edgeless-copilot/index.ts@@ -12,7 +12,7 @@ import {import {Bound,getCommonBoundWithRotation,-} from '@blocksuite/affine/global/utils';+} from '@blocksuite/affine/global/gfx';import {autoUpdate,computePosition,diff --git a/packages/frontend/core/src/blocksuite/extensions/attachment-embed-view.tsx b/packages/frontend/core/src/blocksuite/extensions/attachment-embed-view.tsxindex baff8bf8b1..86a9f5e8ee 100644--- a/packages/frontend/core/src/blocksuite/extensions/attachment-embed-view.tsx+++ b/packages/frontend/core/src/blocksuite/extensions/attachment-embed-view.tsx@@ -1,7 +1,7 @@import type { ElementOrFactory } from '@affine/component';import { AttachmentEmbedPreview } from '@affine/core/components/attachment-viewer/pdf-viewer-embedded';import { AttachmentEmbedConfigIdentifier } from '@blocksuite/affine/blocks';-import { Bound } from '@blocksuite/affine/global/utils';+import { Bound } from '@blocksuite/affine/global/gfx';import type { ExtensionType } from '@blocksuite/affine/store';import type { TemplateResult } from 'lit';diff --git a/packages/frontend/core/src/blocksuite/extensions/editor-config/toolbar/copy-as-image.ts b/packages/frontend/core/src/blocksuite/extensions/editor-config/toolbar/copy-as-image.tsindex 77f2709756..aff3adbd21 100644--- a/packages/frontend/core/src/blocksuite/extensions/editor-config/toolbar/copy-as-image.ts+++ b/packages/frontend/core/src/blocksuite/extensions/editor-config/toolbar/copy-as-image.ts@@ -12,7 +12,7 @@ import {isGfxGroupCompatibleModel,} from '@blocksuite/affine/block-std/gfx';import type { MenuContext } from '@blocksuite/affine/blocks';-import { Bound, getCommonBound } from '@blocksuite/affine/global/utils';+import { Bound, getCommonBound } from '@blocksuite/affine/global/gfx';import { CopyAsImgaeIcon } from '@blocksuite/icons/lit';import type { FrameworkProvider } from '@toeverything/infra';diff --git a/packages/frontend/core/src/blocksuite/extensions/note-config/edgeless-note-header.tsx b/packages/frontend/core/src/blocksuite/extensions/note-config/edgeless-note-header.tsxindex 1430de8a69..49fc794474 100644--- a/packages/frontend/core/src/blocksuite/extensions/note-config/edgeless-note-header.tsx+++ b/packages/frontend/core/src/blocksuite/extensions/note-config/edgeless-note-header.tsx@@ -10,7 +10,7 @@ import { useI18n } from '@affine/i18n';import { track } from '@affine/track';import { GfxControllerIdentifier } from '@blocksuite/affine/block-std/gfx';import { type NoteBlockModel } from '@blocksuite/affine/blocks';-import { Bound } from '@blocksuite/affine/global/utils';+import { Bound } from '@blocksuite/affine/global/gfx';import {InformationIcon,LinkedPageIcon,diff --git a/packages/frontend/core/src/desktop/dialogs/setting/general-setting/editor/edgeless/snapshot.tsx b/packages/frontend/core/src/desktop/dialogs/setting/general-setting/editor/edgeless/snapshot.tsxindex f8e9cdfbdb..f5646c915b 100644--- a/packages/frontend/core/src/desktop/dialogs/setting/general-setting/editor/edgeless/snapshot.tsx+++ b/packages/frontend/core/src/desktop/dialogs/setting/general-setting/editor/edgeless/snapshot.tsx@@ -12,7 +12,7 @@ import {type EdgelessRootPreviewBlockComponent,SpecProvider,} from '@blocksuite/affine/blocks';-import { Bound } from '@blocksuite/affine/global/utils';+import { Bound } from '@blocksuite/affine/global/gfx';import type { Block, Store } from '@blocksuite/affine/store';import { useFramework } from '@toeverything/infra';import { isEqual } from 'lodash-es';diff --git a/packages/frontend/core/src/modules/peek-view/view/doc-preview/doc-peek-view.tsx b/packages/frontend/core/src/modules/peek-view/view/doc-preview/doc-peek-view.tsxindex 442ae73643..b6f2189362 100644--- a/packages/frontend/core/src/modules/peek-view/view/doc-preview/doc-peek-view.tsx+++ b/packages/frontend/core/src/modules/peek-view/view/doc-preview/doc-peek-view.tsx@@ -10,8 +10,8 @@ import { GuardService } from '@affine/core/modules/permissions';import { DebugLogger } from '@affine/debug';import { GfxControllerIdentifier } from '@blocksuite/affine/block-std/gfx';import { RefNodeSlotsProvider } from '@blocksuite/affine/blocks';+import { Bound } from '@blocksuite/affine/global/gfx';import {- Bound,type Disposable,DisposableGroup,} from '@blocksuite/affine/global/utils';diff --git a/tests/affine-local/e2e/blocksuite/edgeless/note.spec.ts b/tests/affine-local/e2e/blocksuite/edgeless/note.spec.tsindex e767e1a690..abfca9a8aa 100644--- a/tests/affine-local/e2e/blocksuite/edgeless/note.spec.ts+++ b/tests/affine-local/e2e/blocksuite/edgeless/note.spec.ts@@ -30,8 +30,8 @@ import {import type {EdgelessRootBlockComponent,NoteBlockModel,-} from '@blocksuite/blocks';-import type { IVec } from '@blocksuite/global/utils';+} from '@blocksuite/affine/blocks';+import type { IVec } from '@blocksuite/affine/global/gfx';import { expect, type Page } from '@playwright/test';const title = 'Edgeless Note Header Test';diff --git a/tests/kit/src/utils/editor.ts b/tests/kit/src/utils/editor.tsindex 30936fa862..8be04fc3cc 100644--- a/tests/kit/src/utils/editor.ts+++ b/tests/kit/src/utils/editor.ts@@ -1,5 +1,5 @@import type * as BlocksuiteBlocks from '@blocksuite/affine/blocks';-import type { IVec, XYWH } from '@blocksuite/global/utils';+import type { IVec, XYWH } from '@blocksuite/affine/global/gfx';import { expect, type Locator, type Page } from '@playwright/test';declare type _GLOBAL_ = typeof BlocksuiteBlocks;