mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
chore: release @excalidraw/excalidraw@18.0.0 🎉 (#9127)
This commit is contained in:
parent
392118bf26
commit
ecef5d12f4
232 changed files with 3412 additions and 2851 deletions
|
@ -7,7 +7,7 @@ import { API } from "./helpers/api";
|
|||
import { KEYS } from "../keys";
|
||||
import { actionWrapTextInContainer } from "../actions/actionBoundText";
|
||||
import { arrayToMap } from "../utils";
|
||||
import { pointFrom } from "../../math";
|
||||
import { pointFrom } from "@excalidraw/math";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
|
|
@ -314,6 +314,7 @@ describe("Cropping and other features", async () => {
|
|||
|
||||
const canvas = await exportToCanvas({
|
||||
elements: [image],
|
||||
// @ts-ignore
|
||||
appState: h.state,
|
||||
files: h.app.files,
|
||||
exportPadding: 0,
|
||||
|
@ -324,6 +325,7 @@ describe("Cropping and other features", async () => {
|
|||
|
||||
const svg = await exportToSvg({
|
||||
elements: [image],
|
||||
// @ts-ignore
|
||||
appState: h.state,
|
||||
files: h.app.files,
|
||||
exportPadding: 0,
|
||||
|
|
|
@ -13,7 +13,7 @@ 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 "../../../math";
|
||||
import { pointFrom } from "@excalidraw/math";
|
||||
|
||||
describe("restoreElements", () => {
|
||||
const mockSizeHelper = vi.spyOn(sizeHelpers, "isInvisiblySmallElement");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Radians } from "../../../math";
|
||||
import type { Radians } from "@excalidraw/math";
|
||||
import { DEFAULT_FONT_FAMILY } from "../../constants";
|
||||
import type { ExcalidrawElement } from "../../element/types";
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ import { KEYS } from "../keys";
|
|||
import { getBoundTextElementPosition } from "../element/textElement";
|
||||
import { createPasteEvent } from "../clipboard";
|
||||
import { arrayToMap, cloneJSON } from "../utils";
|
||||
import type { LocalPoint } from "../../math";
|
||||
import { pointFrom, type Radians } from "../../math";
|
||||
import type { LocalPoint } from "@excalidraw/math";
|
||||
import { pointFrom, type Radians } from "@excalidraw/math";
|
||||
|
||||
const { h } = window;
|
||||
const mouse = new Pointer("mouse");
|
||||
|
|
|
@ -39,7 +39,7 @@ 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 "../../../math";
|
||||
import { pointFrom, type LocalPoint, type Radians } from "@excalidraw/math";
|
||||
import { selectGroupsForSelectedElements } from "../../groups";
|
||||
|
||||
const readFile = util.promisify(fs.readFile);
|
||||
|
|
|
@ -33,8 +33,8 @@ 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 "../../../math";
|
||||
import { pointFrom, pointRotateRads } from "../../../math";
|
||||
import type { GlobalPoint, LocalPoint, Radians } from "@excalidraw/math";
|
||||
import { pointFrom, pointRotateRads } from "@excalidraw/math";
|
||||
import { cropElement } from "../../element/cropElement";
|
||||
import type { ToolType } from "../../types";
|
||||
|
||||
|
|
|
@ -46,9 +46,9 @@ import { vi } from "vitest";
|
|||
import { queryByText } from "@testing-library/react";
|
||||
import { HistoryEntry } from "../history";
|
||||
import { AppStateChange, ElementsChange } from "../change";
|
||||
import { Snapshot, StoreAction } from "../store";
|
||||
import type { LocalPoint, Radians } from "../../math";
|
||||
import { pointFrom } from "../../math";
|
||||
import { Snapshot, CaptureUpdateAction } from "../store";
|
||||
import type { LocalPoint, Radians } from "@excalidraw/math";
|
||||
import { pointFrom } from "@excalidraw/math";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
@ -182,7 +182,7 @@ describe("history", () => {
|
|||
|
||||
API.updateScene({
|
||||
elements: [rect1, rect2],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
expect(API.getUndoStack().length).toBe(1);
|
||||
|
@ -194,7 +194,7 @@ describe("history", () => {
|
|||
|
||||
API.updateScene({
|
||||
elements: [rect1, rect2],
|
||||
storeAction: StoreAction.CAPTURE, // even though the flag is on, same elements are passed, nothing to commit
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY, // even though the flag is on, same elements are passed, nothing to commit
|
||||
});
|
||||
expect(API.getUndoStack().length).toBe(1);
|
||||
expect(API.getRedoStack().length).toBe(0);
|
||||
|
@ -562,7 +562,7 @@ describe("history", () => {
|
|||
appState: {
|
||||
name: "New name",
|
||||
},
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
expect(API.getUndoStack().length).toBe(1);
|
||||
|
@ -573,7 +573,7 @@ describe("history", () => {
|
|||
appState: {
|
||||
viewBackgroundColor: "#000",
|
||||
},
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
expect(API.getUndoStack().length).toBe(2);
|
||||
expect(API.getRedoStack().length).toBe(0);
|
||||
|
@ -586,7 +586,7 @@ describe("history", () => {
|
|||
name: "New name",
|
||||
viewBackgroundColor: "#000",
|
||||
},
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
expect(API.getUndoStack().length).toBe(2);
|
||||
expect(API.getRedoStack().length).toBe(0);
|
||||
|
@ -1293,7 +1293,7 @@ describe("history", () => {
|
|||
|
||||
API.updateScene({
|
||||
elements: [rect1, text, rect2],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
// bind text1 to rect1
|
||||
|
@ -1847,7 +1847,7 @@ describe("history", () => {
|
|||
strokeColor: blue,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -1885,7 +1885,7 @@ describe("history", () => {
|
|||
strokeColor: yellow,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -1933,7 +1933,7 @@ describe("history", () => {
|
|||
backgroundColor: yellow,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
// At this point our entry gets updated from `red` -> `blue` into `red` -> `yellow`
|
||||
|
@ -1949,7 +1949,7 @@ describe("history", () => {
|
|||
backgroundColor: violet,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
// At this point our (inversed) entry gets updated from `red` -> `yellow` into `violet` -> `yellow`
|
||||
|
@ -1994,7 +1994,7 @@ describe("history", () => {
|
|||
|
||||
API.updateScene({
|
||||
elements: [rect, diamond],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
// Connect the arrow
|
||||
|
@ -2043,7 +2043,7 @@ describe("history", () => {
|
|||
} as FixedPointBinding,
|
||||
},
|
||||
],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -2058,7 +2058,7 @@ describe("history", () => {
|
|||
}
|
||||
: el,
|
||||
),
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -2082,7 +2082,7 @@ describe("history", () => {
|
|||
// Initialize scene
|
||||
API.updateScene({
|
||||
elements: [rect1, rect2],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
// Simulate local update
|
||||
|
@ -2091,7 +2091,7 @@ describe("history", () => {
|
|||
newElementWith(h.elements[0], { groupIds: ["A"] }),
|
||||
newElementWith(h.elements[1], { groupIds: ["A"] }),
|
||||
],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
const rect3 = API.createElement({ type: "rectangle", groupIds: ["B"] });
|
||||
|
@ -2105,7 +2105,7 @@ describe("history", () => {
|
|||
rect3,
|
||||
rect4,
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -2151,7 +2151,7 @@ describe("history", () => {
|
|||
] as LocalPoint[],
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo(); // undo `actionFinalize`
|
||||
|
@ -2246,7 +2246,7 @@ describe("history", () => {
|
|||
isDeleted: false, // undeletion might happen due to concurrency between clients
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
expect(API.getSelectedElements()).toEqual([]);
|
||||
|
@ -2323,7 +2323,7 @@ describe("history", () => {
|
|||
isDeleted: true,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
expect(h.elements).toEqual([
|
||||
|
@ -2385,7 +2385,7 @@ describe("history", () => {
|
|||
isDeleted: true,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -2461,7 +2461,7 @@ describe("history", () => {
|
|||
isDeleted: true,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -2500,7 +2500,7 @@ describe("history", () => {
|
|||
isDeleted: false,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.redo();
|
||||
|
@ -2546,7 +2546,7 @@ describe("history", () => {
|
|||
// Simulate remote update
|
||||
API.updateScene({
|
||||
elements: [rect1, rect2],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.withModifierKeys({ ctrl: true }, () => {
|
||||
|
@ -2556,7 +2556,7 @@ describe("history", () => {
|
|||
// Simulate remote update
|
||||
API.updateScene({
|
||||
elements: [h.elements[0], h.elements[1], rect3, rect4],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.withModifierKeys({ ctrl: true }, () => {
|
||||
|
@ -2577,7 +2577,7 @@ describe("history", () => {
|
|||
isDeleted: true,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -2602,7 +2602,7 @@ describe("history", () => {
|
|||
isDeleted: false,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.redo();
|
||||
|
@ -2613,7 +2613,7 @@ describe("history", () => {
|
|||
// Simulate remote update
|
||||
API.updateScene({
|
||||
elements: [h.elements[0], h.elements[1], rect3, rect4],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.redo();
|
||||
|
@ -2659,7 +2659,7 @@ describe("history", () => {
|
|||
isDeleted: true,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -2680,7 +2680,7 @@ describe("history", () => {
|
|||
}),
|
||||
h.elements[1],
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -2723,7 +2723,7 @@ describe("history", () => {
|
|||
isDeleted: true,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -2766,7 +2766,7 @@ describe("history", () => {
|
|||
h.elements[0],
|
||||
h.elements[1],
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
expect(API.getUndoStack().length).toBe(2);
|
||||
|
@ -2805,7 +2805,7 @@ describe("history", () => {
|
|||
h.elements[0],
|
||||
h.elements[1],
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
expect(API.getUndoStack().length).toBe(2);
|
||||
|
@ -2856,7 +2856,7 @@ describe("history", () => {
|
|||
h.elements[0], // rect2
|
||||
h.elements[1], // rect1
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -2886,7 +2886,7 @@ describe("history", () => {
|
|||
h.elements[0], // rect3
|
||||
h.elements[2], // rect1
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -2916,7 +2916,7 @@ describe("history", () => {
|
|||
// Simulate remote update
|
||||
API.updateScene({
|
||||
elements: [...h.elements, rect],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
mouse.moveTo(60, 60);
|
||||
|
@ -2968,7 +2968,7 @@ describe("history", () => {
|
|||
// // Simulate remote update
|
||||
API.updateScene({
|
||||
elements: [...h.elements, rect3],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
mouse.moveTo(100, 100);
|
||||
|
@ -3058,7 +3058,7 @@ describe("history", () => {
|
|||
// Simulate remote update
|
||||
API.updateScene({
|
||||
elements: [...h.elements, rect3],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
mouse.moveTo(100, 100);
|
||||
|
@ -3235,7 +3235,7 @@ describe("history", () => {
|
|||
// Initialize the scene
|
||||
API.updateScene({
|
||||
elements: [container, text],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
// Simulate local update
|
||||
|
@ -3248,7 +3248,7 @@ describe("history", () => {
|
|||
containerId: container.id,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -3279,7 +3279,7 @@ describe("history", () => {
|
|||
x: h.elements[1].x + 10,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
runTwice(() => {
|
||||
|
@ -3322,7 +3322,7 @@ describe("history", () => {
|
|||
// Initialize the scene
|
||||
API.updateScene({
|
||||
elements: [container, text],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
// Simulate local update
|
||||
|
@ -3335,7 +3335,7 @@ describe("history", () => {
|
|||
containerId: container.id,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -3369,7 +3369,7 @@ describe("history", () => {
|
|||
remoteText,
|
||||
h.elements[1],
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
runTwice(() => {
|
||||
|
@ -3425,7 +3425,7 @@ describe("history", () => {
|
|||
// Initialize the scene
|
||||
API.updateScene({
|
||||
elements: [container, text],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
// Simulate local update
|
||||
|
@ -3438,7 +3438,7 @@ describe("history", () => {
|
|||
containerId: container.id,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -3475,7 +3475,7 @@ describe("history", () => {
|
|||
containerId: remoteContainer.id,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
runTwice(() => {
|
||||
|
@ -3533,7 +3533,7 @@ describe("history", () => {
|
|||
// Simulate local update
|
||||
API.updateScene({
|
||||
elements: [container],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
// Simulate remote update
|
||||
|
@ -3544,7 +3544,7 @@ describe("history", () => {
|
|||
}),
|
||||
newElementWith(text, { containerId: container.id }),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
runTwice(() => {
|
||||
|
@ -3594,7 +3594,7 @@ describe("history", () => {
|
|||
// Simulate local update
|
||||
API.updateScene({
|
||||
elements: [text],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
// Simulate remote update
|
||||
|
@ -3605,7 +3605,7 @@ describe("history", () => {
|
|||
}),
|
||||
newElementWith(text, { containerId: container.id }),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
runTwice(() => {
|
||||
|
@ -3654,7 +3654,7 @@ describe("history", () => {
|
|||
// Simulate local update
|
||||
API.updateScene({
|
||||
elements: [container],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
// Simulate remote update
|
||||
|
@ -3667,7 +3667,7 @@ describe("history", () => {
|
|||
containerId: container.id,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -3704,7 +3704,7 @@ describe("history", () => {
|
|||
// rebinding the container with a new text element!
|
||||
remoteText,
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
runTwice(() => {
|
||||
|
@ -3761,7 +3761,7 @@ describe("history", () => {
|
|||
// Simulate local update
|
||||
API.updateScene({
|
||||
elements: [text],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
// Simulate remote update
|
||||
|
@ -3774,7 +3774,7 @@ describe("history", () => {
|
|||
containerId: container.id,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -3811,7 +3811,7 @@ describe("history", () => {
|
|||
containerId: container.id,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
runTwice(() => {
|
||||
|
@ -3867,7 +3867,7 @@ describe("history", () => {
|
|||
// Simulate local update
|
||||
API.updateScene({
|
||||
elements: [container],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
// Simulate remote update
|
||||
|
@ -3881,7 +3881,7 @@ describe("history", () => {
|
|||
isDeleted: true,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
runTwice(() => {
|
||||
|
@ -3924,7 +3924,7 @@ describe("history", () => {
|
|||
// Simulate local update
|
||||
API.updateScene({
|
||||
elements: [text],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
// Simulate remote update
|
||||
|
@ -3938,7 +3938,7 @@ describe("history", () => {
|
|||
containerId: container.id,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
runTwice(() => {
|
||||
|
@ -3981,7 +3981,7 @@ describe("history", () => {
|
|||
// Initialize the scene
|
||||
API.updateScene({
|
||||
elements: [container],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
// Simulate local update
|
||||
|
@ -3993,7 +3993,7 @@ describe("history", () => {
|
|||
angle: 90 as Radians,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -4006,7 +4006,7 @@ describe("history", () => {
|
|||
}),
|
||||
newElementWith(text, { containerId: container.id }),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
expect(h.elements).toEqual([
|
||||
|
@ -4099,7 +4099,7 @@ describe("history", () => {
|
|||
// Initialize the scene
|
||||
API.updateScene({
|
||||
elements: [text],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
// Simulate local update
|
||||
|
@ -4111,7 +4111,7 @@ describe("history", () => {
|
|||
angle: 90 as Radians,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -4126,7 +4126,7 @@ describe("history", () => {
|
|||
containerId: container.id,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
expect(API.getUndoStack().length).toBe(0);
|
||||
|
@ -4217,7 +4217,7 @@ describe("history", () => {
|
|||
// Simulate local update
|
||||
API.updateScene({
|
||||
elements: [rect1, rect2],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
mouse.reset();
|
||||
|
@ -4304,7 +4304,7 @@ describe("history", () => {
|
|||
x: h.elements[1].x + 50,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
runTwice(() => {
|
||||
|
@ -4444,7 +4444,7 @@ describe("history", () => {
|
|||
}),
|
||||
remoteContainer,
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
runTwice(() => {
|
||||
|
@ -4549,7 +4549,7 @@ describe("history", () => {
|
|||
boundElements: [{ id: arrow.id, type: "arrow" }],
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
runTwice(() => {
|
||||
|
@ -4626,7 +4626,7 @@ describe("history", () => {
|
|||
// Simulate local update
|
||||
API.updateScene({
|
||||
elements: [arrow],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
// Simulate remote update
|
||||
|
@ -4653,7 +4653,7 @@ describe("history", () => {
|
|||
boundElements: [{ id: arrow.id, type: "arrow" }],
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
runTwice(() => {
|
||||
|
@ -4783,7 +4783,7 @@ describe("history", () => {
|
|||
newElementWith(h.elements[1], { x: 500, y: -500 }),
|
||||
h.elements[2],
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.redo();
|
||||
|
@ -4853,13 +4853,13 @@ describe("history", () => {
|
|||
// Initialize the scene
|
||||
API.updateScene({
|
||||
elements: [frame],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
// Simulate local update
|
||||
API.updateScene({
|
||||
elements: [rect, h.elements[0]],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
// Simulate local update
|
||||
|
@ -4870,7 +4870,7 @@ describe("history", () => {
|
|||
}),
|
||||
h.elements[1],
|
||||
],
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
|
||||
Keyboard.undo();
|
||||
|
@ -4914,7 +4914,7 @@ describe("history", () => {
|
|||
isDeleted: true,
|
||||
}),
|
||||
],
|
||||
storeAction: StoreAction.UPDATE,
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
|
||||
Keyboard.redo();
|
||||
|
|
|
@ -30,8 +30,8 @@ import * as textElementUtils from "../element/textElement";
|
|||
import { ROUNDNESS, VERTICAL_ALIGN } from "../constants";
|
||||
import { vi } from "vitest";
|
||||
import { arrayToMap } from "../utils";
|
||||
import type { GlobalPoint } from "../../math";
|
||||
import { pointCenter, pointFrom } from "../../math";
|
||||
import type { GlobalPoint } from "@excalidraw/math";
|
||||
import { pointCenter, pointFrom } from "@excalidraw/math";
|
||||
import { wrapText } from "../element/textWrapping";
|
||||
|
||||
const renderInteractiveScene = vi.spyOn(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
import { Excalidraw, StoreAction } from "../../index";
|
||||
import { Excalidraw, CaptureUpdateAction } from "../../index";
|
||||
import type { ExcalidrawImperativeAPI } from "../../types";
|
||||
import { resolvablePromise } from "../../utils";
|
||||
import { render } from "../test-utils";
|
||||
|
@ -31,7 +31,7 @@ describe("event callbacks", () => {
|
|||
excalidrawAPI.onChange(onChange);
|
||||
API.updateScene({
|
||||
appState: { viewBackgroundColor: "red" },
|
||||
storeAction: StoreAction.CAPTURE,
|
||||
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
|
||||
});
|
||||
expect(onChange).toHaveBeenCalledWith(
|
||||
// elements
|
||||
|
|
|
@ -15,8 +15,8 @@ import { KEYS } from "../keys";
|
|||
import { isLinearElement } from "../element/typeChecks";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import { arrayToMap } from "../utils";
|
||||
import type { LocalPoint } from "../../math";
|
||||
import { pointFrom } from "../../math";
|
||||
import type { LocalPoint } from "@excalidraw/math";
|
||||
import { pointFrom } from "@excalidraw/math";
|
||||
import { resizeSingleElement } from "../element/resizeElements";
|
||||
import { getSizeFromPoints } from "../points";
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
textFixture,
|
||||
} from "../fixtures/elementFixture";
|
||||
import { API } from "../helpers/api";
|
||||
import { exportToCanvas, exportToSvg } from "../../../utils";
|
||||
import { exportToCanvas, exportToSvg } from "@excalidraw/utils";
|
||||
import { FONT_FAMILY, FRAME_STYLE } from "../../constants";
|
||||
import { prepareElementsForExport } from "../../data";
|
||||
|
||||
|
@ -114,7 +114,7 @@ describe("exportToSvg", () => {
|
|||
);
|
||||
|
||||
expect(svgElement.getAttribute("filter")).toMatchInlineSnapshot(
|
||||
`"_themeFilter_1883f3"`,
|
||||
`"invert(93%) hue-rotate(180deg)"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue