(
- new Map([...elementsMap].filter((el) => !el[1].isDeleted)),
+ return getHoveredElementForBinding(
+ tupleToCoors(origPoint),
+ elements,
+ elementsMap,
+ zoom,
+ true,
+ true,
);
- const elements = Array.from(elementsMap.values());
- return [
- getHoveredElementForBinding(
- tupleToCoors(origStartGlobalPoint),
- elements,
- nonDeletedSceneElementsMap,
- zoom,
- true,
- true,
- ),
- getHoveredElementForBinding(
- tupleToCoors(origEndGlobalPoint),
- elements,
- nonDeletedSceneElementsMap,
- zoom,
- true,
- true,
- ),
- ];
};
const gridAddressesEqual = (a: GridAddress, b: GridAddress): boolean =>
a[0] === b[0] && a[1] === b[1];
-const validateElbowPoints = (
+export const validateElbowPoints =
(
points: readonly P[],
tolerance: number = DEDUP_TRESHOLD,
) =>
diff --git a/packages/excalidraw/element/elementLink.ts b/packages/excalidraw/element/elementLink.ts
index 991f9caec..79b689c93 100644
--- a/packages/excalidraw/element/elementLink.ts
+++ b/packages/excalidraw/element/elementLink.ts
@@ -5,6 +5,7 @@
import { ELEMENT_LINK_KEY } from "../constants";
import { normalizeLink } from "../data/url";
import { elementsAreInSameGroup } from "../groups";
+
import type { AppProps, AppState } from "../types";
import type { ExcalidrawElement } from "./types";
diff --git a/packages/excalidraw/element/embeddable.ts b/packages/excalidraw/element/embeddable.ts
index 8265a0b13..1dc1968a0 100644
--- a/packages/excalidraw/element/embeddable.ts
+++ b/packages/excalidraw/element/embeddable.ts
@@ -1,18 +1,20 @@
import { register } from "../actions/register";
import { FONT_FAMILY, VERTICAL_ALIGN } from "../constants";
-import type { ExcalidrawProps } from "../types";
-import { escapeDoubleQuotes, getFontString, updateActiveTool } from "../utils";
import { setCursorForShape } from "../cursor";
+import { CaptureUpdateAction } from "../store";
+import { escapeDoubleQuotes, getFontString, updateActiveTool } from "../utils";
+
import { newTextElement } from "./newElement";
import { wrapText } from "./textWrapping";
import { isIframeElement } from "./typeChecks";
+
+import type { ExcalidrawProps } from "../types";
+import type { MarkRequired } from "../utility-types";
import type {
ExcalidrawElement,
ExcalidrawIframeLikeElement,
IframeData,
} from "./types";
-import type { MarkRequired } from "../utility-types";
-import { CaptureUpdateAction } from "../store";
type IframeDataWithSandbox = MarkRequired;
diff --git a/packages/excalidraw/element/flowchart.test.tsx b/packages/excalidraw/element/flowchart.test.tsx
index d47c850b7..bc026e7d7 100644
--- a/packages/excalidraw/element/flowchart.test.tsx
+++ b/packages/excalidraw/element/flowchart.test.tsx
@@ -1,9 +1,9 @@
-import { render, unmountComponent } from "../tests/test-utils";
-import { reseed } from "../random";
-import { UI, Keyboard, Pointer } from "../tests/helpers/ui";
import { Excalidraw } from "../index";
-import { API } from "../tests/helpers/api";
import { KEYS } from "../keys";
+import { reseed } from "../random";
+import { API } from "../tests/helpers/api";
+import { UI, Keyboard, Pointer } from "../tests/helpers/ui";
+import { render, unmountComponent } from "../tests/test-utils";
unmountComponent();
diff --git a/packages/excalidraw/element/flowchart.ts b/packages/excalidraw/element/flowchart.ts
index 02ee1ff29..9880f27af 100644
--- a/packages/excalidraw/element/flowchart.ts
+++ b/packages/excalidraw/element/flowchart.ts
@@ -1,3 +1,12 @@
+import { pointFrom, type LocalPoint } from "@excalidraw/math";
+
+import { elementOverlapsWithFrame, elementsAreInFrameBounds } from "../frame";
+import { KEYS } from "../keys";
+import { aabbForElement } from "../shapes";
+import { invariant, toBrandedType } from "../utils";
+
+import { bindLinearElement } from "./binding";
+import { updateElbowArrowPoints } from "./elbowArrow";
import {
HEADING_DOWN,
HEADING_LEFT,
@@ -7,10 +16,15 @@ import {
headingForPointFromElement,
type Heading,
} from "./heading";
-import { bindLinearElement } from "./binding";
import { LinearElementEditor } from "./linearElementEditor";
+import { mutateElement } from "./mutateElement";
import { newArrowElement, newElement } from "./newElement";
-import type { SceneElementsMap } from "./types";
+import {
+ isBindableElement,
+ isElbowArrow,
+ isFrameElement,
+ isFlowchartNodeElement,
+} from "./typeChecks";
import {
type ElementsMap,
type ExcalidrawBindableElement,
@@ -20,20 +34,8 @@ import {
type Ordered,
type OrderedExcalidrawElement,
} from "./types";
-import { KEYS } from "../keys";
+
import type { AppState, PendingExcalidrawElements } from "../types";
-import { mutateElement } from "./mutateElement";
-import { elementOverlapsWithFrame, elementsAreInFrameBounds } from "../frame";
-import {
- isBindableElement,
- isElbowArrow,
- isFrameElement,
- isFlowchartNodeElement,
-} from "./typeChecks";
-import { invariant, toBrandedType } from "../utils";
-import { pointFrom, type LocalPoint } from "@excalidraw/math";
-import { aabbForElement } from "../shapes";
-import { updateElbowArrowPoints } from "./elbowArrow";
type LinkDirection = "up" | "right" | "down" | "left";
@@ -472,7 +474,7 @@ const createBindingArrow = (
const update = updateElbowArrowPoints(
bindingArrow,
- toBrandedType(
+ toBrandedType(
new Map([
...elementsMap.entries(),
[startBindingElement.id, startBindingElement],
diff --git a/packages/excalidraw/element/heading.ts b/packages/excalidraw/element/heading.ts
index 94e86339d..ddebeca53 100644
--- a/packages/excalidraw/element/heading.ts
+++ b/packages/excalidraw/element/heading.ts
@@ -1,10 +1,3 @@
-import type {
- LocalPoint,
- GlobalPoint,
- Triangle,
- Vector,
- Radians,
-} from "@excalidraw/math";
import {
pointFrom,
pointRotateRads,
@@ -13,7 +6,17 @@ import {
triangleIncludesPoint,
vectorFromPoint,
} from "@excalidraw/math";
+
+import type {
+ LocalPoint,
+ GlobalPoint,
+ Triangle,
+ Vector,
+ Radians,
+} from "@excalidraw/math";
+
import { getCenterForBounds, type Bounds } from "./bounds";
+
import type { ExcalidrawBindableElement } from "./types";
export const HEADING_RIGHT = [1, 0] as Heading;
diff --git a/packages/excalidraw/element/image.ts b/packages/excalidraw/element/image.ts
index 32644b64d..0d5f9fb5a 100644
--- a/packages/excalidraw/element/image.ts
+++ b/packages/excalidraw/element/image.ts
@@ -3,8 +3,10 @@
// -----------------------------------------------------------------------------
import { MIME_TYPES, SVG_NS } from "../constants";
-import type { AppClassProperties, DataURL, BinaryFiles } from "../types";
+
import { isInitializedImageElement } from "./typeChecks";
+
+import type { AppClassProperties, DataURL, BinaryFiles } from "../types";
import type {
ExcalidrawElement,
FileId,
diff --git a/packages/excalidraw/element/index.ts b/packages/excalidraw/element/index.ts
index a9b747681..abe84e031 100644
--- a/packages/excalidraw/element/index.ts
+++ b/packages/excalidraw/element/index.ts
@@ -1,10 +1,11 @@
+import { isInvisiblySmallElement } from "./sizeHelpers";
+import { isLinearElementType } from "./typeChecks";
+
import type {
ExcalidrawElement,
NonDeletedExcalidrawElement,
NonDeleted,
} from "./types";
-import { isInvisiblySmallElement } from "./sizeHelpers";
-import { isLinearElementType } from "./typeChecks";
export {
newElement,
diff --git a/packages/excalidraw/element/linearElementEditor.ts b/packages/excalidraw/element/linearElementEditor.ts
index 4bf1e988b..f9b23f048 100644
--- a/packages/excalidraw/element/linearElementEditor.ts
+++ b/packages/excalidraw/element/linearElementEditor.ts
@@ -1,3 +1,48 @@
+import {
+ pointCenter,
+ pointFrom,
+ pointRotateRads,
+ pointsEqual,
+ type GlobalPoint,
+ type LocalPoint,
+ pointDistance,
+ vectorFromPoint,
+} from "@excalidraw/math";
+import { getCurvePathOps } from "@excalidraw/utils/geometry/shape";
+
+import type { Radians } from "@excalidraw/math";
+
+import { DRAGGING_THRESHOLD } from "../constants";
+import { KEYS, shouldRotateWithDiscreteAngle } from "../keys";
+import { ShapeCache } from "../scene/ShapeCache";
+import {
+ getBezierCurveLength,
+ getBezierXY,
+ getControlPointsForBezierCurve,
+ isPathALoop,
+ mapIntervalToBezierT,
+} from "../shapes";
+import { getGridPoint } from "../snapping";
+import { invariant, tupleToCoors } from "../utils";
+
+import {
+ bindOrUnbindLinearElement,
+ getHoveredElementForBinding,
+ isBindingEnabled,
+} from "./binding";
+import { getElementPointsCoords, getMinMaxXYFromCurvePathOps } from "./bounds";
+import { headingIsHorizontal, vectorToHeading } from "./heading";
+import { mutateElement } from "./mutateElement";
+import { getBoundTextElement, handleBindTextResize } from "./textElement";
+import {
+ isBindingElement,
+ isElbowArrow,
+ isFixedPointBinding,
+} from "./typeChecks";
+
+import { getElementAbsoluteCoords, getLockedLinearCursorAlignSize } from ".";
+
+import type { Bounds } from "./bounds";
import type {
NonDeleted,
ExcalidrawLinearElement,
@@ -12,13 +57,8 @@ import type {
FixedSegment,
ExcalidrawElbowArrowElement,
} from "./types";
-import { getElementAbsoluteCoords, getLockedLinearCursorAlignSize } from ".";
-import type { Bounds } from "./bounds";
-import {
- getCurvePathOps,
- getElementPointsCoords,
- getMinMaxXYFromCurvePathOps,
-} from "./bounds";
+import type Scene from "../scene/Scene";
+import type { Store } from "../store";
import type {
AppState,
PointerCoords,
@@ -27,48 +67,7 @@ import type {
NullableGridSize,
Zoom,
} from "../types";
-import { mutateElement } from "./mutateElement";
-
-import {
- bindOrUnbindLinearElement,
- getHoveredElementForBinding,
- isBindingEnabled,
-} from "./binding";
-import { invariant, tupleToCoors } from "../utils";
-import {
- isBindingElement,
- isElbowArrow,
- isFixedPointBinding,
-} from "./typeChecks";
-import { KEYS, shouldRotateWithDiscreteAngle } from "../keys";
-import { getBoundTextElement, handleBindTextResize } from "./textElement";
-import { DRAGGING_THRESHOLD } from "../constants";
import type { Mutable } from "../utility-types";
-import { ShapeCache } from "../scene/ShapeCache";
-import type { Store } from "../store";
-import type Scene from "../scene/Scene";
-import type { Radians } from "@excalidraw/math";
-import {
- pointCenter,
- pointFrom,
- pointRotateRads,
- pointsEqual,
- vector,
- type GlobalPoint,
- type LocalPoint,
- pointDistance,
- pointTranslate,
- vectorFromPoint,
-} from "@excalidraw/math";
-import {
- getBezierCurveLength,
- getBezierXY,
- getControlPointsForBezierCurve,
- isPathALoop,
- mapIntervalToBezierT,
-} from "../shapes";
-import { getGridPoint } from "../snapping";
-import { headingIsHorizontal, vectorToHeading } from "./heading";
const editorMidPointsCache: {
version: number | null;
@@ -1273,34 +1272,28 @@ export class LinearElementEditor {
// all the other points in the opposite direction by delta to
// offset it. We do the same with actual element.x/y position, so
// this hacks are completely transparent to the user.
- let offsetX = 0;
- let offsetY = 0;
+ const [deltaX, deltaY] =
+ targetPoints.find(({ index }) => index === 0)?.point ??
+ pointFrom(0, 0);
+ const [offsetX, offsetY] = pointFrom(
+ deltaX - points[0][0],
+ deltaY - points[0][1],
+ );
- const selectedOriginPoint = targetPoints.find(({ index }) => index === 0);
+ const nextPoints = isElbowArrow(element)
+ ? [
+ targetPoints.find((t) => t.index === 0)?.point ?? points[0],
+ targetPoints.find((t) => t.index === points.length - 1)?.point ??
+ points[points.length - 1],
+ ]
+ : points.map((p, idx) => {
+ const current = targetPoints.find((t) => t.index === idx)?.point ?? p;
- if (selectedOriginPoint) {
- offsetX =
- selectedOriginPoint.point[0] + points[selectedOriginPoint.index][0];
- offsetY =
- selectedOriginPoint.point[1] + points[selectedOriginPoint.index][1];
- }
-
- const nextPoints: LocalPoint[] = points.map((p, idx) => {
- const selectedPointData = targetPoints.find((t) => t.index === idx);
- if (selectedPointData) {
- if (selectedPointData.index === 0) {
- return p;
- }
-
- const deltaX =
- selectedPointData.point[0] - points[selectedPointData.index][0];
- const deltaY =
- selectedPointData.point[1] - points[selectedPointData.index][1];
-
- return pointFrom(p[0] + deltaX - offsetX, p[1] + deltaY - offsetY);
- }
- return offsetX || offsetY ? pointFrom(p[0] - offsetX, p[1] - offsetY) : p;
- });
+ return pointFrom(
+ current[0] - offsetX,
+ current[1] - offsetY,
+ );
+ });
LinearElementEditor._updatePoints(
element,
@@ -1451,14 +1444,6 @@ export class LinearElementEditor {
}
updates.points = Array.from(nextPoints);
- updates.points[0] = pointTranslate(
- updates.points[0],
- vector(offsetX, offsetY),
- );
- updates.points[updates.points.length - 1] = pointTranslate(
- updates.points[updates.points.length - 1],
- vector(offsetX, offsetY),
- );
mutateElement(element, updates, true, {
isDragging: options?.isDragging,
diff --git a/packages/excalidraw/element/mutateElement.ts b/packages/excalidraw/element/mutateElement.ts
index b64366be9..fc96ec312 100644
--- a/packages/excalidraw/element/mutateElement.ts
+++ b/packages/excalidraw/element/mutateElement.ts
@@ -1,13 +1,16 @@
-import type { ExcalidrawElement, SceneElementsMap } from "./types";
-import Scene from "../scene/Scene";
+import type { Radians } from "@excalidraw/math";
+
import { getSizeFromPoints } from "../points";
import { randomInteger } from "../random";
-import { getUpdatedTimestamp, toBrandedType } from "../utils";
-import type { Mutable } from "../utility-types";
+import Scene from "../scene/Scene";
import { ShapeCache } from "../scene/ShapeCache";
-import { isElbowArrow } from "./typeChecks";
+import { getUpdatedTimestamp, toBrandedType } from "../utils";
+
import { updateElbowArrowPoints } from "./elbowArrow";
-import type { Radians } from "@excalidraw/math";
+import { isElbowArrow } from "./typeChecks";
+
+import type { ExcalidrawElement, NonDeletedSceneElementsMap } from "./types";
+import type { Mutable } from "../utility-types";
export type ElementUpdate = Omit<
Partial,
@@ -44,7 +47,7 @@ export const mutateElement = >(
typeof startBinding !== "undefined" ||
typeof endBinding !== "undefined") // manual binding to element
) {
- const elementsMap = toBrandedType(
+ const elementsMap = toBrandedType(
Scene.getScene(element)?.getNonDeletedElementsMap() ?? new Map(),
);
diff --git a/packages/excalidraw/element/newElement.test.ts b/packages/excalidraw/element/newElement.test.ts
index 9c9006b6c..418ede1be 100644
--- a/packages/excalidraw/element/newElement.test.ts
+++ b/packages/excalidraw/element/newElement.test.ts
@@ -1,12 +1,16 @@
-import { duplicateElement, duplicateElements } from "./newElement";
-import { mutateElement } from "./mutateElement";
-import { API } from "../tests/helpers/api";
-import { FONT_FAMILY, ROUNDNESS } from "../constants";
-import { isPrimitive } from "../utils";
-import type { ExcalidrawLinearElement } from "./types";
-import type { LocalPoint } from "@excalidraw/math";
import { pointFrom } from "@excalidraw/math";
+import type { LocalPoint } from "@excalidraw/math";
+
+import { FONT_FAMILY, ROUNDNESS } from "../constants";
+import { API } from "../tests/helpers/api";
+import { isPrimitive } from "../utils";
+
+import { mutateElement } from "./mutateElement";
+import { duplicateElement, duplicateElements } from "./newElement";
+
+import type { ExcalidrawLinearElement } from "./types";
+
const assertCloneObjects = (source: any, clone: any) => {
for (const key in clone) {
if (clone.hasOwnProperty(key) && !isPrimitive(clone[key])) {
diff --git a/packages/excalidraw/element/newElement.ts b/packages/excalidraw/element/newElement.ts
index 7d1f14910..d11c4c20f 100644
--- a/packages/excalidraw/element/newElement.ts
+++ b/packages/excalidraw/element/newElement.ts
@@ -1,3 +1,32 @@
+import type { Radians } from "@excalidraw/math";
+
+import {
+ DEFAULT_ELEMENT_PROPS,
+ DEFAULT_FONT_FAMILY,
+ DEFAULT_FONT_SIZE,
+ DEFAULT_TEXT_ALIGN,
+ DEFAULT_VERTICAL_ALIGN,
+ ORIG_ID,
+ VERTICAL_ALIGN,
+} from "../constants";
+import { getLineHeight } from "../fonts";
+import { getNewGroupIdsForDuplication } from "../groups";
+import { randomInteger, randomId } from "../random";
+import {
+ arrayToMap,
+ getFontString,
+ getUpdatedTimestamp,
+ isTestEnv,
+} from "../utils";
+
+import { getResizedElementAbsoluteCoords } from "./bounds";
+import { bumpVersion, newElementWith } from "./mutateElement";
+import { getBoundTextMaxWidth } from "./textElement";
+import { normalizeText, measureText } from "./textMeasurements";
+import { wrapText } from "./textWrapping";
+
+import { getElementAbsoluteCoords } from ".";
+
import type {
ExcalidrawElement,
ExcalidrawImageElement,
@@ -21,33 +50,8 @@ import type {
FixedSegment,
ExcalidrawElbowArrowElement,
} from "./types";
-import {
- arrayToMap,
- getFontString,
- getUpdatedTimestamp,
- isTestEnv,
-} from "../utils";
-import { randomInteger, randomId } from "../random";
-import { bumpVersion, newElementWith } from "./mutateElement";
-import { getNewGroupIdsForDuplication } from "../groups";
import type { AppState } from "../types";
-import { getElementAbsoluteCoords } from ".";
-import { getResizedElementAbsoluteCoords } from "./bounds";
-import { getBoundTextMaxWidth } from "./textElement";
-import { wrapText } from "./textWrapping";
-import {
- DEFAULT_ELEMENT_PROPS,
- DEFAULT_FONT_FAMILY,
- DEFAULT_FONT_SIZE,
- DEFAULT_TEXT_ALIGN,
- DEFAULT_VERTICAL_ALIGN,
- ORIG_ID,
- VERTICAL_ALIGN,
-} from "../constants";
import type { MarkOptional, Merge, Mutable } from "../utility-types";
-import { getLineHeight } from "../fonts";
-import type { Radians } from "@excalidraw/math";
-import { normalizeText, measureText } from "./textMeasurements";
export type ElementConstructorOpts = MarkOptional<
Omit,
diff --git a/packages/excalidraw/element/resizeElements.ts b/packages/excalidraw/element/resizeElements.ts
index f71a0bc7a..cd51b8bd5 100644
--- a/packages/excalidraw/element/resizeElements.ts
+++ b/packages/excalidraw/element/resizeElements.ts
@@ -1,5 +1,60 @@
+import {
+ pointCenter,
+ normalizeRadians,
+ pointFrom,
+ pointFromPair,
+ pointRotateRads,
+ type Radians,
+ type LocalPoint,
+} from "@excalidraw/math";
+
+import type { GlobalPoint } from "@excalidraw/math";
+
import { MIN_FONT_SIZE, SHIFT_LOCKING_ANGLE } from "../constants";
+import { isInGroup } from "../groups";
import { rescalePoints } from "../points";
+import { getFontString } from "../utils";
+
+import { getArrowLocalFixedPoints, updateBoundElements } from "./binding";
+import {
+ getElementAbsoluteCoords,
+ getCommonBounds,
+ getResizedElementAbsoluteCoords,
+ getCommonBoundingBox,
+ getElementBounds,
+} from "./bounds";
+import { LinearElementEditor } from "./linearElementEditor";
+import { mutateElement } from "./mutateElement";
+import {
+ getBoundTextElement,
+ getBoundTextElementId,
+ getContainerElement,
+ handleBindTextResize,
+ getBoundTextMaxWidth,
+} from "./textElement";
+import {
+ getMinTextElementWidth,
+ measureText,
+ getApproxMinLineWidth,
+ getApproxMinLineHeight,
+} from "./textMeasurements";
+import { wrapText } from "./textWrapping";
+import {
+ isArrowElement,
+ isBoundToContainer,
+ isElbowArrow,
+ isFrameLikeElement,
+ isFreeDrawElement,
+ isImageElement,
+ isLinearElement,
+ isTextElement,
+} from "./typeChecks";
+
+import type { BoundingBox } from "./bounds";
+import type {
+ MaybeTransformHandleType,
+ TransformHandleDirection,
+} from "./transformHandles";
import type {
ExcalidrawLinearElement,
ExcalidrawTextElement,
@@ -12,60 +67,9 @@ import type {
SceneElementsMap,
ExcalidrawElbowArrowElement,
} from "./types";
-import type { Mutable } from "../utility-types";
-import {
- getElementAbsoluteCoords,
- getCommonBounds,
- getResizedElementAbsoluteCoords,
- getCommonBoundingBox,
- getElementBounds,
-} from "./bounds";
-import type { BoundingBox } from "./bounds";
-import {
- isArrowElement,
- isBoundToContainer,
- isElbowArrow,
- isFrameLikeElement,
- isFreeDrawElement,
- isImageElement,
- isLinearElement,
- isTextElement,
-} from "./typeChecks";
-import { mutateElement } from "./mutateElement";
-import { getFontString } from "../utils";
-import { getArrowLocalFixedPoints, updateBoundElements } from "./binding";
-import type {
- MaybeTransformHandleType,
- TransformHandleDirection,
-} from "./transformHandles";
-import type { PointerDownState } from "../types";
import type Scene from "../scene/Scene";
-import {
- getBoundTextElement,
- getBoundTextElementId,
- getContainerElement,
- handleBindTextResize,
- getBoundTextMaxWidth,
-} from "./textElement";
-import { wrapText } from "./textWrapping";
-import { LinearElementEditor } from "./linearElementEditor";
-import { isInGroup } from "../groups";
-import type { GlobalPoint } from "@excalidraw/math";
-import {
- pointCenter,
- normalizeRadians,
- pointFrom,
- pointFromPair,
- pointRotateRads,
- type Radians,
- type LocalPoint,
-} from "@excalidraw/math";
-import {
- getMinTextElementWidth,
- measureText,
- getApproxMinLineWidth,
- getApproxMinLineHeight,
-} from "./textMeasurements";
+import type { PointerDownState } from "../types";
+import type { Mutable } from "../utility-types";
// Returns true when transform (resizing/rotation) happened
export const transformElements = (
@@ -769,32 +773,12 @@ const getResizedOrigin = (
y: y - (newHeight - prevHeight) / 2,
};
case "east-side":
- // NOTE (mtolmacs): Reverting this for a short period to test if it is
- // the cause of the megasized elbow arrows showing up.
- if (
- Math.abs(
- y +
- ((prevWidth - newWidth) / 2) * Math.sin(angle) +
- (prevHeight - newHeight) / 2,
- ) > 1e6
- ) {
- console.error(
- "getResizedOrigin() new calculation creates extremely large (> 1e6) y value where the old calculation resulted in",
- {
- result:
- y +
- (newHeight - prevHeight) / 2 +
- ((prevWidth - newWidth) / 2) * Math.sin(angle),
- },
- );
- }
-
return {
x: x + ((prevWidth - newWidth) / 2) * (Math.cos(angle) + 1),
y:
y +
- (newHeight - prevHeight) / 2 +
- ((prevWidth - newWidth) / 2) * Math.sin(angle),
+ ((prevWidth - newWidth) / 2) * Math.sin(angle) +
+ (prevHeight - newHeight) / 2,
};
case "west-side":
return {
diff --git a/packages/excalidraw/element/resizeTest.ts b/packages/excalidraw/element/resizeTest.ts
index 375ff980b..1eb36d0b2 100644
--- a/packages/excalidraw/element/resizeTest.ts
+++ b/packages/excalidraw/element/resizeTest.ts
@@ -1,27 +1,3 @@
-import type {
- ExcalidrawElement,
- PointerType,
- NonDeletedExcalidrawElement,
- ElementsMap,
-} from "./types";
-
-import type {
- TransformHandleType,
- TransformHandle,
- MaybeTransformHandleType,
-} from "./transformHandles";
-import {
- getTransformHandlesFromCoords,
- getTransformHandles,
- getOmitSidesForDevice,
- canResizeFromSides,
-} from "./transformHandles";
-import type { AppState, Device, Zoom } from "../types";
-import type { Bounds } from "./bounds";
-import { getElementAbsoluteCoords } from "./bounds";
-import { SIDE_RESIZING_THRESHOLD } from "../constants";
-import { isImageElement, isLinearElement } from "./typeChecks";
-import type { GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
import {
pointFrom,
pointOnLineSegment,
@@ -29,6 +5,33 @@ import {
type Radians,
} from "@excalidraw/math";
+import type { GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
+
+import { SIDE_RESIZING_THRESHOLD } from "../constants";
+
+import { getElementAbsoluteCoords } from "./bounds";
+import {
+ getTransformHandlesFromCoords,
+ getTransformHandles,
+ getOmitSidesForDevice,
+ canResizeFromSides,
+} from "./transformHandles";
+import { isImageElement, isLinearElement } from "./typeChecks";
+
+import type { AppState, Device, Zoom } from "../types";
+import type { Bounds } from "./bounds";
+import type {
+ TransformHandleType,
+ TransformHandle,
+ MaybeTransformHandleType,
+} from "./transformHandles";
+import type {
+ ExcalidrawElement,
+ PointerType,
+ NonDeletedExcalidrawElement,
+ ElementsMap,
+} from "./types";
+
const isInsideTransformHandle = (
transformHandle: TransformHandle,
x: number,
diff --git a/packages/excalidraw/element/showSelectedShapeActions.ts b/packages/excalidraw/element/showSelectedShapeActions.ts
index bbf313d01..44c2e75c3 100644
--- a/packages/excalidraw/element/showSelectedShapeActions.ts
+++ b/packages/excalidraw/element/showSelectedShapeActions.ts
@@ -1,6 +1,7 @@
-import type { NonDeletedExcalidrawElement } from "./types";
import { getSelectedElements } from "../scene";
+
import type { UIAppState } from "../types";
+import type { NonDeletedExcalidrawElement } from "./types";
export const showSelectedShapeActions = (
appState: UIAppState,
diff --git a/packages/excalidraw/element/sizeHelpers.test.ts b/packages/excalidraw/element/sizeHelpers.test.ts
index 8e63dd9da..c882e1f3c 100644
--- a/packages/excalidraw/element/sizeHelpers.test.ts
+++ b/packages/excalidraw/element/sizeHelpers.test.ts
@@ -1,7 +1,9 @@
import { vi } from "vitest";
-import { getPerfectElementSize } from "./sizeHelpers";
+
import * as constants from "../constants";
+import { getPerfectElementSize } from "./sizeHelpers";
+
const EPSILON_DIGITS = 3;
// Needed so that we can mock the value of constants which is done in
// below tests. In Jest this wasn't needed as global override was possible
diff --git a/packages/excalidraw/element/sizeHelpers.ts b/packages/excalidraw/element/sizeHelpers.ts
index f633789a9..33b13e188 100644
--- a/packages/excalidraw/element/sizeHelpers.ts
+++ b/packages/excalidraw/element/sizeHelpers.ts
@@ -1,10 +1,12 @@
-import type { ElementsMap, ExcalidrawElement } from "./types";
+import { SHIFT_LOCKING_ANGLE } from "../constants";
+import { viewportCoordsToSceneCoords } from "../utils";
+
+import { getCommonBounds, getElementBounds } from "./bounds";
import { mutateElement } from "./mutateElement";
import { isFreeDrawElement, isLinearElement } from "./typeChecks";
-import { SHIFT_LOCKING_ANGLE } from "../constants";
+
+import type { ElementsMap, ExcalidrawElement } from "./types";
import type { AppState, Offsets, Zoom } from "../types";
-import { getCommonBounds, getElementBounds } from "./bounds";
-import { viewportCoordsToSceneCoords } from "../utils";
// TODO: remove invisible elements consistently actions, so that invisible elements are not recorded by the store, exported, broadcasted or persisted
// - perhaps could be as part of a standalone 'cleanup' action, in addition to 'finalize'
diff --git a/packages/excalidraw/element/sortElements.test.ts b/packages/excalidraw/element/sortElements.test.ts
index a7b78e8ea..5f7c4b2e6 100644
--- a/packages/excalidraw/element/sortElements.test.ts
+++ b/packages/excalidraw/element/sortElements.test.ts
@@ -1,6 +1,8 @@
import { API } from "../tests/helpers/api";
+
import { mutateElement } from "./mutateElement";
import { normalizeElementOrder } from "./sortElements";
+
import type { ExcalidrawElement } from "./types";
const assertOrder = (
diff --git a/packages/excalidraw/element/sortElements.ts b/packages/excalidraw/element/sortElements.ts
index 3078a6827..d395adf2f 100644
--- a/packages/excalidraw/element/sortElements.ts
+++ b/packages/excalidraw/element/sortElements.ts
@@ -1,4 +1,5 @@
import { arrayToMapWithIndex } from "../utils";
+
import type { ExcalidrawElement } from "./types";
const normalizeGroupElementOrder = (elements: readonly ExcalidrawElement[]) => {
diff --git a/packages/excalidraw/element/textElement.test.ts b/packages/excalidraw/element/textElement.test.ts
index 2c23c2b06..41531a738 100644
--- a/packages/excalidraw/element/textElement.test.ts
+++ b/packages/excalidraw/element/textElement.test.ts
@@ -1,6 +1,7 @@
import { FONT_FAMILY } from "../constants";
import { getLineHeight } from "../fonts";
import { API } from "../tests/helpers/api";
+
import {
computeContainerDimensionForBoundText,
getContainerCoords,
@@ -8,6 +9,7 @@ import {
getBoundTextMaxHeight,
} from "./textElement";
import { detectLineHeight, getLineHeightInPx } from "./textMeasurements";
+
import type { ExcalidrawTextElementWithContainer } from "./types";
describe("Test measureText", () => {
diff --git a/packages/excalidraw/element/textElement.ts b/packages/excalidraw/element/textElement.ts
index de948d9ce..9893ba5d6 100644
--- a/packages/excalidraw/element/textElement.ts
+++ b/packages/excalidraw/element/textElement.ts
@@ -1,4 +1,26 @@
+import {
+ ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO,
+ ARROW_LABEL_WIDTH_FRACTION,
+ BOUND_TEXT_PADDING,
+ DEFAULT_FONT_SIZE,
+ TEXT_ALIGN,
+ VERTICAL_ALIGN,
+} from "../constants";
import { getFontString, arrayToMap } from "../utils";
+
+import {
+ resetOriginalContainerCache,
+ updateOriginalContainerCache,
+} from "./containerCache";
+import { LinearElementEditor } from "./linearElementEditor";
+import { mutateElement } from "./mutateElement";
+import { measureText } from "./textMeasurements";
+import { wrapText } from "./textWrapping";
+import { isBoundToContainer, isArrowElement } from "./typeChecks";
+
+import { isTextElement } from ".";
+
+import type { MaybeTransformHandleType } from "./transformHandles";
import type {
ElementsMap,
ExcalidrawElement,
@@ -8,27 +30,8 @@ import type {
ExcalidrawTextElementWithContainer,
NonDeletedExcalidrawElement,
} from "./types";
-import { mutateElement } from "./mutateElement";
-import {
- ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO,
- ARROW_LABEL_WIDTH_FRACTION,
- BOUND_TEXT_PADDING,
- DEFAULT_FONT_SIZE,
- TEXT_ALIGN,
- VERTICAL_ALIGN,
-} from "../constants";
-import type { MaybeTransformHandleType } from "./transformHandles";
-import { isTextElement } from ".";
-import { wrapText } from "./textWrapping";
-import { isBoundToContainer, isArrowElement } from "./typeChecks";
-import { LinearElementEditor } from "./linearElementEditor";
import type { AppState } from "../types";
-import {
- resetOriginalContainerCache,
- updateOriginalContainerCache,
-} from "./containerCache";
import type { ExtractSetType } from "../utility-types";
-import { measureText } from "./textMeasurements";
export const redrawTextBoundingBox = (
textElement: ExcalidrawTextElement,
diff --git a/packages/excalidraw/element/textMeasurements.ts b/packages/excalidraw/element/textMeasurements.ts
index f2a132a3a..840896cfc 100644
--- a/packages/excalidraw/element/textMeasurements.ts
+++ b/packages/excalidraw/element/textMeasurements.ts
@@ -4,6 +4,7 @@ import {
DEFAULT_FONT_FAMILY,
} from "../constants";
import { getFontString, isTestEnv, normalizeEOL } from "../utils";
+
import type { FontString, ExcalidrawTextElement } from "./types";
export const measureText = (
diff --git a/packages/excalidraw/element/textWrapping.test.ts b/packages/excalidraw/element/textWrapping.test.ts
index 6c7bcb819..357736a2e 100644
--- a/packages/excalidraw/element/textWrapping.test.ts
+++ b/packages/excalidraw/element/textWrapping.test.ts
@@ -1,4 +1,5 @@
import { wrapText, parseTokens } from "./textWrapping";
+
import type { FontString } from "./types";
describe("Test wrapText", () => {
diff --git a/packages/excalidraw/element/textWrapping.ts b/packages/excalidraw/element/textWrapping.ts
index 1913f6ed3..5df7051c0 100644
--- a/packages/excalidraw/element/textWrapping.ts
+++ b/packages/excalidraw/element/textWrapping.ts
@@ -1,5 +1,7 @@
import { ENV } from "../constants";
+
import { charWidth, getLineWidth } from "./textMeasurements";
+
import type { FontString } from "./types";
let cachedCjkRegex: RegExp | undefined;
diff --git a/packages/excalidraw/element/textWysiwyg.test.tsx b/packages/excalidraw/element/textWysiwyg.test.tsx
index 0842e30fd..11c700e33 100644
--- a/packages/excalidraw/element/textWysiwyg.test.tsx
+++ b/packages/excalidraw/element/textWysiwyg.test.tsx
@@ -1,29 +1,31 @@
+import { pointFrom } from "@excalidraw/math";
+import { queryByText } from "@testing-library/react";
import React from "react";
+
+import { FONT_FAMILY, TEXT_ALIGN, VERTICAL_ALIGN } from "../constants";
import { Excalidraw } from "../index";
+import { CODES, KEYS } from "../keys";
+import { API } from "../tests/helpers/api";
+import { Keyboard, Pointer, UI } from "../tests/helpers/ui";
+import { getTextEditor, updateTextEditor } from "../tests/queries/dom";
import {
GlobalTestState,
render,
screen,
unmountComponent,
} from "../tests/test-utils";
-import { Keyboard, Pointer, UI } from "../tests/helpers/ui";
-import { CODES, KEYS } from "../keys";
import {
fireEvent,
mockBoundingClientRect,
restoreOriginalGetBoundingClientRect,
} from "../tests/test-utils";
-import { queryByText } from "@testing-library/react";
-import { FONT_FAMILY, TEXT_ALIGN, VERTICAL_ALIGN } from "../constants";
+import { getOriginalContainerHeightFromCache } from "./containerCache";
+
import type {
ExcalidrawTextElement,
ExcalidrawTextElementWithContainer,
} from "./types";
-import { API } from "../tests/helpers/api";
-import { getOriginalContainerHeightFromCache } from "./containerCache";
-import { getTextEditor, updateTextEditor } from "../tests/queries/dom";
-import { pointFrom } from "@excalidraw/math";
unmountComponent();
diff --git a/packages/excalidraw/element/textWysiwyg.tsx b/packages/excalidraw/element/textWysiwyg.tsx
index 01dfc600f..4897f323e 100644
--- a/packages/excalidraw/element/textWysiwyg.tsx
+++ b/packages/excalidraw/element/textWysiwyg.tsx
@@ -1,24 +1,28 @@
+import {
+ actionResetZoom,
+ actionZoomIn,
+ actionZoomOut,
+} from "../actions/actionCanvas";
+import {
+ actionDecreaseFontSize,
+ actionIncreaseFontSize,
+} from "../actions/actionProperties";
+import { parseClipboard } from "../clipboard";
+import { CLASSES, POINTER_BUTTON } from "../constants";
import { CODES, KEYS } from "../keys";
+import Scene from "../scene/Scene";
import {
isWritableElement,
getFontString,
getFontFamilyString,
isTestEnv,
} from "../utils";
-import Scene from "../scene/Scene";
+
import {
- isArrowElement,
- isBoundToContainer,
- isTextElement,
-} from "./typeChecks";
-import { CLASSES, POINTER_BUTTON } from "../constants";
-import type {
- ExcalidrawElement,
- ExcalidrawLinearElement,
- ExcalidrawTextElementWithContainer,
- ExcalidrawTextElement,
-} from "./types";
-import type { AppState } from "../types";
+ originalContainerCache,
+ updateOriginalContainerCache,
+} from "./containerCache";
+import { LinearElementEditor } from "./linearElementEditor";
import { bumpVersion, mutateElement } from "./mutateElement";
import {
getBoundTextElementId,
@@ -31,25 +35,23 @@ import {
computeBoundTextPosition,
getBoundTextElement,
} from "./textElement";
-import { wrapText } from "./textWrapping";
-import {
- actionDecreaseFontSize,
- actionIncreaseFontSize,
-} from "../actions/actionProperties";
-import {
- actionResetZoom,
- actionZoomIn,
- actionZoomOut,
-} from "../actions/actionCanvas";
-import type App from "../components/App";
-import { LinearElementEditor } from "./linearElementEditor";
-import { parseClipboard } from "../clipboard";
-import {
- originalContainerCache,
- updateOriginalContainerCache,
-} from "./containerCache";
import { getTextWidth, measureText } from "./textMeasurements";
import { normalizeText } from "./textMeasurements";
+import { wrapText } from "./textWrapping";
+import {
+ isArrowElement,
+ isBoundToContainer,
+ isTextElement,
+} from "./typeChecks";
+
+import type {
+ ExcalidrawElement,
+ ExcalidrawLinearElement,
+ ExcalidrawTextElementWithContainer,
+ ExcalidrawTextElement,
+} from "./types";
+import type App from "../components/App";
+import type { AppState } from "../types";
const getTransform = (
width: number,
diff --git a/packages/excalidraw/element/transformHandles.ts b/packages/excalidraw/element/transformHandles.ts
index d34eb3279..ab5691df8 100644
--- a/packages/excalidraw/element/transformHandles.ts
+++ b/packages/excalidraw/element/transformHandles.ts
@@ -1,26 +1,29 @@
-import type {
- ElementsMap,
- ExcalidrawElement,
- NonDeletedExcalidrawElement,
- PointerType,
-} from "./types";
+import { pointFrom, pointRotateRads } from "@excalidraw/math";
+
+import type { Radians } from "@excalidraw/math";
+
+import {
+ DEFAULT_TRANSFORM_HANDLE_SPACING,
+ isAndroid,
+ isIOS,
+} from "../constants";
-import type { Bounds } from "./bounds";
import { getElementAbsoluteCoords } from "./bounds";
-import type { Device, InteractiveCanvasAppState, Zoom } from "../types";
import {
isElbowArrow,
isFrameLikeElement,
isImageElement,
isLinearElement,
} from "./typeChecks";
-import {
- DEFAULT_TRANSFORM_HANDLE_SPACING,
- isAndroid,
- isIOS,
-} from "../constants";
-import type { Radians } from "@excalidraw/math";
-import { pointFrom, pointRotateRads } from "@excalidraw/math";
+
+import type { Device, InteractiveCanvasAppState, Zoom } from "../types";
+import type { Bounds } from "./bounds";
+import type {
+ ElementsMap,
+ ExcalidrawElement,
+ NonDeletedExcalidrawElement,
+ PointerType,
+} from "./types";
export type TransformHandleDirection =
| "n"
diff --git a/packages/excalidraw/element/typeChecks.test.ts b/packages/excalidraw/element/typeChecks.test.ts
index 60eb9e273..44e4dd755 100644
--- a/packages/excalidraw/element/typeChecks.test.ts
+++ b/packages/excalidraw/element/typeChecks.test.ts
@@ -1,4 +1,5 @@
import { API } from "../tests/helpers/api";
+
import { hasBoundTextElement } from "./typeChecks";
describe("Test TypeChecks", () => {
diff --git a/packages/excalidraw/element/typeChecks.ts b/packages/excalidraw/element/typeChecks.ts
index 1c560d576..988ce4497 100644
--- a/packages/excalidraw/element/typeChecks.ts
+++ b/packages/excalidraw/element/typeChecks.ts
@@ -1,7 +1,8 @@
import { ROUNDNESS } from "../constants";
+import { assertNever } from "../utils";
+
import type { ElementOrToolType } from "../types";
import type { MarkNonNullable } from "../utility-types";
-import { assertNever } from "../utils";
import type { Bounds } from "./bounds";
import type {
ExcalidrawElement,
diff --git a/packages/excalidraw/element/types.ts b/packages/excalidraw/element/types.ts
index 596586743..49ad800af 100644
--- a/packages/excalidraw/element/types.ts
+++ b/packages/excalidraw/element/types.ts
@@ -1,4 +1,5 @@
import type { LocalPoint, Radians } from "@excalidraw/math";
+
import type {
FONT_FAMILY,
ROUNDNESS,
diff --git a/packages/excalidraw/element/utils.ts b/packages/excalidraw/element/utils.ts
index d85cd78c6..8992850dc 100644
--- a/packages/excalidraw/element/utils.ts
+++ b/packages/excalidraw/element/utils.ts
@@ -1,5 +1,3 @@
-import { getDiamondPoints } from ".";
-import type { Curve, LineSegment } from "@excalidraw/math";
import {
curve,
lineSegment,
@@ -11,7 +9,13 @@ import {
vectorScale,
type GlobalPoint,
} from "@excalidraw/math";
+
+import type { Curve, LineSegment } from "@excalidraw/math";
+
import { getCornerRadius } from "../shapes";
+
+import { getDiamondPoints } from ".";
+
import type {
ExcalidrawDiamondElement,
ExcalidrawRectanguloidElement,
diff --git a/packages/excalidraw/env.cjs b/packages/excalidraw/env.cjs
index 8d7862246..63c1bde5f 100644
--- a/packages/excalidraw/env.cjs
+++ b/packages/excalidraw/env.cjs
@@ -9,9 +9,10 @@ const parseEnvVariables = (filepath) => {
},
{},
);
- envVars.VITE_PKG_NAME = pkg.name;
- envVars.VITE_PKG_VERSION = pkg.version;
- envVars.VITE_IS_EXCALIDRAW_NPM_PACKAGE = true;
+
+ envVars.PKG_NAME = pkg.name;
+ envVars.PKG_VERSION = pkg.version;
+
return envVars;
};
diff --git a/packages/excalidraw/fonts/Cascadia/index.ts b/packages/excalidraw/fonts/Cascadia/index.ts
index ecd111644..aad91ff0c 100644
--- a/packages/excalidraw/fonts/Cascadia/index.ts
+++ b/packages/excalidraw/fonts/Cascadia/index.ts
@@ -1,7 +1,7 @@
-import CascadiaCodeRegular from "./CascadiaCode-Regular.woff2";
-
import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
+import CascadiaCodeRegular from "./CascadiaCode-Regular.woff2";
+
export const CascadiaFontFaces: ExcalidrawFontFaceDescriptor[] = [
{
uri: CascadiaCodeRegular,
diff --git a/packages/excalidraw/fonts/ComicShanns/index.ts b/packages/excalidraw/fonts/ComicShanns/index.ts
index bf78650b4..20d23c28e 100644
--- a/packages/excalidraw/fonts/ComicShanns/index.ts
+++ b/packages/excalidraw/fonts/ComicShanns/index.ts
@@ -1,13 +1,13 @@
// The following file content was generated with https://chinese-font.netlify.app/online-split,
// but has been manully rewritten from `@font-face` rules into TS while leveraging FontFace API.
-import _0 from "./ComicShanns-Regular-279a7b317d12eb88de06167bd672b4b4.woff2";
-import _1 from "./ComicShanns-Regular-fcb0fc02dcbee4c9846b3e2508668039.woff2";
-import _2 from "./ComicShanns-Regular-dc6a8806fa96795d7b3be5026f989a17.woff2";
-import _3 from "./ComicShanns-Regular-6e066e8de2ac57ea9283adb9c24d7f0c.woff2";
-
import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
+import _0 from "./ComicShanns-Regular-279a7b317d12eb88de06167bd672b4b4.woff2";
+import _3 from "./ComicShanns-Regular-6e066e8de2ac57ea9283adb9c24d7f0c.woff2";
+import _2 from "./ComicShanns-Regular-dc6a8806fa96795d7b3be5026f989a17.woff2";
+import _1 from "./ComicShanns-Regular-fcb0fc02dcbee4c9846b3e2508668039.woff2";
+
/* Generated By cn-font-split@5.2.2 https://www.npmjs.com/package/cn-font-split
CreateTime: Thu, 17 Oct 2024 09:57:51 GMT;
Origin File Name Table:
diff --git a/packages/excalidraw/fonts/Emoji/index.ts b/packages/excalidraw/fonts/Emoji/index.ts
index 491c7b8c9..323d075cb 100644
--- a/packages/excalidraw/fonts/Emoji/index.ts
+++ b/packages/excalidraw/fonts/Emoji/index.ts
@@ -1,5 +1,4 @@
import { LOCAL_FONT_PROTOCOL } from "../FontMetadata";
-
import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
export const EmojiFontFaces: ExcalidrawFontFaceDescriptor[] = [
diff --git a/packages/excalidraw/fonts/ExcalidrawFontFace.ts b/packages/excalidraw/fonts/ExcalidrawFontFace.ts
index a20a45577..615fef20f 100644
--- a/packages/excalidraw/fonts/ExcalidrawFontFace.ts
+++ b/packages/excalidraw/fonts/ExcalidrawFontFace.ts
@@ -1,6 +1,7 @@
-import { promiseTry } from "../utils";
-import { LOCAL_FONT_PROTOCOL } from "./FontMetadata";
import { subsetWoff2GlyphsByCodepoints } from "../subset/subset-main";
+import { promiseTry } from "../utils";
+
+import { LOCAL_FONT_PROTOCOL } from "./FontMetadata";
type DataURL = string;
@@ -9,9 +10,9 @@ export class ExcalidrawFontFace {
public readonly fontFace: FontFace;
private static readonly ASSETS_FALLBACK_URL = `https://esm.sh/${
- import.meta.env.VITE_PKG_NAME
- ? `${import.meta.env.VITE_PKG_NAME}@${import.meta.env.VITE_PKG_VERSION}` // should be provided by vite during package build
- : "@excalidraw/excalidraw" // fallback to latest package version (i.e. for app)
+ import.meta.env.PKG_NAME
+ ? `${import.meta.env.PKG_NAME}@${import.meta.env.PKG_VERSION}` // is provided during package build
+ : "@excalidraw/excalidraw" // fallback to the latest package version (i.e. for app)
}/dist/prod/`;
constructor(family: string, uri: string, descriptors?: FontFaceDescriptors) {
diff --git a/packages/excalidraw/fonts/Excalifont/index.ts b/packages/excalidraw/fonts/Excalifont/index.ts
index 7e11af6c6..bcd384be5 100644
--- a/packages/excalidraw/fonts/Excalifont/index.ts
+++ b/packages/excalidraw/fonts/Excalifont/index.ts
@@ -1,13 +1,13 @@
-import _0 from "./Excalifont-Regular-a88b72a24fb54c9f94e3b5fdaa7481c9.woff2";
-import _1 from "./Excalifont-Regular-be310b9bcd4f1a43f571c46df7809174.woff2";
-import _2 from "./Excalifont-Regular-b9dcf9d2e50a1eaf42fc664b50a3fd0d.woff2";
-import _3 from "./Excalifont-Regular-41b173a47b57366892116a575a43e2b6.woff2";
-import _4 from "./Excalifont-Regular-3f2c5db56cc93c5a6873b1361d730c16.woff2";
-import _5 from "./Excalifont-Regular-349fac6ca4700ffec595a7150a0d1e1d.woff2";
-import _6 from "./Excalifont-Regular-623ccf21b21ef6b3a0d87738f77eb071.woff2";
-
import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
+import _5 from "./Excalifont-Regular-349fac6ca4700ffec595a7150a0d1e1d.woff2";
+import _4 from "./Excalifont-Regular-3f2c5db56cc93c5a6873b1361d730c16.woff2";
+import _3 from "./Excalifont-Regular-41b173a47b57366892116a575a43e2b6.woff2";
+import _6 from "./Excalifont-Regular-623ccf21b21ef6b3a0d87738f77eb071.woff2";
+import _0 from "./Excalifont-Regular-a88b72a24fb54c9f94e3b5fdaa7481c9.woff2";
+import _2 from "./Excalifont-Regular-b9dcf9d2e50a1eaf42fc664b50a3fd0d.woff2";
+import _1 from "./Excalifont-Regular-be310b9bcd4f1a43f571c46df7809174.woff2";
+
/* Generated By cn-font-split@5.2.2 https://www.npmjs.com/package/cn-font-split
CreateTime: Mon, 14 Oct 2024 18:59:19 GMT;
Origin File Name Table:
diff --git a/packages/excalidraw/fonts/FontMetadata.ts b/packages/excalidraw/fonts/FontMetadata.ts
index e93380e81..e8b46205b 100644
--- a/packages/excalidraw/fonts/FontMetadata.ts
+++ b/packages/excalidraw/fonts/FontMetadata.ts
@@ -1,4 +1,3 @@
-import type { JSX } from "react";
import {
FreedrawIcon,
FontFamilyNormalIcon,
@@ -7,6 +6,8 @@ import {
} from "../components/icons";
import { FONT_FAMILY, FONT_FAMILY_FALLBACKS } from "../constants";
+import type { JSX } from "react";
+
/**
* Encapsulates font metrics with additional font metadata.
* */
diff --git a/packages/excalidraw/fonts/Fonts.ts b/packages/excalidraw/fonts/Fonts.ts
index 4b8ba7828..c1b94bdef 100644
--- a/packages/excalidraw/fonts/Fonts.ts
+++ b/packages/excalidraw/fonts/Fonts.ts
@@ -7,15 +7,17 @@ import {
} from "../constants";
import { isTextElement } from "../element";
import { getContainerElement } from "../element/textElement";
+import { charWidth } from "../element/textMeasurements";
import { containsCJK } from "../element/textWrapping";
import { ShapeCache } from "../scene/ShapeCache";
import { getFontString, PromisePool, promiseTry } from "../utils";
-import { ExcalidrawFontFace } from "./ExcalidrawFontFace";
import { CascadiaFontFaces } from "./Cascadia";
import { ComicShannsFontFaces } from "./ComicShanns";
import { EmojiFontFaces } from "./Emoji";
+import { ExcalidrawFontFace } from "./ExcalidrawFontFace";
import { ExcalifontFontFaces } from "./Excalifont";
+import { FONT_METADATA, type FontMetadata } from "./FontMetadata";
import { HelveticaFontFaces } from "./Helvetica";
import { LiberationFontFaces } from "./Liberation";
import { LilitaFontFaces } from "./Lilita";
@@ -23,7 +25,6 @@ import { NunitoFontFaces } from "./Nunito";
import { VirgilFontFaces } from "./Virgil";
import { XiaolaiFontFaces } from "./Xiaolai";
-import { FONT_METADATA, type FontMetadata } from "./FontMetadata";
import type {
ExcalidrawElement,
ExcalidrawTextElement,
@@ -31,7 +32,6 @@ import type {
} from "../element/types";
import type Scene from "../scene/Scene";
import type { ValueOf } from "../utility-types";
-import { charWidth } from "../element/textMeasurements";
export class Fonts {
// it's ok to track fonts across multiple instances only once, so let's use
diff --git a/packages/excalidraw/fonts/Helvetica/index.ts b/packages/excalidraw/fonts/Helvetica/index.ts
index a0e7ecb61..f13d15118 100644
--- a/packages/excalidraw/fonts/Helvetica/index.ts
+++ b/packages/excalidraw/fonts/Helvetica/index.ts
@@ -1,5 +1,4 @@
import { LOCAL_FONT_PROTOCOL } from "../FontMetadata";
-
import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
export const HelveticaFontFaces: ExcalidrawFontFaceDescriptor[] = [
diff --git a/packages/excalidraw/fonts/Liberation/index.ts b/packages/excalidraw/fonts/Liberation/index.ts
index 5bc964815..86b3e72ec 100644
--- a/packages/excalidraw/fonts/Liberation/index.ts
+++ b/packages/excalidraw/fonts/Liberation/index.ts
@@ -1,7 +1,7 @@
-import LiberationSansRegular from "./LiberationSans-Regular.woff2";
-
import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
+import LiberationSansRegular from "./LiberationSans-Regular.woff2";
+
export const LiberationFontFaces: ExcalidrawFontFaceDescriptor[] = [
{
uri: LiberationSansRegular,
diff --git a/packages/excalidraw/fonts/Lilita/index.ts b/packages/excalidraw/fonts/Lilita/index.ts
index d5ea82e58..37a5d6a5e 100644
--- a/packages/excalidraw/fonts/Lilita/index.ts
+++ b/packages/excalidraw/fonts/Lilita/index.ts
@@ -1,10 +1,9 @@
-import LilitaLatin from "./Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYEF8RXi4EwQ.woff2";
-import LilitaLatinExt from "./Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYE98RXi4EwSsbg.woff2";
-
import { GOOGLE_FONTS_RANGES } from "../FontMetadata";
-
import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
+import LilitaLatinExt from "./Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYE98RXi4EwSsbg.woff2";
+import LilitaLatin from "./Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYEF8RXi4EwQ.woff2";
+
export const LilitaFontFaces: ExcalidrawFontFaceDescriptor[] = [
{
uri: LilitaLatinExt,
diff --git a/packages/excalidraw/fonts/Nunito/index.ts b/packages/excalidraw/fonts/Nunito/index.ts
index 4db432d07..3b092b0d6 100644
--- a/packages/excalidraw/fonts/Nunito/index.ts
+++ b/packages/excalidraw/fonts/Nunito/index.ts
@@ -1,13 +1,12 @@
-import Latin from "./Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTQ3j6zbXWjgeg.woff2";
-import LatinExt from "./Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTo3j6zbXWjgevT5.woff2";
-import Cyrilic from "./Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTA3j6zbXWjgevT5.woff2";
-import CyrilicExt from "./Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTk3j6zbXWjgevT5.woff2";
-import Vietnamese from "./Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTs3j6zbXWjgevT5.woff2";
-
import { GOOGLE_FONTS_RANGES } from "../FontMetadata";
-
import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
+import Cyrilic from "./Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTA3j6zbXWjgevT5.woff2";
+import Latin from "./Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTQ3j6zbXWjgeg.woff2";
+import CyrilicExt from "./Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTk3j6zbXWjgevT5.woff2";
+import LatinExt from "./Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTo3j6zbXWjgevT5.woff2";
+import Vietnamese from "./Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTs3j6zbXWjgevT5.woff2";
+
export const NunitoFontFaces: ExcalidrawFontFaceDescriptor[] = [
{
uri: CyrilicExt,
diff --git a/packages/excalidraw/fonts/Virgil/index.ts b/packages/excalidraw/fonts/Virgil/index.ts
index fdd5ffcfc..b9ce7ee78 100644
--- a/packages/excalidraw/fonts/Virgil/index.ts
+++ b/packages/excalidraw/fonts/Virgil/index.ts
@@ -1,7 +1,7 @@
-import Virgil from "./Virgil-Regular.woff2";
-
import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
+import Virgil from "./Virgil-Regular.woff2";
+
export const VirgilFontFaces: ExcalidrawFontFaceDescriptor[] = [
{
uri: Virgil,
diff --git a/packages/excalidraw/fonts/Xiaolai/index.ts b/packages/excalidraw/fonts/Xiaolai/index.ts
index 17fd71831..67476b912 100644
--- a/packages/excalidraw/fonts/Xiaolai/index.ts
+++ b/packages/excalidraw/fonts/Xiaolai/index.ts
@@ -1,23 +1,31 @@
// The following file content was generated with https://chinese-font.netlify.app/online-split,
// but has been manully rewritten from `@font-face` rules into TS while leveraging FontFace API.
+import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
+
+import _80 from "./Xiaolai-Regular-019d66dcad46dc156b162d267f981c20.woff2";
+import _16 from "./Xiaolai-Regular-04b718e5623574919c8b0dea5f301444.woff2";
+import _13 from "./Xiaolai-Regular-069e77aac84590e2e991d0a0176d34f2.woff2";
+import _166 from "./Xiaolai-Regular-06c77b8c66e51ed6c63ccb502dd8b8af.woff2";
+import _71 from "./Xiaolai-Regular-08e0dc436ad0ad61ba5558db0674d762.woff2";
+import _161 from "./Xiaolai-Regular-093b9ef39a46ceae95a1df18a0a3a326.woff2";
+import _183 from "./Xiaolai-Regular-095c169f3314805276f603a362766abd.woff2";
import _0 from "./Xiaolai-Regular-09850c4077f3fffe707905872e0e2460.woff2";
-import _1 from "./Xiaolai-Regular-7eb9fffd1aa890d07d0f88cc82e6cfe4.woff2";
+import _14 from "./Xiaolai-Regular-41521fade99856108931b4768b1b2648.woff2";
+import _10 from "./Xiaolai-Regular-544fc28abe2c5c30e62383fd4dac255f.woff2";
import _2 from "./Xiaolai-Regular-60a3089806700d379f11827ee9843b6b.woff2";
+import _1 from "./Xiaolai-Regular-7eb9fffd1aa890d07d0f88cc82e6cfe4.woff2";
import _3 from "./Xiaolai-Regular-6fe5c5973cc06f74b2387a631ea36b88.woff2";
+import _6 from "./Xiaolai-Regular-a4c34be6d42152e64b0df90bc4607f64.woff2";
import _4 from "./Xiaolai-Regular-b96d9226ce77ec94ceca043d712182e6.woff2";
import _5 from "./Xiaolai-Regular-6ae5b42180ad70b971c91e7eefb8eba2.woff2";
-import _6 from "./Xiaolai-Regular-a4c34be6d42152e64b0df90bc4607f64.woff2";
import _7 from "./Xiaolai-Regular-c69f61a4ab18d0488c8d1fc12e7028e8.woff2";
+import _30 from "./Xiaolai-Regular-cb17fc3db95f6d139afc9d31a8e93293.woff2";
import _8 from "./Xiaolai-Regular-e3fcf5180fd466c8915c4e8069491054.woff2";
import _9 from "./Xiaolai-Regular-c1f94158256bb1f3bf665b053d895af9.woff2";
-import _10 from "./Xiaolai-Regular-544fc28abe2c5c30e62383fd4dac255f.woff2";
import _11 from "./Xiaolai-Regular-7197d6fda6cba7c3874c53d6381ca239.woff2";
import _12 from "./Xiaolai-Regular-70c2eb8d64e71a42a834eb857ea9df51.woff2";
-import _13 from "./Xiaolai-Regular-069e77aac84590e2e991d0a0176d34f2.woff2";
-import _14 from "./Xiaolai-Regular-41521fade99856108931b4768b1b2648.woff2";
import _15 from "./Xiaolai-Regular-a004ddfcb26e67bd6e678c8ed19e25ce.woff2";
-import _16 from "./Xiaolai-Regular-04b718e5623574919c8b0dea5f301444.woff2";
import _17 from "./Xiaolai-Regular-7e4bde7e9c7f84cd34d8a845e384c746.woff2";
import _18 from "./Xiaolai-Regular-23686f7f29da6e8008c36dd3a80c83d6.woff2";
import _19 from "./Xiaolai-Regular-69c09cc5fa3e55c74fc4821f76909cc3.woff2";
@@ -31,7 +39,6 @@ import _26 from "./Xiaolai-Regular-7e929f262f30c8ee78bf398150b1a7cd.woff2";
import _27 from "./Xiaolai-Regular-73e309718fd16cea44b4d54a33581811.woff2";
import _28 from "./Xiaolai-Regular-9eb5a99df4e76ac3363453ac9ca288b1.woff2";
import _29 from "./Xiaolai-Regular-3e63ed8162808a9e425ed80a8bc79114.woff2";
-import _30 from "./Xiaolai-Regular-cb17fc3db95f6d139afc9d31a8e93293.woff2";
import _31 from "./Xiaolai-Regular-c8b71798409ccc126ee264a00aadcf21.woff2";
import _32 from "./Xiaolai-Regular-11c345711937f0ba4b8f7b6b919c8440.woff2";
import _33 from "./Xiaolai-Regular-e480d9c614742d05f0e78f274f1e69e6.woff2";
@@ -40,15 +47,17 @@ import _35 from "./Xiaolai-Regular-2cf96d082d35ea3d8106851223ad0d16.woff2";
import _36 from "./Xiaolai-Regular-2d43040e86ff03ba677f6f9c04cd0805.woff2";
import _37 from "./Xiaolai-Regular-2a26d20a23b00898ce82f09d2ee47c3f.woff2";
import _38 from "./Xiaolai-Regular-a365e82ed54697a52f27adcea1315fe8.woff2";
+import _41 from "./Xiaolai-Regular-e4bca6cfa53e499cae0a6be4894a90e9.woff2";
+import _105 from "./Xiaolai-Regular-e51ef413167c6e14e0c0fdcc585f2fc9.woff2";
+import _82 from "./Xiaolai-Regular-e5f453bb04da18eed01675eeebd88bf8.woff2";
+import _45 from "./Xiaolai-Regular-e656f091b9dc4709722c9f4b84d3c797.woff2";
+import _47 from "./Xiaolai-Regular-f0f13b5c60e0af5553bd359f5513be1b.woff2";
import _39 from "./Xiaolai-Regular-f5d079153c99a25b9be5b8583c4cc8a7.woff2";
import _40 from "./Xiaolai-Regular-10a7ae9a371830a80c3d844acf1c02d7.woff2";
-import _41 from "./Xiaolai-Regular-e4bca6cfa53e499cae0a6be4894a90e9.woff2";
import _42 from "./Xiaolai-Regular-60a41c7e1c68f22424e6d22df544bc82.woff2";
import _43 from "./Xiaolai-Regular-7ab2bed91166a9dca83a5ebfbe2a7f38.woff2";
import _44 from "./Xiaolai-Regular-670ba603758d94268e8606f240a42e12.woff2";
-import _45 from "./Xiaolai-Regular-e656f091b9dc4709722c9f4b84d3c797.woff2";
import _46 from "./Xiaolai-Regular-15dc6d811c9cd078f9086a740d5a1038.woff2";
-import _47 from "./Xiaolai-Regular-f0f13b5c60e0af5553bd359f5513be1b.woff2";
import _48 from "./Xiaolai-Regular-8c2f33cee3993174f7e87c28e4bf42ee.woff2";
import _49 from "./Xiaolai-Regular-761d05e3cd968cf574166867998ef06a.woff2";
import _50 from "./Xiaolai-Regular-642b26e2e5f5fb780b51b593dbc8c851.woff2";
@@ -72,7 +81,6 @@ import _67 from "./Xiaolai-Regular-0b5d723fdc4e249c140f0909e87d03b4.woff2";
import _68 from "./Xiaolai-Regular-cdbce89e82cc1ab53a2decbf5819278f.woff2";
import _69 from "./Xiaolai-Regular-739bc1a567439c7cffcd1614644593d2.woff2";
import _70 from "./Xiaolai-Regular-72252d73220fa3cd856677888cee1635.woff2";
-import _71 from "./Xiaolai-Regular-08e0dc436ad0ad61ba5558db0674d762.woff2";
import _72 from "./Xiaolai-Regular-cf6ff4e0f491ca0cf3038187a997b9b4.woff2";
import _73 from "./Xiaolai-Regular-9cfb2a77a4e45025105ad29a1748b90d.woff2";
import _74 from "./Xiaolai-Regular-450da755d5bcb70906e1295e559b9602.woff2";
@@ -81,9 +89,7 @@ import _76 from "./Xiaolai-Regular-1ee544f0f1dac422545c505baa788992.woff2";
import _77 from "./Xiaolai-Regular-4806e761d750087c2d734fc64596eaff.woff2";
import _78 from "./Xiaolai-Regular-33432927cd87d40cfe393c7482bf221f.woff2";
import _79 from "./Xiaolai-Regular-be549ab72f0719d606a5c01e2c0219b6.woff2";
-import _80 from "./Xiaolai-Regular-019d66dcad46dc156b162d267f981c20.woff2";
import _81 from "./Xiaolai-Regular-b5c1596551c256e0e9cf02028595b092.woff2";
-import _82 from "./Xiaolai-Regular-e5f453bb04da18eed01675eeebd88bf8.woff2";
import _83 from "./Xiaolai-Regular-cf2cc71752631e579e35b0e423bf2638.woff2";
import _84 from "./Xiaolai-Regular-6f3256af8454371776bc46670d33cc65.woff2";
import _85 from "./Xiaolai-Regular-23f228f3999c01983860012330e4be08.woff2";
@@ -106,7 +112,6 @@ import _101 from "./Xiaolai-Regular-4a0fdb40036e87b40aa08dd30584cb85.woff2";
import _102 from "./Xiaolai-Regular-0f626226ba1272e832aea87bafd9720e.woff2";
import _103 from "./Xiaolai-Regular-938d90c10ff8c20386af7f242c05d6b0.woff2";
import _104 from "./Xiaolai-Regular-b6d128682ee29e471486354d486a1b90.woff2";
-import _105 from "./Xiaolai-Regular-e51ef413167c6e14e0c0fdcc585f2fc9.woff2";
import _106 from "./Xiaolai-Regular-9d81066dd2b337c938df6e90380a00dc.woff2";
import _107 from "./Xiaolai-Regular-20e7bf72fa05de9adf7dbcc7bf51dde6.woff2";
import _108 from "./Xiaolai-Regular-4095eb84ef3874e2600247bee0b04026.woff2";
@@ -162,15 +167,14 @@ import _157 from "./Xiaolai-Regular-774d4f764a1299da5d28ec2f2ffe0d69.woff2";
import _158 from "./Xiaolai-Regular-7718fe60986d8b42b1be9c5ace5ccf25.woff2";
import _159 from "./Xiaolai-Regular-aa5c9ca6cf4fba00433b7aa3fa10671a.woff2";
import _160 from "./Xiaolai-Regular-4f50e5136e136527280bc902c5817561.woff2";
-import _161 from "./Xiaolai-Regular-093b9ef39a46ceae95a1df18a0a3a326.woff2";
import _162 from "./Xiaolai-Regular-a0ca5df4258213d7fc9fce80f65ce760.woff2";
import _163 from "./Xiaolai-Regular-d2666cbed13462c5dc36fa2f15c202ca.woff2";
import _164 from "./Xiaolai-Regular-1e6fd68f1f3902ce48ce8c69df385622.woff2";
import _165 from "./Xiaolai-Regular-87599f94b6cc129d505b375798d0d751.woff2";
-import _166 from "./Xiaolai-Regular-06c77b8c66e51ed6c63ccb502dd8b8af.woff2";
import _167 from "./Xiaolai-Regular-13ae07ed2e272d26d59bc0691cd7117a.woff2";
import _168 from "./Xiaolai-Regular-353f33792a8f60dc69323ddf635a269e.woff2";
import _169 from "./Xiaolai-Regular-0facdf1ea213ba40261022f5d5ed4493.woff2";
+import _202 from "./Xiaolai-Regular-f6032fc06eb20480f096199713f70885.woff2";
import _170 from "./Xiaolai-Regular-f8ee5d36068a42b51d0e4a1116cfcec1.woff2";
import _171 from "./Xiaolai-Regular-79d494361ae093b69e74ee9dbe65bfd4.woff2";
import _172 from "./Xiaolai-Regular-74e2263a91439c25b91d5132ce9f4d62.woff2";
@@ -184,7 +188,6 @@ import _179 from "./Xiaolai-Regular-8e9f97f01034820170065b2921b4fb5e.woff2";
import _180 from "./Xiaolai-Regular-13d2887ec8ee73c43acdabc52a05af7b.woff2";
import _181 from "./Xiaolai-Regular-72536a3d71b694a0d53dd90ddceae41e.woff2";
import _182 from "./Xiaolai-Regular-603aefd23e350ba7eb124273e3c9bcf1.woff2";
-import _183 from "./Xiaolai-Regular-095c169f3314805276f603a362766abd.woff2";
import _184 from "./Xiaolai-Regular-9544732d2e62d1a429674f8ee41b5d3a.woff2";
import _185 from "./Xiaolai-Regular-d3716376641d615e2995605b29bca7b6.woff2";
import _186 from "./Xiaolai-Regular-5a1ce3117cfe90c48e8fb4a9a00f694d.woff2";
@@ -203,7 +206,6 @@ import _198 from "./Xiaolai-Regular-24476a126f129212beb33f66853ea151.woff2";
import _199 from "./Xiaolai-Regular-1b611157cd46bb184d4fa4dae2d6a2b8.woff2";
import _200 from "./Xiaolai-Regular-56a32a7689abd0326e57c10c6c069bb4.woff2";
import _201 from "./Xiaolai-Regular-3cc70dbb64df5b21f1326cc24dee2195.woff2";
-import _202 from "./Xiaolai-Regular-f6032fc06eb20480f096199713f70885.woff2";
import _203 from "./Xiaolai-Regular-e2ead7ea7da0437f085f42ffc05f8d13.woff2";
import _204 from "./Xiaolai-Regular-97f7f48ce90c9429bf32ae51469db74d.woff2";
import _205 from "./Xiaolai-Regular-24a21c1e4449222e8d1898d69ff3a404.woff2";
@@ -211,8 +213,6 @@ import _206 from "./Xiaolai-Regular-726303e0774b4e678bff8c2deb6ca603.woff2";
import _207 from "./Xiaolai-Regular-5a7fac4b8b23a6e4e5ba0c9bf1756c91.woff2";
import _208 from "./Xiaolai-Regular-2b7441d46298788ac94e610ffcc709b6.woff2";
-import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
-
/* Generated By cn-font-split@5.2.2 https://www.npmjs.com/package/cn-font-split
CreateTime: Tue, 08 Oct 2024 18:34:44 GMT;
Origin File Name Table:
diff --git a/packages/excalidraw/fractionalIndex.ts b/packages/excalidraw/fractionalIndex.ts
index dfb8a4672..8a1459ddd 100644
--- a/packages/excalidraw/fractionalIndex.ts
+++ b/packages/excalidraw/fractionalIndex.ts
@@ -1,14 +1,16 @@
import { generateNKeysBetween } from "fractional-indexing";
+
import { mutateElement } from "./element/mutateElement";
+import { getBoundTextElement } from "./element/textElement";
+import { hasBoundTextElement } from "./element/typeChecks";
+import { InvalidFractionalIndexError } from "./errors";
+import { arrayToMap } from "./utils";
+
import type {
ExcalidrawElement,
FractionalIndex,
OrderedExcalidrawElement,
} from "./element/types";
-import { InvalidFractionalIndexError } from "./errors";
-import { hasBoundTextElement } from "./element/typeChecks";
-import { getBoundTextElement } from "./element/textElement";
-import { arrayToMap } from "./utils";
/**
* Envisioned relation between array order and fractional indices:
diff --git a/packages/excalidraw/frame.test.tsx b/packages/excalidraw/frame.test.tsx
index 6a5045b2c..fce420c02 100644
--- a/packages/excalidraw/frame.test.tsx
+++ b/packages/excalidraw/frame.test.tsx
@@ -1,9 +1,11 @@
-import type { ExcalidrawElement } from "./element/types";
-import { convertToExcalidrawElements, Excalidraw } from "./index";
import { API } from "./tests/helpers/api";
import { Keyboard, Pointer } from "./tests/helpers/ui";
import { getCloneByOrigId, render } from "./tests/test-utils";
+import { convertToExcalidrawElements, Excalidraw } from "./index";
+
+import type { ExcalidrawElement } from "./element/types";
+
const { h } = window;
const mouse = new Pointer("mouse");
diff --git a/packages/excalidraw/frame.ts b/packages/excalidraw/frame.ts
index 4659a34a0..758bc273e 100644
--- a/packages/excalidraw/frame.ts
+++ b/packages/excalidraw/frame.ts
@@ -1,8 +1,25 @@
+import { isPointWithinBounds, pointFrom } from "@excalidraw/math";
+import {
+ doLineSegmentsIntersect,
+ elementsOverlappingBBox,
+} from "@excalidraw/utils";
+
import {
getCommonBounds,
getElementAbsoluteCoords,
isTextElement,
} from "./element";
+import { getElementLineSegments } from "./element/bounds";
+import { mutateElement } from "./element/mutateElement";
+import {
+ getBoundTextElement,
+ getContainerElement,
+} from "./element/textElement";
+import { isFrameElement, isFrameLikeElement } from "./element/typeChecks";
+import { getElementsInGroup, selectGroupsFromGivenElements } from "./groups";
+import { getElementsWithinSelection, getSelectedElements } from "./scene";
+import { arrayToMap } from "./utils";
+
import type {
ElementsMap,
ElementsMapOrArray,
@@ -11,28 +28,13 @@ import type {
NonDeleted,
NonDeletedExcalidrawElement,
} from "./element/types";
-import {
- getBoundTextElement,
- getContainerElement,
-} from "./element/textElement";
-import { arrayToMap } from "./utils";
-import { mutateElement } from "./element/mutateElement";
+import type { ExcalidrawElementsIncludingDeleted } from "./scene/Scene";
import type {
AppClassProperties,
AppState,
StaticCanvasAppState,
} from "./types";
-import { getElementsWithinSelection, getSelectedElements } from "./scene";
-import { getElementsInGroup, selectGroupsFromGivenElements } from "./groups";
-import type { ExcalidrawElementsIncludingDeleted } from "./scene/Scene";
-import { getElementLineSegments } from "./element/bounds";
-import {
- doLineSegmentsIntersect,
- elementsOverlappingBBox,
-} from "@excalidraw/utils";
-import { isFrameElement, isFrameLikeElement } from "./element/typeChecks";
import type { ReadonlySetLike } from "./utility-types";
-import { isPointWithinBounds, pointFrom } from "@excalidraw/math";
// --------------------------- Frame State ------------------------------------
export const bindElementsToFramesAfterDuplication = (
diff --git a/packages/excalidraw/groups.ts b/packages/excalidraw/groups.ts
index 5a4e606f7..cedc4af0f 100644
--- a/packages/excalidraw/groups.ts
+++ b/packages/excalidraw/groups.ts
@@ -1,3 +1,7 @@
+import { getBoundTextElement } from "./element/textElement";
+import { getSelectedElements } from "./scene";
+import { makeNextSelectedElementIds } from "./scene/selection";
+
import type {
GroupId,
ExcalidrawElement,
@@ -11,9 +15,6 @@ import type {
AppState,
InteractiveCanvasAppState,
} from "./types";
-import { getSelectedElements } from "./scene";
-import { getBoundTextElement } from "./element/textElement";
-import { makeNextSelectedElementIds } from "./scene/selection";
import type { Mutable } from "./utility-types";
export const selectGroup = (
diff --git a/packages/excalidraw/history.ts b/packages/excalidraw/history.ts
index daed2a394..48ea012bd 100644
--- a/packages/excalidraw/history.ts
+++ b/packages/excalidraw/history.ts
@@ -1,6 +1,7 @@
+import { Emitter } from "./emitter";
+
import type { AppStateChange, ElementsChange } from "./change";
import type { SceneElementsMap } from "./element/types";
-import { Emitter } from "./emitter";
import type { Snapshot } from "./store";
import type { AppState } from "./types";
diff --git a/packages/excalidraw/hooks/useCreatePortalContainer.ts b/packages/excalidraw/hooks/useCreatePortalContainer.ts
index e8f5e3db6..b557d7e2f 100644
--- a/packages/excalidraw/hooks/useCreatePortalContainer.ts
+++ b/packages/excalidraw/hooks/useCreatePortalContainer.ts
@@ -1,4 +1,5 @@
import { useState, useLayoutEffect } from "react";
+
import { useDevice, useExcalidrawContainer } from "../components/App";
import { THEME } from "../constants";
import { useUIAppState } from "../context/ui-appState";
diff --git a/packages/excalidraw/hooks/useEmitter.ts b/packages/excalidraw/hooks/useEmitter.ts
index 27b94bc91..eebbaaf30 100644
--- a/packages/excalidraw/hooks/useEmitter.ts
+++ b/packages/excalidraw/hooks/useEmitter.ts
@@ -1,4 +1,5 @@
import { useEffect, useState } from "react";
+
import type { Emitter } from "../emitter";
export const useEmitter = (
diff --git a/packages/excalidraw/hooks/useLibraryItemSvg.ts b/packages/excalidraw/hooks/useLibraryItemSvg.ts
index 72b648d11..a79aab5c5 100644
--- a/packages/excalidraw/hooks/useLibraryItemSvg.ts
+++ b/packages/excalidraw/hooks/useLibraryItemSvg.ts
@@ -1,7 +1,9 @@
+import { exportToSvg } from "@excalidraw/utils/export";
import { useEffect, useState } from "react";
+
import { COLOR_PALETTE } from "../colors";
import { atom, useAtom } from "../editor-jotai";
-import { exportToSvg } from "@excalidraw/utils/export";
+
import type { LibraryItem } from "../types";
export type SvgCache = Map;
diff --git a/packages/excalidraw/hooks/useOutsideClick.ts b/packages/excalidraw/hooks/useOutsideClick.ts
index da9a54d08..7ec2113c2 100644
--- a/packages/excalidraw/hooks/useOutsideClick.ts
+++ b/packages/excalidraw/hooks/useOutsideClick.ts
@@ -1,4 +1,5 @@
import { useEffect } from "react";
+
import { EVENT } from "../constants";
export function useOutsideClick(
diff --git a/packages/excalidraw/hooks/useScrollPosition.ts b/packages/excalidraw/hooks/useScrollPosition.ts
index 0be2eab95..1fb1408b5 100644
--- a/packages/excalidraw/hooks/useScrollPosition.ts
+++ b/packages/excalidraw/hooks/useScrollPosition.ts
@@ -1,6 +1,7 @@
-import { useEffect } from "react";
-import { atom, useAtom } from "../editor-jotai";
import throttle from "lodash.throttle";
+import { useEffect } from "react";
+
+import { atom, useAtom } from "../editor-jotai";
const scrollPositionAtom = atom(0);
diff --git a/packages/excalidraw/i18n.ts b/packages/excalidraw/i18n.ts
index e1da5fc44..47bae5979 100644
--- a/packages/excalidraw/i18n.ts
+++ b/packages/excalidraw/i18n.ts
@@ -1,6 +1,7 @@
+import { useAtomValue, editorJotaiStore, atom } from "./editor-jotai";
import fallbackLangData from "./locales/en.json";
import percentages from "./locales/percentages.json";
-import { useAtomValue, editorJotaiStore, atom } from "./editor-jotai";
+
import type { NestedKeyOf } from "./utility-types";
const COMPLETION_THRESHOLD = 85;
diff --git a/packages/excalidraw/index-node.ts b/packages/excalidraw/index-node.ts
index e966b1d52..3b9499149 100644
--- a/packages/excalidraw/index-node.ts
+++ b/packages/excalidraw/index-node.ts
@@ -1,5 +1,7 @@
-import { exportToCanvas } from "./scene/export";
import { getDefaultAppState } from "./appState";
+import { exportToCanvas } from "./scene/export";
+
+const fs = require("fs");
const { registerFont, createCanvas } = require("canvas");
@@ -74,7 +76,6 @@ const canvas = exportToCanvas(
createCanvas,
);
-const fs = require("fs");
const out = fs.createWriteStream("test.png");
const stream = (canvas as any).createPNGStream();
stream.pipe(out);
diff --git a/packages/excalidraw/index.tsx b/packages/excalidraw/index.tsx
index b4b8574bd..f9f25b530 100644
--- a/packages/excalidraw/index.tsx
+++ b/packages/excalidraw/index.tsx
@@ -1,21 +1,22 @@
import React, { useEffect } from "react";
-import { InitializeApp } from "./components/InitializeApp";
+
import App from "./components/App";
-import { isShallowEqual } from "./utils";
+import { InitializeApp } from "./components/InitializeApp";
+import Footer from "./components/footer/FooterCenter";
+import LiveCollaborationTrigger from "./components/live-collaboration/LiveCollaborationTrigger";
+import MainMenu from "./components/main-menu/MainMenu";
+import WelcomeScreen from "./components/welcome-screen/WelcomeScreen";
+import { DEFAULT_UI_OPTIONS } from "./constants";
+import { defaultLang } from "./i18n";
+import { EditorJotaiProvider, editorJotaiStore } from "./editor-jotai";
import polyfill from "./polyfill";
+import { isShallowEqual } from "./utils";
import "./css/app.scss";
import "./css/styles.scss";
import "./fonts/fonts.css";
import type { AppProps, ExcalidrawProps } from "./types";
-import { defaultLang } from "./i18n";
-import { DEFAULT_UI_OPTIONS } from "./constants";
-import { EditorJotaiProvider, editorJotaiStore } from "./editor-jotai";
-import Footer from "./components/footer/FooterCenter";
-import MainMenu from "./components/main-menu/MainMenu";
-import WelcomeScreen from "./components/welcome-screen/WelcomeScreen";
-import LiveCollaborationTrigger from "./components/live-collaboration/LiveCollaborationTrigger";
polyfill();
diff --git a/packages/excalidraw/keys.ts b/packages/excalidraw/keys.ts
index 2088f89d6..948e7f568 100644
--- a/packages/excalidraw/keys.ts
+++ b/packages/excalidraw/keys.ts
@@ -1,4 +1,5 @@
import { isDarwin } from "./constants";
+
import type { ValueOf } from "./utility-types";
export const CODES = {
diff --git a/packages/excalidraw/laser-trails.ts b/packages/excalidraw/laser-trails.ts
index b7733baed..06e6b573a 100644
--- a/packages/excalidraw/laser-trails.ts
+++ b/packages/excalidraw/laser-trails.ts
@@ -1,12 +1,14 @@
import type { LaserPointerOptions } from "@excalidraw/laser-pointer";
-import type { Trail } from "./animated-trail";
+
import { AnimatedTrail } from "./animated-trail";
+import { getClientColor } from "./clients";
+import { DEFAULT_LASER_COLOR } from "./constants";
+import { easeOut } from "./utils";
+
+import type { Trail } from "./animated-trail";
import type { AnimationFrameHandler } from "./animation-frame-handler";
import type App from "./components/App";
import type { SocketId } from "./types";
-import { easeOut } from "./utils";
-import { getClientColor } from "./clients";
-import { DEFAULT_LASER_COLOR } from "./constants";
export class LaserTrails implements Trail {
public localTrail: AnimatedTrail;
diff --git a/packages/excalidraw/queue.ts b/packages/excalidraw/queue.ts
index 9cac2c5e9..b7369e5e0 100644
--- a/packages/excalidraw/queue.ts
+++ b/packages/excalidraw/queue.ts
@@ -1,6 +1,7 @@
+import { promiseTry, resolvablePromise } from "./utils";
+
import type { MaybePromise } from "./utility-types";
import type { ResolvablePromise } from "./utils";
-import { promiseTry, resolvablePromise } from "./utils";
type Job = (...args: TArgs) => MaybePromise;
diff --git a/packages/excalidraw/random.ts b/packages/excalidraw/random.ts
index 851bc28ec..4a4424a76 100644
--- a/packages/excalidraw/random.ts
+++ b/packages/excalidraw/random.ts
@@ -1,5 +1,6 @@
-import { Random } from "roughjs/bin/math";
import { nanoid } from "nanoid";
+import { Random } from "roughjs/bin/math";
+
import { isTestEnv } from "./utils";
let random = new Random(Date.now());
diff --git a/packages/excalidraw/reactUtils.ts b/packages/excalidraw/reactUtils.ts
index 535302d42..5bc466395 100644
--- a/packages/excalidraw/reactUtils.ts
+++ b/packages/excalidraw/reactUtils.ts
@@ -2,8 +2,9 @@
* @param func handler taking at most single parameter (event).
*/
-import { unstable_batchedUpdates } from "react-dom";
import { version as ReactVersion } from "react";
+import { unstable_batchedUpdates } from "react-dom";
+
import { throttleRAF } from "./utils";
export const withBatchedUpdates = <
diff --git a/packages/excalidraw/renderer/helpers.ts b/packages/excalidraw/renderer/helpers.ts
index 90f40099f..05097f95b 100644
--- a/packages/excalidraw/renderer/helpers.ts
+++ b/packages/excalidraw/renderer/helpers.ts
@@ -1,8 +1,7 @@
-import type { StaticCanvasAppState, AppState } from "../types";
+import { THEME, THEME_FILTER } from "../constants";
import type { StaticCanvasRenderConfig } from "../scene/types";
-
-import { THEME, THEME_FILTER } from "../constants";
+import type { StaticCanvasAppState, AppState } from "../types";
export const fillCircle = (
context: CanvasRenderingContext2D,
diff --git a/packages/excalidraw/renderer/interactiveScene.ts b/packages/excalidraw/renderer/interactiveScene.ts
index 9aa832770..257decd62 100644
--- a/packages/excalidraw/renderer/interactiveScene.ts
+++ b/packages/excalidraw/renderer/interactiveScene.ts
@@ -1,48 +1,23 @@
+import {
+ pointFrom,
+ type GlobalPoint,
+ type LocalPoint,
+ type Radians,
+} from "@excalidraw/math";
+import oc from "open-color";
+
+import { getClientColor, renderRemoteCursors } from "../clients";
+import {
+ DEFAULT_TRANSFORM_HANDLE_SPACING,
+ FRAME_STYLE,
+ THEME,
+} from "../constants";
import {
getElementAbsoluteCoords,
getTransformHandlesFromCoords,
getTransformHandles,
getCommonBounds,
} from "../element";
-
-import { roundRect } from "../renderer/roundRect";
-
-import {
- getScrollBars,
- SCROLLBAR_COLOR,
- SCROLLBAR_WIDTH,
-} from "../scene/scrollbars";
-
-import { renderSelectionElement } from "../renderer/renderElement";
-import { getClientColor, renderRemoteCursors } from "../clients";
-import {
- isSelectedViaGroup,
- getSelectedGroupIds,
- getElementsInGroup,
- selectGroupsFromGivenElements,
-} from "../groups";
-import type {
- TransformHandles,
- TransformHandleType,
-} from "../element/transformHandles";
-import {
- getOmitSidesForDevice,
- shouldShowBoundingBox,
-} from "../element/transformHandles";
-import { arrayToMap, invariant, throttleRAF } from "../utils";
-import {
- DEFAULT_TRANSFORM_HANDLE_SPACING,
- FRAME_STYLE,
- THEME,
-} from "../constants";
-import { type InteractiveCanvasAppState } from "../types";
-
-import { renderSnaps } from "../renderer/renderSnaps";
-
-import type {
- SuggestedBinding,
- SuggestedPointBinding,
-} from "../element/binding";
import {
BINDING_HIGHLIGHT_OFFSET,
BINDING_HIGHLIGHT_THICKNESS,
@@ -50,11 +25,9 @@ import {
} from "../element/binding";
import { LinearElementEditor } from "../element/linearElementEditor";
import {
- bootstrapCanvas,
- fillCircle,
- getNormalizedCanvasDimensions,
-} from "./helpers";
-import oc from "open-color";
+ getOmitSidesForDevice,
+ shouldShowBoundingBox,
+} from "../element/transformHandles";
import {
isElbowArrow,
isFrameLikeElement,
@@ -62,6 +35,38 @@ import {
isLinearElement,
isTextElement,
} from "../element/typeChecks";
+import {
+ isSelectedViaGroup,
+ getSelectedGroupIds,
+ getElementsInGroup,
+ selectGroupsFromGivenElements,
+} from "../groups";
+import { renderSelectionElement } from "../renderer/renderElement";
+import { renderSnaps } from "../renderer/renderSnaps";
+import { roundRect } from "../renderer/roundRect";
+import {
+ getScrollBars,
+ SCROLLBAR_COLOR,
+ SCROLLBAR_WIDTH,
+} from "../scene/scrollbars";
+import { getCornerRadius } from "../shapes";
+import { type InteractiveCanvasAppState } from "../types";
+import { arrayToMap, invariant, throttleRAF } from "../utils";
+
+import {
+ bootstrapCanvas,
+ fillCircle,
+ getNormalizedCanvasDimensions,
+} from "./helpers";
+
+import type {
+ SuggestedBinding,
+ SuggestedPointBinding,
+} from "../element/binding";
+import type {
+ TransformHandles,
+ TransformHandleType,
+} from "../element/transformHandles";
import type {
ElementsMap,
ExcalidrawBindableElement,
@@ -78,13 +83,6 @@ import type {
InteractiveSceneRenderConfig,
RenderableElementsMap,
} from "../scene/types";
-import {
- pointFrom,
- type GlobalPoint,
- type LocalPoint,
- type Radians,
-} from "@excalidraw/math";
-import { getCornerRadius } from "../shapes";
const renderElbowArrowMidPointHighlight = (
context: CanvasRenderingContext2D,
diff --git a/packages/excalidraw/renderer/renderElement.ts b/packages/excalidraw/renderer/renderElement.ts
index d93469c2d..9209c46d6 100644
--- a/packages/excalidraw/renderer/renderElement.ts
+++ b/packages/excalidraw/renderer/renderElement.ts
@@ -1,3 +1,43 @@
+import { isRightAngleRads } from "@excalidraw/math";
+import { getStroke } from "perfect-freehand";
+import rough from "roughjs/bin/rough";
+
+import { getDefaultAppState } from "../appState";
+import {
+ BOUND_TEXT_PADDING,
+ DEFAULT_REDUCED_GLOBAL_ALPHA,
+ ELEMENT_READY_TO_ERASE_OPACITY,
+ FRAME_STYLE,
+ MIME_TYPES,
+ THEME,
+} from "../constants";
+import { getElementAbsoluteCoords } from "../element/bounds";
+import { getUncroppedImageElement } from "../element/cropElement";
+import { LinearElementEditor } from "../element/linearElementEditor";
+import {
+ getBoundTextElement,
+ getContainerCoords,
+ getContainerElement,
+ getBoundTextMaxHeight,
+ getBoundTextMaxWidth,
+} from "../element/textElement";
+import { getLineHeightInPx } from "../element/textMeasurements";
+import {
+ isTextElement,
+ isLinearElement,
+ isFreeDrawElement,
+ isInitializedImageElement,
+ isArrowElement,
+ hasBoundTextElement,
+ isMagicFrameElement,
+ isImageElement,
+} from "../element/typeChecks";
+import { getVerticalOffset } from "../fonts";
+import { getContainingFrame } from "../frame";
+import { ShapeCache } from "../scene/ShapeCache";
+import { getCornerRadius } from "../shapes";
+import { distance, getFontString, isRTL } from "../utils";
+
import type {
ExcalidrawElement,
ExcalidrawTextElement,
@@ -9,26 +49,11 @@ import type {
NonDeletedSceneElementsMap,
ElementsMap,
} from "../element/types";
-import {
- isTextElement,
- isLinearElement,
- isFreeDrawElement,
- isInitializedImageElement,
- isArrowElement,
- hasBoundTextElement,
- isMagicFrameElement,
- isImageElement,
-} from "../element/typeChecks";
-import { getElementAbsoluteCoords } from "../element/bounds";
-import type { RoughCanvas } from "roughjs/bin/canvas";
-
import type {
StaticCanvasRenderConfig,
RenderableElementsMap,
InteractiveCanvasRenderConfig,
} from "../scene/types";
-import { distance, getFontString, isRTL } from "../utils";
-import rough from "roughjs/bin/rough";
import type {
AppState,
StaticCanvasAppState,
@@ -37,33 +62,8 @@ import type {
ElementsPendingErasure,
PendingExcalidrawElements,
} from "../types";
-import { getDefaultAppState } from "../appState";
-import {
- BOUND_TEXT_PADDING,
- DEFAULT_REDUCED_GLOBAL_ALPHA,
- ELEMENT_READY_TO_ERASE_OPACITY,
- FRAME_STYLE,
- MIME_TYPES,
- THEME,
-} from "../constants";
import type { StrokeOptions } from "perfect-freehand";
-import { getStroke } from "perfect-freehand";
-import {
- getBoundTextElement,
- getContainerCoords,
- getContainerElement,
- getBoundTextMaxHeight,
- getBoundTextMaxWidth,
-} from "../element/textElement";
-import { LinearElementEditor } from "../element/linearElementEditor";
-
-import { getContainingFrame } from "../frame";
-import { ShapeCache } from "../scene/ShapeCache";
-import { getVerticalOffset } from "../fonts";
-import { isRightAngleRads } from "@excalidraw/math";
-import { getCornerRadius } from "../shapes";
-import { getUncroppedImageElement } from "../element/cropElement";
-import { getLineHeightInPx } from "../element/textMeasurements";
+import type { RoughCanvas } from "roughjs/bin/canvas";
// using a stronger invert (100% vs our regular 93%) and saturate
// as a temp hack to make images in dark theme look closer to original
diff --git a/packages/excalidraw/renderer/renderNewElementScene.ts b/packages/excalidraw/renderer/renderNewElementScene.ts
index caa7f581c..f80408366 100644
--- a/packages/excalidraw/renderer/renderNewElementScene.ts
+++ b/packages/excalidraw/renderer/renderNewElementScene.ts
@@ -1,8 +1,10 @@
-import type { NewElementSceneRenderConfig } from "../scene/types";
import { throttleRAF } from "../utils";
+
import { bootstrapCanvas, getNormalizedCanvasDimensions } from "./helpers";
import { renderElement } from "./renderElement";
+import type { NewElementSceneRenderConfig } from "../scene/types";
+
const _renderNewElementScene = ({
canvas,
rc,
diff --git a/packages/excalidraw/renderer/renderSnaps.ts b/packages/excalidraw/renderer/renderSnaps.ts
index 878e8e523..8c26675ac 100644
--- a/packages/excalidraw/renderer/renderSnaps.ts
+++ b/packages/excalidraw/renderer/renderSnaps.ts
@@ -1,5 +1,7 @@
import { pointFrom, type GlobalPoint, type LocalPoint } from "@excalidraw/math";
+
import { THEME } from "../constants";
+
import type { PointSnapLine, PointerSnapLine } from "../snapping";
import type { InteractiveCanvasAppState } from "../types";
diff --git a/packages/excalidraw/renderer/staticScene.ts b/packages/excalidraw/renderer/staticScene.ts
index 21fca4590..62aeed5b9 100644
--- a/packages/excalidraw/renderer/staticScene.ts
+++ b/packages/excalidraw/renderer/staticScene.ts
@@ -1,19 +1,28 @@
+import {
+ EXTERNAL_LINK_IMG,
+ ELEMENT_LINK_IMG,
+ getLinkHandleFromCoords,
+} from "../components/hyperlink/helpers";
import { FRAME_STYLE } from "../constants";
import { getElementAbsoluteCoords } from "../element";
-
-import {
- elementOverlapsWithFrame,
- getTargetFrame,
- shouldApplyFrameClip,
-} from "../frame";
+import { isElementLink } from "../element/elementLink";
+import { createPlaceholderEmbeddableLabel } from "../element/embeddable";
+import { getBoundTextElement } from "../element/textElement";
import {
isEmbeddableElement,
isIframeLikeElement,
isTextElement,
} from "../element/typeChecks";
+import {
+ elementOverlapsWithFrame,
+ getTargetFrame,
+ shouldApplyFrameClip,
+} from "../frame";
import { renderElement } from "../renderer/renderElement";
-import { createPlaceholderEmbeddableLabel } from "../element/embeddable";
-import type { StaticCanvasAppState, Zoom } from "../types";
+import { throttleRAF } from "../utils";
+
+import { bootstrapCanvas, getNormalizedCanvasDimensions } from "./helpers";
+
import type {
ElementsMap,
ExcalidrawFrameLikeElement,
@@ -23,15 +32,7 @@ import type {
StaticCanvasRenderConfig,
StaticSceneRenderConfig,
} from "../scene/types";
-import {
- EXTERNAL_LINK_IMG,
- ELEMENT_LINK_IMG,
- getLinkHandleFromCoords,
-} from "../components/hyperlink/helpers";
-import { bootstrapCanvas, getNormalizedCanvasDimensions } from "./helpers";
-import { throttleRAF } from "../utils";
-import { getBoundTextElement } from "../element/textElement";
-import { isElementLink } from "../element/elementLink";
+import type { StaticCanvasAppState, Zoom } from "../types";
const GridLineColor = {
Bold: "#dddddd",
@@ -351,7 +352,14 @@ const _renderStaticScene = ({
renderLinkIcon(element, context, appState, elementsMap);
}
} catch (error: any) {
- console.error(error);
+ console.error(
+ error,
+ element.id,
+ element.x,
+ element.y,
+ element.width,
+ element.height,
+ );
}
});
diff --git a/packages/excalidraw/renderer/staticSvgScene.ts b/packages/excalidraw/renderer/staticSvgScene.ts
index b14faf7f4..23a6890df 100644
--- a/packages/excalidraw/renderer/staticSvgScene.ts
+++ b/packages/excalidraw/renderer/staticSvgScene.ts
@@ -1,5 +1,3 @@
-import type { Drawable } from "roughjs/bin/core";
-import type { RoughSVG } from "roughjs/bin/svg";
import {
FRAME_STYLE,
MAX_DECIMALS_FOR_SVG_EXPORT,
@@ -8,6 +6,7 @@ import {
} from "../constants";
import { normalizeLink, toValidURL } from "../data/url";
import { getElementAbsoluteCoords, hashString } from "../element";
+import { getUncroppedWidthAndHeight } from "../element/cropElement";
import {
createPlaceholderEmbeddableLabel,
getEmbedLink,
@@ -17,27 +16,30 @@ import {
getBoundTextElement,
getContainerElement,
} from "../element/textElement";
+import { getLineHeightInPx } from "../element/textMeasurements";
import {
isArrowElement,
isIframeLikeElement,
isInitializedImageElement,
isTextElement,
} from "../element/typeChecks";
+import { getVerticalOffset } from "../fonts";
+import { getContainingFrame } from "../frame";
+import { ShapeCache } from "../scene/ShapeCache";
+import { getCornerRadius, isPathALoop } from "../shapes";
+import { getFontFamilyString, isRTL, isTestEnv } from "../utils";
+
+import { getFreeDrawSvgPath, IMAGE_INVERT_FILTER } from "./renderElement";
+
import type {
ExcalidrawElement,
ExcalidrawTextElementWithContainer,
NonDeletedExcalidrawElement,
} from "../element/types";
-import { getContainingFrame } from "../frame";
-import { ShapeCache } from "../scene/ShapeCache";
import type { RenderableElementsMap, SVGRenderConfig } from "../scene/types";
import type { AppState, BinaryFiles } from "../types";
-import { getFontFamilyString, isRTL, isTestEnv } from "../utils";
-import { getFreeDrawSvgPath, IMAGE_INVERT_FILTER } from "./renderElement";
-import { getVerticalOffset } from "../fonts";
-import { getCornerRadius, isPathALoop } from "../shapes";
-import { getUncroppedWidthAndHeight } from "../element/cropElement";
-import { getLineHeightInPx } from "../element/textMeasurements";
+import type { Drawable } from "roughjs/bin/core";
+import type { RoughSVG } from "roughjs/bin/svg";
const roughSVGDrawWithPrecision = (
rsvg: RoughSVG,
diff --git a/packages/excalidraw/scene/Renderer.ts b/packages/excalidraw/scene/Renderer.ts
index 8048d20c1..19a6c0b10 100644
--- a/packages/excalidraw/scene/Renderer.ts
+++ b/packages/excalidraw/scene/Renderer.ts
@@ -1,17 +1,17 @@
import { isElementInViewport } from "../element/sizeHelpers";
import { isImageElement } from "../element/typeChecks";
+import { renderInteractiveSceneThrottled } from "../renderer/interactiveScene";
+import { renderStaticSceneThrottled } from "../renderer/staticScene";
+import { memoize, toBrandedType } from "../utils";
+
+import type Scene from "./Scene";
+import type { RenderableElementsMap } from "./types";
import type {
ExcalidrawElement,
NonDeletedElementsMap,
NonDeletedExcalidrawElement,
} from "../element/types";
-import { renderInteractiveSceneThrottled } from "../renderer/interactiveScene";
-import { renderStaticSceneThrottled } from "../renderer/staticScene";
-
import type { AppState } from "../types";
-import { memoize, toBrandedType } from "../utils";
-import type Scene from "./Scene";
-import type { RenderableElementsMap } from "./types";
export class Renderer {
private scene: Scene;
diff --git a/packages/excalidraw/scene/Scene.ts b/packages/excalidraw/scene/Scene.ts
index 99bb9e1e4..0eab8b80e 100644
--- a/packages/excalidraw/scene/Scene.ts
+++ b/packages/excalidraw/scene/Scene.ts
@@ -1,4 +1,21 @@
import throttle from "lodash.throttle";
+
+import { ENV } from "../constants";
+import { isNonDeletedElement } from "../element";
+import { isFrameLikeElement } from "../element/typeChecks";
+import {
+ syncInvalidIndices,
+ syncMovedIndices,
+ validateFractionalIndices,
+} from "../fractionalIndex";
+import { getElementsInGroup } from "../groups";
+import { randomInteger } from "../random";
+import { arrayToMap } from "../utils";
+import { toBrandedType } from "../utils";
+
+import { getSelectedElements } from "./selection";
+
+import type { LinearElementEditor } from "../element/linearElementEditor";
import type {
ExcalidrawElement,
NonDeletedExcalidrawElement,
@@ -10,22 +27,8 @@ import type {
OrderedExcalidrawElement,
Ordered,
} from "../element/types";
-import { isNonDeletedElement } from "../element";
-import type { LinearElementEditor } from "../element/linearElementEditor";
-import { isFrameLikeElement } from "../element/typeChecks";
-import { getSelectedElements } from "./selection";
import type { AppState } from "../types";
import type { Assert, SameType } from "../utility-types";
-import { randomInteger } from "../random";
-import {
- syncInvalidIndices,
- syncMovedIndices,
- validateFractionalIndices,
-} from "../fractionalIndex";
-import { arrayToMap } from "../utils";
-import { toBrandedType } from "../utils";
-import { ENV } from "../constants";
-import { getElementsInGroup } from "../groups";
type ElementIdKey = InstanceType["elementId"];
type ElementKey = ExcalidrawElement | ElementIdKey;
diff --git a/packages/excalidraw/scene/Shape.ts b/packages/excalidraw/scene/Shape.ts
index 0fef0b2b2..64d90b789 100644
--- a/packages/excalidraw/scene/Shape.ts
+++ b/packages/excalidraw/scene/Shape.ts
@@ -1,19 +1,9 @@
-import type { Point as RoughPoint } from "roughjs/bin/geometry";
-import type { Drawable, Options } from "roughjs/bin/core";
-import type { RoughGenerator } from "roughjs/bin/generator";
-import { getDiamondPoints, getArrowheadPoints } from "../element";
-import type { ElementShapes } from "./types";
-import type {
- ExcalidrawElement,
- NonDeletedExcalidrawElement,
- ExcalidrawSelectionElement,
- ExcalidrawLinearElement,
- Arrowhead,
-} from "../element/types";
-import { generateFreeDrawShape } from "../renderer/renderElement";
-import { isTransparent, assertNever } from "../utils";
+import { pointFrom, pointDistance, type LocalPoint } from "@excalidraw/math";
import { simplify } from "points-on-curve";
+
import { ROUGHNESS } from "../constants";
+import { getDiamondPoints, getArrowheadPoints } from "../element";
+import { headingForPointIsHorizontal } from "../element/heading";
import {
isElbowArrow,
isEmbeddableElement,
@@ -21,11 +11,24 @@ import {
isIframeLikeElement,
isLinearElement,
} from "../element/typeChecks";
-import { canChangeRoundness } from "./comparisons";
-import type { EmbedsValidationStatus } from "../types";
-import { pointFrom, pointDistance, type LocalPoint } from "@excalidraw/math";
+import { generateFreeDrawShape } from "../renderer/renderElement";
import { getCornerRadius, isPathALoop } from "../shapes";
-import { headingForPointIsHorizontal } from "../element/heading";
+import { isTransparent, assertNever } from "../utils";
+
+import { canChangeRoundness } from "./comparisons";
+
+import type {
+ ExcalidrawElement,
+ NonDeletedExcalidrawElement,
+ ExcalidrawSelectionElement,
+ ExcalidrawLinearElement,
+ Arrowhead,
+} from "../element/types";
+import type { EmbedsValidationStatus } from "../types";
+import type { ElementShapes } from "./types";
+import type { Drawable, Options } from "roughjs/bin/core";
+import type { RoughGenerator } from "roughjs/bin/generator";
+import type { Point as RoughPoint } from "roughjs/bin/geometry";
const getDashArrayDashed = (strokeWidth: number) => [8, 8 + strokeWidth];
@@ -430,12 +433,26 @@ export const _generateElementShape = (
: [pointFrom(0, 0)];
if (isElbowArrow(element)) {
- shape = [
- generator.path(
- generateElbowArrowShape(points, 16),
- generateRoughOptions(element, true),
- ),
- ];
+ // NOTE (mtolmacs): Temporary fix for extremely big arrow shapes
+ if (
+ !points.every(
+ (point) => Math.abs(point[0]) <= 1e6 && Math.abs(point[1]) <= 1e6,
+ )
+ ) {
+ console.error(
+ `Elbow arrow with extreme point positions detected. Arrow not rendered.`,
+ element.id,
+ JSON.stringify(points),
+ );
+ shape = [];
+ } else {
+ shape = [
+ generator.path(
+ generateElbowArrowShape(points, 16),
+ generateRoughOptions(element, true),
+ ),
+ ];
+ }
} else if (!element.roundness) {
// curve is always the first element
// this simplifies finding the curve for an element
diff --git a/packages/excalidraw/scene/ShapeCache.ts b/packages/excalidraw/scene/ShapeCache.ts
index 39d388a7b..c170b0a80 100644
--- a/packages/excalidraw/scene/ShapeCache.ts
+++ b/packages/excalidraw/scene/ShapeCache.ts
@@ -1,14 +1,17 @@
-import type { Drawable } from "roughjs/bin/core";
import { RoughGenerator } from "roughjs/bin/generator";
+
+import { COLOR_PALETTE } from "../colors";
+import { elementWithCanvasCache } from "../renderer/renderElement";
+
+import { _generateElementShape } from "./Shape";
+
import type {
ExcalidrawElement,
ExcalidrawSelectionElement,
} from "../element/types";
-import { elementWithCanvasCache } from "../renderer/renderElement";
-import { _generateElementShape } from "./Shape";
-import type { ElementShape, ElementShapes } from "./types";
-import { COLOR_PALETTE } from "../colors";
import type { AppState, EmbedsValidationStatus } from "../types";
+import type { ElementShape, ElementShapes } from "./types";
+import type { Drawable } from "roughjs/bin/core";
export class ShapeCache {
private static rg = new RoughGenerator();
diff --git a/packages/excalidraw/scene/export.ts b/packages/excalidraw/scene/export.ts
index 7b3325690..8ca35de2c 100644
--- a/packages/excalidraw/scene/export.ts
+++ b/packages/excalidraw/scene/export.ts
@@ -1,16 +1,6 @@
import rough from "roughjs/bin/rough";
-import type {
- ExcalidrawElement,
- ExcalidrawFrameLikeElement,
- ExcalidrawTextElement,
- NonDeletedExcalidrawElement,
- NonDeletedSceneElementsMap,
-} from "../element/types";
-import type { Bounds } from "../element/bounds";
-import { getCommonBounds, getElementAbsoluteCoords } from "../element/bounds";
-import { renderSceneToSvg } from "../renderer/staticSvgScene";
-import { arrayToMap, distance, getFontString, toBrandedType } from "../utils";
-import type { AppState, BinaryFiles } from "../types";
+
+import { getDefaultAppState } from "../appState";
import {
DEFAULT_EXPORT_PADDING,
FRAME_STYLE,
@@ -21,27 +11,39 @@ import {
MIME_TYPES,
EXPORT_DATA_TYPES,
} from "../constants";
-import { getDefaultAppState } from "../appState";
+import { base64ToString, decode, encode, stringToBase64 } from "../data/encode";
import { serializeAsJSON } from "../data/json";
+import { newTextElement } from "../element";
+import { getCommonBounds, getElementAbsoluteCoords } from "../element/bounds";
import {
getInitializedImageElements,
updateImageCache,
} from "../element/image";
+import { newElementWith } from "../element/mutateElement";
+import { isFrameLikeElement } from "../element/typeChecks";
+import { Fonts } from "../fonts";
+import { syncInvalidIndices } from "../fractionalIndex";
import {
getElementsOverlappingFrame,
getFrameLikeElements,
getFrameLikeTitle,
getRootElements,
} from "../frame";
-import { newTextElement } from "../element";
-import { type Mutable } from "../utility-types";
-import { newElementWith } from "../element/mutateElement";
-import { isFrameLikeElement } from "../element/typeChecks";
-import type { RenderableElementsMap } from "./types";
-import { syncInvalidIndices } from "../fractionalIndex";
import { renderStaticScene } from "../renderer/staticScene";
-import { Fonts } from "../fonts";
-import { base64ToString, decode, encode, stringToBase64 } from "../data/encode";
+import { renderSceneToSvg } from "../renderer/staticSvgScene";
+import { type Mutable } from "../utility-types";
+import { arrayToMap, distance, getFontString, toBrandedType } from "../utils";
+
+import type { RenderableElementsMap } from "./types";
+import type { Bounds } from "../element/bounds";
+import type {
+ ExcalidrawElement,
+ ExcalidrawFrameLikeElement,
+ ExcalidrawTextElement,
+ NonDeletedExcalidrawElement,
+ NonDeletedSceneElementsMap,
+} from "../element/types";
+import type { AppState, BinaryFiles } from "../types";
const truncateText = (element: ExcalidrawTextElement, maxWidth: number) => {
if (element.width <= maxWidth) {
diff --git a/packages/excalidraw/scene/normalize.ts b/packages/excalidraw/scene/normalize.ts
index 2a025fc27..0c73c5a8a 100644
--- a/packages/excalidraw/scene/normalize.ts
+++ b/packages/excalidraw/scene/normalize.ts
@@ -1,5 +1,7 @@
import { clamp, round } from "@excalidraw/math";
+
import { MAX_ZOOM, MIN_ZOOM } from "../constants";
+
import type { NormalizedZoomValue } from "../types";
export const getNormalizedZoom = (zoom: number): NormalizedZoomValue => {
diff --git a/packages/excalidraw/scene/scroll.ts b/packages/excalidraw/scene/scroll.ts
index 5d059e5b4..989564eb0 100644
--- a/packages/excalidraw/scene/scroll.ts
+++ b/packages/excalidraw/scene/scroll.ts
@@ -1,16 +1,16 @@
-import type { AppState, Offsets, PointerCoords, Zoom } from "../types";
-import type { ExcalidrawElement } from "../element/types";
import {
getCommonBounds,
getClosestElementBounds,
getVisibleElements,
} from "../element";
-
import {
sceneCoordsToViewportCoords,
viewportCoordsToSceneCoords,
} from "../utils";
+import type { ExcalidrawElement } from "../element/types";
+import type { AppState, Offsets, PointerCoords, Zoom } from "../types";
+
const isOutsideViewPort = (appState: AppState, cords: Array) => {
const [x1, y1, x2, y2] = cords;
const { x: viewportX1, y: viewportY1 } = sceneCoordsToViewportCoords(
diff --git a/packages/excalidraw/scene/scrollbars.ts b/packages/excalidraw/scene/scrollbars.ts
index 70f7033fb..b44d79f2b 100644
--- a/packages/excalidraw/scene/scrollbars.ts
+++ b/packages/excalidraw/scene/scrollbars.ts
@@ -1,9 +1,10 @@
import { getCommonBounds } from "../element";
+import { getLanguage } from "../i18n";
+import { getGlobalCSSVariable } from "../utils";
+
+import type { ExcalidrawElement } from "../element/types";
import type { InteractiveCanvasAppState } from "../types";
import type { ScrollBars } from "./types";
-import { getGlobalCSSVariable } from "../utils";
-import { getLanguage } from "../i18n";
-import type { ExcalidrawElement } from "../element/types";
export const SCROLLBAR_MARGIN = 4;
export const SCROLLBAR_WIDTH = 6;
diff --git a/packages/excalidraw/scene/selection.ts b/packages/excalidraw/scene/selection.ts
index 3ca91cd50..02f8f05e7 100644
--- a/packages/excalidraw/scene/selection.ts
+++ b/packages/excalidraw/scene/selection.ts
@@ -1,11 +1,5 @@
-import type {
- ElementsMap,
- ElementsMapOrArray,
- ExcalidrawElement,
- NonDeletedExcalidrawElement,
-} from "../element/types";
import { getElementAbsoluteCoords, getElementBounds } from "../element";
-import type { AppState, InteractiveCanvasAppState } from "../types";
+import { isElementInViewport } from "../element/sizeHelpers";
import { isBoundToContainer, isFrameLikeElement } from "../element/typeChecks";
import {
elementOverlapsWithFrame,
@@ -13,7 +7,14 @@ import {
getFrameChildren,
} from "../frame";
import { isShallowEqual } from "../utils";
-import { isElementInViewport } from "../element/sizeHelpers";
+
+import type {
+ ElementsMap,
+ ElementsMapOrArray,
+ ExcalidrawElement,
+ NonDeletedExcalidrawElement,
+} from "../element/types";
+import type { AppState, InteractiveCanvasAppState } from "../types";
/**
* Frames and their containing elements are not to be selected at the same time.
diff --git a/packages/excalidraw/scene/types.ts b/packages/excalidraw/scene/types.ts
index c0bfd1bba..3c198d153 100644
--- a/packages/excalidraw/scene/types.ts
+++ b/packages/excalidraw/scene/types.ts
@@ -1,5 +1,4 @@
-import type { RoughCanvas } from "roughjs/bin/canvas";
-import type { Drawable } from "roughjs/bin/core";
+import type { UserIdleState } from "../constants";
import type {
ExcalidrawElement,
NonDeletedElementsMap,
@@ -18,7 +17,8 @@ import type {
PendingExcalidrawElements,
} from "../types";
import type { MakeBrand } from "../utility-types";
-import type { UserIdleState } from "../constants";
+import type { RoughCanvas } from "roughjs/bin/canvas";
+import type { Drawable } from "roughjs/bin/core";
export type RenderableElementsMap = NonDeletedElementsMap &
MakeBrand<"RenderableElementsMap">;
diff --git a/packages/excalidraw/shapes.tsx b/packages/excalidraw/shapes.tsx
index cfd639f2d..b2c391a42 100644
--- a/packages/excalidraw/shapes.tsx
+++ b/packages/excalidraw/shapes.tsx
@@ -17,6 +17,7 @@ import {
getPolygonShape,
type GeometricShape,
} from "@excalidraw/utils/geometry/shape";
+
import {
ArrowIcon,
DiamondIcon,
@@ -36,20 +37,21 @@ import {
ROUNDNESS,
} from "./constants";
import { getElementAbsoluteCoords } from "./element";
-import type { Bounds } from "./element/bounds";
import { shouldTestInside } from "./element/collision";
import { LinearElementEditor } from "./element/linearElementEditor";
import { getBoundTextElement } from "./element/textElement";
+import { KEYS } from "./keys";
+import { ShapeCache } from "./scene/ShapeCache";
+import { invariant } from "./utils";
+
+import type { Bounds } from "./element/bounds";
import type {
ElementsMap,
ExcalidrawElement,
ExcalidrawLinearElement,
NonDeleted,
} from "./element/types";
-import { KEYS } from "./keys";
-import { ShapeCache } from "./scene/ShapeCache";
import type { NormalizedZoomValue, Zoom } from "./types";
-import { invariant } from "./utils";
export const SHAPES = [
{
diff --git a/packages/excalidraw/snapping.ts b/packages/excalidraw/snapping.ts
index 1b661516e..7c85f4112 100644
--- a/packages/excalidraw/snapping.ts
+++ b/packages/excalidraw/snapping.ts
@@ -1,4 +1,3 @@
-import type { InclusiveRange } from "@excalidraw/math";
import {
pointFrom,
pointRotateRads,
@@ -7,26 +6,30 @@ import {
rangesOverlap,
type GlobalPoint,
} from "@excalidraw/math";
+
+import type { InclusiveRange } from "@excalidraw/math";
+
import { TOOL_TYPE } from "./constants";
-import type { Bounds } from "./element/bounds";
import {
getCommonBounds,
getDraggedElementsBounds,
getElementAbsoluteCoords,
} from "./element/bounds";
-import type { MaybeTransformHandleType } from "./element/transformHandles";
import { isBoundToContainer, isFrameLikeElement } from "./element/typeChecks";
-import type {
- ElementsMap,
- ExcalidrawElement,
- NonDeletedExcalidrawElement,
-} from "./element/types";
import { getMaximumGroups } from "./groups";
import { KEYS } from "./keys";
import {
getSelectedElements,
getVisibleAndNonSelectedElements,
} from "./scene/selection";
+
+import type { Bounds } from "./element/bounds";
+import type { MaybeTransformHandleType } from "./element/transformHandles";
+import type {
+ ElementsMap,
+ ExcalidrawElement,
+ NonDeletedExcalidrawElement,
+} from "./element/types";
import type {
AppClassProperties,
AppState,
diff --git a/packages/excalidraw/store.ts b/packages/excalidraw/store.ts
index 1343347c4..8b0065884 100644
--- a/packages/excalidraw/store.ts
+++ b/packages/excalidraw/store.ts
@@ -3,11 +3,12 @@ import { AppStateChange, ElementsChange } from "./change";
import { ENV } from "./constants";
import { newElementWith } from "./element/mutateElement";
import { deepCopyElement } from "./element/newElement";
-import type { OrderedExcalidrawElement } from "./element/types";
import { Emitter } from "./emitter";
+import { isShallowEqual } from "./utils";
+
+import type { OrderedExcalidrawElement } from "./element/types";
import type { AppState, ObservedAppState } from "./types";
import type { ValueOf } from "./utility-types";
-import { isShallowEqual } from "./utils";
// hidden non-enumerable property for runtime checks
const hiddenObservedAppStateProp = "__observedAppState";
diff --git a/packages/excalidraw/subset/harfbuzz/harfbuzz-loader.ts b/packages/excalidraw/subset/harfbuzz/harfbuzz-loader.ts
index 9a48d19c4..120dedb7f 100644
--- a/packages/excalidraw/subset/harfbuzz/harfbuzz-loader.ts
+++ b/packages/excalidraw/subset/harfbuzz/harfbuzz-loader.ts
@@ -7,8 +7,8 @@
* In the future consider separating common utils into a separate shared chunk.
*/
-import binary from "./harfbuzz-wasm";
import bindings from "./harfbuzz-bindings";
+import binary from "./harfbuzz-wasm";
/**
* Lazy loads wasm and respective bindings for font subsetting based on the harfbuzzjs.
diff --git a/packages/excalidraw/subset/subset-main.ts b/packages/excalidraw/subset/subset-main.ts
index afccf0d20..5f39af99c 100644
--- a/packages/excalidraw/subset/subset-main.ts
+++ b/packages/excalidraw/subset/subset-main.ts
@@ -1,6 +1,6 @@
-import { WorkerPool } from "../workers";
-import { isServerEnv, promiseTry } from "../utils";
import { WorkerInTheMainChunkError, WorkerUrlNotDefinedError } from "../errors";
+import { isServerEnv, promiseTry } from "../utils";
+import { WorkerPool } from "../workers";
import type { Commands } from "./subset-shared.chunk";
diff --git a/packages/excalidraw/subset/subset-shared.chunk.ts b/packages/excalidraw/subset/subset-shared.chunk.ts
index b64a3825e..4e4b88424 100644
--- a/packages/excalidraw/subset/subset-shared.chunk.ts
+++ b/packages/excalidraw/subset/subset-shared.chunk.ts
@@ -7,8 +7,8 @@
* In the future consider separating common utils into a separate shared chunk.
*/
-import loadWoff2 from "./woff2/woff2-loader";
import loadHbSubset from "./harfbuzz/harfbuzz-loader";
+import loadWoff2 from "./woff2/woff2-loader";
/**
* Shared commands between the main thread and worker threads.
diff --git a/packages/excalidraw/subset/woff2/woff2-loader.ts b/packages/excalidraw/subset/woff2/woff2-loader.ts
index 446dc9f8b..7d5de3095 100644
--- a/packages/excalidraw/subset/woff2/woff2-loader.ts
+++ b/packages/excalidraw/subset/woff2/woff2-loader.ts
@@ -7,8 +7,8 @@
* In the future consider separating common utils into a separate shared chunk.
*/
-import binary from "./woff2-wasm";
import bindings from "./woff2-bindings";
+import binary from "./woff2-wasm";
/**
* Lazy loads wasm and respective bindings for woff2 compression and decompression.
diff --git a/packages/excalidraw/tests/App.test.tsx b/packages/excalidraw/tests/App.test.tsx
index ad62706a5..8b86477f9 100644
--- a/packages/excalidraw/tests/App.test.tsx
+++ b/packages/excalidraw/tests/App.test.tsx
@@ -1,10 +1,10 @@
import React from "react";
-import * as StaticScene from "../renderer/staticScene";
-import { reseed } from "../random";
-import { render, queryByTestId, unmountComponent } from "../tests/test-utils";
+import { vi } from "vitest";
import { Excalidraw } from "../index";
-import { vi } from "vitest";
+import { reseed } from "../random";
+import * as StaticScene from "../renderer/staticScene";
+import { render, queryByTestId, unmountComponent } from "../tests/test-utils";
const renderStaticScene = vi.spyOn(StaticScene, "renderStaticScene");
diff --git a/packages/excalidraw/tests/MermaidToExcalidraw.test.tsx b/packages/excalidraw/tests/MermaidToExcalidraw.test.tsx
index 05727a0f4..cedb70487 100644
--- a/packages/excalidraw/tests/MermaidToExcalidraw.test.tsx
+++ b/packages/excalidraw/tests/MermaidToExcalidraw.test.tsx
@@ -1,9 +1,11 @@
import React from "react";
-import { render, waitFor } from "./test-utils";
-import { Excalidraw } from "../index";
import { expect } from "vitest";
-import { getTextEditor, updateTextEditor } from "./queries/dom";
+
+import { Excalidraw } from "../index";
+
import { mockMermaidToExcalidraw } from "./helpers/mocks";
+import { getTextEditor, updateTextEditor } from "./queries/dom";
+import { render, waitFor } from "./test-utils";
mockMermaidToExcalidraw({
mockRef: true,
diff --git a/packages/excalidraw/tests/actionStyles.test.tsx b/packages/excalidraw/tests/actionStyles.test.tsx
index abe4a7c00..2e60000ad 100644
--- a/packages/excalidraw/tests/actionStyles.test.tsx
+++ b/packages/excalidraw/tests/actionStyles.test.tsx
@@ -1,4 +1,6 @@
import React from "react";
+
+import { copiedStyles } from "../actions/actionStyles";
import { Excalidraw } from "../index";
import { CODES } from "../keys";
import { API } from "../tests/helpers/api";
@@ -10,7 +12,6 @@ import {
screen,
togglePopover,
} from "../tests/test-utils";
-import { copiedStyles } from "../actions/actionStyles";
const { h } = window;
diff --git a/packages/excalidraw/tests/align.test.tsx b/packages/excalidraw/tests/align.test.tsx
index 47624e8f4..d29e497ec 100644
--- a/packages/excalidraw/tests/align.test.tsx
+++ b/packages/excalidraw/tests/align.test.tsx
@@ -1,10 +1,5 @@
import React from "react";
-import { act, unmountComponent, render } from "./test-utils";
-import { Excalidraw } from "../index";
-import { defaultLang, setLanguage } from "../i18n";
-import { UI, Pointer, Keyboard } from "./helpers/ui";
-import { API } from "./helpers/api";
-import { KEYS } from "../keys";
+
import {
actionAlignVerticallyCentered,
actionAlignHorizontallyCentered,
@@ -14,6 +9,13 @@ import {
actionAlignLeft,
actionAlignRight,
} from "../actions";
+import { defaultLang, setLanguage } from "../i18n";
+import { Excalidraw } from "../index";
+import { KEYS } from "../keys";
+
+import { API } from "./helpers/api";
+import { UI, Pointer, Keyboard } from "./helpers/ui";
+import { act, unmountComponent, render } from "./test-utils";
const mouse = new Pointer("mouse");
diff --git a/packages/excalidraw/tests/appState.test.tsx b/packages/excalidraw/tests/appState.test.tsx
index 4a937cd56..e97c5f3be 100644
--- a/packages/excalidraw/tests/appState.test.tsx
+++ b/packages/excalidraw/tests/appState.test.tsx
@@ -1,10 +1,13 @@
import React from "react";
-import { fireEvent, queryByTestId, render, waitFor } from "./test-utils";
-import { Excalidraw } from "../index";
-import { API } from "./helpers/api";
+
import { getDefaultAppState } from "../appState";
import { EXPORT_DATA_TYPES, MIME_TYPES } from "../constants";
+import { Excalidraw } from "../index";
+
+import { API } from "./helpers/api";
import { Pointer, UI } from "./helpers/ui";
+import { fireEvent, queryByTestId, render, waitFor } from "./test-utils";
+
import type { ExcalidrawTextElement } from "../element/types";
const { h } = window;
diff --git a/packages/excalidraw/tests/binding.test.tsx b/packages/excalidraw/tests/binding.test.tsx
index 905a44e70..1c50062c1 100644
--- a/packages/excalidraw/tests/binding.test.tsx
+++ b/packages/excalidraw/tests/binding.test.tsx
@@ -1,13 +1,15 @@
-import React from "react";
-import { fireEvent, render } from "./test-utils";
-import { Excalidraw, isLinearElement } from "../index";
-import { UI, Pointer, Keyboard } from "./helpers/ui";
-import { getTransformHandles } from "../element/transformHandles";
-import { API } from "./helpers/api";
-import { KEYS } from "../keys";
-import { actionWrapTextInContainer } from "../actions/actionBoundText";
-import { arrayToMap } from "../utils";
import { pointFrom } from "@excalidraw/math";
+import React from "react";
+
+import { actionWrapTextInContainer } from "../actions/actionBoundText";
+import { getTransformHandles } from "../element/transformHandles";
+import { Excalidraw, isLinearElement } from "../index";
+import { KEYS } from "../keys";
+import { arrayToMap } from "../utils";
+
+import { API } from "./helpers/api";
+import { UI, Pointer, Keyboard } from "./helpers/ui";
+import { fireEvent, render } from "./test-utils";
const { h } = window;
diff --git a/packages/excalidraw/tests/clipboard.test.tsx b/packages/excalidraw/tests/clipboard.test.tsx
index c2c0a5e2d..c7e17f49d 100644
--- a/packages/excalidraw/tests/clipboard.test.tsx
+++ b/packages/excalidraw/tests/clipboard.test.tsx
@@ -1,22 +1,25 @@
import React from "react";
import { vi } from "vitest";
+
+import { createPasteEvent, serializeAsClipboardJSON } from "../clipboard";
+import { getElementBounds } from "../element";
+import { getLineHeightInPx } from "../element/textMeasurements";
+import { getLineHeight } from "../fonts";
+import { Excalidraw } from "../index";
+import { KEYS } from "../keys";
+import { arrayToMap } from "../utils";
+
+import { API } from "./helpers/api";
+import { mockMermaidToExcalidraw } from "./helpers/mocks";
+import { Pointer, Keyboard } from "./helpers/ui";
import {
render,
waitFor,
GlobalTestState,
unmountComponent,
} from "./test-utils";
-import { Pointer, Keyboard } from "./helpers/ui";
-import { Excalidraw } from "../index";
-import { KEYS } from "../keys";
-import { getLineHeightInPx } from "../element/textMeasurements";
-import { getElementBounds } from "../element";
+
import type { NormalizedZoomValue } from "../types";
-import { API } from "./helpers/api";
-import { createPasteEvent, serializeAsClipboardJSON } from "../clipboard";
-import { arrayToMap } from "../utils";
-import { mockMermaidToExcalidraw } from "./helpers/mocks";
-import { getLineHeight } from "../fonts";
const { h } = window;
diff --git a/packages/excalidraw/tests/contextmenu.test.tsx b/packages/excalidraw/tests/contextmenu.test.tsx
index bb3f415f1..7de349516 100644
--- a/packages/excalidraw/tests/contextmenu.test.tsx
+++ b/packages/excalidraw/tests/contextmenu.test.tsx
@@ -1,4 +1,15 @@
import React from "react";
+import { vi } from "vitest";
+
+import { copiedStyles } from "../actions/actionStyles";
+import { Excalidraw } from "../index";
+import { KEYS } from "../keys";
+import { reseed } from "../random";
+import * as StaticScene from "../renderer/staticScene";
+import { setDateTimeForTests } from "../utils";
+
+import { API } from "./helpers/api";
+import { UI, Pointer, Keyboard } from "./helpers/ui";
import {
render,
fireEvent,
@@ -12,16 +23,8 @@ import {
togglePopover,
unmountComponent,
} from "./test-utils";
-import { Excalidraw } from "../index";
-import * as StaticScene from "../renderer/staticScene";
-import { reseed } from "../random";
-import { UI, Pointer, Keyboard } from "./helpers/ui";
-import { KEYS } from "../keys";
+
import type { ShortcutName } from "../actions/shortcuts";
-import { copiedStyles } from "../actions/actionStyles";
-import { API } from "./helpers/api";
-import { setDateTimeForTests } from "../utils";
-import { vi } from "vitest";
import type { ActionName } from "../actions/types";
const checkpoint = (name: string) => {
diff --git a/packages/excalidraw/tests/cropElement.test.tsx b/packages/excalidraw/tests/cropElement.test.tsx
index a508f5d64..ddc93e3fe 100644
--- a/packages/excalidraw/tests/cropElement.test.tsx
+++ b/packages/excalidraw/tests/cropElement.test.tsx
@@ -1,15 +1,18 @@
import React from "react";
import { vi } from "vitest";
-import { Keyboard, Pointer, UI } from "./helpers/ui";
-import type { ExcalidrawImageElement, ImageCrop } from "../element/types";
-import { act, GlobalTestState, render, unmountComponent } from "./test-utils";
+
import { Excalidraw, exportToCanvas, exportToSvg } from "..";
-import { API } from "./helpers/api";
-import type { NormalizedZoomValue } from "../types";
-import { KEYS } from "../keys";
-import { duplicateElement } from "../element";
-import { cloneJSON } from "../utils";
import { actionFlipHorizontal, actionFlipVertical } from "../actions";
+import { duplicateElement } from "../element";
+import { KEYS } from "../keys";
+import { cloneJSON } from "../utils";
+
+import { API } from "./helpers/api";
+import { Keyboard, Pointer, UI } from "./helpers/ui";
+import { act, GlobalTestState, render, unmountComponent } from "./test-utils";
+
+import type { ExcalidrawImageElement, ImageCrop } from "../element/types";
+import type { NormalizedZoomValue } from "../types";
const { h } = window;
const mouse = new Pointer("mouse");
diff --git a/packages/excalidraw/tests/data/reconcile.test.ts b/packages/excalidraw/tests/data/reconcile.test.ts
index f0e8105a1..35a33956a 100644
--- a/packages/excalidraw/tests/data/reconcile.test.ts
+++ b/packages/excalidraw/tests/data/reconcile.test.ts
@@ -1,13 +1,14 @@
-import type { RemoteExcalidrawElement } from "../../data/reconcile";
import { reconcileElements } from "../../data/reconcile";
+import { syncInvalidIndices } from "../../fractionalIndex";
+import { randomInteger } from "../../random";
+import { cloneJSON } from "../../utils";
+
+import type { RemoteExcalidrawElement } from "../../data/reconcile";
import type {
ExcalidrawElement,
OrderedExcalidrawElement,
} from "../../element/types";
-import { syncInvalidIndices } from "../../fractionalIndex";
-import { randomInteger } from "../../random";
import type { AppState } from "../../types";
-import { cloneJSON } from "../../utils";
type Id = string;
type ElementLike = {
diff --git a/packages/excalidraw/tests/data/restore.test.ts b/packages/excalidraw/tests/data/restore.test.ts
index 37a27ac6a..529284358 100644
--- a/packages/excalidraw/tests/data/restore.test.ts
+++ b/packages/excalidraw/tests/data/restore.test.ts
@@ -1,19 +1,21 @@
+import { pointFrom } from "@excalidraw/math";
+import { vi } from "vitest";
+
+import { getDefaultAppState } from "../../appState";
+import { DEFAULT_SIDEBAR, FONT_FAMILY, ROUNDNESS } from "../../constants";
import * as restore from "../../data/restore";
+import { newElementWith } from "../../element/mutateElement";
+import * as sizeHelpers from "../../element/sizeHelpers";
+import { API } from "../helpers/api";
+
+import type { ImportedDataState } from "../../data/types";
import type {
ExcalidrawElement,
ExcalidrawFreeDrawElement,
ExcalidrawLinearElement,
ExcalidrawTextElement,
} from "../../element/types";
-import * as sizeHelpers from "../../element/sizeHelpers";
-import { API } from "../helpers/api";
-import { getDefaultAppState } from "../../appState";
-import type { ImportedDataState } from "../../data/types";
import type { NormalizedZoomValue } from "../../types";
-import { DEFAULT_SIDEBAR, FONT_FAMILY, ROUNDNESS } from "../../constants";
-import { newElementWith } from "../../element/mutateElement";
-import { vi } from "vitest";
-import { pointFrom } from "@excalidraw/math";
describe("restoreElements", () => {
const mockSizeHelper = vi.spyOn(sizeHelpers, "isInvisiblySmallElement");
diff --git a/packages/excalidraw/tests/dragCreate.test.tsx b/packages/excalidraw/tests/dragCreate.test.tsx
index 743ba7947..ecdfbcb64 100644
--- a/packages/excalidraw/tests/dragCreate.test.tsx
+++ b/packages/excalidraw/tests/dragCreate.test.tsx
@@ -1,8 +1,12 @@
import React from "react";
+import { vi } from "vitest";
+
import { Excalidraw } from "../index";
-import * as StaticScene from "../renderer/staticScene";
-import * as InteractiveScene from "../renderer/interactiveScene";
import { KEYS } from "../keys";
+import { reseed } from "../random";
+import * as InteractiveScene from "../renderer/interactiveScene";
+import * as StaticScene from "../renderer/staticScene";
+
import {
render,
fireEvent,
@@ -10,9 +14,8 @@ import {
restoreOriginalGetBoundingClientRect,
unmountComponent,
} from "./test-utils";
+
import type { ExcalidrawLinearElement } from "../element/types";
-import { reseed } from "../random";
-import { vi } from "vitest";
unmountComponent();
diff --git a/packages/excalidraw/tests/elementLocking.test.tsx b/packages/excalidraw/tests/elementLocking.test.tsx
index 281c26892..a1ca14683 100644
--- a/packages/excalidraw/tests/elementLocking.test.tsx
+++ b/packages/excalidraw/tests/elementLocking.test.tsx
@@ -1,12 +1,13 @@
import React from "react";
+
+import { actionSelectAll } from "../actions";
+import { mutateElement } from "../element/mutateElement";
+import { t } from "../i18n";
import { Excalidraw } from "../index";
-import { render, unmountComponent } from "../tests/test-utils";
-import { Keyboard, Pointer, UI } from "../tests/helpers/ui";
import { KEYS } from "../keys";
import { API } from "../tests/helpers/api";
-import { actionSelectAll } from "../actions";
-import { t } from "../i18n";
-import { mutateElement } from "../element/mutateElement";
+import { Keyboard, Pointer, UI } from "../tests/helpers/ui";
+import { render, unmountComponent } from "../tests/test-utils";
unmountComponent();
diff --git a/packages/excalidraw/tests/excalidraw.test.tsx b/packages/excalidraw/tests/excalidraw.test.tsx
index 6fbcf2adc..0e33f8167 100644
--- a/packages/excalidraw/tests/excalidraw.test.tsx
+++ b/packages/excalidraw/tests/excalidraw.test.tsx
@@ -1,10 +1,12 @@
-import React from "react";
-import { fireEvent, GlobalTestState, toggleMenu, render } from "./test-utils";
-import { Excalidraw, Footer, MainMenu } from "../index";
import { queryByText, queryByTestId } from "@testing-library/react";
+import React from "react";
+import { useMemo } from "react";
+
import { THEME } from "../constants";
import { t } from "../i18n";
-import { useMemo } from "react";
+import { Excalidraw, Footer, MainMenu } from "../index";
+
+import { fireEvent, GlobalTestState, toggleMenu, render } from "./test-utils";
const { h } = window;
diff --git a/packages/excalidraw/tests/export.test.tsx b/packages/excalidraw/tests/export.test.tsx
index 3547b2978..c10336271 100644
--- a/packages/excalidraw/tests/export.test.tsx
+++ b/packages/excalidraw/tests/export.test.tsx
@@ -1,18 +1,21 @@
import React from "react";
-import { render, waitFor } from "./test-utils";
-import { Excalidraw } from "../index";
-import { API } from "./helpers/api";
+
+import { getDefaultAppState } from "../appState";
+import { SVG_NS } from "../constants";
+import { getDataURL } from "../data/blob";
import { encodePngMetadata } from "../data/image";
import { serializeAsJSON } from "../data/json";
+import { Excalidraw } from "../index";
import {
decodeSvgBase64Payload,
encodeSvgBase64Payload,
exportToSvg,
} from "../scene/export";
+
+import { API } from "./helpers/api";
+import { render, waitFor } from "./test-utils";
+
import type { FileId } from "../element/types";
-import { getDataURL } from "../data/blob";
-import { getDefaultAppState } from "../appState";
-import { SVG_NS } from "../constants";
const { h } = window;
diff --git a/packages/excalidraw/tests/fitToContent.test.tsx b/packages/excalidraw/tests/fitToContent.test.tsx
index a4f03910b..bfd16c4e1 100644
--- a/packages/excalidraw/tests/fitToContent.test.tsx
+++ b/packages/excalidraw/tests/fitToContent.test.tsx
@@ -1,9 +1,10 @@
import React from "react";
-import { act, render } from "./test-utils";
-import { API } from "./helpers/api";
+import { vi } from "vitest";
import { Excalidraw } from "../index";
-import { vi } from "vitest";
+
+import { API } from "./helpers/api";
+import { act, render } from "./test-utils";
const { h } = window;
diff --git a/packages/excalidraw/tests/fixtures/diagramFixture.ts b/packages/excalidraw/tests/fixtures/diagramFixture.ts
index 72b909af8..a4fdc1560 100644
--- a/packages/excalidraw/tests/fixtures/diagramFixture.ts
+++ b/packages/excalidraw/tests/fixtures/diagramFixture.ts
@@ -1,4 +1,5 @@
import { VERSIONS } from "../../constants";
+
import {
diamondFixture,
ellipseFixture,
diff --git a/packages/excalidraw/tests/fixtures/elementFixture.ts b/packages/excalidraw/tests/fixtures/elementFixture.ts
index f0470ec86..a7d8c5080 100644
--- a/packages/excalidraw/tests/fixtures/elementFixture.ts
+++ b/packages/excalidraw/tests/fixtures/elementFixture.ts
@@ -1,5 +1,7 @@
import type { Radians } from "@excalidraw/math";
+
import { DEFAULT_FONT_FAMILY } from "../../constants";
+
import type { ExcalidrawElement } from "../../element/types";
const elementBase: Omit = {
diff --git a/packages/excalidraw/tests/flip.test.tsx b/packages/excalidraw/tests/flip.test.tsx
index e3f44b333..9d9f68611 100644
--- a/packages/excalidraw/tests/flip.test.tsx
+++ b/packages/excalidraw/tests/flip.test.tsx
@@ -1,4 +1,21 @@
+import { pointFrom, type Radians } from "@excalidraw/math";
import React from "react";
+import { vi } from "vitest";
+
+import type { LocalPoint } from "@excalidraw/math";
+
+import { actionFlipHorizontal, actionFlipVertical } from "../actions";
+import { createPasteEvent } from "../clipboard";
+import { ROUNDNESS } from "../constants";
+import { getElementAbsoluteCoords } from "../element";
+import { newLinearElement } from "../element";
+import { getBoundTextElementPosition } from "../element/textElement";
+import { Excalidraw } from "../index";
+import { KEYS } from "../keys";
+import { arrayToMap, cloneJSON } from "../utils";
+
+import { API } from "./helpers/api";
+import { UI, Pointer, Keyboard } from "./helpers/ui";
import {
fireEvent,
GlobalTestState,
@@ -7,10 +24,7 @@ import {
unmountComponent,
waitFor,
} from "./test-utils";
-import { UI, Pointer, Keyboard } from "./helpers/ui";
-import { API } from "./helpers/api";
-import { actionFlipHorizontal, actionFlipVertical } from "../actions";
-import { getElementAbsoluteCoords } from "../element";
+
import type {
ExcalidrawElement,
ExcalidrawImageElement,
@@ -18,17 +32,7 @@ import type {
ExcalidrawTextElementWithContainer,
FileId,
} from "../element/types";
-import { newLinearElement } from "../element";
-import { Excalidraw } from "../index";
import type { NormalizedZoomValue } from "../types";
-import { ROUNDNESS } from "../constants";
-import { vi } from "vitest";
-import { KEYS } from "../keys";
-import { getBoundTextElementPosition } from "../element/textElement";
-import { createPasteEvent } from "../clipboard";
-import { arrayToMap, cloneJSON } from "../utils";
-import type { LocalPoint } from "@excalidraw/math";
-import { pointFrom, type Radians } from "@excalidraw/math";
const { h } = window;
const mouse = new Pointer("mouse");
diff --git a/packages/excalidraw/tests/fractionalIndex.test.ts b/packages/excalidraw/tests/fractionalIndex.test.ts
index b57af016b..dbd55bd92 100644
--- a/packages/excalidraw/tests/fractionalIndex.test.ts
+++ b/packages/excalidraw/tests/fractionalIndex.test.ts
@@ -1,15 +1,18 @@
/* eslint-disable no-lone-blocks */
+import { generateKeyBetween } from "fractional-indexing";
+
+import { deepCopyElement } from "../element/newElement";
+import { InvalidFractionalIndexError } from "../errors";
import {
syncInvalidIndices,
syncMovedIndices,
validateFractionalIndices,
} from "../fractionalIndex";
-import { API } from "./helpers/api";
import { arrayToMap } from "../utils";
-import { InvalidFractionalIndexError } from "../errors";
+
+import { API } from "./helpers/api";
+
import type { ExcalidrawElement, FractionalIndex } from "../element/types";
-import { deepCopyElement } from "../element/newElement";
-import { generateKeyBetween } from "fractional-indexing";
describe("sync invalid indices with array order", () => {
describe("should NOT sync empty array", () => {
diff --git a/packages/excalidraw/tests/helpers/api.ts b/packages/excalidraw/tests/helpers/api.ts
index 218f37116..2aa9ee999 100644
--- a/packages/excalidraw/tests/helpers/api.ts
+++ b/packages/excalidraw/tests/helpers/api.ts
@@ -1,3 +1,32 @@
+import fs from "fs";
+import path from "path";
+import util from "util";
+
+import { pointFrom, type LocalPoint, type Radians } from "@excalidraw/math";
+
+import { getDefaultAppState } from "../../appState";
+import { createTestHook } from "../../components/App";
+import { DEFAULT_VERTICAL_ALIGN, ROUNDNESS } from "../../constants";
+import { getMimeType } from "../../data/blob";
+import { newElement, newTextElement, newLinearElement } from "../../element";
+import { mutateElement } from "../../element/mutateElement";
+import {
+ newArrowElement,
+ newEmbeddableElement,
+ newFrameElement,
+ newFreeDrawElement,
+ newIframeElement,
+ newImageElement,
+ newMagicFrameElement,
+} from "../../element/newElement";
+import { isLinearElementType } from "../../element/typeChecks";
+import { selectGroupsForSelectedElements } from "../../groups";
+import { getSelectedElements } from "../../scene/selection";
+import { assertNever } from "../../utils";
+import { GlobalTestState, createEvent, fireEvent, act } from "../test-utils";
+
+import type { Action } from "../../actions/types";
+import type App from "../../components/App";
import type {
ExcalidrawElement,
ExcalidrawGenericElement,
@@ -13,34 +42,8 @@ import type {
ExcalidrawArrowElement,
FixedSegment,
} from "../../element/types";
-import { newElement, newTextElement, newLinearElement } from "../../element";
-import { DEFAULT_VERTICAL_ALIGN, ROUNDNESS } from "../../constants";
-import { getDefaultAppState } from "../../appState";
-import { GlobalTestState, createEvent, fireEvent, act } from "../test-utils";
-import fs from "fs";
-import util from "util";
-import path from "path";
-import { getMimeType } from "../../data/blob";
-import {
- newArrowElement,
- newEmbeddableElement,
- newFrameElement,
- newFreeDrawElement,
- newIframeElement,
- newImageElement,
- newMagicFrameElement,
-} from "../../element/newElement";
import type { AppState } from "../../types";
-import { getSelectedElements } from "../../scene/selection";
-import { isLinearElementType } from "../../element/typeChecks";
import type { Mutable } from "../../utility-types";
-import { assertNever } from "../../utils";
-import type App from "../../components/App";
-import { createTestHook } from "../../components/App";
-import type { Action } from "../../actions/types";
-import { mutateElement } from "../../element/mutateElement";
-import { pointFrom, type LocalPoint, type Radians } from "@excalidraw/math";
-import { selectGroupsForSelectedElements } from "../../groups";
const readFile = util.promisify(fs.readFile);
// so that window.h is available when App.tsx is not imported as well.
diff --git a/packages/excalidraw/tests/helpers/mocks.ts b/packages/excalidraw/tests/helpers/mocks.ts
index a87523ec1..10e1dee2b 100644
--- a/packages/excalidraw/tests/helpers/mocks.ts
+++ b/packages/excalidraw/tests/helpers/mocks.ts
@@ -1,7 +1,8 @@
-import { vi } from "vitest";
import * as MermaidToExcalidraw from "@excalidraw/mermaid-to-excalidraw";
-import type { parseMermaidToExcalidraw } from "@excalidraw/mermaid-to-excalidraw";
import React from "react";
+import { vi } from "vitest";
+
+import type { parseMermaidToExcalidraw } from "@excalidraw/mermaid-to-excalidraw";
export const mockMermaidToExcalidraw = (opts: {
parseMermaidToExcalidraw: typeof parseMermaidToExcalidraw;
diff --git a/packages/excalidraw/tests/helpers/ui.ts b/packages/excalidraw/tests/helpers/ui.ts
index b9b7023c1..a72e3fa74 100644
--- a/packages/excalidraw/tests/helpers/ui.ts
+++ b/packages/excalidraw/tests/helpers/ui.ts
@@ -1,3 +1,33 @@
+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 {
+ getTransformHandles,
+ getTransformHandlesFromCoords,
+ OMIT_SIDES_FOR_FRAME,
+ OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,
+ type TransformHandle,
+ type TransformHandleDirection,
+} from "../../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";
+
+import { API } from "./api";
+
+import type { TransformHandleType } from "../../element/transformHandles";
import type {
ExcalidrawElement,
ExcalidrawLinearElement,
@@ -10,32 +40,6 @@ import type {
ExcalidrawTextElementWithContainer,
ExcalidrawImageElement,
} from "../../element/types";
-import type { TransformHandleType } from "../../element/transformHandles";
-import {
- getTransformHandles,
- getTransformHandlesFromCoords,
- OMIT_SIDES_FOR_FRAME,
- OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,
- type TransformHandle,
- type TransformHandleDirection,
-} from "../../element/transformHandles";
-import { KEYS } from "../../keys";
-import { act, fireEvent, GlobalTestState, screen } from "../test-utils";
-import { mutateElement } from "../../element/mutateElement";
-import { API } from "./api";
-import {
- isLinearElement,
- isFreeDrawElement,
- isTextElement,
- isFrameLikeElement,
-} from "../../element/typeChecks";
-import { getCommonBounds, getElementPointsCoords } from "../../element/bounds";
-import { getTextEditor } from "../queries/dom";
-import { arrayToMap } from "../../utils";
-import { createTestHook } from "../../components/App";
-import type { GlobalPoint, LocalPoint, Radians } from "@excalidraw/math";
-import { pointFrom, pointRotateRads } from "@excalidraw/math";
-import { cropElement } from "../../element/cropElement";
import type { ToolType } from "../../types";
// so that window.h is available when App.tsx is not imported as well.
diff --git a/packages/excalidraw/tests/history.test.tsx b/packages/excalidraw/tests/history.test.tsx
index ffddec49f..6e7066b90 100644
--- a/packages/excalidraw/tests/history.test.tsx
+++ b/packages/excalidraw/tests/history.test.tsx
@@ -1,6 +1,43 @@
import React from "react";
+import {
+ queryByText,
+ fireEvent,
+ queryByTestId,
+ waitFor,
+} from "@testing-library/react";
+import { vi } from "vitest";
+import { pointFrom } from "@excalidraw/math";
+
+import type { LocalPoint, Radians } from "@excalidraw/math";
+
import "../global.d.ts";
+import "../../utils/test-utils";
+
+import {
+ actionSendBackward,
+ actionBringForward,
+ actionSendToBack,
+} from "../actions";
+import { createUndoAction, createRedoAction } from "../actions/actionHistory";
+import { actionToggleViewMode } from "../actions/actionToggleViewMode";
+import { getDefaultAppState } from "../appState";
+import { HistoryEntry } from "../history";
+import { Excalidraw } from "../index";
+import { KEYS } from "../keys";
import * as StaticScene from "../renderer/staticScene";
+import { EXPORT_DATA_TYPES, MIME_TYPES, ORIG_ID } from "../constants";
+import { Snapshot, CaptureUpdateAction } from "../store";
+import { arrayToMap } from "../utils";
+import {
+ COLOR_PALETTE,
+ DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX,
+ DEFAULT_ELEMENT_STROKE_COLOR_INDEX,
+} from "../colors";
+import { newElementWith } from "../element/mutateElement";
+import { AppStateChange, ElementsChange } from "../change";
+
+import { API } from "./helpers/api";
+import { Keyboard, Pointer, UI } from "./helpers/ui";
import {
GlobalTestState,
act,
@@ -9,24 +46,7 @@ import {
togglePopover,
getCloneByOrigId,
} from "./test-utils";
-import "../../utils/test-utils";
-import { Excalidraw } from "../index";
-import { Keyboard, Pointer, UI } from "./helpers/ui";
-import { API } from "./helpers/api";
-import { getDefaultAppState } from "../appState";
-import { fireEvent, queryByTestId, waitFor } from "@testing-library/react";
-import { createUndoAction, createRedoAction } from "../actions/actionHistory";
-import { actionToggleViewMode } from "../actions/actionToggleViewMode";
-import { EXPORT_DATA_TYPES, MIME_TYPES, ORIG_ID } from "../constants";
-import type { AppState } from "../types";
-import { arrayToMap } from "../utils";
-import {
- COLOR_PALETTE,
- DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX,
- DEFAULT_ELEMENT_STROKE_COLOR_INDEX,
-} from "../colors";
-import { KEYS } from "../keys";
-import { newElementWith } from "../element/mutateElement";
+
import type {
ExcalidrawElbowArrowElement,
ExcalidrawFrameElement,
@@ -37,18 +57,7 @@ import type {
FractionalIndex,
SceneElementsMap,
} from "../element/types";
-import {
- actionSendBackward,
- actionBringForward,
- actionSendToBack,
-} from "../actions";
-import { vi } from "vitest";
-import { queryByText } from "@testing-library/react";
-import { HistoryEntry } from "../history";
-import { AppStateChange, ElementsChange } from "../change";
-import { Snapshot, CaptureUpdateAction } from "../store";
-import type { LocalPoint, Radians } from "@excalidraw/math";
-import { pointFrom } from "@excalidraw/math";
+import type { AppState } from "../types";
const { h } = window;
diff --git a/packages/excalidraw/tests/library.test.tsx b/packages/excalidraw/tests/library.test.tsx
index 7b48407b7..b084d835b 100644
--- a/packages/excalidraw/tests/library.test.tsx
+++ b/packages/excalidraw/tests/library.test.tsx
@@ -1,18 +1,20 @@
+import { act, queryByTestId } from "@testing-library/react";
import React from "react";
import { vi } from "vitest";
-import { fireEvent, getCloneByOrigId, render, waitFor } from "./test-utils";
-import { act, queryByTestId } from "@testing-library/react";
-import { Excalidraw } from "../index";
-import { API } from "./helpers/api";
import { MIME_TYPES, ORIG_ID } from "../constants";
-import type { LibraryItem, LibraryItems } from "../types";
-import { UI } from "./helpers/ui";
+import { parseLibraryJSON } from "../data/blob";
import { serializeLibraryAsJSON } from "../data/json";
import { distributeLibraryItemsOnSquareGrid } from "../data/library";
-import type { ExcalidrawGenericElement } from "../element/types";
import { getCommonBoundingBox } from "../element/bounds";
-import { parseLibraryJSON } from "../data/blob";
+import { Excalidraw } from "../index";
+
+import { API } from "./helpers/api";
+import { UI } from "./helpers/ui";
+import { fireEvent, getCloneByOrigId, render, waitFor } from "./test-utils";
+
+import type { ExcalidrawGenericElement } from "../element/types";
+import type { LibraryItem, LibraryItems } from "../types";
const { h } = window;
diff --git a/packages/excalidraw/tests/linearElementEditor.test.tsx b/packages/excalidraw/tests/linearElementEditor.test.tsx
index 98d6058c2..162dbb3f0 100644
--- a/packages/excalidraw/tests/linearElementEditor.test.tsx
+++ b/packages/excalidraw/tests/linearElementEditor.test.tsx
@@ -1,14 +1,25 @@
+import { pointCenter, pointFrom } from "@excalidraw/math";
+import { act, queryByTestId, queryByText } from "@testing-library/react";
import React from "react";
-import type {
- ExcalidrawElement,
- ExcalidrawLinearElement,
- ExcalidrawTextElementWithContainer,
- FontString,
-} from "../element/types";
+import { vi } from "vitest";
+
+import type { GlobalPoint } from "@excalidraw/math";
+
+import { ROUNDNESS, VERTICAL_ALIGN } from "../constants";
+import { LinearElementEditor } from "../element/linearElementEditor";
+import {
+ getBoundTextElementPosition,
+ getBoundTextMaxWidth,
+} from "../element/textElement";
+import * as textElementUtils from "../element/textElement";
+import { wrapText } from "../element/textWrapping";
import { Excalidraw, mutateElement } from "../index";
+import { KEYS } from "../keys";
import { reseed } from "../random";
-import * as StaticScene from "../renderer/staticScene";
import * as InteractiveCanvas from "../renderer/interactiveScene";
+import * as StaticScene from "../renderer/staticScene";
+import { API } from "../tests/helpers/api";
+import { arrayToMap } from "../utils";
import { Keyboard, Pointer, UI } from "./helpers/ui";
import {
@@ -18,21 +29,13 @@ import {
GlobalTestState,
unmountComponent,
} from "./test-utils";
-import { API } from "../tests/helpers/api";
-import { KEYS } from "../keys";
-import { LinearElementEditor } from "../element/linearElementEditor";
-import { act, queryByTestId, queryByText } from "@testing-library/react";
-import {
- getBoundTextElementPosition,
- getBoundTextMaxWidth,
-} from "../element/textElement";
-import * as textElementUtils from "../element/textElement";
-import { ROUNDNESS, VERTICAL_ALIGN } from "../constants";
-import { vi } from "vitest";
-import { arrayToMap } from "../utils";
-import type { GlobalPoint } from "@excalidraw/math";
-import { pointCenter, pointFrom } from "@excalidraw/math";
-import { wrapText } from "../element/textWrapping";
+
+import type {
+ ExcalidrawElement,
+ ExcalidrawLinearElement,
+ ExcalidrawTextElementWithContainer,
+ FontString,
+} from "../element/types";
const renderInteractiveScene = vi.spyOn(
InteractiveCanvas,
diff --git a/packages/excalidraw/tests/move.test.tsx b/packages/excalidraw/tests/move.test.tsx
index 528f9554d..855496f44 100644
--- a/packages/excalidraw/tests/move.test.tsx
+++ b/packages/excalidraw/tests/move.test.tsx
@@ -1,19 +1,22 @@
import React from "react";
+import { vi } from "vitest";
+
import "../../utils/test-utils";
-import { render, fireEvent, act, unmountComponent } from "./test-utils";
-import { Excalidraw } from "../index";
-import * as StaticScene from "../renderer/staticScene";
-import * as InteractiveCanvas from "../renderer/interactiveScene";
-import { reseed } from "../random";
import { bindOrUnbindLinearElement } from "../element/binding";
+import { Excalidraw } from "../index";
+import { KEYS } from "../keys";
+import { reseed } from "../random";
+import * as InteractiveCanvas from "../renderer/interactiveScene";
+import * as StaticScene from "../renderer/staticScene";
+
+import { UI, Pointer, Keyboard } from "./helpers/ui";
+import { render, fireEvent, act, unmountComponent } from "./test-utils";
+
import type {
ExcalidrawLinearElement,
NonDeleted,
ExcalidrawRectangleElement,
} from "../element/types";
-import { UI, Pointer, Keyboard } from "./helpers/ui";
-import { KEYS } from "../keys";
-import { vi } from "vitest";
import type Scene from "../scene/Scene";
unmountComponent();
diff --git a/packages/excalidraw/tests/multiPointCreate.test.tsx b/packages/excalidraw/tests/multiPointCreate.test.tsx
index df94eb9da..5cbce4966 100644
--- a/packages/excalidraw/tests/multiPointCreate.test.tsx
+++ b/packages/excalidraw/tests/multiPointCreate.test.tsx
@@ -1,4 +1,12 @@
import React from "react";
+import { vi } from "vitest";
+
+import { Excalidraw } from "../index";
+import { KEYS } from "../keys";
+import { reseed } from "../random";
+import * as InteractiveCanvas from "../renderer/interactiveScene";
+import * as StaticScene from "../renderer/staticScene";
+
import {
render,
fireEvent,
@@ -6,13 +14,8 @@ import {
restoreOriginalGetBoundingClientRect,
unmountComponent,
} from "./test-utils";
-import { Excalidraw } from "../index";
-import * as StaticScene from "../renderer/staticScene";
-import * as InteractiveCanvas from "../renderer/interactiveScene";
-import { KEYS } from "../keys";
+
import type { ExcalidrawLinearElement } from "../element/types";
-import { reseed } from "../random";
-import { vi } from "vitest";
unmountComponent();
diff --git a/packages/excalidraw/tests/packages/events.test.tsx b/packages/excalidraw/tests/packages/events.test.tsx
index ad8b3c6d9..3e79239c8 100644
--- a/packages/excalidraw/tests/packages/events.test.tsx
+++ b/packages/excalidraw/tests/packages/events.test.tsx
@@ -1,11 +1,13 @@
import React from "react";
import { vi } from "vitest";
+
import { Excalidraw, CaptureUpdateAction } from "../../index";
-import type { ExcalidrawImperativeAPI } from "../../types";
import { resolvablePromise } from "../../utils";
-import { render } from "../test-utils";
-import { Pointer } from "../helpers/ui";
import { API } from "../helpers/api";
+import { Pointer } from "../helpers/ui";
+import { render } from "../test-utils";
+
+import type { ExcalidrawImperativeAPI } from "../../types";
describe("event callbacks", () => {
const h = window.h;
diff --git a/packages/excalidraw/tests/queries/toolQueries.ts b/packages/excalidraw/tests/queries/toolQueries.ts
index df0afa117..ed168735d 100644
--- a/packages/excalidraw/tests/queries/toolQueries.ts
+++ b/packages/excalidraw/tests/queries/toolQueries.ts
@@ -1,7 +1,9 @@
import { queries, buildQueries } from "@testing-library/react";
-import type { ToolType } from "../../types";
+
import { TOOL_TYPE } from "../../constants";
+import type { ToolType } from "../../types";
+
const _getAllByToolName = (container: HTMLElement, tool: ToolType | "lock") => {
const toolTitle = tool === "lock" ? "lock" : TOOL_TYPE[tool];
return queries.getAllByTestId(container, `toolbar-${toolTitle}`);
diff --git a/packages/excalidraw/tests/regressionTests.test.tsx b/packages/excalidraw/tests/regressionTests.test.tsx
index a3e45bca6..8407f0766 100644
--- a/packages/excalidraw/tests/regressionTests.test.tsx
+++ b/packages/excalidraw/tests/regressionTests.test.tsx
@@ -1,10 +1,13 @@
import React from "react";
-import type { ExcalidrawElement } from "../element/types";
-import { CODES, KEYS } from "../keys";
+import { vi } from "vitest";
+
+import { FONT_FAMILY } from "../constants";
import { Excalidraw } from "../index";
+import { CODES, KEYS } from "../keys";
import { reseed } from "../random";
import * as StaticScene from "../renderer/staticScene";
import { setDateTimeForTests } from "../utils";
+
import { API } from "./helpers/api";
import { Keyboard, Pointer, UI } from "./helpers/ui";
import {
@@ -15,8 +18,8 @@ import {
togglePopover,
unmountComponent,
} from "./test-utils";
-import { FONT_FAMILY } from "../constants";
-import { vi } from "vitest";
+
+import type { ExcalidrawElement } from "../element/types";
const { h } = window;
diff --git a/packages/excalidraw/tests/resize.test.tsx b/packages/excalidraw/tests/resize.test.tsx
index a12d31048..055b097b3 100644
--- a/packages/excalidraw/tests/resize.test.tsx
+++ b/packages/excalidraw/tests/resize.test.tsx
@@ -1,24 +1,28 @@
+import { pointFrom } from "@excalidraw/math";
import React from "react";
-import { render, unmountComponent } from "./test-utils";
+
+import type { LocalPoint } from "@excalidraw/math";
+
+import { getElementPointsCoords } from "../element/bounds";
+import { LinearElementEditor } from "../element/linearElementEditor";
+import { resizeSingleElement } from "../element/resizeElements";
+import { isLinearElement } from "../element/typeChecks";
+import { Excalidraw } from "../index";
+import { KEYS } from "../keys";
+import { getSizeFromPoints } from "../points";
import { reseed } from "../random";
+import { arrayToMap } from "../utils";
+
+import { API } from "./helpers/api";
import { UI, Keyboard, Pointer } from "./helpers/ui";
+import { render, unmountComponent } from "./test-utils";
+
+import type { Bounds } from "../element/bounds";
import type {
ExcalidrawElbowArrowElement,
ExcalidrawFreeDrawElement,
ExcalidrawLinearElement,
} from "../element/types";
-import type { Bounds } from "../element/bounds";
-import { getElementPointsCoords } from "../element/bounds";
-import { Excalidraw } from "../index";
-import { API } from "./helpers/api";
-import { KEYS } from "../keys";
-import { isLinearElement } from "../element/typeChecks";
-import { LinearElementEditor } from "../element/linearElementEditor";
-import { arrayToMap } from "../utils";
-import type { LocalPoint } from "@excalidraw/math";
-import { pointFrom } from "@excalidraw/math";
-import { resizeSingleElement } from "../element/resizeElements";
-import { getSizeFromPoints } from "../points";
unmountComponent();
@@ -533,9 +537,8 @@ describe("arrow element", () => {
expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.75);
UI.resize([rectangle, arrow], "nw", [300, 350]);
-
- expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(-0.13);
- expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.11);
+ expect(arrow.startBinding?.fixedPoint?.[0]).toBeCloseTo(0);
+ expect(arrow.startBinding?.fixedPoint?.[1]).toBeCloseTo(0.25);
});
});
diff --git a/packages/excalidraw/tests/rotate.test.tsx b/packages/excalidraw/tests/rotate.test.tsx
index 367313ea9..2c678f45b 100644
--- a/packages/excalidraw/tests/rotate.test.tsx
+++ b/packages/excalidraw/tests/rotate.test.tsx
@@ -1,10 +1,12 @@
import React from "react";
-import { render, unmountComponent } from "./test-utils";
-import { reseed } from "../random";
-import { UI } from "./helpers/ui";
-import { Excalidraw } from "../index";
import { expect } from "vitest";
+import { Excalidraw } from "../index";
+import { reseed } from "../random";
+
+import { UI } from "./helpers/ui";
+import { render, unmountComponent } from "./test-utils";
+
unmountComponent();
beforeEach(() => {
diff --git a/packages/excalidraw/tests/scene/export.test.ts b/packages/excalidraw/tests/scene/export.test.ts
index 6fd8a8b85..43c37eb28 100644
--- a/packages/excalidraw/tests/scene/export.test.ts
+++ b/packages/excalidraw/tests/scene/export.test.ts
@@ -1,8 +1,7 @@
-import type {
- ExcalidrawTextElement,
- FractionalIndex,
- NonDeletedExcalidrawElement,
-} from "../../element/types";
+import { exportToCanvas, exportToSvg } from "@excalidraw/utils";
+
+import { FONT_FAMILY, FRAME_STYLE } from "../../constants";
+import { prepareElementsForExport } from "../../data";
import * as exportUtils from "../../scene/export";
import {
diamondFixture,
@@ -11,9 +10,12 @@ import {
textFixture,
} from "../fixtures/elementFixture";
import { API } from "../helpers/api";
-import { exportToCanvas, exportToSvg } from "@excalidraw/utils";
-import { FONT_FAMILY, FRAME_STYLE } from "../../constants";
-import { prepareElementsForExport } from "../../data";
+
+import type {
+ ExcalidrawTextElement,
+ FractionalIndex,
+ NonDeletedExcalidrawElement,
+} from "../../element/types";
describe("exportToSvg", () => {
const ELEMENT_HEIGHT = 100;
diff --git a/packages/excalidraw/tests/scroll.test.tsx b/packages/excalidraw/tests/scroll.test.tsx
index 1a3f80c14..2ccc4546f 100644
--- a/packages/excalidraw/tests/scroll.test.tsx
+++ b/packages/excalidraw/tests/scroll.test.tsx
@@ -1,14 +1,16 @@
import React from "react";
+
+import { Excalidraw } from "../index";
+import { KEYS } from "../keys";
+
+import { API } from "./helpers/api";
+import { Keyboard } from "./helpers/ui";
import {
mockBoundingClientRect,
render,
restoreOriginalGetBoundingClientRect,
waitFor,
} from "./test-utils";
-import { Excalidraw } from "../index";
-import { API } from "./helpers/api";
-import { Keyboard } from "./helpers/ui";
-import { KEYS } from "../keys";
const { h } = window;
diff --git a/packages/excalidraw/tests/search.test.tsx b/packages/excalidraw/tests/search.test.tsx
index 68ad65826..d3622d4b1 100644
--- a/packages/excalidraw/tests/search.test.tsx
+++ b/packages/excalidraw/tests/search.test.tsx
@@ -1,11 +1,14 @@
import React from "react";
-import { act, render, waitFor } from "./test-utils";
-import { Excalidraw } from "../index";
+
import { CANVAS_SEARCH_TAB, CLASSES, DEFAULT_SIDEBAR } from "../constants";
-import { Keyboard } from "./helpers/ui";
+import { Excalidraw } from "../index";
import { KEYS } from "../keys";
-import { updateTextEditor } from "./queries/dom";
+
import { API } from "./helpers/api";
+import { Keyboard } from "./helpers/ui";
+import { updateTextEditor } from "./queries/dom";
+import { act, render, waitFor } from "./test-utils";
+
import type { ExcalidrawTextElement } from "../element/types";
const { h } = window;
diff --git a/packages/excalidraw/tests/selection.test.tsx b/packages/excalidraw/tests/selection.test.tsx
index 0b1f6e50d..d93d3eff5 100644
--- a/packages/excalidraw/tests/selection.test.tsx
+++ b/packages/excalidraw/tests/selection.test.tsx
@@ -1,4 +1,15 @@
import React from "react";
+import { vi } from "vitest";
+
+import { Excalidraw } from "../index";
+import { KEYS } from "../keys";
+import { reseed } from "../random";
+import * as InteractiveCanvas from "../renderer/interactiveScene";
+import * as StaticScene from "../renderer/staticScene";
+import { SHAPES } from "../shapes";
+
+import { API } from "./helpers/api";
+import { Keyboard, Pointer, UI } from "./helpers/ui";
import {
render,
fireEvent,
@@ -7,15 +18,6 @@ import {
assertSelectedElements,
unmountComponent,
} from "./test-utils";
-import { Excalidraw } from "../index";
-import * as StaticScene from "../renderer/staticScene";
-import * as InteractiveCanvas from "../renderer/interactiveScene";
-import { KEYS } from "../keys";
-import { reseed } from "../random";
-import { API } from "./helpers/api";
-import { Keyboard, Pointer, UI } from "./helpers/ui";
-import { SHAPES } from "../shapes";
-import { vi } from "vitest";
unmountComponent();
diff --git a/packages/excalidraw/tests/shortcuts.test.tsx b/packages/excalidraw/tests/shortcuts.test.tsx
index e02ed0193..ee2234ecc 100644
--- a/packages/excalidraw/tests/shortcuts.test.tsx
+++ b/packages/excalidraw/tests/shortcuts.test.tsx
@@ -1,6 +1,8 @@
import React from "react";
-import { KEYS } from "../keys";
+
import { Excalidraw } from "../index";
+import { KEYS } from "../keys";
+
import { API } from "./helpers/api";
import { Keyboard } from "./helpers/ui";
import { fireEvent, render, waitFor } from "./test-utils";
diff --git a/packages/excalidraw/tests/test-utils.ts b/packages/excalidraw/tests/test-utils.ts
index 84936f520..73b340982 100644
--- a/packages/excalidraw/tests/test-utils.ts
+++ b/packages/excalidraw/tests/test-utils.ts
@@ -1,6 +1,4 @@
import "pepjs";
-
-import type { RenderResult, RenderOptions } from "@testing-library/react";
import { act } from "@testing-library/react";
import {
render,
@@ -9,16 +7,20 @@ import {
fireEvent,
cleanup,
} from "@testing-library/react";
-
-import * as toolQueries from "./queries/toolQueries";
-import type { ImportedDataState } from "../data/types";
-import { STORAGE_KEYS } from "../../../excalidraw-app/app_constants";
-import { getSelectedElements } from "../scene/selection";
-import type { ExcalidrawElement } from "../element/types";
-import { UI } from "./helpers/ui";
import ansi from "ansicolor";
+
+import { STORAGE_KEYS } from "../../../excalidraw-app/app_constants";
import { ORIG_ID } from "../constants";
+import { getSelectedElements } from "../scene/selection";
import { arrayToMap } from "../utils";
+
+import { UI } from "./helpers/ui";
+import * as toolQueries from "./queries/toolQueries";
+
+import type { RenderResult, RenderOptions } from "@testing-library/react";
+
+import type { ImportedDataState } from "../data/types";
+import type { ExcalidrawElement } from "../element/types";
import type { AllPossibleKeys } from "../utility-types";
export { cleanup as unmountComponent };
diff --git a/packages/excalidraw/tests/tool.test.tsx b/packages/excalidraw/tests/tool.test.tsx
index 662c61baa..f70d1ccdd 100644
--- a/packages/excalidraw/tests/tool.test.tsx
+++ b/packages/excalidraw/tests/tool.test.tsx
@@ -1,9 +1,12 @@
import React from "react";
+
import { Excalidraw } from "../index";
-import type { ExcalidrawImperativeAPI } from "../types";
import { resolvablePromise } from "../utils";
-import { act, render } from "./test-utils";
+
import { Pointer } from "./helpers/ui";
+import { act, render } from "./test-utils";
+
+import type { ExcalidrawImperativeAPI } from "../types";
describe("setActiveTool()", () => {
const h = window.h;
diff --git a/packages/excalidraw/tests/viewMode.test.tsx b/packages/excalidraw/tests/viewMode.test.tsx
index 66eca8c7f..c190ee0e3 100644
--- a/packages/excalidraw/tests/viewMode.test.tsx
+++ b/packages/excalidraw/tests/viewMode.test.tsx
@@ -1,10 +1,12 @@
import React from "react";
-import { render, GlobalTestState } from "./test-utils";
+
+import { CURSOR_TYPE } from "../constants";
import { Excalidraw } from "../index";
import { KEYS } from "../keys";
-import { Keyboard, Pointer, UI } from "./helpers/ui";
-import { CURSOR_TYPE } from "../constants";
+
import { API } from "./helpers/api";
+import { Keyboard, Pointer, UI } from "./helpers/ui";
+import { render, GlobalTestState } from "./test-utils";
const mouse = new Pointer("mouse");
const touch = new Pointer("touch");
diff --git a/packages/excalidraw/tests/zindex.test.tsx b/packages/excalidraw/tests/zindex.test.tsx
index f15d55931..c8e166aff 100644
--- a/packages/excalidraw/tests/zindex.test.tsx
+++ b/packages/excalidraw/tests/zindex.test.tsx
@@ -1,7 +1,5 @@
import React from "react";
-import { act, getCloneByOrigId, render, unmountComponent } from "./test-utils";
-import { Excalidraw } from "../index";
-import { reseed } from "../random";
+
import {
actionSendBackward,
actionBringForward,
@@ -9,14 +7,19 @@ import {
actionSendToBack,
actionDuplicateSelection,
} from "../actions";
-import type { AppState } from "../types";
-import { API } from "./helpers/api";
import { selectGroupsForSelectedElements } from "../groups";
+import { Excalidraw } from "../index";
+import { reseed } from "../random";
+
+import { API } from "./helpers/api";
+import { act, getCloneByOrigId, render, unmountComponent } from "./test-utils";
+
import type {
ExcalidrawElement,
ExcalidrawFrameElement,
ExcalidrawSelectionElement,
} from "../element/types";
+import type { AppState } from "../types";
unmountComponent();
diff --git a/packages/excalidraw/types.ts b/packages/excalidraw/types.ts
index 13523a269..b9a0649cb 100644
--- a/packages/excalidraw/types.ts
+++ b/packages/excalidraw/types.ts
@@ -1,5 +1,19 @@
-import type { JSX } from "react";
-import type React from "react";
+import type { Action } from "./actions/types";
+import type { Spreadsheet } from "./charts";
+import type { ClipboardData } from "./clipboard";
+import type App from "./components/App";
+import type Library from "./data/library";
+import type { FileSystemHandle } from "./data/filesystem";
+import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
+import type { ContextMenuItems } from "./components/ContextMenu";
+import type { SnapLine } from "./snapping";
+import type { Merge, MaybePromise, ValueOf, MakeBrand } from "./utility-types";
+import type { CaptureUpdateActionType } from "./store";
+import type { UserIdleState } from "./constants";
+import type { ImportedDataState } from "./data/types";
+import type { SuggestedBinding } from "./element/binding";
+import type { LinearElementEditor } from "./element/linearElementEditor";
+import type { MaybeTransformHandleType } from "./element/transformHandles";
import type {
PointerType,
ExcalidrawLinearElement,
@@ -24,25 +38,11 @@ import type {
OrderedExcalidrawElement,
ExcalidrawNonSelectionElement,
} from "./element/types";
-import type { Action } from "./actions/types";
-import type { LinearElementEditor } from "./element/linearElementEditor";
-import type { SuggestedBinding } from "./element/binding";
-import type { ImportedDataState } from "./data/types";
-import type App from "./components/App";
-import type { throttleRAF } from "./utils";
-import type { Spreadsheet } from "./charts";
import type { Language } from "./i18n";
-import type { ClipboardData } from "./clipboard";
import type { isOverScrollBars } from "./scene/scrollbars";
-import type { MaybeTransformHandleType } from "./element/transformHandles";
-import type Library from "./data/library";
-import type { FileSystemHandle } from "./data/filesystem";
-import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
-import type { ContextMenuItems } from "./components/ContextMenu";
-import type { SnapLine } from "./snapping";
-import type { Merge, MaybePromise, ValueOf, MakeBrand } from "./utility-types";
-import type { CaptureUpdateActionType } from "./store";
-import type { UserIdleState } from "./constants";
+import type { throttleRAF } from "./utils";
+import type React from "react";
+import type { JSX } from "react";
export type SocketId = string & { _brand: "SocketId" };
diff --git a/packages/excalidraw/utils.ts b/packages/excalidraw/utils.ts
index e3e18eb93..84f6637f1 100644
--- a/packages/excalidraw/utils.ts
+++ b/packages/excalidraw/utils.ts
@@ -1,7 +1,7 @@
-import Pool from "es6-promise-pool";
import { average } from "@excalidraw/math";
+import Pool from "es6-promise-pool";
+
import { COLOR_PALETTE } from "./colors";
-import type { EVENT } from "./constants";
import {
DEFAULT_VERSION,
FONT_FAMILY,
@@ -9,6 +9,8 @@ import {
isDarwin,
WINDOWS_EMOJI_FALLBACK_FONT,
} from "./constants";
+
+import type { EVENT } from "./constants";
import type {
ExcalidrawBindableElement,
FontFamilyValues,
diff --git a/packages/excalidraw/visualdebug.ts b/packages/excalidraw/visualdebug.ts
index 862f2cf20..6b7014864 100644
--- a/packages/excalidraw/visualdebug.ts
+++ b/packages/excalidraw/visualdebug.ts
@@ -1,4 +1,3 @@
-import type { Curve } from "@excalidraw/math";
import {
isLineSegment,
lineSegment,
@@ -6,10 +5,14 @@ import {
type GlobalPoint,
type LocalPoint,
} from "@excalidraw/math";
+
+import type { Curve } from "@excalidraw/math";
import type { LineSegment } from "@excalidraw/utils";
-import type { Bounds } from "./element/bounds";
+
import { isBounds } from "./element/typeChecks";
+import type { Bounds } from "./element/bounds";
+
// The global data holder to collect the debug operations
declare global {
interface Window {
diff --git a/packages/excalidraw/vite-env.d.ts b/packages/excalidraw/vite-env.d.ts
index 628275181..4292e3b6a 100644
--- a/packages/excalidraw/vite-env.d.ts
+++ b/packages/excalidraw/vite-env.d.ts
@@ -43,9 +43,8 @@ interface ImportMetaEnv {
VITE_APP_ENABLE_ESLINT: string;
VITE_APP_ENABLE_TRACKING: string;
- VITE_PKG_NAME: string;
- VITE_PKG_VERSION: string;
- VITE_IS_EXCALIDRAW_NPM_PACKAGE: string;
+ PKG_NAME: string;
+ PKG_VERSION: string;
VITE_APP_PLUS_LP: string;
VITE_APP_PLUS_APP: string;
diff --git a/packages/excalidraw/zindex.ts b/packages/excalidraw/zindex.ts
index 1118ed533..8ffcec5d1 100644
--- a/packages/excalidraw/zindex.ts
+++ b/packages/excalidraw/zindex.ts
@@ -1,15 +1,16 @@
import { isFrameLikeElement } from "./element/typeChecks";
-import type {
- ExcalidrawElement,
- ExcalidrawFrameLikeElement,
-} from "./element/types";
import { syncMovedIndices } from "./fractionalIndex";
import { getElementsInGroup } from "./groups";
import { getSelectedElements } from "./scene";
import Scene from "./scene/Scene";
-import type { AppState } from "./types";
import { arrayToMap, findIndex, findLastIndex } from "./utils";
+import type {
+ ExcalidrawElement,
+ ExcalidrawFrameLikeElement,
+} from "./element/types";
+import type { AppState } from "./types";
+
const isOfTargetFrame = (element: ExcalidrawElement, frameId: string) => {
return element.frameId === frameId || element.id === frameId;
};
diff --git a/packages/math/angle.ts b/packages/math/angle.ts
index 8d473cf55..353dc5dad 100644
--- a/packages/math/angle.ts
+++ b/packages/math/angle.ts
@@ -1,3 +1,5 @@
+import { PRECISION } from "./utils";
+
import type {
Degrees,
GlobalPoint,
@@ -5,7 +7,6 @@ import type {
PolarCoords,
Radians,
} from "./types";
-import { PRECISION } from "./utils";
// TODO: Simplify with modulo and fix for angles beyond 4*Math.PI and - 4*Math.PI
export const normalizeRadians = (angle: Radians): Radians => {
diff --git a/packages/math/curve.test.ts b/packages/math/curve.test.ts
index 94670d7ab..8d60a7346 100644
--- a/packages/math/curve.test.ts
+++ b/packages/math/curve.test.ts
@@ -1,4 +1,5 @@
import "../utils/test-utils";
+
import {
curve,
curveClosestPoint,
diff --git a/packages/math/curve.ts b/packages/math/curve.ts
index 9b275ceec..cd466bbc7 100644
--- a/packages/math/curve.ts
+++ b/packages/math/curve.ts
@@ -1,7 +1,8 @@
-import type { Bounds } from "../excalidraw/element/bounds";
import { isPoint, pointDistance, pointFrom } from "./point";
import { rectangle, rectangleIntersectLineSegment } from "./rectangle";
+
import type { Curve, GlobalPoint, LineSegment, LocalPoint } from "./types";
+import type { Bounds } from "../excalidraw/element/bounds";
/**
*
diff --git a/packages/math/ellipse.test.ts b/packages/math/ellipse.test.ts
index 507cc5a1a..bcaab2a5d 100644
--- a/packages/math/ellipse.test.ts
+++ b/packages/math/ellipse.test.ts
@@ -8,6 +8,7 @@ import {
import { line } from "./line";
import { pointFrom } from "./point";
import { lineSegment } from "./segment";
+
import type { Ellipse, GlobalPoint } from "./types";
describe("point and ellipse", () => {
diff --git a/packages/math/ellipse.ts b/packages/math/ellipse.ts
index c32def0eb..741a77df3 100644
--- a/packages/math/ellipse.ts
+++ b/packages/math/ellipse.ts
@@ -4,13 +4,6 @@ import {
pointFromVector,
pointsEqual,
} from "./point";
-import type {
- Ellipse,
- GlobalPoint,
- Line,
- LineSegment,
- LocalPoint,
-} from "./types";
import { PRECISION } from "./utils";
import {
vector,
@@ -20,6 +13,14 @@ import {
vectorScale,
} from "./vector";
+import type {
+ Ellipse,
+ GlobalPoint,
+ Line,
+ LineSegment,
+ LocalPoint,
+} from "./types";
+
/**
* Construct an Ellipse object from the parameters
*
diff --git a/packages/math/line.ts b/packages/math/line.ts
index bcb4f6d90..889fa08ce 100644
--- a/packages/math/line.ts
+++ b/packages/math/line.ts
@@ -1,4 +1,5 @@
import { pointFrom } from "./point";
+
import type { GlobalPoint, Line, LocalPoint } from "./types";
/**
diff --git a/packages/math/point.test.ts b/packages/math/point.test.ts
index 89cc4f8f3..0ed59ee9a 100644
--- a/packages/math/point.test.ts
+++ b/packages/math/point.test.ts
@@ -1,4 +1,5 @@
import { pointFrom, pointRotateRads } from "./point";
+
import type { Radians } from "./types";
describe("rotate", () => {
diff --git a/packages/math/point.ts b/packages/math/point.ts
index 92df18773..f6234c8ea 100644
--- a/packages/math/point.ts
+++ b/packages/math/point.ts
@@ -1,4 +1,7 @@
import { degreesToRadians } from "./angle";
+import { PRECISION } from "./utils";
+import { vectorFromPoint, vectorScale } from "./vector";
+
import type {
LocalPoint,
GlobalPoint,
@@ -6,8 +9,6 @@ import type {
Degrees,
Vector,
} from "./types";
-import { PRECISION } from "./utils";
-import { vectorFromPoint, vectorScale } from "./vector";
/**
* Create a properly typed Point instance from the X and Y coordinates.
diff --git a/packages/math/polygon.ts b/packages/math/polygon.ts
index 783bc4cf3..762c82dbf 100644
--- a/packages/math/polygon.ts
+++ b/packages/math/polygon.ts
@@ -1,8 +1,9 @@
import { pointsEqual } from "./point";
import { lineSegment, pointOnLineSegment } from "./segment";
-import type { GlobalPoint, LocalPoint, Polygon } from "./types";
import { PRECISION } from "./utils";
+import type { GlobalPoint, LocalPoint, Polygon } from "./types";
+
export function polygon(
...points: Point[]
) {
diff --git a/packages/math/range.ts b/packages/math/range.ts
index d90530cba..dee3d7edf 100644
--- a/packages/math/range.ts
+++ b/packages/math/range.ts
@@ -1,4 +1,5 @@
import { toBrandedType } from "@excalidraw/excalidraw/utils";
+
import type { InclusiveRange } from "./types";
/**
diff --git a/packages/math/rectangle.ts b/packages/math/rectangle.ts
index 7dde15ded..394b5c2f8 100644
--- a/packages/math/rectangle.ts
+++ b/packages/math/rectangle.ts
@@ -1,5 +1,6 @@
import { pointFrom } from "./point";
import { lineSegment, lineSegmentIntersectionPoints } from "./segment";
+
import type { GlobalPoint, LineSegment, LocalPoint, Rectangle } from "./types";
export function rectangle(
diff --git a/packages/math/segment.ts b/packages/math/segment.ts
index 60943aacb..e38978b7e 100644
--- a/packages/math/segment.ts
+++ b/packages/math/segment.ts
@@ -5,7 +5,6 @@ import {
pointFromVector,
pointRotateRads,
} from "./point";
-import type { GlobalPoint, LineSegment, LocalPoint, Radians } from "./types";
import { PRECISION } from "./utils";
import {
vectorAdd,
@@ -15,6 +14,8 @@ import {
vectorSubtract,
} from "./vector";
+import type { GlobalPoint, LineSegment, LocalPoint, Radians } from "./types";
+
/**
* Create a line segment from two points.
*
diff --git a/packages/utils/bbox.ts b/packages/utils/bbox.ts
index 19a1a5430..61c75a668 100644
--- a/packages/utils/bbox.ts
+++ b/packages/utils/bbox.ts
@@ -4,6 +4,7 @@ import {
type GlobalPoint,
type LocalPoint,
} from "@excalidraw/math";
+
import type { Bounds } from "@excalidraw/excalidraw/element/bounds";
export type LineSegment
= [P, P];
diff --git a/packages/utils/collision.test.ts b/packages/utils/collision.test.ts
index 744bea367..24f96e985 100644
--- a/packages/utils/collision.test.ts
+++ b/packages/utils/collision.test.ts
@@ -1,4 +1,3 @@
-import type { Curve, Degrees, GlobalPoint } from "@excalidraw/math";
import {
curve,
degreesToRadians,
@@ -7,7 +6,11 @@ import {
pointFrom,
pointRotateDegs,
} from "@excalidraw/math";
+
+import type { Curve, Degrees, GlobalPoint } from "@excalidraw/math";
+
import { pointOnCurve, pointOnPolyline } from "./collision";
+
import type { Polyline } from "./geometry/shape";
describe("point and curve", () => {
diff --git a/packages/utils/collision.ts b/packages/utils/collision.ts
index fb48f4e45..f90019418 100644
--- a/packages/utils/collision.ts
+++ b/packages/utils/collision.ts
@@ -1,10 +1,3 @@
-import type { Polycurve, Polyline } from "./geometry/shape";
-import {
- pointInEllipse,
- pointOnEllipse,
- type GeometricShape,
-} from "./geometry/shape";
-import type { Curve } from "@excalidraw/math";
import {
lineSegment,
pointFrom,
@@ -17,6 +10,16 @@ import {
type Polygon,
} from "@excalidraw/math";
+import type { Curve } from "@excalidraw/math";
+
+import {
+ pointInEllipse,
+ pointOnEllipse,
+ type GeometricShape,
+} from "./geometry/shape";
+
+import type { Polycurve, Polyline } from "./geometry/shape";
+
// check if the given point is considered on the given shape's border
export const isPointOnShape = (
point: Point,
diff --git a/packages/utils/export.test.ts b/packages/utils/export.test.ts
index e2af763b5..86bbe80b7 100644
--- a/packages/utils/export.test.ts
+++ b/packages/utils/export.test.ts
@@ -1,9 +1,9 @@
-import * as utils from ".";
+import { MIME_TYPES } from "@excalidraw/excalidraw/constants";
+import * as mockedSceneExportUtils from "@excalidraw/excalidraw/scene/export";
import { diagramFactory } from "@excalidraw/excalidraw/tests/fixtures/diagramFixture";
import { vi } from "vitest";
-import * as mockedSceneExportUtils from "@excalidraw/excalidraw/scene/export";
-import { MIME_TYPES } from "@excalidraw/excalidraw/constants";
+import * as utils from ".";
const exportToSvgSpy = vi.spyOn(mockedSceneExportUtils, "exportToSvg");
diff --git a/packages/utils/export.ts b/packages/utils/export.ts
index 22287ce7e..6de25c62b 100644
--- a/packages/utils/export.ts
+++ b/packages/utils/export.ts
@@ -1,23 +1,24 @@
-import {
- exportToCanvas as _exportToCanvas,
- exportToSvg as _exportToSvg,
-} from "@excalidraw/excalidraw/scene/export";
import { getDefaultAppState } from "@excalidraw/excalidraw/appState";
-import type { AppState, BinaryFiles } from "@excalidraw/excalidraw/types";
-import type {
- ExcalidrawElement,
- ExcalidrawFrameLikeElement,
- NonDeleted,
-} from "@excalidraw/excalidraw/element/types";
-import { restore } from "@excalidraw/excalidraw/data/restore";
-import { MIME_TYPES } from "@excalidraw/excalidraw/constants";
-import { encodePngMetadata } from "@excalidraw/excalidraw/data/image";
-import { serializeAsJSON } from "@excalidraw/excalidraw/data/json";
import {
copyBlobToClipboardAsPng,
copyTextToSystemClipboard,
copyToClipboard,
} from "@excalidraw/excalidraw/clipboard";
+import { MIME_TYPES } from "@excalidraw/excalidraw/constants";
+import { encodePngMetadata } from "@excalidraw/excalidraw/data/image";
+import { serializeAsJSON } from "@excalidraw/excalidraw/data/json";
+import { restore } from "@excalidraw/excalidraw/data/restore";
+import {
+ exportToCanvas as _exportToCanvas,
+ exportToSvg as _exportToSvg,
+} from "@excalidraw/excalidraw/scene/export";
+
+import type {
+ ExcalidrawElement,
+ ExcalidrawFrameLikeElement,
+ NonDeleted,
+} from "@excalidraw/excalidraw/element/types";
+import type { AppState, BinaryFiles } from "@excalidraw/excalidraw/types";
export { MIME_TYPES };
diff --git a/packages/utils/geometry/geometry.test.ts b/packages/utils/geometry/geometry.test.ts
index e9ad067fe..6ddab71b0 100644
--- a/packages/utils/geometry/geometry.test.ts
+++ b/packages/utils/geometry/geometry.test.ts
@@ -1,9 +1,3 @@
-import type {
- GlobalPoint,
- LineSegment,
- Polygon,
- Radians,
-} from "@excalidraw/math";
import {
pointFrom,
lineSegment,
@@ -13,6 +7,14 @@ import {
polygonIncludesPoint,
segmentsIntersectAt,
} from "@excalidraw/math";
+
+import type {
+ GlobalPoint,
+ LineSegment,
+ Polygon,
+ Radians,
+} from "@excalidraw/math";
+
import { pointInEllipse, pointOnEllipse, type Ellipse } from "./shape";
describe("point and line", () => {
diff --git a/packages/utils/geometry/shape.ts b/packages/utils/geometry/shape.ts
index 2ba04a2b2..ea3cde3f6 100644
--- a/packages/utils/geometry/shape.ts
+++ b/packages/utils/geometry/shape.ts
@@ -12,7 +12,8 @@
* to pure shapes
*/
-import type { Curve, LineSegment, Polygon, Radians } from "@excalidraw/math";
+import { getElementAbsoluteCoords } from "@excalidraw/excalidraw/element";
+import { invariant } from "@excalidraw/excalidraw/utils";
import {
curve,
lineSegment,
@@ -32,7 +33,8 @@ import {
type GlobalPoint,
type LocalPoint,
} from "@excalidraw/math";
-import { getElementAbsoluteCoords } from "@excalidraw/excalidraw/element";
+import { pointsOnBezierCurves } from "points-on-curve";
+
import type {
ElementsMap,
ExcalidrawBindableElement,
@@ -49,9 +51,9 @@ import type {
ExcalidrawSelectionElement,
ExcalidrawTextElement,
} from "@excalidraw/excalidraw/element/types";
-import { pointsOnBezierCurves } from "points-on-curve";
+import type { Curve, LineSegment, Polygon, Radians } from "@excalidraw/math";
+
import type { Drawable, Op } from "roughjs/bin/core";
-import { invariant } from "@excalidraw/excalidraw/utils";
// a polyline (made up term here) is a line consisting of other line segments
// this corresponds to a straight line element in the editor but it could also
@@ -192,6 +194,11 @@ export const getEllipseShape = (
};
export const getCurvePathOps = (shape: Drawable): Op[] => {
+ // NOTE (mtolmacs): Temporary fix for extremely large elements
+ if (!shape) {
+ return [];
+ }
+
for (const set of shape.sets) {
if (set.type === "path") {
return set.ops;
diff --git a/packages/utils/utils.unmocked.test.ts b/packages/utils/utils.unmocked.test.ts
index 341adef95..417eabda1 100644
--- a/packages/utils/utils.unmocked.test.ts
+++ b/packages/utils/utils.unmocked.test.ts
@@ -1,8 +1,10 @@
-import type { ImportedDataState } from "@excalidraw/excalidraw/data/types";
-import * as utils from "./index";
-import { API } from "@excalidraw/excalidraw/tests/helpers/api";
-import { decodeSvgBase64Payload } from "@excalidraw/excalidraw/scene/export";
import { decodePngMetadata } from "@excalidraw/excalidraw/data/image";
+import { decodeSvgBase64Payload } from "@excalidraw/excalidraw/scene/export";
+import { API } from "@excalidraw/excalidraw/tests/helpers/api";
+
+import type { ImportedDataState } from "@excalidraw/excalidraw/data/types";
+
+import * as utils from "./index";
// NOTE this test file is using the actual API, unmocked. Hence splitting it
// from the other test file, because I couldn't figure out how to test
diff --git a/packages/utils/withinBounds.test.ts b/packages/utils/withinBounds.test.ts
index 85354d742..b07d0bc33 100644
--- a/packages/utils/withinBounds.test.ts
+++ b/packages/utils/withinBounds.test.ts
@@ -1,5 +1,7 @@
-import type { Bounds } from "@excalidraw/excalidraw/element/bounds";
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
+
+import type { Bounds } from "@excalidraw/excalidraw/element/bounds";
+
import {
elementPartiallyOverlapsWithOrContainsBBox,
elementsOverlappingBBox,
diff --git a/packages/utils/withinBounds.ts b/packages/utils/withinBounds.ts
index 8d52eb3ad..71bc78969 100644
--- a/packages/utils/withinBounds.ts
+++ b/packages/utils/withinBounds.ts
@@ -1,9 +1,4 @@
-import type {
- ExcalidrawElement,
- ExcalidrawFreeDrawElement,
- ExcalidrawLinearElement,
- NonDeletedExcalidrawElement,
-} from "@excalidraw/excalidraw/element/types";
+import { getElementBounds } from "@excalidraw/excalidraw/element/bounds";
import {
isArrowElement,
isExcalidrawElement,
@@ -11,10 +6,7 @@ import {
isLinearElement,
isTextElement,
} from "@excalidraw/excalidraw/element/typeChecks";
-import type { Bounds } from "@excalidraw/excalidraw/element/bounds";
-import { getElementBounds } from "@excalidraw/excalidraw/element/bounds";
import { arrayToMap } from "@excalidraw/excalidraw/utils";
-import type { LocalPoint } from "@excalidraw/math";
import {
rangeIncludesValue,
pointFrom,
@@ -22,6 +14,15 @@ import {
rangeInclusive,
} from "@excalidraw/math";
+import type { Bounds } from "@excalidraw/excalidraw/element/bounds";
+import type {
+ ExcalidrawElement,
+ ExcalidrawFreeDrawElement,
+ ExcalidrawLinearElement,
+ NonDeletedExcalidrawElement,
+} from "@excalidraw/excalidraw/element/types";
+import type { LocalPoint } from "@excalidraw/math";
+
type Element = NonDeletedExcalidrawElement;
type Elements = readonly NonDeletedExcalidrawElement[];
diff --git a/scripts/autorelease.js b/scripts/autorelease.js
index f506cf13c..6ca5af213 100644
--- a/scripts/autorelease.js
+++ b/scripts/autorelease.js
@@ -1,5 +1,6 @@
-const fs = require("fs");
const { exec, execSync } = require("child_process");
+const fs = require("fs");
+
const core = require("@actions/core");
const excalidrawDir = `${__dirname}/../packages/excalidraw`;
diff --git a/scripts/buildMath.js b/scripts/buildMath.js
index fd2f820ea..ba421b48c 100644
--- a/scripts/buildMath.js
+++ b/scripts/buildMath.js
@@ -1,4 +1,5 @@
const path = require("path");
+
const { build } = require("esbuild");
const { sassPlugin } = require("esbuild-sass-plugin");
diff --git a/scripts/buildPackage.js b/scripts/buildPackage.js
index 653af50f2..3dd15eeca 100644
--- a/scripts/buildPackage.js
+++ b/scripts/buildPackage.js
@@ -1,6 +1,8 @@
const path = require("path");
+
const { build } = require("esbuild");
const { sassPlugin } = require("esbuild-sass-plugin");
+
const { parseEnvVariables } = require("../packages/excalidraw/env.cjs");
const ENV_VARS = {
diff --git a/scripts/buildUtils.js b/scripts/buildUtils.js
index 65b947385..b5718f57e 100644
--- a/scripts/buildUtils.js
+++ b/scripts/buildUtils.js
@@ -1,6 +1,8 @@
const path = require("path");
+
const { build } = require("esbuild");
const { sassPlugin } = require("esbuild-sass-plugin");
+
const { woff2ServerPlugin } = require("./woff2/woff2-esbuild-plugins");
// contains all dependencies bundled inside
diff --git a/scripts/prerelease.js b/scripts/prerelease.js
index 3b8080d33..005a6cf5f 100644
--- a/scripts/prerelease.js
+++ b/scripts/prerelease.js
@@ -1,5 +1,6 @@
const fs = require("fs");
const util = require("util");
+
const exec = util.promisify(require("child_process").exec);
const updateChangelog = require("./updateChangelog");
diff --git a/scripts/woff2/woff2-esbuild-plugins.js b/scripts/woff2/woff2-esbuild-plugins.js
index 19ebafc93..2116dd059 100644
--- a/scripts/woff2/woff2-esbuild-plugins.js
+++ b/scripts/woff2/woff2-esbuild-plugins.js
@@ -1,9 +1,10 @@
+const { execSync } = require("child_process");
const fs = require("fs");
const path = require("path");
-const { execSync } = require("child_process");
-const which = require("which");
-const wawoff = require("wawoff2");
+
const { Font } = require("fonteditor-core");
+const wawoff = require("wawoff2");
+const which = require("which");
/**
* Custom esbuild plugin to:
diff --git a/setupTests.ts b/setupTests.ts
index 20d2cc517..2aec616b4 100644
--- a/setupTests.ts
+++ b/setupTests.ts
@@ -1,11 +1,13 @@
+import fs from "fs";
+
// vitest.setup.ts
import "vitest-canvas-mock";
import "@testing-library/jest-dom";
-import fs from "fs";
import { vi } from "vitest";
+
import polyfill from "./packages/excalidraw/polyfill";
-import { testPolyfills } from "./packages/excalidraw/tests/helpers/polyfills";
import { yellow } from "./packages/excalidraw/tests/helpers/colorize";
+import { testPolyfills } from "./packages/excalidraw/tests/helpers/polyfills";
// mock for pep.js not working with setPointerCapture()
HTMLElement.prototype.setPointerCapture = vi.fn();
diff --git a/yarn.lock b/yarn.lock
index d1c522a91..ccd0827fb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1442,43 +1442,6 @@
resolved "https://registry.yarnpkg.com/@excalidraw/eslint-config/-/eslint-config-1.0.3.tgz#2122ef7413ae77874ae9848ce0f1c6b3f0d8bbbd"
integrity sha512-GemHNF5Z6ga0BWBSX7GJaNBUchLu6RwTcAB84eX1MeckRNhNasAsPCdelDlFalz27iS4RuYEQh0bPE8SRxJgbQ==
-"@excalidraw/excalidraw@0.18.0-rc.5":
- version "0.18.0-rc.5"
- resolved "https://registry.yarnpkg.com/@excalidraw/excalidraw/-/excalidraw-0.18.0-rc.5.tgz#c55598e01808693702251322e59bf9dba931b6e0"
- integrity sha512-f6Z6cWlx+FWl1nxCu5F6OdKm9ooV/FPjndjIfFhGLVyERKATXhuNwZUHWwqsEW+SIGmiPG2515NG9KIOhjGd5g==
- dependencies:
- "@braintree/sanitize-url" "6.0.2"
- "@excalidraw/laser-pointer" "1.3.1"
- "@excalidraw/mermaid-to-excalidraw" "1.1.2"
- "@excalidraw/random-username" "1.1.0"
- "@radix-ui/react-popover" "1.0.3"
- "@radix-ui/react-tabs" "1.0.2"
- browser-fs-access "0.29.1"
- canvas-roundrect-polyfill "0.0.1"
- clsx "1.1.1"
- cross-env "7.0.3"
- es6-promise-pool "2.5.0"
- fractional-indexing "3.2.0"
- fuzzy "0.1.3"
- image-blob-reduce "3.0.1"
- jotai "2.11.0"
- jotai-scope "0.7.2"
- lodash.debounce "4.0.8"
- lodash.throttle "4.1.1"
- nanoid "3.3.3"
- open-color "1.9.1"
- pako "2.0.3"
- perfect-freehand "1.2.0"
- pica "7.1.1"
- png-chunk-text "1.0.0"
- png-chunks-encode "1.0.0"
- png-chunks-extract "1.0.0"
- points-on-curve "1.0.1"
- pwacompat "2.0.17"
- roughjs "4.6.4"
- sass "1.51.0"
- tunnel-rat "0.1.2"
-
"@excalidraw/laser-pointer@1.3.1":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@excalidraw/laser-pointer/-/laser-pointer-1.3.1.tgz#7c40836598e8e6ad91f01057883ed8b88fb9266c"
@@ -1904,11 +1867,6 @@
resolved "https://registry.yarnpkg.com/@firebase/webchannel-wrapper/-/webchannel-wrapper-1.0.3.tgz#a73bab8eb491d7b8b7be2f0e6c310647835afe83"
integrity sha512-2xCRM9q9FlzGZCdgDMJwc0gyUkWFtkosy7Xxr6sFgQwn+wMNIWd7xIvYNauU1r64B5L5rsGKy/n9TKJ0aAFeqQ==
-"@floating-ui/core@^0.7.3":
- version "0.7.3"
- resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-0.7.3.tgz#d274116678ffae87f6b60e90f88cc4083eefab86"
- integrity sha512-buc8BXHmG9l82+OQXOFU3Kr2XQx9ys01U/Q9HMIrZ300iLc8HLMgh7dcCqgYzAzf4BkoQvDcXf5Y+CuEZ5JBYg==
-
"@floating-ui/core@^1.6.0":
version "1.6.9"
resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.6.9.tgz#64d1da251433019dafa091de9b2886ff35ec14e6"
@@ -1916,13 +1874,6 @@
dependencies:
"@floating-ui/utils" "^0.2.9"
-"@floating-ui/dom@^0.5.3":
- version "0.5.4"
- resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-0.5.4.tgz#4eae73f78bcd4bd553ae2ade30e6f1f9c73fe3f1"
- integrity sha512-419BMceRLq0RrmTSDxn8hf9R3VCJv2K9PUfugh5JyEFmdjzDo+e8U5EdR8nzKq8Yj1htzLm3b6eQEEam3/rrtg==
- dependencies:
- "@floating-ui/core" "^0.7.3"
-
"@floating-ui/dom@^1.0.0":
version "1.6.13"
resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.6.13.tgz#a8a938532aea27a95121ec16e667a7cbe8c59e34"
@@ -1931,14 +1882,6 @@
"@floating-ui/core" "^1.6.0"
"@floating-ui/utils" "^0.2.9"
-"@floating-ui/react-dom@0.7.2":
- version "0.7.2"
- resolved "https://registry.yarnpkg.com/@floating-ui/react-dom/-/react-dom-0.7.2.tgz#0bf4ceccb777a140fc535c87eb5d6241c8e89864"
- integrity sha512-1T0sJcpHgX/u4I1OzIEhlcrvkUN8ln39nz7fMoE/2HDHrPiMFoOGR7++GYyfUmIQHkkrTinaeQsO3XWubjSvGg==
- dependencies:
- "@floating-ui/dom" "^0.5.3"
- use-isomorphic-layout-effect "^1.1.1"
-
"@floating-ui/react-dom@^2.0.0":
version "2.1.2"
resolved "https://registry.yarnpkg.com/@floating-ui/react-dom/-/react-dom-2.1.2.tgz#a1349bbf6a0e5cb5ded55d023766f20a4d439a31"
@@ -2289,14 +2232,6 @@
resolved "https://registry.yarnpkg.com/@radix-ui/primitive/-/primitive-1.1.1.tgz#fc169732d755c7fbad33ba8d0cd7fd10c90dc8e3"
integrity sha512-SJ31y+Q/zAyShtXJc8x83i9TYdbAfHZ++tUZnvjJJqFjzsdUnKsxPL6IEtBlxKkU7yzer//GQtZSV4GbldL3YA==
-"@radix-ui/react-arrow@1.0.1":
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/@radix-ui/react-arrow/-/react-arrow-1.0.1.tgz#5246adf79e97f89e819af68da51ddcf349ecf1c4"
- integrity sha512-1yientwXqXcErDHEv8av9ZVNEBldH8L9scVR3is20lL+jOCfcJyMFZFEY5cgIrgexsq1qggSXqiEL/d/4f+QXA==
- dependencies:
- "@babel/runtime" "^7.13.10"
- "@radix-ui/react-primitive" "1.0.1"
-
"@radix-ui/react-arrow@1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@radix-ui/react-arrow/-/react-arrow-1.1.2.tgz#30c0d574d7bb10eed55cd7007b92d38b03c6b2ab"
@@ -2346,18 +2281,6 @@
dependencies:
"@babel/runtime" "^7.13.10"
-"@radix-ui/react-dismissable-layer@1.0.2":
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.0.2.tgz#f04d1061bddf00b1ca304148516b9ddc62e45fb2"
- integrity sha512-WjJzMrTWROozDqLB0uRWYvj4UuXsM/2L19EmQ3Au+IJWqwvwq9Bwd+P8ivo0Deg9JDPArR1I6MbWNi1CmXsskg==
- dependencies:
- "@babel/runtime" "^7.13.10"
- "@radix-ui/primitive" "1.0.0"
- "@radix-ui/react-compose-refs" "1.0.0"
- "@radix-ui/react-primitive" "1.0.1"
- "@radix-ui/react-use-callback-ref" "1.0.0"
- "@radix-ui/react-use-escape-keydown" "1.0.2"
-
"@radix-ui/react-dismissable-layer@1.1.5":
version "1.1.5"
resolved "https://registry.yarnpkg.com/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.5.tgz#96dde2be078c694a621e55e047406c58cd5fe774"
@@ -2369,28 +2292,11 @@
"@radix-ui/react-use-callback-ref" "1.1.0"
"@radix-ui/react-use-escape-keydown" "1.1.0"
-"@radix-ui/react-focus-guards@1.0.0":
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/@radix-ui/react-focus-guards/-/react-focus-guards-1.0.0.tgz#339c1c69c41628c1a5e655f15f7020bf11aa01fa"
- integrity sha512-UagjDk4ijOAnGu4WMUPj9ahi7/zJJqNZ9ZAiGPp7waUWJO0O1aWXi/udPphI0IUjvrhBsZJGSN66dR2dsueLWQ==
- dependencies:
- "@babel/runtime" "^7.13.10"
-
"@radix-ui/react-focus-guards@1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@radix-ui/react-focus-guards/-/react-focus-guards-1.1.1.tgz#8635edd346304f8b42cae86b05912b61aef27afe"
integrity sha512-pSIwfrT1a6sIoDASCSpFwOasEwKTZWDw/iBdtnqKO7v6FeOzYJ7U53cPzYFVR3geGGXgVHaH+CdngrrAzqUGxg==
-"@radix-ui/react-focus-scope@1.0.1":
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/@radix-ui/react-focus-scope/-/react-focus-scope-1.0.1.tgz#faea8c25f537c5a5c38c50914b63722db0e7f951"
- integrity sha512-Ej2MQTit8IWJiS2uuujGUmxXjF/y5xZptIIQnyd2JHLwtV0R2j9NRVoRj/1j/gJ7e3REdaBw4Hjf4a1ImhkZcQ==
- dependencies:
- "@babel/runtime" "^7.13.10"
- "@radix-ui/react-compose-refs" "1.0.0"
- "@radix-ui/react-primitive" "1.0.1"
- "@radix-ui/react-use-callback-ref" "1.0.0"
-
"@radix-ui/react-focus-scope@1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.2.tgz#c0a4519cd95c772606a82fc5b96226cd7fdd2602"
@@ -2415,28 +2321,6 @@
dependencies:
"@radix-ui/react-use-layout-effect" "1.1.0"
-"@radix-ui/react-popover@1.0.3":
- version "1.0.3"
- resolved "https://registry.yarnpkg.com/@radix-ui/react-popover/-/react-popover-1.0.3.tgz#65ae2ee1fca2d7fd750308549eb8e0857c6160fe"
- integrity sha512-YwedSukfWsyJs3/yP3yXUq44k4/JBe3jqU63Z8v2i19qZZ3dsx32oma17ztgclWPNuqp3A+Xa9UiDlZHyVX8Vg==
- dependencies:
- "@babel/runtime" "^7.13.10"
- "@radix-ui/primitive" "1.0.0"
- "@radix-ui/react-compose-refs" "1.0.0"
- "@radix-ui/react-context" "1.0.0"
- "@radix-ui/react-dismissable-layer" "1.0.2"
- "@radix-ui/react-focus-guards" "1.0.0"
- "@radix-ui/react-focus-scope" "1.0.1"
- "@radix-ui/react-id" "1.0.0"
- "@radix-ui/react-popper" "1.1.0"
- "@radix-ui/react-portal" "1.0.1"
- "@radix-ui/react-presence" "1.0.0"
- "@radix-ui/react-primitive" "1.0.1"
- "@radix-ui/react-slot" "1.0.1"
- "@radix-ui/react-use-controllable-state" "1.0.0"
- aria-hidden "^1.1.1"
- react-remove-scroll "2.5.5"
-
"@radix-ui/react-popover@1.1.6":
version "1.1.6"
resolved "https://registry.yarnpkg.com/@radix-ui/react-popover/-/react-popover-1.1.6.tgz#699634dbc7899429f657bb590d71fb3ca0904087"
@@ -2458,23 +2342,6 @@
aria-hidden "^1.2.4"
react-remove-scroll "^2.6.3"
-"@radix-ui/react-popper@1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@radix-ui/react-popper/-/react-popper-1.1.0.tgz#2be7e4c0cd4581f54277ca33a981c9037d2a8e60"
- integrity sha512-07U7jpI0dZcLRAxT7L9qs6HecSoPhDSJybF7mEGHJDBDv+ZoGCvIlva0s+WxMXwJEav+ckX3hAlXBtnHmuvlCQ==
- dependencies:
- "@babel/runtime" "^7.13.10"
- "@floating-ui/react-dom" "0.7.2"
- "@radix-ui/react-arrow" "1.0.1"
- "@radix-ui/react-compose-refs" "1.0.0"
- "@radix-ui/react-context" "1.0.0"
- "@radix-ui/react-primitive" "1.0.1"
- "@radix-ui/react-use-callback-ref" "1.0.0"
- "@radix-ui/react-use-layout-effect" "1.0.0"
- "@radix-ui/react-use-rect" "1.0.0"
- "@radix-ui/react-use-size" "1.0.0"
- "@radix-ui/rect" "1.0.0"
-
"@radix-ui/react-popper@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@radix-ui/react-popper/-/react-popper-1.2.2.tgz#d2e1ee5a9b24419c5936a1b7f6f472b7b412b029"
@@ -2491,14 +2358,6 @@
"@radix-ui/react-use-size" "1.1.0"
"@radix-ui/rect" "1.1.0"
-"@radix-ui/react-portal@1.0.1":
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/@radix-ui/react-portal/-/react-portal-1.0.1.tgz#169c5a50719c2bb0079cf4c91a27aa6d37e5dd33"
- integrity sha512-NY2vUWI5WENgAT1nfC6JS7RU5xRYBfjZVLq0HmgEN1Ezy3rk/UruMV4+Rd0F40PEaFC5SrLS1ixYvcYIQrb4Ig==
- dependencies:
- "@babel/runtime" "^7.13.10"
- "@radix-ui/react-primitive" "1.0.1"
-
"@radix-ui/react-portal@1.1.4":
version "1.1.4"
resolved "https://registry.yarnpkg.com/@radix-ui/react-portal/-/react-portal-1.1.4.tgz#ff5401ff63c8a825c46eea96d3aef66074b8c0c8"
@@ -2612,14 +2471,6 @@
dependencies:
"@radix-ui/react-use-callback-ref" "1.1.0"
-"@radix-ui/react-use-escape-keydown@1.0.2":
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.0.2.tgz#09ab6455ab240b4f0a61faf06d4e5132c4d639f6"
- integrity sha512-DXGim3x74WgUv+iMNCF+cAo8xUHHeqvjx8zs7trKf+FkQKPQXLk2sX7Gx1ysH7Q76xCpZuxIJE7HLPxRE+Q+GA==
- dependencies:
- "@babel/runtime" "^7.13.10"
- "@radix-ui/react-use-callback-ref" "1.0.0"
-
"@radix-ui/react-use-escape-keydown@1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@radix-ui/react-use-escape-keydown/-/react-use-escape-keydown-1.1.0.tgz#31a5b87c3b726504b74e05dac1edce7437b98754"
@@ -2639,14 +2490,6 @@
resolved "https://registry.yarnpkg.com/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.0.tgz#3c2c8ce04827b26a39e442ff4888d9212268bd27"
integrity sha512-+FPE0rOdziWSrH9athwI1R0HDVbWlEhd+FR+aSDk4uWGmSJ9Z54sdZVDQPZAinJhJXwfT+qnj969mCsT2gfm5w==
-"@radix-ui/react-use-rect@1.0.0":
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/@radix-ui/react-use-rect/-/react-use-rect-1.0.0.tgz#b040cc88a4906b78696cd3a32b075ed5b1423b3e"
- integrity sha512-TB7pID8NRMEHxb/qQJpvSt3hQU4sqNPM1VCTjTRjEOa7cEop/QMuq8S6fb/5Tsz64kqSvB9WnwsDHtjnrM9qew==
- dependencies:
- "@babel/runtime" "^7.13.10"
- "@radix-ui/rect" "1.0.0"
-
"@radix-ui/react-use-rect@1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@radix-ui/react-use-rect/-/react-use-rect-1.1.0.tgz#13b25b913bd3e3987cc9b073a1a164bb1cf47b88"
@@ -2654,14 +2497,6 @@
dependencies:
"@radix-ui/rect" "1.1.0"
-"@radix-ui/react-use-size@1.0.0":
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/@radix-ui/react-use-size/-/react-use-size-1.0.0.tgz#a0b455ac826749419f6354dc733e2ca465054771"
- integrity sha512-imZ3aYcoYCKhhgNpkNDh/aTiU05qw9hX+HHI1QDBTyIlcFjgeFlKKySNGMwTp7nYFLQg/j0VA2FmCY4WPDDHMg==
- dependencies:
- "@babel/runtime" "^7.13.10"
- "@radix-ui/react-use-layout-effect" "1.0.0"
-
"@radix-ui/react-use-size@1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@radix-ui/react-use-size/-/react-use-size-1.1.0.tgz#b4dba7fbd3882ee09e8d2a44a3eed3a7e555246b"
@@ -2669,13 +2504,6 @@
dependencies:
"@radix-ui/react-use-layout-effect" "1.1.0"
-"@radix-ui/rect@1.0.0":
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/@radix-ui/rect/-/rect-1.0.0.tgz#0dc8e6a829ea2828d53cbc94b81793ba6383bf3c"
- integrity sha512-d0O68AYy/9oeEy1DdC07bz1/ZXX+DqCskRd3i4JzLSTXwefzaepQrKjXC7aNM8lTHjFLDO0pDgaEiQ7jEk+HVg==
- dependencies:
- "@babel/runtime" "^7.13.10"
-
"@radix-ui/rect@1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@radix-ui/rect/-/rect-1.1.0.tgz#f817d1d3265ac5415dadc67edab30ae196696438"
@@ -3191,7 +3019,14 @@
resolved "https://registry.yarnpkg.com/@types/ms/-/ms-2.1.0.tgz#052aa67a48eccc4309d7f0191b7e41434b90bb78"
integrity sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==
-"@types/node@*", "@types/node@>=12.12.47", "@types/node@>=13.7.0":
+"@types/node@*":
+ version "22.13.10"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-22.13.10.tgz#df9ea358c5ed991266becc3109dc2dc9125d77e4"
+ integrity sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==
+ dependencies:
+ undici-types "~6.20.0"
+
+"@types/node@>=12.12.47", "@types/node@>=13.7.0":
version "22.13.8"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.13.8.tgz#57e2450295b33a6518d6fd4f65f47236d3e41d8d"
integrity sha512-G3EfaZS+iOGYWLLRCEAXdWK9my08oHNZ+FHluRiggIYJPOXzhOiDgpVCUHaUvyIC5/fj7C/p637jdzC666AOKQ==
@@ -3638,7 +3473,12 @@ acorn@^7.4.0:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==
-acorn@^8.14.0, acorn@^8.8.2:
+acorn@^8.14.0:
+ version "8.14.1"
+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.1.tgz#721d5dc10f7d5b5609a891773d47731796935dfb"
+ integrity sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==
+
+acorn@^8.8.2:
version "8.14.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.0.tgz#063e2c70cac5fb4f6467f0b11152e04c682795b0"
integrity sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==
@@ -3758,7 +3598,7 @@ argparse@^2.0.1:
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
-aria-hidden@^1.1.1, aria-hidden@^1.2.4:
+aria-hidden@^1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/aria-hidden/-/aria-hidden-1.2.4.tgz#b78e383fdbc04d05762c78b4a25a501e736c4522"
integrity sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==
@@ -4177,7 +4017,12 @@ camelcase@^6.2.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a"
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
-caniuse-lite@^1.0.30001335, caniuse-lite@^1.0.30001579, caniuse-lite@^1.0.30001688:
+caniuse-lite@^1.0.30001335:
+ version "1.0.30001703"
+ resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001703.tgz#977cb4920598c158f491ecf4f4f2cfed9e354718"
+ integrity sha512-kRlAGTRWgPsOj7oARC9m1okJEXdL/8fekFVcxA8Hl7GH4r/sN4OJn/i6Flde373T50KS7Y37oFbMwlE8+F42kQ==
+
+caniuse-lite@^1.0.30001579, caniuse-lite@^1.0.30001688:
version "1.0.30001701"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001701.tgz#ad9c90301f7153cf6b3314d16cc30757285bf9e7"
integrity sha512-faRs/AW3jA9nTwmJBSO1PQ6L/EOgsB5HMQQq4iCu5zhPgVVgO/pZRHlmatwijZKetFw8/Pr4q6dEN8sJuq8qTw==
@@ -4912,9 +4757,9 @@ decimal.js@^10.4.3:
integrity sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw==
decode-named-character-reference@^1.0.0:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz#daabac9690874c394c81e4162a0304b35d824f0e"
- integrity sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/decode-named-character-reference/-/decode-named-character-reference-1.1.0.tgz#5d6ce68792808901210dac42a8e9853511e2b8bf"
+ integrity sha512-Wy+JTSbFThEOXQIR2L6mxJvEs+veIzpmqD7ynWxMXGpnk3smkHQOp6forLdHsKpAMW9iJpaBBIxz285t1n1C3w==
dependencies:
character-entities "^2.0.0"
@@ -5509,7 +5354,7 @@ eslint-plugin-flowtype@^8.0.3:
lodash "^4.17.21"
string-natural-compare "^3.0.1"
-eslint-plugin-import@^2.25.3:
+eslint-plugin-import@2.31.0, eslint-plugin-import@^2.25.3:
version "2.31.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz#310ce7e720ca1d9c0bb3f69adfd1c6bdd7d9e0e7"
integrity sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==
@@ -7636,7 +7481,12 @@ nanoid@4.0.2:
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-4.0.2.tgz#140b3c5003959adbebf521c170f282c5e7f9fb9e"
integrity sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw==
-nanoid@^3.3.2, nanoid@^3.3.6, nanoid@^3.3.8:
+nanoid@^3.3.2:
+ version "3.3.9"
+ resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.9.tgz#e0097d8e026b3343ff053e9ccd407360a03f503a"
+ integrity sha512-SppoicMGpZvbF1l3z4x7No3OlIjP7QJvC9XR7AhZr1kL133KHnKPztkKDc+Ir4aJ/1VhTySrtKhrsycmrMQfvg==
+
+nanoid@^3.3.6, nanoid@^3.3.8:
version "3.3.8"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.8.tgz#b1be3030bee36aaff18bacb375e5cce521684baf"
integrity sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==
@@ -8320,7 +8170,7 @@ react-refresh@^0.14.0:
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.14.2.tgz#3833da01ce32da470f1f936b9d477da5c7028bf9"
integrity sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==
-react-remove-scroll-bar@^2.3.3, react-remove-scroll-bar@^2.3.7:
+react-remove-scroll-bar@^2.3.7:
version "2.3.8"
resolved "https://registry.yarnpkg.com/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.8.tgz#99c20f908ee467b385b68a3469b4a3e750012223"
integrity sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q==
@@ -8328,17 +8178,6 @@ react-remove-scroll-bar@^2.3.3, react-remove-scroll-bar@^2.3.7:
react-style-singleton "^2.2.2"
tslib "^2.0.0"
-react-remove-scroll@2.5.5:
- version "2.5.5"
- resolved "https://registry.yarnpkg.com/react-remove-scroll/-/react-remove-scroll-2.5.5.tgz#1e31a1260df08887a8a0e46d09271b52b3a37e77"
- integrity sha512-ImKhrzJJsyXJfBZ4bzu8Bwpka14c/fQt0k+cyFp/PBhTfyDnU5hjOtM4AG/0AMyy8oKzOTR0lDgJIM7pYXI0kw==
- dependencies:
- react-remove-scroll-bar "^2.3.3"
- react-style-singleton "^2.2.1"
- tslib "^2.1.0"
- use-callback-ref "^1.3.0"
- use-sidecar "^1.1.2"
-
react-remove-scroll@^2.6.3:
version "2.6.3"
resolved "https://registry.yarnpkg.com/react-remove-scroll/-/react-remove-scroll-2.6.3.tgz#df02cde56d5f2731e058531f8ffd7f9adec91ac2"
@@ -8350,7 +8189,7 @@ react-remove-scroll@^2.6.3:
use-callback-ref "^1.3.3"
use-sidecar "^1.1.3"
-react-style-singleton@^2.2.1, react-style-singleton@^2.2.2, react-style-singleton@^2.2.3:
+react-style-singleton@^2.2.2, react-style-singleton@^2.2.3:
version "2.2.3"
resolved "https://registry.yarnpkg.com/react-style-singleton/-/react-style-singleton-2.2.3.tgz#4265608be69a4d70cfe3047f2c6c88b2c3ace388"
integrity sha512-b6jSvxvVnyptAiLjbkWLE/lOnR4lfTtDAl+eUC7RZy+QQWc6wRzIV2CE6xBuMmDxc2qIihtDCZD5NPOFl7fRBQ==
@@ -9270,9 +9109,9 @@ tempy@^0.6.0:
unique-string "^2.0.0"
terser-webpack-plugin@^5.3.11:
- version "5.3.12"
- resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.12.tgz#d9518c80493081bace668aa8613b22e4a838810c"
- integrity sha512-jDLYqo7oF8tJIttjXO6jBY5Hk8p3A8W4ttih7cCEq64fQFWmgJ4VqAQjKr7WwIDlmXKEc6QeoRb5ecjZ+2afcg==
+ version "5.3.14"
+ resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz#9031d48e57ab27567f02ace85c7d690db66c3e06"
+ integrity sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==
dependencies:
"@jridgewell/trace-mapping" "^0.3.25"
jest-worker "^27.4.5"
@@ -9650,19 +9489,14 @@ url-parse@^1.5.3:
querystringify "^2.1.1"
requires-port "^1.0.0"
-use-callback-ref@^1.3.0, use-callback-ref@^1.3.3:
+use-callback-ref@^1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/use-callback-ref/-/use-callback-ref-1.3.3.tgz#98d9fab067075841c5b2c6852090d5d0feabe2bf"
integrity sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg==
dependencies:
tslib "^2.0.0"
-use-isomorphic-layout-effect@^1.1.1:
- version "1.2.0"
- resolved "https://registry.yarnpkg.com/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.2.0.tgz#afb292eb284c39219e8cb8d3d62d71999361a21d"
- integrity sha512-q6ayo8DWoPZT0VdG4u3D3uxcgONP3Mevx2i2b0434cwWBoL+aelL1DzkXI6w3PhTZzUeR2kaVlZn70iCiseP6w==
-
-use-sidecar@^1.1.2, use-sidecar@^1.1.3:
+use-sidecar@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/use-sidecar/-/use-sidecar-1.1.3.tgz#10e7fd897d130b896e2c546c63a5e8233d00efdb"
integrity sha512-Fedw0aZvkhynoPYlA5WXrMCAMm+nSWdZt6lzJQ7Ok8S6Q+VsHmHpRWndVRJ8Be0ZbkfPc5LRYH+5XrzXcEeLRQ==