mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
refactor(editor): add gfx entry in bs global package (#10612)
This commit is contained in:
@@ -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],
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user