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

View File

@@ -104,10 +104,7 @@ import {
Emitter,
} from "@excalidraw/common";
import {
getCommonBounds,
getElementAbsoluteCoords,
} from "@excalidraw/element/bounds";
import { getCommonBounds, getElementAbsoluteCoords } from "@excalidraw/element";
import {
bindOrUnbindLinearElement,
@@ -120,11 +117,11 @@ import {
shouldEnableBindingForPointerEvent,
updateBoundElements,
getSuggestedBindingsForArrows,
} from "@excalidraw/element/binding";
} from "@excalidraw/element";
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
import { LinearElementEditor } from "@excalidraw/element";
import { newElementWith } from "@excalidraw/element/mutateElement";
import { newElementWith } from "@excalidraw/element";
import {
newFrameElement,
@@ -138,12 +135,9 @@ import {
newLinearElement,
newTextElement,
refreshTextDimensions,
} from "@excalidraw/element/newElement";
} from "@excalidraw/element";
import {
deepCopyElement,
duplicateElements,
} from "@excalidraw/element/duplicate";
import { deepCopyElement, duplicateElements } from "@excalidraw/element";
import {
hasBoundTextElement,
@@ -166,7 +160,7 @@ import {
isFlowchartNodeElement,
isBindableElement,
isTextElement,
} from "@excalidraw/element/typeChecks";
} from "@excalidraw/element";
import {
getLockedLinearCursorAlignSize,
@@ -174,28 +168,28 @@ import {
isElementCompletelyInViewport,
isElementInViewport,
isInvisiblySmallElement,
} from "@excalidraw/element/sizeHelpers";
} from "@excalidraw/element";
import {
getBoundTextShape,
getCornerRadius,
getElementShape,
isPathALoop,
} from "@excalidraw/element/shapes";
} from "@excalidraw/element";
import {
createSrcDoc,
embeddableURLValidator,
maybeParseEmbedSrc,
getEmbedLink,
} from "@excalidraw/element/embeddable";
} from "@excalidraw/element";
import {
getInitializedImageElements,
loadHTMLImageElement,
normalizeSVG,
updateImageCache as _updateImageCache,
} from "@excalidraw/element/image";
} from "@excalidraw/element";
import {
getBoundTextElement,
@@ -203,9 +197,9 @@ import {
getContainerElement,
isValidTextContainer,
redrawTextBoundingBox,
} from "@excalidraw/element/textElement";
} from "@excalidraw/element";
import { shouldShowBoundingBox } from "@excalidraw/element/transformHandles";
import { shouldShowBoundingBox } from "@excalidraw/element";
import {
getFrameChildren,
@@ -222,30 +216,27 @@ import {
getFrameLikeTitle,
getElementsOverlappingFrame,
filterElementsEligibleAsFrameChildren,
} from "@excalidraw/element/frame";
} from "@excalidraw/element";
import {
hitElementBoundText,
hitElementBoundingBoxOnly,
hitElementItself,
} from "@excalidraw/element/collision";
} from "@excalidraw/element";
import { getVisibleSceneBounds } from "@excalidraw/element/bounds";
import { getVisibleSceneBounds } from "@excalidraw/element";
import {
FlowChartCreator,
FlowChartNavigator,
getLinkDirectionFromKey,
} from "@excalidraw/element/flowchart";
} from "@excalidraw/element";
import { cropElement } from "@excalidraw/element/cropElement";
import { cropElement } from "@excalidraw/element";
import { wrapText } from "@excalidraw/element/textWrapping";
import { wrapText } from "@excalidraw/element";
import {
isElementLink,
parseElementLinkFromURL,
} from "@excalidraw/element/elementLink";
import { isElementLink, parseElementLinkFromURL } from "@excalidraw/element";
import {
isMeasureTextSupported,
@@ -255,11 +246,11 @@ import {
getApproxMinLineWidth,
getApproxMinLineHeight,
getMinTextElementWidth,
} from "@excalidraw/element/textMeasurements";
} from "@excalidraw/element";
import { ShapeCache } from "@excalidraw/element/ShapeCache";
import { ShapeCache } from "@excalidraw/element";
import { getRenderOpacity } from "@excalidraw/element/renderElement";
import { getRenderOpacity } from "@excalidraw/element";
import {
editGroupForSelectedElement,
@@ -269,44 +260,41 @@ import {
isElementInGroup,
isSelectedViaGroup,
selectGroupsForSelectedElements,
} from "@excalidraw/element/groups";
} from "@excalidraw/element";
import {
syncInvalidIndices,
syncMovedIndices,
} from "@excalidraw/element/fractionalIndex";
import { syncInvalidIndices, syncMovedIndices } from "@excalidraw/element";
import {
excludeElementsInFramesFromSelection,
getSelectionStateForElements,
makeNextSelectedElementIds,
} from "@excalidraw/element/selection";
} from "@excalidraw/element";
import {
getResizeOffsetXY,
getResizeArrowDirection,
transformElements,
} from "@excalidraw/element/resizeElements";
} from "@excalidraw/element";
import {
getCursorForResizingElement,
getElementWithTransformHandleType,
getTransformHandleTypeFromCoords,
} from "@excalidraw/element/resizeTest";
} from "@excalidraw/element";
import {
dragNewElement,
dragSelectedElements,
getDragOffsetXY,
} from "@excalidraw/element/dragElements";
} from "@excalidraw/element";
import { isNonDeletedElement } from "@excalidraw/element";
import Scene from "@excalidraw/element/Scene";
import { Scene } from "@excalidraw/element";
import { Store, CaptureUpdateAction } from "@excalidraw/element/store";
import { Store, CaptureUpdateAction } from "@excalidraw/element";
import type { ElementUpdate } from "@excalidraw/element/mutateElement";
import type { ElementUpdate } from "@excalidraw/element";
import type { LocalPoint, Radians } from "@excalidraw/math";