refactor: export everything from @excalidraw/element, don't import from subpaths (#9466)

* Don't import from subpaths

* Fix tests, move related tests to element
This commit is contained in:
Marcel Mraz
2025-05-09 23:01:33 +02:00
committed by GitHub
parent a8ebe514da
commit 7e41026812
129 changed files with 517 additions and 541 deletions
+3 -3
View File
@@ -1,8 +1,8 @@
import { elementCenterPoint, THEME, THEME_FILTER } from "@excalidraw/common";
import { FIXED_BINDING_DISTANCE } from "@excalidraw/element/binding";
import { getDiamondPoints } from "@excalidraw/element/bounds";
import { getCornerRadius } from "@excalidraw/element/shapes";
import { FIXED_BINDING_DISTANCE } from "@excalidraw/element";
import { getDiamondPoints } from "@excalidraw/element";
import { getCornerRadius } from "@excalidraw/element";
import {
bezierEquation,
@@ -15,48 +15,42 @@ import {
throttleRAF,
} from "@excalidraw/common";
import {
FIXED_BINDING_DISTANCE,
maxBindingGap,
} from "@excalidraw/element/binding";
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
import { FIXED_BINDING_DISTANCE, maxBindingGap } from "@excalidraw/element";
import { LinearElementEditor } from "@excalidraw/element";
import {
getOmitSidesForDevice,
getTransformHandles,
getTransformHandlesFromCoords,
shouldShowBoundingBox,
} from "@excalidraw/element/transformHandles";
} from "@excalidraw/element";
import {
isElbowArrow,
isFrameLikeElement,
isImageElement,
isLinearElement,
isTextElement,
} from "@excalidraw/element/typeChecks";
} from "@excalidraw/element";
import { renderSelectionElement } from "@excalidraw/element/renderElement";
import { renderSelectionElement } from "@excalidraw/element";
import {
getElementsInGroup,
getSelectedGroupIds,
isSelectedViaGroup,
selectGroupsFromGivenElements,
} from "@excalidraw/element/groups";
} from "@excalidraw/element";
import {
getCommonBounds,
getElementAbsoluteCoords,
} from "@excalidraw/element/bounds";
import { getCommonBounds, getElementAbsoluteCoords } from "@excalidraw/element";
import type {
SuggestedBinding,
SuggestedPointBinding,
} from "@excalidraw/element/binding";
} from "@excalidraw/element";
import type {
TransformHandles,
TransformHandleType,
} from "@excalidraw/element/transformHandles";
} from "@excalidraw/element";
import type {
ElementsMap,
@@ -1,6 +1,6 @@
import { throttleRAF } from "@excalidraw/common";
import { renderElement } from "@excalidraw/element/renderElement";
import { renderElement } from "@excalidraw/element";
import { bootstrapCanvas, getNormalizedCanvasDimensions } from "./helpers";
+7 -7
View File
@@ -1,21 +1,21 @@
import { FRAME_STYLE, throttleRAF } from "@excalidraw/common";
import { isElementLink } from "@excalidraw/element/elementLink";
import { createPlaceholderEmbeddableLabel } from "@excalidraw/element/embeddable";
import { getBoundTextElement } from "@excalidraw/element/textElement";
import { isElementLink } from "@excalidraw/element";
import { createPlaceholderEmbeddableLabel } from "@excalidraw/element";
import { getBoundTextElement } from "@excalidraw/element";
import {
isEmbeddableElement,
isIframeLikeElement,
isTextElement,
} from "@excalidraw/element/typeChecks";
} from "@excalidraw/element";
import {
elementOverlapsWithFrame,
getTargetFrame,
shouldApplyFrameClip,
} from "@excalidraw/element/frame";
} from "@excalidraw/element";
import { renderElement } from "@excalidraw/element/renderElement";
import { renderElement } from "@excalidraw/element";
import { getElementAbsoluteCoords } from "@excalidraw/element/bounds";
import { getElementAbsoluteCoords } from "@excalidraw/element";
import type {
ElementsMap,
+11 -17
View File
@@ -10,36 +10,30 @@ import {
} from "@excalidraw/common";
import { normalizeLink, toValidURL } from "@excalidraw/common";
import { hashString } from "@excalidraw/element";
import { getUncroppedWidthAndHeight } from "@excalidraw/element/cropElement";
import { getUncroppedWidthAndHeight } from "@excalidraw/element";
import {
createPlaceholderEmbeddableLabel,
getEmbedLink,
} from "@excalidraw/element/embeddable";
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
import {
getBoundTextElement,
getContainerElement,
} from "@excalidraw/element/textElement";
import { getLineHeightInPx } from "@excalidraw/element/textMeasurements";
} from "@excalidraw/element";
import { LinearElementEditor } from "@excalidraw/element";
import { getBoundTextElement, getContainerElement } from "@excalidraw/element";
import { getLineHeightInPx } from "@excalidraw/element";
import {
isArrowElement,
isIframeLikeElement,
isInitializedImageElement,
isTextElement,
} from "@excalidraw/element/typeChecks";
} from "@excalidraw/element";
import { getContainingFrame } from "@excalidraw/element/frame";
import { getContainingFrame } from "@excalidraw/element";
import { getCornerRadius, isPathALoop } from "@excalidraw/element/shapes";
import { getCornerRadius, isPathALoop } from "@excalidraw/element";
import { ShapeCache } from "@excalidraw/element/ShapeCache";
import { ShapeCache } from "@excalidraw/element";
import {
getFreeDrawSvgPath,
IMAGE_INVERT_FILTER,
} from "@excalidraw/element/renderElement";
import { getFreeDrawSvgPath, IMAGE_INVERT_FILTER } from "@excalidraw/element";
import { getElementAbsoluteCoords } from "@excalidraw/element/bounds";
import { getElementAbsoluteCoords } from "@excalidraw/element";
import type {
ExcalidrawElement,