From 66d9d576e0af347248eb14609399ffaee6aa5857 Mon Sep 17 00:00:00 2001 From: Saul-Mirone Date: Tue, 4 Mar 2025 12:46:50 +0000 Subject: [PATCH] refactor(editor): add gfx entry in bs global package (#10612) --- blocksuite/affine/all/package.json | 4 ++++ blocksuite/affine/all/src/global/gfx.ts | 1 + .../block-attachment/src/components/options.ts | 2 +- blocksuite/affine/block-attachment/src/embed.ts | 2 +- blocksuite/affine/block-attachment/src/utils.ts | 2 +- .../affine/block-database/src/database-block.ts | 2 +- .../block-database/src/properties/converts.ts | 2 +- .../src/commands/insert-edgeless-text.ts | 2 +- .../block-edgeless-text/src/edgeless-text-block.ts | 2 +- .../block-embed/src/common/insert-embed-card.ts | 2 +- .../src/common/to-edgeless-embed-block.ts | 2 +- .../embed-edgeless-linked-doc-block.ts | 2 +- .../embed-linked-doc-block.ts | 3 ++- .../embed-edgeless-synced-doc-block.ts | 2 +- .../embed-synced-doc-block.ts | 3 ++- blocksuite/affine/block-frame/src/frame-block.ts | 2 +- blocksuite/affine/block-frame/src/frame-manager.ts | 4 ++-- blocksuite/affine/block-image/src/utils.ts | 2 +- .../src/components/edgeless-note-background.ts | 8 ++------ .../src/components/edgeless-note-mask.ts | 8 ++------ .../affine/block-note/src/note-edgeless-block.ts | 2 +- .../block-root/src/edgeless/clipboard/clipboard.ts | 12 ++++++++---- .../auto-complete/auto-complete-panel.ts | 7 +++---- .../auto-complete/edgeless-auto-complete.ts | 4 ++-- .../src/edgeless/components/auto-complete/utils.ts | 4 ++-- .../components/connector/connector-handle.ts | 3 ++- .../src/edgeless/components/frame/frame-preview.ts | 3 +-- .../src/edgeless/components/note-slicer/index.ts | 8 ++------ .../edgeless-navigator-black-background.ts | 2 +- .../components/rects/edgeless-selected-rect.ts | 14 ++++---------- .../edgeless/components/resize/resize-handles.ts | 2 +- .../edgeless/components/resize/resize-manager.ts | 4 ++-- .../text/edgeless-connector-label-editor.ts | 8 ++------ .../components/text/edgeless-frame-title-editor.ts | 3 ++- .../components/text/edgeless-group-title-editor.ts | 3 ++- .../components/text/edgeless-shape-text-editor.ts | 9 ++------- .../components/text/edgeless-text-editor.ts | 9 ++------- .../draggable/draggable-element.controller.ts | 3 ++- .../components/toolbar/common/draggable/types.ts | 3 ++- .../components/toolbar/mindmap/basket-elements.ts | 3 ++- .../components/toolbar/mindmap/mindmap-menu.ts | 2 +- .../toolbar/mindmap/mindmap-tool-button.ts | 2 +- .../toolbar/mindmap/utils/import-mindmap.ts | 2 +- .../components/toolbar/presentation-toolbar.ts | 3 ++- .../components/toolbar/shape/shape-tool-element.ts | 3 ++- .../components/toolbar/template/template-panel.ts | 3 ++- .../block-root/src/edgeless/components/utils.ts | 6 +++--- .../block-root/src/edgeless/edgeless-keyboard.ts | 2 +- .../block-root/src/edgeless/edgeless-root-block.ts | 3 ++- .../src/edgeless/edgeless-root-service.ts | 2 +- .../block-root/src/edgeless/gfx-tool/brush-tool.ts | 2 +- .../src/edgeless/gfx-tool/connector-tool.ts | 4 ++-- .../gfx-tool/default-tool-ext/event-ext.ts | 3 ++- .../default-tool-ext/mind-map-ext/drag-utils.ts | 3 ++- .../mind-map-ext/indicator-overlay.ts | 4 ++-- .../default-tool-ext/mind-map-ext/mind-map-ext.ts | 2 +- .../src/edgeless/gfx-tool/default-tool.ts | 12 +++--------- .../src/edgeless/gfx-tool/eraser-tool.ts | 2 +- .../block-root/src/edgeless/gfx-tool/frame-tool.ts | 4 ++-- .../block-root/src/edgeless/gfx-tool/lasso-tool.ts | 4 ++-- .../block-root/src/edgeless/gfx-tool/note-tool.ts | 2 +- .../block-root/src/edgeless/gfx-tool/shape-tool.ts | 4 ++-- .../block-root/src/edgeless/gfx-tool/text-tool.ts | 2 +- .../src/edgeless/services/template-middlewares.ts | 3 ++- .../block-root/src/edgeless/services/template.ts | 9 ++------- .../block-root/src/edgeless/utils/bound-utils.ts | 2 +- .../src/edgeless/utils/clipboard-utils.ts | 3 ++- .../block-root/src/edgeless/utils/panning-utils.ts | 2 +- .../affine/block-root/src/edgeless/utils/query.ts | 4 ++-- .../block-root/src/edgeless/utils/snap-manager.ts | 2 +- .../affine/block-root/src/edgeless/utils/text.ts | 5 +++-- .../block-root/src/edgeless/utils/tool-overlay.ts | 4 ++-- .../affine/block-root/src/page/page-root-block.ts | 2 +- .../widgets/element-toolbar/add-frame-button.ts | 3 ++- .../src/widgets/element-toolbar/align-button.ts | 3 ++- .../element-toolbar/change-attachment-button.ts | 3 ++- .../element-toolbar/change-embed-card-button.ts | 3 ++- .../widgets/element-toolbar/change-frame-button.ts | 9 ++------- .../widgets/element-toolbar/change-group-button.ts | 7 ++----- .../widgets/element-toolbar/change-note-button.ts | 8 ++------ .../widgets/element-toolbar/change-text-menu.ts | 8 ++------ .../src/widgets/element-toolbar/index.ts | 9 ++------- .../widgets/element-toolbar/more-menu/config.ts | 2 +- .../src/widgets/surface-ref-toolbar/utils.ts | 3 ++- .../block-surface-ref/src/portal/generic-block.ts | 3 ++- .../affine/block-surface-ref/src/portal/note.ts | 3 ++- .../block-surface-ref/src/surface-ref-block.ts | 5 ++--- .../src/__tests__/a-star.unit.spec.ts | 6 +++--- .../block-surface/src/__tests__/bound.unit.spec.ts | 2 +- .../block-surface/src/__tests__/graph.unit.spec.ts | 2 +- .../src/__tests__/math-utils.unit.spec.ts | 4 ++-- .../block-surface/src/commands/auto-align.ts | 2 +- .../extensions/export-manager/export-manager.ts | 4 ++-- .../src/managers/connector-manager.ts | 12 +++++++----- .../block-surface/src/renderer/canvas-renderer.ts | 11 +++-------- .../src/renderer/elements/connector/index.ts | 2 +- .../src/renderer/elements/connector/utils.ts | 4 ++-- .../src/renderer/elements/group/index.ts | 2 +- .../src/renderer/elements/group/utils.ts | 2 +- .../block-surface/src/renderer/elements/index.ts | 2 +- .../block-surface/src/renderer/elements/mindmap.ts | 2 +- .../src/renderer/elements/shape/index.ts | 4 ++-- .../src/renderer/elements/shape/utils.ts | 2 +- .../src/renderer/elements/text/utils.ts | 4 ++-- .../affine/block-surface/src/surface-block.ts | 2 +- .../affine/block-surface/src/utils/a-star.ts | 5 +++-- .../affine/block-surface/src/utils/add-note.ts | 6 +----- .../block-surface/src/utils/get-bg-grip-gap.ts | 2 +- blocksuite/affine/block-surface/src/utils/graph.ts | 4 ++-- .../block-surface/src/utils/mindmap/layout.ts | 4 ++-- .../block-surface/src/utils/mindmap/utils.ts | 3 ++- .../affine/block-surface/src/utils/update-xywh.ts | 2 +- .../components/src/color-picker/color-picker.ts | 3 ++- .../affine/components/src/color-picker/utils.ts | 2 +- .../components/src/date-picker/date-picker.ts | 3 ++- .../src/drop-indicator/drop-indicator.ts | 2 +- .../src/drop-indicator/file-drop-manager.ts | 5 +++-- .../data-view/src/property-presets/converts.ts | 2 +- .../src/view-presets/kanban/pc/controller/drag.ts | 3 ++- .../src/body/frame-panel-body.ts | 2 +- .../src/body/outline-panel-body.ts | 3 ++- .../affine/fragment-outline/src/utils/scroll.ts | 3 ++- .../affine/model/src/blocks/frame/frame-model.ts | 2 +- .../affine/model/src/blocks/note/note-model.ts | 2 +- .../affine/model/src/elements/brush/brush.ts | 2 +- .../model/src/elements/connector/connector.ts | 8 ++++++-- .../src/elements/connector/local-connector.ts | 2 +- .../affine/model/src/elements/group/group.ts | 5 +++-- .../affine/model/src/elements/mindmap/mindmap.ts | 12 +++--------- .../affine/model/src/elements/shape/api/diamond.ts | 4 ++-- .../affine/model/src/elements/shape/api/ellipse.ts | 2 +- .../affine/model/src/elements/shape/api/rect.ts | 4 ++-- .../model/src/elements/shape/api/triangle.ts | 4 ++-- .../affine/model/src/elements/shape/shape.ts | 2 +- blocksuite/affine/model/src/elements/text/text.ts | 4 ++-- .../shared/src/__tests__/utils/rect.unit.spec.ts | 2 +- .../shared/src/utils/dnd/calc-drop-target.ts | 2 +- .../shared/src/utils/dnd/get-drop-rect-by-point.ts | 2 +- blocksuite/affine/shared/src/utils/dnd/types.ts | 2 +- .../affine/shared/src/utils/dom/point-to-block.ts | 2 +- blocksuite/affine/shared/src/utils/edgeless.ts | 2 +- .../affine/widget-drag-handle/src/drag-handle.ts | 8 ++------ .../widget-drag-handle/src/helpers/rect-helper.ts | 2 +- .../src/middleware/blocks-filter.ts | 7 ++----- blocksuite/affine/widget-drag-handle/src/utils.ts | 2 +- .../src/watchers/drag-event-watcher.ts | 6 ++---- .../src/watchers/edgeless-watcher.ts | 2 +- .../src/watchers/pointer-event-watcher.ts | 3 ++- .../widget-edgeless-auto-connect/src/index.ts | 2 +- .../affine/widget-frame-title/src/frame-title.ts | 8 ++------ .../src/scroll-anchoring.ts | 2 +- .../block-std/src/event/control/pointer.ts | 3 ++- blocksuite/framework/block-std/src/event/utils.ts | 2 +- .../framework/block-std/src/gfx/controller.ts | 6 ++---- blocksuite/framework/block-std/src/gfx/grid.ts | 4 ++-- blocksuite/framework/block-std/src/gfx/layer.ts | 2 +- .../framework/block-std/src/gfx/model/base.ts | 2 +- .../block-std/src/gfx/model/gfx-block-model.ts | 10 +++------- .../src/gfx/model/surface/element-model.ts | 6 ++---- .../src/gfx/model/surface/local-element-model.ts | 4 ++-- .../framework/block-std/src/gfx/selection.ts | 6 ++++-- .../block-std/src/gfx/tool/tool-controller.ts | 8 ++------ .../framework/block-std/src/gfx/view/view.ts | 7 ++----- blocksuite/framework/block-std/src/gfx/viewport.ts | 5 ++--- .../src/view/element/gfx-block-component.ts | 2 +- blocksuite/framework/global/package.json | 9 ++++++++- .../framework/global/src/{utils => gfx}/bound.ts | 0 .../framework/global/src/{utils => gfx}/curve.ts | 4 +--- blocksuite/framework/global/src/gfx/index.ts | 7 +++++++ .../framework/global/src/{utils => gfx}/math.ts | 0 .../global/src/{utils => gfx}/model/bound.ts | 0 .../global/src/{utils => gfx}/model/index.ts | 0 .../src/{utils => gfx}/model/point-location.ts | 0 .../global/src/{utils => gfx}/model/point.ts | 0 .../global/src/{utils => gfx}/model/vec.ts | 0 .../src/{utils => gfx}/perfect-freehand/LICENSE | 0 .../perfect-freehand/get-solid-stroke-points.ts | 0 .../perfect-freehand/get-stroke-outline-points.ts | 0 .../perfect-freehand/get-stroke-points.ts | 0 .../perfect-freehand/get-stroke-radius.ts | 0 .../{utils => gfx}/perfect-freehand/get-stroke.ts | 0 .../src/{utils => gfx}/perfect-freehand/index.ts | 0 .../src/{utils => gfx}/perfect-freehand/types.ts | 0 .../src/{utils => gfx}/perfect-freehand/vec.ts | 0 .../global/src/{utils => gfx}/polyline.ts | 0 .../framework/global/src/{utils => gfx}/xywh.ts | 0 blocksuite/framework/global/src/utils/index.ts | 8 -------- .../src/__tests__/edgeless/mindmap.spec.ts | 2 +- .../src/__tests__/main/snapshot.spec.ts | 2 +- .../integration-test/src/__tests__/utils/common.ts | 2 +- .../apps/_common/components/starter-debug-menu.ts | 2 +- .../apps/starter/data/heavy-whiteboard.ts | 2 +- .../e2e/edgeless/edgeless-text.spec.ts | 2 +- .../tests-legacy/e2e/edgeless/frame/frame.spec.ts | 2 +- blocksuite/tests-legacy/e2e/utils/actions/click.ts | 2 +- .../tests-legacy/e2e/utils/actions/edgeless.ts | 2 +- .../tests-legacy/e2e/utils/bs-alternative.ts | 2 +- .../blocksuite/ai/_common/chat-actions-handle.ts | 2 +- .../src/blocksuite/ai/actions/edgeless-response.ts | 3 ++- .../src/blocksuite/ai/actions/page-response.ts | 2 +- .../frontend/core/src/blocksuite/ai/ai-panel.ts | 3 ++- .../blocks/ai-chat-block/ai-chat-edgeless-block.ts | 2 +- .../blocksuite/ai/mini-mindmap/surface-block.ts | 2 +- .../core/src/blocksuite/ai/peek-view/utils.ts | 2 +- .../core/src/blocksuite/ai/slides/template.ts | 2 +- .../core/src/blocksuite/ai/tool/copilot-tool.ts | 4 ++-- .../core/src/blocksuite/ai/utils/context.ts | 2 +- .../core/src/blocksuite/ai/utils/template-job.ts | 7 ++----- .../ai/widgets/edgeless-copilot/index.ts | 2 +- .../extensions/attachment-embed-view.tsx | 2 +- .../editor-config/toolbar/copy-as-image.ts | 2 +- .../note-config/edgeless-note-header.tsx | 2 +- .../general-setting/editor/edgeless/snapshot.tsx | 2 +- .../peek-view/view/doc-preview/doc-peek-view.tsx | 2 +- .../e2e/blocksuite/edgeless/note.spec.ts | 4 ++-- tests/kit/src/utils/editor.ts | 2 +- 216 files changed, 341 insertions(+), 397 deletions(-) create mode 100644 blocksuite/affine/all/src/global/gfx.ts rename blocksuite/framework/global/src/{utils => gfx}/bound.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/curve.ts (98%) create mode 100644 blocksuite/framework/global/src/gfx/index.ts rename blocksuite/framework/global/src/{utils => gfx}/math.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/model/bound.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/model/index.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/model/point-location.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/model/point.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/model/vec.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/perfect-freehand/LICENSE (100%) rename blocksuite/framework/global/src/{utils => gfx}/perfect-freehand/get-solid-stroke-points.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/perfect-freehand/get-stroke-outline-points.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/perfect-freehand/get-stroke-points.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/perfect-freehand/get-stroke-radius.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/perfect-freehand/get-stroke.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/perfect-freehand/index.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/perfect-freehand/types.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/perfect-freehand/vec.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/polyline.ts (100%) rename blocksuite/framework/global/src/{utils => gfx}/xywh.ts (100%) diff --git a/blocksuite/affine/all/package.json b/blocksuite/affine/all/package.json index 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.ts new file mode 100644 index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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'; -// ""; 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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 connect diff --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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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 { diff --git a/blocksuite/affine/shared/src/utils/dnd/calc-drop-target.ts b/blocksuite/affine/shared/src/utils/dnd/calc-drop-target.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.json index 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.ts similarity index 100% rename from blocksuite/framework/global/src/utils/bound.ts rename to blocksuite/framework/global/src/gfx/bound.ts diff --git a/blocksuite/framework/global/src/utils/curve.ts b/blocksuite/framework/global/src/gfx/curve.ts similarity index 98% rename from blocksuite/framework/global/src/utils/curve.ts rename to blocksuite/framework/global/src/gfx/curve.ts index 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.ts new file mode 100644 index 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.ts similarity index 100% rename from blocksuite/framework/global/src/utils/math.ts rename to blocksuite/framework/global/src/gfx/math.ts diff --git a/blocksuite/framework/global/src/utils/model/bound.ts b/blocksuite/framework/global/src/gfx/model/bound.ts similarity index 100% rename from blocksuite/framework/global/src/utils/model/bound.ts rename to blocksuite/framework/global/src/gfx/model/bound.ts diff --git a/blocksuite/framework/global/src/utils/model/index.ts b/blocksuite/framework/global/src/gfx/model/index.ts similarity index 100% rename from blocksuite/framework/global/src/utils/model/index.ts rename to blocksuite/framework/global/src/gfx/model/index.ts diff --git a/blocksuite/framework/global/src/utils/model/point-location.ts b/blocksuite/framework/global/src/gfx/model/point-location.ts similarity index 100% rename from blocksuite/framework/global/src/utils/model/point-location.ts rename to blocksuite/framework/global/src/gfx/model/point-location.ts diff --git a/blocksuite/framework/global/src/utils/model/point.ts b/blocksuite/framework/global/src/gfx/model/point.ts similarity index 100% rename from blocksuite/framework/global/src/utils/model/point.ts rename to blocksuite/framework/global/src/gfx/model/point.ts diff --git a/blocksuite/framework/global/src/utils/model/vec.ts b/blocksuite/framework/global/src/gfx/model/vec.ts similarity index 100% rename from blocksuite/framework/global/src/utils/model/vec.ts rename to blocksuite/framework/global/src/gfx/model/vec.ts diff --git a/blocksuite/framework/global/src/utils/perfect-freehand/LICENSE b/blocksuite/framework/global/src/gfx/perfect-freehand/LICENSE similarity index 100% rename from blocksuite/framework/global/src/utils/perfect-freehand/LICENSE rename to blocksuite/framework/global/src/gfx/perfect-freehand/LICENSE diff --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.ts similarity index 100% rename from blocksuite/framework/global/src/utils/perfect-freehand/get-solid-stroke-points.ts rename to blocksuite/framework/global/src/gfx/perfect-freehand/get-solid-stroke-points.ts diff --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.ts similarity index 100% rename from blocksuite/framework/global/src/utils/perfect-freehand/get-stroke-outline-points.ts rename to blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke-outline-points.ts diff --git a/blocksuite/framework/global/src/utils/perfect-freehand/get-stroke-points.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke-points.ts similarity index 100% rename from blocksuite/framework/global/src/utils/perfect-freehand/get-stroke-points.ts rename to blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke-points.ts diff --git a/blocksuite/framework/global/src/utils/perfect-freehand/get-stroke-radius.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke-radius.ts similarity index 100% rename from blocksuite/framework/global/src/utils/perfect-freehand/get-stroke-radius.ts rename to blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke-radius.ts diff --git a/blocksuite/framework/global/src/utils/perfect-freehand/get-stroke.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke.ts similarity index 100% rename from blocksuite/framework/global/src/utils/perfect-freehand/get-stroke.ts rename to blocksuite/framework/global/src/gfx/perfect-freehand/get-stroke.ts diff --git a/blocksuite/framework/global/src/utils/perfect-freehand/index.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/index.ts similarity index 100% rename from blocksuite/framework/global/src/utils/perfect-freehand/index.ts rename to blocksuite/framework/global/src/gfx/perfect-freehand/index.ts diff --git a/blocksuite/framework/global/src/utils/perfect-freehand/types.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/types.ts similarity index 100% rename from blocksuite/framework/global/src/utils/perfect-freehand/types.ts rename to blocksuite/framework/global/src/gfx/perfect-freehand/types.ts diff --git a/blocksuite/framework/global/src/utils/perfect-freehand/vec.ts b/blocksuite/framework/global/src/gfx/perfect-freehand/vec.ts similarity index 100% rename from blocksuite/framework/global/src/utils/perfect-freehand/vec.ts rename to blocksuite/framework/global/src/gfx/perfect-freehand/vec.ts diff --git a/blocksuite/framework/global/src/utils/polyline.ts b/blocksuite/framework/global/src/gfx/polyline.ts similarity index 100% rename from blocksuite/framework/global/src/utils/polyline.ts rename to blocksuite/framework/global/src/gfx/polyline.ts diff --git a/blocksuite/framework/global/src/utils/xywh.ts b/blocksuite/framework/global/src/gfx/xywh.ts similarity index 100% rename from blocksuite/framework/global/src/utils/xywh.ts rename to blocksuite/framework/global/src/gfx/xywh.ts diff --git a/blocksuite/framework/global/src/utils/index.ts b/blocksuite/framework/global/src/utils/index.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.ts index 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.tsx index 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.ts index 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.tsx index 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.tsx index 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.tsx index 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.ts index 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.ts index 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;