refactor(editor): add gfx entry in bs global package (#10612)

This commit is contained in:
Saul-Mirone
2025-03-04 12:46:50 +00:00
parent 5ad3d3c94a
commit 66d9d576e0
216 changed files with 341 additions and 397 deletions

View File

@@ -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';

View File

@@ -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;

View File

@@ -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';

View File

@@ -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';

View File

@@ -1,6 +1,6 @@
import { Bound } from '@blocksuite/global/gfx';
import {
assertType,
Bound,
DisposableGroup,
last,
Slot,

View File

@@ -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';

View File

@@ -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 {

View File

@@ -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';

View File

@@ -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';

View File

@@ -1,9 +1,11 @@
import {
getCommonBoundWithRotation,
type IPoint,
} from '@blocksuite/global/gfx';
import {
assertType,
DisposableGroup,
getCommonBoundWithRotation,
groupBy,
type IPoint,
Slot,
} from '@blocksuite/global/utils';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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 '.';

View File

@@ -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';