refactor(editor): use lodash (#10657)

This commit is contained in:
Saul-Mirone
2025-03-06 09:00:00 +00:00
parent 8062893603
commit 7ae9daa6f6
46 changed files with 160 additions and 555 deletions
@@ -10,7 +10,7 @@ import {
type GfxModel,
} from '@blocksuite/block-std/gfx';
import { Bound } from '@blocksuite/global/gfx';
import chunk from 'lodash.chunk';
import chunk from 'lodash-es/chunk';
const ALIGN_HEIGHT = 200;
const ALIGN_PADDING = 20;
@@ -32,8 +32,9 @@ import {
toRadian,
Vec,
} from '@blocksuite/global/gfx';
import { assertType, last } from '@blocksuite/global/utils';
import { assertType } from '@blocksuite/global/utils';
import { effect } from '@preact/signals-core';
import last from 'lodash-es/last';
import { Overlay } from '../renderer/overlay.js';
import { AStarRunner } from '../utils/a-star.js';
@@ -602,7 +603,7 @@ function mergePath(points: IVec[] | IVec3[]) {
continue;
result.push([cur[0], cur[1]]);
}
result.push(last(points) as IVec);
result.push(last(points as IVec[]) as IVec);
for (let i = 0; i < result.length - 1; i++) {
const cur = result[i];
const next = result[i + 1];
@@ -8,7 +8,8 @@ import type {
} from '@blocksuite/block-std/gfx';
import type { IBound } from '@blocksuite/global/gfx';
import { getBoundWithRotation, intersects } from '@blocksuite/global/gfx';
import { DisposableGroup, last, Slot } from '@blocksuite/global/utils';
import { DisposableGroup, Slot } from '@blocksuite/global/utils';
import last from 'lodash-es/last';
import type { SurfaceElementModel } from '../element-model/base.js';
import { RoughCanvas } from '../utils/rough/canvas.js';
@@ -14,7 +14,9 @@ import {
type SurfaceBlockModel,
} from '@blocksuite/block-std/gfx';
import type { IVec } from '@blocksuite/global/gfx';
import { assertType, isEqual, last } from '@blocksuite/global/utils';
import { assertType } from '@blocksuite/global/utils';
import isEqual from 'lodash-es/isEqual';
import last from 'lodash-es/last';
import * as Y from 'yjs';
import { fitContent } from '../../renderer/elements/shape/utils.js';