refactor: separate elements logic into a standalone package (#9285)

This commit is contained in:
Marcel Mraz
2025-03-26 15:24:59 +01:00
committed by GitHub
parent a18f059188
commit 432a46ef9e
372 changed files with 3463 additions and 2463 deletions
+19 -15
View File
@@ -1,11 +1,11 @@
import { pointFrom, pointRotateRads } from "@excalidraw/math";
import type { GlobalPoint, LocalPoint, Radians } from "@excalidraw/math";
import { createTestHook } from "../../components/App";
import { getCommonBounds, getElementPointsCoords } from "../../element/bounds";
import { cropElement } from "../../element/cropElement";
import { mutateElement } from "../../element/mutateElement";
import {
getCommonBounds,
getElementPointsCoords,
} from "@excalidraw/element/bounds";
import { cropElement } from "@excalidraw/element/cropElement";
import { mutateElement } from "@excalidraw/element/mutateElement";
import {
getTransformHandles,
getTransformHandlesFromCoords,
@@ -13,21 +13,18 @@ import {
OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,
type TransformHandle,
type TransformHandleDirection,
} from "../../element/transformHandles";
} from "@excalidraw/element/transformHandles";
import {
isLinearElement,
isFreeDrawElement,
isTextElement,
isFrameLikeElement,
} from "../../element/typeChecks";
import { KEYS } from "../../keys";
import { arrayToMap } from "../../utils";
import { getTextEditor } from "../queries/dom";
import { act, fireEvent, GlobalTestState, screen } from "../test-utils";
} from "@excalidraw/element/typeChecks";
import { KEYS, arrayToMap } from "@excalidraw/common";
import { API } from "./api";
import type { GlobalPoint, LocalPoint, Radians } from "@excalidraw/math";
import type { TransformHandleType } from "../../element/transformHandles";
import type { TransformHandleType } from "@excalidraw/element/transformHandles";
import type {
ExcalidrawElement,
ExcalidrawLinearElement,
@@ -39,7 +36,14 @@ import type {
ExcalidrawTextContainer,
ExcalidrawTextElementWithContainer,
ExcalidrawImageElement,
} from "../../element/types";
} from "@excalidraw/element/types";
import { createTestHook } from "../../components/App";
import { getTextEditor } from "../queries/dom";
import { act, fireEvent, GlobalTestState, screen } from "../test-utils";
import { API } from "./api";
import type { ToolType } from "../../types";
// so that window.h is available when App.tsx is not imported as well.