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
+2 -2
View File
@@ -23,17 +23,17 @@
"@lit/context": "^1.1.2",
"@preact/signals-core": "^1.8.0",
"@toeverything/theme": "^1.1.12",
"@types/lodash-es": "^4.17.12",
"fractional-indexing": "^3.2.0",
"html2canvas": "^1.4.1",
"lit": "^3.2.0",
"lodash.chunk": "^4.2.0",
"lodash-es": "^4.17.21",
"nanoid": "^5.0.7",
"pdf-lib": "^1.17.1",
"yjs": "^13.6.21",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/lodash.chunk": "^4.2.9",
"vitest": "3.0.7"
},
"exports": {
@@ -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';