@excalidraw/excalidraw 0.18.0-195a743 → 0.18.0-1b287a8ba
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/chunk-CBGOW5JB.js +5669 -0
- package/dist/dev/chunk-CBGOW5JB.js.map +7 -0
- package/dist/dev/chunk-CP5DND7P.js +7 -0
- package/dist/dev/chunk-CP5DND7P.js.map +7 -0
- package/dist/dev/{chunk-T3M44BFV.js → chunk-QF5FRM6O.js} +12 -4
- package/dist/dev/chunk-QF5FRM6O.js.map +7 -0
- package/dist/dev/data/{image-TTQKTTOH.js → image-SURZSZNX.js} +3 -3
- package/dist/dev/index.css +89 -22
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +7516 -9372
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/locales/{en-I23TB6DJ.js → en-SMAPCEOQ.js} +2 -2
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/chunk-A66AFZZU.js +7 -0
- package/dist/prod/chunk-I4UNSFV6.js +12 -0
- package/dist/prod/chunk-IRHK23LL.js +4 -0
- package/dist/prod/data/image-HXEZYJPQ.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +26 -19
- package/dist/prod/locales/{en-TC3OFDA6.js → en-TYY6KWIJ.js} +1 -1
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/common/src/constants.d.ts +19 -3
- package/dist/types/{excalidraw → common/src}/emitter.d.ts +1 -1
- package/dist/types/common/src/font-metadata.d.ts +4 -2
- package/dist/types/common/src/index.d.ts +1 -0
- package/dist/types/common/src/utility-types.d.ts +5 -0
- package/dist/types/common/src/utils.d.ts +15 -5
- package/dist/types/element/src/Scene.d.ts +4 -4
- package/dist/types/element/src/align.d.ts +3 -2
- package/dist/types/element/src/binding.d.ts +11 -8
- package/dist/types/element/src/bounds.d.ts +12 -4
- package/dist/types/element/src/collision.d.ts +18 -12
- package/dist/types/element/src/cropElement.d.ts +1 -1
- package/dist/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +63 -38
- package/dist/types/element/src/distance.d.ts +2 -2
- package/dist/types/element/src/distribute.d.ts +2 -1
- package/dist/types/element/src/dragElements.d.ts +1 -1
- package/dist/types/element/src/flowchart.d.ts +1 -1
- package/dist/types/element/src/fractionalIndex.d.ts +8 -2
- package/dist/types/element/src/frame.d.ts +3 -2
- package/dist/types/element/src/groups.d.ts +1 -0
- package/dist/types/element/src/index.d.ts +43 -2
- package/dist/types/element/src/linearElementEditor.d.ts +15 -29
- package/dist/types/element/src/mutateElement.d.ts +1 -1
- package/dist/types/element/src/newElement.d.ts +3 -2
- package/dist/types/element/src/resizeElements.d.ts +2 -1
- package/dist/types/element/src/selection.d.ts +0 -5
- package/dist/types/element/src/shape.d.ts +42 -0
- package/dist/types/element/src/sizeHelpers.d.ts +2 -1
- package/dist/types/element/src/store.d.ts +232 -0
- package/dist/types/element/src/textElement.d.ts +1 -1
- package/dist/types/element/src/typeChecks.d.ts +16 -1
- package/dist/types/element/src/types.d.ts +13 -3
- package/dist/types/element/src/utils.d.ts +16 -6
- package/dist/types/element/src/zindex.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +39 -48
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +26 -32
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +173 -212
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +75 -92
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +13 -16
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +34 -42
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +12 -15
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +41 -48
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +13 -16
- package/dist/types/excalidraw/actions/actionExport.d.ts +127 -154
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +69 -35
- package/dist/types/excalidraw/actions/actionFrame.d.ts +99 -111
- package/dist/types/excalidraw/actions/actionGroup.d.ts +26 -32
- package/dist/types/excalidraw/actions/actionHistory.d.ts +1 -2
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +505 -15
- package/dist/types/excalidraw/actions/actionLink.d.ts +13 -16
- package/dist/types/excalidraw/actions/actionMenu.d.ts +38 -47
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +26 -32
- package/dist/types/excalidraw/actions/actionProperties.d.ts +186 -223
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +12 -15
- package/dist/types/excalidraw/actions/actionStyles.d.ts +13 -16
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +13 -16
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +13 -16
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +12 -188
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +13 -16
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +13 -16
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +13 -16
- package/dist/types/excalidraw/actions/actionZindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/types.d.ts +3 -2
- package/dist/types/excalidraw/appState.d.ts +16 -7
- package/dist/types/excalidraw/components/App.d.ts +18 -20
- package/dist/types/excalidraw/components/ButtonIcon.d.ts +1 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +5 -1
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -3
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -3
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +1 -1
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -28
- package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/Ellipsify.d.ts +4 -0
- package/dist/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
- package/dist/types/excalidraw/components/Range.d.ts +3 -3
- package/dist/types/excalidraw/components/Stats/Angle.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
- package/dist/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +12 -2
- package/dist/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/Position.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/utils.d.ts +2 -1
- package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
- package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +1 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -1
- package/dist/types/excalidraw/components/icons.d.ts +3 -0
- package/dist/types/excalidraw/components/shapes.d.ts +1 -1
- package/dist/types/excalidraw/data/transform.d.ts +1 -1
- package/dist/types/excalidraw/eraser/index.d.ts +0 -2
- package/dist/types/excalidraw/fonts/Fonts.d.ts +1 -1
- package/dist/types/excalidraw/history.d.ts +30 -22
- package/dist/types/excalidraw/hooks/useEmitter.d.ts +1 -1
- package/dist/types/excalidraw/index.d.ts +10 -9
- package/dist/types/excalidraw/lasso/index.d.ts +1 -0
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -1
- package/dist/types/excalidraw/renderer/helpers.d.ts +7 -2
- package/dist/types/excalidraw/scene/Renderer.d.ts +1 -2
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/snapping.d.ts +2 -2
- package/dist/types/excalidraw/types.d.ts +23 -10
- package/dist/types/math/src/angle.d.ts +2 -0
- package/dist/types/math/src/constants.d.ts +3 -0
- package/dist/types/math/src/curve.d.ts +34 -0
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/point.d.ts +1 -1
- package/dist/types/math/src/rectangle.d.ts +2 -0
- package/dist/types/math/src/vector.d.ts +8 -2
- package/dist/types/utils/src/bbox.d.ts +1 -1
- package/dist/types/utils/src/index.d.ts +1 -1
- package/dist/types/utils/src/withinBounds.d.ts +1 -1
- package/history.ts +147 -110
- package/package.json +12 -9
- package/dist/dev/chunk-H3EW23X2.js +0 -18294
- package/dist/dev/chunk-H3EW23X2.js.map +0 -7
- package/dist/dev/chunk-T3M44BFV.js.map +0 -7
- package/dist/dev/chunk-WMGEUIQQ.js +0 -7
- package/dist/dev/chunk-WMGEUIQQ.js.map +0 -7
- package/dist/prod/chunk-2Z7RPVPO.js +0 -12
- package/dist/prod/chunk-7M43VNIB.js +0 -33
- package/dist/prod/chunk-GK4XUKZB.js +0 -7
- package/dist/prod/data/image-7YYIWLVQ.js +0 -1
- package/dist/types/element/src/Shape.d.ts +0 -17
- package/dist/types/element/src/ShapeCache.d.ts +0 -25
- package/dist/types/element/src/shapes.d.ts +0 -23
- package/dist/types/excalidraw/components/ButtonSelect.d.ts +0 -9
- package/dist/types/excalidraw/store.d.ts +0 -129
- package/dist/types/excalidraw/visualdebug.d.ts +0 -41
- package/dist/types/utils/src/collision.d.ts +0 -8
- /package/dist/dev/data/{image-TTQKTTOH.js.map → image-SURZSZNX.js.map} +0 -0
- /package/dist/dev/locales/{en-I23TB6DJ.js.map → en-SMAPCEOQ.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
-
import type Scene from "@excalidraw/element
|
|
2
|
+
import type { Scene } from "@excalidraw/element";
|
|
3
3
|
import type { AppState } from "../../types";
|
|
4
4
|
interface FontSizeProps {
|
|
5
5
|
element: ExcalidrawElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
-
import type Scene from "@excalidraw/element
|
|
2
|
+
import type { Scene } from "@excalidraw/element";
|
|
3
3
|
import type { AppState } from "../../types";
|
|
4
4
|
interface MultiAngleProps {
|
|
5
5
|
elements: readonly ExcalidrawElement[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
|
|
2
|
-
import type Scene from "@excalidraw/element
|
|
2
|
+
import type { Scene } from "@excalidraw/element";
|
|
3
3
|
import type { AtomicUnit } from "./utils";
|
|
4
4
|
import type { AppState } from "../../types";
|
|
5
5
|
interface MultiDimensionProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
|
|
2
|
-
import type Scene from "@excalidraw/element
|
|
2
|
+
import type { Scene } from "@excalidraw/element";
|
|
3
3
|
import type { AppState } from "../../types";
|
|
4
4
|
interface MultiFontSizeProps {
|
|
5
5
|
elements: readonly ExcalidrawElement[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
-
import type Scene from "@excalidraw/element
|
|
2
|
+
import type { Scene } from "@excalidraw/element";
|
|
3
3
|
import type { AtomicUnit } from "./utils";
|
|
4
4
|
import type { AppState } from "../../types";
|
|
5
5
|
interface MultiPositionProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
-
import type Scene from "@excalidraw/element
|
|
2
|
+
import type { Scene } from "@excalidraw/element";
|
|
3
3
|
import type { AppState } from "../../types";
|
|
4
4
|
interface PositionProps {
|
|
5
5
|
property: "x" | "y";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
-
import type Scene from "@excalidraw/element
|
|
2
|
+
import type { Scene } from "@excalidraw/element";
|
|
3
3
|
import type { AppState } from "../../types";
|
|
4
4
|
export type StatsInputProperty = "x" | "y" | "width" | "height" | "angle" | "fontSize" | "gridStep";
|
|
5
5
|
export declare const SMALLEST_DELTA = 0.01;
|
|
6
|
+
export declare const STEP_SIZE = 10;
|
|
6
7
|
export declare const isPropertyEditable: (element: ExcalidrawElement, property: keyof ExcalidrawElement) => boolean;
|
|
7
8
|
export declare const getStepSizedValue: (value: number, stepSize: number) => number;
|
|
8
9
|
export type AtomicUnit = Record<string, true>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "./UnlockPopup.scss";
|
|
2
|
+
import type App from "./App";
|
|
3
|
+
import type { AppState } from "../types";
|
|
4
|
+
declare const UnlockPopup: ({ app, activeLockedId, }: {
|
|
5
|
+
app: App;
|
|
6
|
+
activeLockedId: NonNullable<AppState["activeLockedId"]>;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export default UnlockPopup;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type Scene from "@excalidraw/element
|
|
1
|
+
import type { Scene } from "@excalidraw/element";
|
|
2
2
|
import type { ElementsMap, ExcalidrawEmbeddableElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
3
3
|
import "./Hyperlink.scss";
|
|
4
4
|
import type { AppState, ExcalidrawProps, UIAppState } from "../../types";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { GlobalPoint, Radians } from "@excalidraw/math";
|
|
2
|
-
import type { Bounds } from "@excalidraw/element
|
|
2
|
+
import type { Bounds } from "@excalidraw/element";
|
|
3
3
|
import type { ElementsMap, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
4
4
|
import type { AppState, UIAppState } from "../../types";
|
|
5
|
+
export declare const DEFAULT_LINK_SIZE = 12;
|
|
5
6
|
export declare const EXTERNAL_LINK_IMG: HTMLImageElement;
|
|
6
7
|
export declare const ELEMENT_LINK_IMG: HTMLImageElement;
|
|
7
8
|
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: Radians, appState: Pick<UIAppState, "zoom">) => Bounds;
|
|
@@ -12,8 +12,10 @@ export declare const LibraryIcon: import("react/jsx-runtime").JSX.Element;
|
|
|
12
12
|
export declare const PlusIcon: import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export declare const DotsIcon: import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export declare const PinIcon: import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const polygonIcon: import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export declare const UnlockedIcon: import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export declare const LockedIcon: import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const LockedIconFilled: import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export declare const WelcomeScreenMenuArrow: import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
export declare const WelcomeScreenHelpArrow: import("react/jsx-runtime").JSX.Element;
|
|
19
21
|
export declare const WelcomeScreenTopToolbarArrow: import("react/jsx-runtime").JSX.Element;
|
|
@@ -54,6 +56,7 @@ export declare const LoadIcon: import("react/jsx-runtime").JSX.Element;
|
|
|
54
56
|
export declare const clipboard: import("react/jsx-runtime").JSX.Element;
|
|
55
57
|
export declare const palette: import("react/jsx-runtime").JSX.Element;
|
|
56
58
|
export declare const bucketFillIcon: import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
export declare const slashIcon: import("react/jsx-runtime").JSX.Element;
|
|
57
60
|
export declare const ExportImageIcon: import("react/jsx-runtime").JSX.Element;
|
|
58
61
|
export declare const exportToFileIcon: import("react/jsx-runtime").JSX.Element;
|
|
59
62
|
export declare const zoomIn: import("react/jsx-runtime").JSX.Element;
|
|
@@ -59,4 +59,4 @@ export declare const SHAPES: readonly [{
|
|
|
59
59
|
readonly numericKey: "0";
|
|
60
60
|
readonly fillable: false;
|
|
61
61
|
}];
|
|
62
|
-
export declare const findShapeByKey: (key: string) => "line" | "
|
|
62
|
+
export declare const findShapeByKey: (key: string) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser" | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ElementConstructorOpts } from "@excalidraw/element
|
|
1
|
+
import type { ElementConstructorOpts } from "@excalidraw/element";
|
|
2
2
|
import type { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawIframeLikeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawMagicFrameElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, TextAlign, VerticalAlign } from "@excalidraw/element/types";
|
|
3
3
|
import type { MarkOptional } from "@excalidraw/common/utility-types";
|
|
4
4
|
export type ValidLinearElement = {
|
|
@@ -4,8 +4,6 @@ import type App from "../components/App";
|
|
|
4
4
|
export declare class EraserTrail extends AnimatedTrail {
|
|
5
5
|
private elementsToErase;
|
|
6
6
|
private groupsToErase;
|
|
7
|
-
private segmentsCache;
|
|
8
|
-
private geometricShapesCache;
|
|
9
7
|
constructor(animationFrameHandler: AnimationFrameHandler, app: App);
|
|
10
8
|
startPath(x: number, y: number): void;
|
|
11
9
|
addPointToPath(x: number, y: number, restore?: boolean): string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FontMetadata } from "@excalidraw/common";
|
|
2
2
|
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
3
|
-
import type Scene from "@excalidraw/element
|
|
3
|
+
import type { Scene } from "@excalidraw/element";
|
|
4
4
|
import { ExcalidrawFontFace } from "./ExcalidrawFontFace";
|
|
5
5
|
export declare class Fonts {
|
|
6
6
|
static readonly loadedFontsCache: Set<string>;
|
|
@@ -1,40 +1,48 @@
|
|
|
1
|
+
import { Emitter } from "@excalidraw/common";
|
|
2
|
+
import { StoreDelta } from "@excalidraw/element";
|
|
3
|
+
import type { StoreSnapshot, Store } from "@excalidraw/element";
|
|
1
4
|
import type { SceneElementsMap } from "@excalidraw/element/types";
|
|
2
|
-
import { Emitter } from "./emitter";
|
|
3
|
-
import type { AppStateChange, ElementsChange } from "./change";
|
|
4
|
-
import type { Snapshot } from "./store";
|
|
5
5
|
import type { AppState } from "./types";
|
|
6
|
+
export declare class HistoryDelta extends StoreDelta {
|
|
7
|
+
/**
|
|
8
|
+
* Apply the delta to the passed elements and appState, does not modify the snapshot.
|
|
9
|
+
*/
|
|
10
|
+
applyTo(elements: SceneElementsMap, appState: AppState, snapshot: StoreSnapshot): [SceneElementsMap, AppState, boolean];
|
|
11
|
+
/**
|
|
12
|
+
* Overriding once to avoid type casting everywhere.
|
|
13
|
+
*/
|
|
14
|
+
static calculate(prevSnapshot: StoreSnapshot, nextSnapshot: StoreSnapshot): HistoryDelta;
|
|
15
|
+
/**
|
|
16
|
+
* Overriding once to avoid type casting everywhere.
|
|
17
|
+
*/
|
|
18
|
+
static inverse(delta: StoreDelta): HistoryDelta;
|
|
19
|
+
/**
|
|
20
|
+
* Overriding once to avoid type casting everywhere.
|
|
21
|
+
*/
|
|
22
|
+
static applyLatestChanges(delta: StoreDelta, prevElements: SceneElementsMap, nextElements: SceneElementsMap, modifierOptions?: "deleted" | "inserted"): HistoryDelta;
|
|
23
|
+
}
|
|
6
24
|
export declare class HistoryChangedEvent {
|
|
7
25
|
readonly isUndoStackEmpty: boolean;
|
|
8
26
|
readonly isRedoStackEmpty: boolean;
|
|
9
27
|
constructor(isUndoStackEmpty?: boolean, isRedoStackEmpty?: boolean);
|
|
10
28
|
}
|
|
11
29
|
export declare class History {
|
|
30
|
+
private readonly store;
|
|
12
31
|
readonly onHistoryChangedEmitter: Emitter<[HistoryChangedEvent]>;
|
|
13
|
-
|
|
14
|
-
|
|
32
|
+
readonly undoStack: HistoryDelta[];
|
|
33
|
+
readonly redoStack: HistoryDelta[];
|
|
15
34
|
get isUndoStackEmpty(): boolean;
|
|
16
35
|
get isRedoStackEmpty(): boolean;
|
|
36
|
+
constructor(store: Store);
|
|
17
37
|
clear(): void;
|
|
18
38
|
/**
|
|
19
|
-
* Record a local
|
|
39
|
+
* Record a non-empty local durable increment, which will go into the undo stack..
|
|
40
|
+
* Do not re-record history entries, which were already pushed to undo / redo stack, as part of history action.
|
|
20
41
|
*/
|
|
21
|
-
record(
|
|
22
|
-
undo(elements: SceneElementsMap, appState: AppState
|
|
23
|
-
redo(elements: SceneElementsMap, appState: AppState
|
|
42
|
+
record(delta: StoreDelta): void;
|
|
43
|
+
undo(elements: SceneElementsMap, appState: AppState): void | [SceneElementsMap, AppState];
|
|
44
|
+
redo(elements: SceneElementsMap, appState: AppState): void | [SceneElementsMap, AppState];
|
|
24
45
|
private perform;
|
|
25
46
|
private static pop;
|
|
26
47
|
private static push;
|
|
27
48
|
}
|
|
28
|
-
export declare class HistoryEntry {
|
|
29
|
-
readonly appStateChange: AppStateChange;
|
|
30
|
-
readonly elementsChange: ElementsChange;
|
|
31
|
-
private constructor();
|
|
32
|
-
static create(appStateChange: AppStateChange, elementsChange: ElementsChange): HistoryEntry;
|
|
33
|
-
inverse(): HistoryEntry;
|
|
34
|
-
applyTo(elements: SceneElementsMap, appState: AppState, snapshot: Readonly<Snapshot>): [SceneElementsMap, AppState, boolean];
|
|
35
|
-
/**
|
|
36
|
-
* Apply latest (remote) changes to the history entry, creates new instance of `HistoryEntry`.
|
|
37
|
-
*/
|
|
38
|
-
applyLatestChanges(elements: SceneElementsMap): HistoryEntry;
|
|
39
|
-
isEmpty(): boolean;
|
|
40
|
-
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Emitter } from "
|
|
1
|
+
import type { Emitter } from "@excalidraw/common";
|
|
2
2
|
export declare const useEmitter: <TEvent extends unknown>(emitter: Emitter<[TEvent]>, initialState: TEvent) => TEvent;
|
|
@@ -9,26 +9,27 @@ import "./fonts/fonts.css";
|
|
|
9
9
|
import type { ExcalidrawProps } from "./types";
|
|
10
10
|
export declare const Excalidraw: React.MemoExoticComponent<(props: ExcalidrawProps) => import("react/jsx-runtime").JSX.Element>;
|
|
11
11
|
export { getSceneVersion, hashElementsVersion, hashString, getNonDeletedElements, } from "@excalidraw/element";
|
|
12
|
-
export { getTextFromElements } from "@excalidraw/element
|
|
13
|
-
export { isInvisiblySmallElement } from "@excalidraw/element
|
|
12
|
+
export { getTextFromElements } from "@excalidraw/element";
|
|
13
|
+
export { isInvisiblySmallElement } from "@excalidraw/element";
|
|
14
14
|
export { defaultLang, useI18n, languages } from "./i18n";
|
|
15
15
|
export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "./data/restore";
|
|
16
16
|
export { reconcileElements } from "./data/reconcile";
|
|
17
17
|
export { exportToCanvas, exportToBlob, exportToSvg, exportToClipboard, } from "@excalidraw/utils/export";
|
|
18
18
|
export { serializeAsJSON, serializeLibraryAsJSON } from "./data/json";
|
|
19
19
|
export { loadFromBlob, loadSceneOrLibraryFromBlob, loadLibraryFromBlob, } from "./data/blob";
|
|
20
|
-
export { getFreeDrawSvgPath } from "@excalidraw/element
|
|
20
|
+
export { getFreeDrawSvgPath } from "@excalidraw/element";
|
|
21
21
|
export { mergeLibraryItems, getLibraryItemsHash } from "./data/library";
|
|
22
|
-
export { isLinearElement } from "@excalidraw/element
|
|
22
|
+
export { isLinearElement } from "@excalidraw/element";
|
|
23
23
|
export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS, DEFAULT_LASER_COLOR, UserIdleState, normalizeLink, } from "@excalidraw/common";
|
|
24
|
-
export { mutateElement, newElementWith, bumpVersion, } from "@excalidraw/element
|
|
25
|
-
export { CaptureUpdateAction } from "
|
|
24
|
+
export { mutateElement, newElementWith, bumpVersion, } from "@excalidraw/element";
|
|
25
|
+
export { CaptureUpdateAction } from "@excalidraw/element";
|
|
26
26
|
export { parseLibraryTokensFromUrl, useHandleLibrary } from "./data/library";
|
|
27
27
|
export { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, } from "@excalidraw/common";
|
|
28
28
|
export { Sidebar } from "./components/Sidebar/Sidebar";
|
|
29
29
|
export { Button } from "./components/Button";
|
|
30
30
|
export { Footer };
|
|
31
31
|
export { MainMenu };
|
|
32
|
+
export { Ellipsify } from "./components/Ellipsify";
|
|
32
33
|
export { useDevice } from "./components/App";
|
|
33
34
|
export { WelcomeScreen };
|
|
34
35
|
export { LiveCollaborationTrigger };
|
|
@@ -38,9 +39,9 @@ export { TTDDialog } from "./components/TTDDialog/TTDDialog";
|
|
|
38
39
|
export { TTDDialogTrigger } from "./components/TTDDialog/TTDDialogTrigger";
|
|
39
40
|
export { zoomToFitBounds } from "./actions/actionCanvas";
|
|
40
41
|
export { convertToExcalidrawElements } from "./data/transform";
|
|
41
|
-
export { getCommonBounds, getVisibleSceneBounds
|
|
42
|
+
export { getCommonBounds, getVisibleSceneBounds } from "@excalidraw/element";
|
|
42
43
|
export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "@excalidraw/utils/withinBounds";
|
|
43
44
|
export { DiagramToCodePlugin } from "./components/DiagramToCodePlugin/DiagramToCodePlugin";
|
|
44
45
|
export { getDataURL } from "./data/blob";
|
|
45
|
-
export { isElementLink } from "@excalidraw/element
|
|
46
|
-
export { setCustomTextMetricsProvider } from "@excalidraw/element
|
|
46
|
+
export { isElementLink } from "@excalidraw/element";
|
|
47
|
+
export { setCustomTextMetricsProvider } from "@excalidraw/element";
|
|
@@ -5,6 +5,7 @@ export declare class LassoTrail extends AnimatedTrail {
|
|
|
5
5
|
private intersectedElements;
|
|
6
6
|
private enclosedElements;
|
|
7
7
|
private elementsSegments;
|
|
8
|
+
private canvasTranslate;
|
|
8
9
|
private keepPreviousSelection;
|
|
9
10
|
constructor(animationFrameHandler: AnimationFrameHandler, app: App);
|
|
10
11
|
startPath(x: number, y: number, keepPreviousSelection?: boolean): void;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ElementsSegmentsMap, GlobalPoint } from "@excalidraw/math/types";
|
|
2
|
-
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
+
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
|
3
3
|
export declare const getLassoSelectedElementIds: (input: {
|
|
4
4
|
lassoPath: GlobalPoint[];
|
|
5
5
|
elements: readonly ExcalidrawElement[];
|
|
6
|
+
elementsMap: ElementsMap;
|
|
6
7
|
elementsSegments: ElementsSegmentsMap;
|
|
7
8
|
intersectedElements: Set<ExcalidrawElement["id"]>;
|
|
8
9
|
enclosedElements: Set<ExcalidrawElement["id"]>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ElementsMap, ExcalidrawDiamondElement, ExcalidrawRectanguloidElement } from "@excalidraw/element/types";
|
|
1
2
|
import type { StaticCanvasRenderConfig } from "../scene/types";
|
|
2
|
-
import type {
|
|
3
|
-
export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke?: boolean) => void;
|
|
3
|
+
import type { AppState, StaticCanvasAppState } from "../types";
|
|
4
|
+
export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke: boolean, fill?: boolean) => void;
|
|
4
5
|
export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
|
|
5
6
|
export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
|
|
6
7
|
canvas: HTMLCanvasElement;
|
|
@@ -11,3 +12,7 @@ export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normali
|
|
|
11
12
|
isExporting?: boolean | undefined;
|
|
12
13
|
viewBackgroundColor?: string | null | undefined;
|
|
13
14
|
}) => CanvasRenderingContext2D;
|
|
15
|
+
export declare const drawHighlightForRectWithRotation: (context: CanvasRenderingContext2D, element: ExcalidrawRectanguloidElement, elementsMap: ElementsMap, padding: number) => void;
|
|
16
|
+
export declare const strokeEllipseWithRotation: (context: CanvasRenderingContext2D, width: number, height: number, cx: number, cy: number, angle: number) => void;
|
|
17
|
+
export declare const strokeRectWithRotation: (context: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, cx: number, cy: number, angle: number, fill?: boolean, radius?: number) => void;
|
|
18
|
+
export declare const drawHighlightForDiamondWithRotation: (context: CanvasRenderingContext2D, padding: number, element: ExcalidrawDiamondElement, elementsMap: ElementsMap) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
-
import type Scene from "@excalidraw/element
|
|
2
|
+
import type { Scene } from "@excalidraw/element";
|
|
3
3
|
import type { AppState } from "../types";
|
|
4
4
|
export declare class Renderer {
|
|
5
5
|
private scene;
|
|
@@ -16,7 +16,6 @@ export declare class Renderer {
|
|
|
16
16
|
/** note: first render of newElement will always bust the cache
|
|
17
17
|
* (we'd have to prefilter elements outside of this function) */
|
|
18
18
|
newElementId: ExcalidrawElement["id"] | undefined;
|
|
19
|
-
pendingImageElementId: AppState["pendingImageElementId"];
|
|
20
19
|
sceneNonce: ReturnType<InstanceType<typeof Scene>["getSceneNonce"]>;
|
|
21
20
|
}) => {
|
|
22
21
|
elementsMap: Map<string, NonDeletedExcalidrawElement> & import("@excalidraw/common/utility-types").MakeBrand<"NonDeletedElementsMap"> & import("@excalidraw/common/utility-types").MakeBrand<"RenderableElementsMap">;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { isSomeElementSelected, getElementsWithinSelection,
|
|
1
|
+
export { isSomeElementSelected, getElementsWithinSelection, getSelectedElements, getTargetElements, } from "@excalidraw/element";
|
|
2
2
|
export { calculateScrollCenter } from "./scroll";
|
|
3
|
-
export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element
|
|
3
|
+
export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element";
|
|
4
4
|
export { getNormalizedZoom, getNormalizedGridSize, getNormalizedGridStep, } from "./normalize";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type GlobalPoint } from "@excalidraw/math";
|
|
2
2
|
import type { InclusiveRange } from "@excalidraw/math";
|
|
3
|
-
import type { Bounds } from "@excalidraw/element
|
|
4
|
-
import type { MaybeTransformHandleType } from "@excalidraw/element
|
|
3
|
+
import type { Bounds } from "@excalidraw/element";
|
|
4
|
+
import type { MaybeTransformHandleType } from "@excalidraw/element";
|
|
5
5
|
import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
6
6
|
import type { AppClassProperties, AppState, KeyboardModifiersObject } from "./types";
|
|
7
7
|
export declare const getSnapDistance: (zoomValue: number) => number;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES } from "@excalidraw/common";
|
|
2
|
-
import type { SuggestedBinding } from "@excalidraw/element
|
|
3
|
-
import type { LinearElementEditor } from "@excalidraw/element
|
|
4
|
-
import type { MaybeTransformHandleType } from "@excalidraw/element
|
|
5
|
-
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId,
|
|
2
|
+
import type { SuggestedBinding } from "@excalidraw/element";
|
|
3
|
+
import type { LinearElementEditor } from "@excalidraw/element";
|
|
4
|
+
import type { MaybeTransformHandleType } from "@excalidraw/element";
|
|
5
|
+
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement } from "@excalidraw/element/types";
|
|
6
6
|
import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
|
|
7
|
+
import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
|
|
7
8
|
import type { Action } from "./actions/types";
|
|
8
9
|
import type { Spreadsheet } from "./charts";
|
|
9
10
|
import type { ClipboardData } from "./clipboard";
|
|
@@ -12,7 +13,6 @@ import type Library from "./data/library";
|
|
|
12
13
|
import type { FileSystemHandle } from "./data/filesystem";
|
|
13
14
|
import type { ContextMenuItems } from "./components/ContextMenu";
|
|
14
15
|
import type { SnapLine } from "./snapping";
|
|
15
|
-
import type { CaptureUpdateActionType } from "./store";
|
|
16
16
|
import type { ImportedDataState } from "./data/types";
|
|
17
17
|
import type { Language } from "./i18n";
|
|
18
18
|
import type { isOverScrollBars } from "./scene/scrollbars";
|
|
@@ -113,7 +113,6 @@ type _CommonCanvasAppState = {
|
|
|
113
113
|
offsetLeft: AppState["offsetLeft"];
|
|
114
114
|
offsetTop: AppState["offsetTop"];
|
|
115
115
|
theme: AppState["theme"];
|
|
116
|
-
pendingImageElementId: AppState["pendingImageElementId"];
|
|
117
116
|
};
|
|
118
117
|
export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
119
118
|
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
|
|
@@ -146,6 +145,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
146
145
|
isCropping: AppState["isCropping"];
|
|
147
146
|
croppingElementId: AppState["croppingElementId"];
|
|
148
147
|
searchMatches: AppState["searchMatches"];
|
|
148
|
+
activeLockedId: AppState["activeLockedId"];
|
|
149
149
|
}>;
|
|
150
150
|
export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
|
|
151
151
|
export type ObservedStandaloneAppState = {
|
|
@@ -159,6 +159,8 @@ export type ObservedElementsAppState = {
|
|
|
159
159
|
editingLinearElementId: LinearElementEditor["elementId"] | null;
|
|
160
160
|
selectedLinearElementId: LinearElementEditor["elementId"] | null;
|
|
161
161
|
croppingElementId: AppState["croppingElementId"];
|
|
162
|
+
lockedMultiSelections: AppState["lockedMultiSelections"];
|
|
163
|
+
activeLockedId: AppState["activeLockedId"];
|
|
162
164
|
};
|
|
163
165
|
export interface AppState {
|
|
164
166
|
contextMenu: {
|
|
@@ -324,8 +326,6 @@ export interface AppState {
|
|
|
324
326
|
shown: true;
|
|
325
327
|
data: Spreadsheet;
|
|
326
328
|
};
|
|
327
|
-
/** imageElement waiting to be placed on canvas */
|
|
328
|
-
pendingImageElementId: ExcalidrawImageElement["id"] | null;
|
|
329
329
|
showHyperlinkPopup: false | "info" | "editor";
|
|
330
330
|
selectedLinearElement: LinearElementEditor | null;
|
|
331
331
|
snapLines: readonly SnapLine[];
|
|
@@ -341,9 +341,18 @@ export interface AppState {
|
|
|
341
341
|
/** image cropping */
|
|
342
342
|
isCropping: boolean;
|
|
343
343
|
croppingElementId: ExcalidrawElement["id"] | null;
|
|
344
|
-
|
|
344
|
+
/** null if no search matches found / search closed */
|
|
345
|
+
searchMatches: Readonly<{
|
|
346
|
+
focusedId: ExcalidrawElement["id"] | null;
|
|
347
|
+
matches: readonly SearchMatch[];
|
|
348
|
+
}> | null;
|
|
349
|
+
/** the locked element/group that's active and shows unlock popup */
|
|
350
|
+
activeLockedId: string | null;
|
|
351
|
+
lockedMultiSelections: {
|
|
352
|
+
[groupId: string]: true;
|
|
353
|
+
};
|
|
345
354
|
}
|
|
346
|
-
type SearchMatch = {
|
|
355
|
+
export type SearchMatch = {
|
|
347
356
|
id: string;
|
|
348
357
|
focus: boolean;
|
|
349
358
|
matchedLines: {
|
|
@@ -351,6 +360,7 @@ type SearchMatch = {
|
|
|
351
360
|
offsetY: number;
|
|
352
361
|
width: number;
|
|
353
362
|
height: number;
|
|
363
|
+
showOnCanvas: boolean;
|
|
354
364
|
}[];
|
|
355
365
|
};
|
|
356
366
|
export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
|
|
@@ -403,6 +413,7 @@ export type OnUserFollowedPayload = {
|
|
|
403
413
|
};
|
|
404
414
|
export interface ExcalidrawProps {
|
|
405
415
|
onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
416
|
+
onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
|
|
406
417
|
initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
|
|
407
418
|
excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
|
|
408
419
|
isCollaborating?: boolean;
|
|
@@ -611,6 +622,7 @@ export interface ExcalidrawImperativeAPI {
|
|
|
611
622
|
updateLibrary: InstanceType<typeof Library>["updateLibrary"];
|
|
612
623
|
resetScene: InstanceType<typeof App>["resetScene"];
|
|
613
624
|
getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
|
|
625
|
+
getSceneElementsMapIncludingDeleted: InstanceType<typeof App>["getSceneElementsMapIncludingDeleted"];
|
|
614
626
|
history: {
|
|
615
627
|
clear: InstanceType<typeof App>["resetHistory"];
|
|
616
628
|
};
|
|
@@ -635,6 +647,7 @@ export interface ExcalidrawImperativeAPI {
|
|
|
635
647
|
*/
|
|
636
648
|
updateFrameRendering: InstanceType<typeof App>["updateFrameRendering"];
|
|
637
649
|
onChange: (callback: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void) => UnsubscribeCallback;
|
|
650
|
+
onIncrement: (callback: (event: DurableIncrement | EphemeralIncrement) => void) => UnsubscribeCallback;
|
|
638
651
|
onPointerDown: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: React.PointerEvent<HTMLElement>) => void) => UnsubscribeCallback;
|
|
639
652
|
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
640
653
|
onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
|
|
@@ -15,3 +15,5 @@ export declare function radiansToDegrees(degrees: Radians): Degrees;
|
|
|
15
15
|
* @returns TRUE if the provided angle is a right angle
|
|
16
16
|
*/
|
|
17
17
|
export declare function isRightAngleRads(rads: Radians): boolean;
|
|
18
|
+
export declare function radiansBetweenAngles(a: Radians, min: Radians, max: Radians): boolean;
|
|
19
|
+
export declare function radiansDifference(a: Radians, b: Radians): Radians;
|
|
@@ -8,6 +8,7 @@ import type { Curve, GlobalPoint, LineSegment, LocalPoint } from "./types";
|
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
10
|
export declare function curve<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point, c: Point, d: Point): Curve<Point>;
|
|
11
|
+
export declare const bezierEquation: <Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, t: number) => Point;
|
|
11
12
|
/**
|
|
12
13
|
* Computes the intersection between a cubic spline and a line segment.
|
|
13
14
|
*/
|
|
@@ -38,3 +39,36 @@ export declare function curvePointDistance<Point extends GlobalPoint | LocalPoin
|
|
|
38
39
|
* Determines if the parameter is a Curve
|
|
39
40
|
*/
|
|
40
41
|
export declare function isCurve<P extends GlobalPoint | LocalPoint>(v: unknown): v is Curve<P>;
|
|
42
|
+
export declare function curveTangent<Point extends GlobalPoint | LocalPoint>([p0, p1, p2, p3]: Curve<Point>, t: number): import("./types").Vector;
|
|
43
|
+
export declare function curveCatmullRomQuadraticApproxPoints(points: GlobalPoint[], tension?: number): [GlobalPoint, GlobalPoint][] | undefined;
|
|
44
|
+
export declare function curveCatmullRomCubicApproxPoints<Point extends GlobalPoint | LocalPoint>(points: Point[], tension?: number): Curve<Point>[] | undefined;
|
|
45
|
+
export declare function curveOffsetPoints([p0, p1, p2, p3]: Curve<GlobalPoint>, offset: number, steps?: number): GlobalPoint[];
|
|
46
|
+
export declare function offsetPointsForQuadraticBezier(p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, offsetDist: number, steps?: number): GlobalPoint[];
|
|
47
|
+
/**
|
|
48
|
+
* Implementation based on Legendre-Gauss quadrature for more accurate arc
|
|
49
|
+
* length calculation.
|
|
50
|
+
*
|
|
51
|
+
* Reference: https://pomax.github.io/bezierinfo/#arclength
|
|
52
|
+
*
|
|
53
|
+
* @param c The curve to calculate the length of
|
|
54
|
+
* @returns The approximated length of the curve
|
|
55
|
+
*/
|
|
56
|
+
export declare function curveLength<P extends GlobalPoint | LocalPoint>(c: Curve<P>): number;
|
|
57
|
+
/**
|
|
58
|
+
* Calculates the curve length from t=0 to t=parameter using the same
|
|
59
|
+
* Legendre-Gauss quadrature method used in curveLength
|
|
60
|
+
*
|
|
61
|
+
* @param c The curve to calculate the partial length for
|
|
62
|
+
* @param t The parameter value (0 to 1) to calculate length up to
|
|
63
|
+
* @returns The length of the curve from beginning to parameter t
|
|
64
|
+
*/
|
|
65
|
+
export declare function curveLengthAtParameter<P extends GlobalPoint | LocalPoint>(c: Curve<P>, t: number): number;
|
|
66
|
+
/**
|
|
67
|
+
* Calculates the point at a specific percentage of a curve's total length
|
|
68
|
+
* using binary search for improved efficiency and accuracy.
|
|
69
|
+
*
|
|
70
|
+
* @param c The curve to calculate point on
|
|
71
|
+
* @param percent A value between 0 and 1 representing the percentage of the curve's length
|
|
72
|
+
* @returns The point at the specified percentage of curve length
|
|
73
|
+
*/
|
|
74
|
+
export declare function curvePointAtLength<P extends GlobalPoint | LocalPoint>(c: Curve<P>, percent: number): P;
|
|
@@ -43,7 +43,7 @@ export declare function isPoint(p: unknown): p is LocalPoint | GlobalPoint;
|
|
|
43
43
|
* @param b Point The second point to compare
|
|
44
44
|
* @returns TRUE if the points are sufficiently close to each other
|
|
45
45
|
*/
|
|
46
|
-
export declare function pointsEqual<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point): boolean;
|
|
46
|
+
export declare function pointsEqual<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point, tolerance?: number): boolean;
|
|
47
47
|
/**
|
|
48
48
|
* Rotate a point by [angle] radians.
|
|
49
49
|
*
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { GlobalPoint, LineSegment, LocalPoint, Rectangle } from "./types";
|
|
2
2
|
export declare function rectangle<P extends GlobalPoint | LocalPoint>(topLeft: P, bottomRight: P): Rectangle<P>;
|
|
3
|
+
export declare function rectangleFromNumberSequence<Point extends LocalPoint | GlobalPoint>(minX: number, minY: number, maxX: number, maxY: number): Rectangle<Point>;
|
|
3
4
|
export declare function rectangleIntersectLineSegment<Point extends LocalPoint | GlobalPoint>(r: Rectangle<Point>, l: LineSegment<Point>): Point[];
|
|
5
|
+
export declare function rectangleIntersectRectangle<Point extends LocalPoint | GlobalPoint>(rectangle1: Rectangle<Point>, rectangle2: Rectangle<Point>): boolean;
|
|
@@ -12,9 +12,11 @@ export declare function vector(x: number, y: number, originX?: number, originY?:
|
|
|
12
12
|
*
|
|
13
13
|
* @param p The point to turn into a vector
|
|
14
14
|
* @param origin The origin point in a given coordiante system
|
|
15
|
-
* @
|
|
15
|
+
* @param threshold The threshold to consider the vector as 'undefined'
|
|
16
|
+
* @param defaultValue The default value to return if the vector is 'undefined'
|
|
17
|
+
* @returns The created vector from the point and the origin or default
|
|
16
18
|
*/
|
|
17
|
-
export declare function vectorFromPoint<Point extends GlobalPoint | LocalPoint>(p: Point, origin?: Point): Vector;
|
|
19
|
+
export declare function vectorFromPoint<Point extends GlobalPoint | LocalPoint>(p: Point, origin?: Point, threshold?: number, defaultValue?: Vector): Vector;
|
|
18
20
|
/**
|
|
19
21
|
* Cross product is a binary operation on two vectors in 2D space.
|
|
20
22
|
* It results in a vector that is perpendicular to both vectors.
|
|
@@ -86,3 +88,7 @@ export declare function vectorMagnitude(v: Vector): number;
|
|
|
86
88
|
* @returns The new normalized vector
|
|
87
89
|
*/
|
|
88
90
|
export declare const vectorNormalize: (v: Vector) => Vector;
|
|
91
|
+
/**
|
|
92
|
+
* Calculate the right-hand normal of the vector.
|
|
93
|
+
*/
|
|
94
|
+
export declare const vectorNormal: (v: Vector) => Vector;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
|
|
2
|
-
import type { Bounds } from "@excalidraw/element
|
|
2
|
+
import type { Bounds } from "@excalidraw/element";
|
|
3
3
|
export type LineSegment<P extends LocalPoint | GlobalPoint> = [P, P];
|
|
4
4
|
export declare function getBBox<P extends LocalPoint | GlobalPoint>(line: LineSegment<P>): Bounds;
|
|
5
5
|
export declare function doBBoxesIntersect(a: Bounds, b: Bounds): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Bounds } from "@excalidraw/element
|
|
1
|
+
import type { Bounds } from "@excalidraw/element";
|
|
2
2
|
import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
3
3
|
type Element = NonDeletedExcalidrawElement;
|
|
4
4
|
type Elements = readonly NonDeletedExcalidrawElement[];
|