@zsviczian/excalidraw 0.18.0-13 → 0.18.0-15
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/excalidraw.development.js +153 -153
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/styles.development.css +38 -2
- package/dist/styles.production.css +2 -2
- package/package.json +1 -1
- package/types/common/src/constants.d.ts +1 -0
- package/types/{excalidraw → common/src}/emitter.d.ts +1 -1
- package/types/common/src/font-metadata.d.ts +4 -2
- package/types/common/src/index.d.ts +1 -0
- package/types/common/src/utility-types.d.ts +5 -0
- package/types/common/src/utils.d.ts +16 -4
- package/types/element/src/Scene.d.ts +4 -4
- package/types/element/src/ShapeCache.d.ts +1 -1
- package/types/element/src/align.d.ts +1 -1
- package/types/element/src/binding.d.ts +1 -1
- package/types/element/src/bounds.d.ts +1 -1
- package/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +40 -35
- package/types/element/src/dragElements.d.ts +1 -1
- package/types/element/src/flowchart.d.ts +1 -1
- package/types/element/src/frame.d.ts +3 -2
- package/types/element/src/index.d.ts +45 -2
- package/types/element/src/linearElementEditor.d.ts +4 -8
- package/types/element/src/newElement.d.ts +1 -1
- package/types/element/src/resizeElements.d.ts +1 -1
- package/types/element/src/selection.d.ts +1 -6
- package/types/element/src/store.d.ts +227 -0
- package/types/element/src/textElement.d.ts +1 -1
- package/types/element/src/transformHandles.d.ts +4 -4
- package/types/element/src/typeChecks.d.ts +2 -1
- package/types/element/src/types.d.ts +6 -1
- package/types/element/src/zindex.d.ts +3 -3
- package/types/excalidraw/actions/actionAddToLibrary.d.ts +24 -42
- package/types/excalidraw/actions/actionAlign.d.ts +8 -8
- package/types/excalidraw/actions/actionBoundText.d.ts +16 -28
- package/types/excalidraw/actions/actionCanvas.d.ts +238 -328
- package/types/excalidraw/actions/actionClipboard.d.ts +50 -86
- package/types/excalidraw/actions/actionCropEditor.d.ts +8 -14
- package/types/excalidraw/actions/actionDeleteSelected.d.ts +22 -40
- package/types/excalidraw/actions/actionDistribute.d.ts +4 -4
- package/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
- package/types/excalidraw/actions/actionElementLink.d.ts +8 -14
- package/types/excalidraw/actions/actionElementLock.d.ts +18 -30
- package/types/excalidraw/actions/actionEmbeddable.d.ts +8 -14
- package/types/excalidraw/actions/actionExport.d.ts +173 -227
- package/types/excalidraw/actions/actionFinalize.d.ts +14 -26
- package/types/excalidraw/actions/actionFlip.d.ts +4 -4
- package/types/excalidraw/actions/actionFrame.d.ts +81 -105
- package/types/excalidraw/actions/actionGroup.d.ts +22 -34
- package/types/excalidraw/actions/actionHistory.d.ts +1 -2
- package/types/excalidraw/actions/actionLinearEditor.d.ts +7 -13
- package/types/excalidraw/actions/actionLink.d.ts +9 -15
- package/types/excalidraw/actions/actionMenu.d.ts +26 -44
- package/types/excalidraw/actions/actionNavigate.d.ts +16 -28
- package/types/excalidraw/actions/actionProperties.d.ts +106 -196
- package/types/excalidraw/actions/actionSelectAll.d.ts +10 -16
- package/types/excalidraw/actions/actionStyles.d.ts +12 -18
- package/types/excalidraw/actions/actionToggleGridMode.d.ts +10 -16
- package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +10 -16
- package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +10 -225
- package/types/excalidraw/actions/actionToggleStats.d.ts +10 -16
- package/types/excalidraw/actions/actionToggleViewMode.d.ts +10 -16
- package/types/excalidraw/actions/actionToggleZenMode.d.ts +10 -16
- package/types/excalidraw/actions/actionZindex.d.ts +10 -10
- package/types/excalidraw/actions/types.d.ts +1 -1
- package/types/excalidraw/appState.d.ts +23 -23
- package/types/excalidraw/clipboard.d.ts +4 -4
- package/types/excalidraw/components/App.d.ts +8 -8
- package/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
- package/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +5 -1
- package/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -3
- package/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -3
- package/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -2
- package/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +1 -1
- package/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -28
- package/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
- package/types/excalidraw/components/Range.d.ts +3 -3
- package/types/excalidraw/components/Stats/Angle.d.ts +1 -1
- package/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
- package/types/excalidraw/components/Stats/CanvasGridSize.d.ts +1 -1
- package/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
- package/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
- package/types/excalidraw/components/Stats/DragInput.d.ts +1 -1
- package/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
- package/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
- package/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
- package/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
- package/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
- package/types/excalidraw/components/Stats/Position.d.ts +1 -1
- package/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
- package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +1 -1
- package/types/excalidraw/components/hyperlink/helpers.d.ts +1 -1
- package/types/excalidraw/components/icons.d.ts +1 -0
- package/types/excalidraw/components/shapes.d.ts +1 -1
- package/types/excalidraw/data/blob.d.ts +1 -1
- package/types/excalidraw/data/library.d.ts +1 -1
- package/types/excalidraw/data/transform.d.ts +1 -1
- package/types/excalidraw/fonts/Fonts.d.ts +1 -1
- package/types/excalidraw/history.d.ts +14 -22
- package/types/excalidraw/hooks/useEmitter.d.ts +1 -1
- package/types/excalidraw/index.d.ts +9 -9
- package/types/excalidraw/renderer/helpers.d.ts +6 -1
- package/types/excalidraw/scene/Renderer.d.ts +1 -1
- package/types/excalidraw/scene/index.d.ts +2 -2
- package/types/excalidraw/snapping.d.ts +2 -2
- package/types/excalidraw/types.d.ts +13 -6
- package/types/excalidraw/visualdebug.d.ts +1 -1
- package/types/math/src/curve.d.ts +2 -0
- package/types/math/src/vector.d.ts +4 -0
- package/types/utils/src/bbox.d.ts +1 -1
- package/types/utils/src/index.d.ts +1 -1
- package/types/utils/src/withinBounds.d.ts +1 -1
- package/types/excalidraw/store.d.ts +0 -129
|
@@ -1,5 +1,5 @@
|
|
|
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" | "gridSize";
|
|
5
5
|
export declare const SMALLEST_DELTA = 0.01;
|
|
@@ -3,4 +3,4 @@ export declare const DropdownMenuContentPropsContext: React.Context<{
|
|
|
3
3
|
onSelect?: ((event: Event) => void) | undefined;
|
|
4
4
|
}>;
|
|
5
5
|
export declare const getDropdownMenuItemClassName: (className?: string, selected?: boolean, hovered?: boolean) => string;
|
|
6
|
-
export declare const useHandleDropdownMenuItemClick: (origOnClick: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement> | undefined, onSelect: ((event: Event) => void) | undefined) => (event: React.MouseEvent<
|
|
6
|
+
export declare const useHandleDropdownMenuItemClick: (origOnClick: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement> | undefined, onSelect: ((event: Event) => void) | undefined) => (event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement, MouseEvent>) => void;
|
|
@@ -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,5 +1,5 @@
|
|
|
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
5
|
export declare const EXTERNAL_LINK_IMG: HTMLImageElement;
|
|
@@ -54,6 +54,7 @@ export declare const LoadIcon: import("react/jsx-runtime").JSX.Element;
|
|
|
54
54
|
export declare const clipboard: import("react/jsx-runtime").JSX.Element;
|
|
55
55
|
export declare const palette: import("react/jsx-runtime").JSX.Element;
|
|
56
56
|
export declare const bucketFillIcon: import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export declare const slashIcon: import("react/jsx-runtime").JSX.Element;
|
|
57
58
|
export declare const ExportImageIcon: import("react/jsx-runtime").JSX.Element;
|
|
58
59
|
export declare const exportToFileIcon: import("react/jsx-runtime").JSX.Element;
|
|
59
60
|
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) => "
|
|
62
|
+
export declare const findShapeByKey: (key: string) => "text" | "line" | "arrow" | "selection" | "rectangle" | "diamond" | "ellipse" | "freedraw" | "image" | "eraser" | null;
|
|
@@ -6,7 +6,7 @@ import type { FileSystemHandle } from "./filesystem";
|
|
|
6
6
|
import type { ImportedLibraryData } from "./types";
|
|
7
7
|
export declare const getMimeType: (blob: Blob | string) => string;
|
|
8
8
|
export declare const getFileHandleType: (handle: FileSystemHandle | null) => string | null;
|
|
9
|
-
export declare const isImageFileHandleType: (type: string | null) => type is "
|
|
9
|
+
export declare const isImageFileHandleType: (type: string | null) => type is "svg" | "png";
|
|
10
10
|
export declare const isImageFileHandle: (handle: FileSystemHandle | null) => boolean;
|
|
11
11
|
export declare const isSupportedImageFileType: (type: string | null | undefined) => boolean;
|
|
12
12
|
export declare const isSupportedImageFile: (blob: Blob | null | undefined) => blob is Blob & {
|
|
@@ -77,7 +77,7 @@ declare class Library {
|
|
|
77
77
|
merge?: boolean | undefined;
|
|
78
78
|
prompt?: boolean | undefined;
|
|
79
79
|
openLibraryMenu?: boolean | undefined;
|
|
80
|
-
defaultStatus?: "
|
|
80
|
+
defaultStatus?: "unpublished" | "published" | undefined;
|
|
81
81
|
}) => Promise<LibraryItems>;
|
|
82
82
|
setLibrary: (libraryItems: LibraryItems | Promise<LibraryItems> | ((latestLibraryItems: LibraryItems) => LibraryItems | Promise<LibraryItems>)) => Promise<LibraryItems>;
|
|
83
83
|
}
|
|
@@ -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 = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FontMetadata } from "@excalidraw/common";
|
|
2
2
|
import type { ExcalidrawElement, ExcalidrawTextElement } 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,32 @@
|
|
|
1
|
+
import { Emitter } from "@excalidraw/common";
|
|
2
|
+
import { StoreDelta, type Store } from "@excalidraw/element";
|
|
1
3
|
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
4
|
import type { AppState } from "./types";
|
|
5
|
+
declare class HistoryEntry extends StoreDelta {
|
|
6
|
+
}
|
|
6
7
|
export declare class HistoryChangedEvent {
|
|
7
8
|
readonly isUndoStackEmpty: boolean;
|
|
8
9
|
readonly isRedoStackEmpty: boolean;
|
|
9
10
|
constructor(isUndoStackEmpty?: boolean, isRedoStackEmpty?: boolean);
|
|
10
11
|
}
|
|
11
12
|
export declare class History {
|
|
13
|
+
private readonly store;
|
|
12
14
|
readonly onHistoryChangedEmitter: Emitter<[HistoryChangedEvent]>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
readonly undoStack: HistoryEntry[];
|
|
16
|
+
readonly redoStack: HistoryEntry[];
|
|
15
17
|
get isUndoStackEmpty(): boolean;
|
|
16
18
|
get isRedoStackEmpty(): boolean;
|
|
19
|
+
constructor(store: Store);
|
|
17
20
|
clear(): void;
|
|
18
21
|
/**
|
|
19
|
-
* Record a local
|
|
22
|
+
* Record a non-empty local durable increment, which will go into the undo stack..
|
|
23
|
+
* Do not re-record history entries, which were already pushed to undo / redo stack, as part of history action.
|
|
20
24
|
*/
|
|
21
|
-
record(
|
|
22
|
-
undo(elements: SceneElementsMap, appState: AppState
|
|
23
|
-
redo(elements: SceneElementsMap, appState: AppState
|
|
25
|
+
record(delta: StoreDelta): void;
|
|
26
|
+
undo(elements: SceneElementsMap, appState: AppState): void | [SceneElementsMap, AppState];
|
|
27
|
+
redo(elements: SceneElementsMap, appState: AppState): void | [SceneElementsMap, AppState];
|
|
24
28
|
private perform;
|
|
25
29
|
private static pop;
|
|
26
30
|
private static push;
|
|
27
31
|
}
|
|
28
|
-
export
|
|
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
|
-
}
|
|
32
|
+
export {};
|
|
@@ -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,8 +9,8 @@ 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";
|
|
@@ -29,12 +29,12 @@ export { refreshTextDimensions } from "@excalidraw/element/newElement";
|
|
|
29
29
|
export { getContainerElement } from "@excalidraw/element/textElement";
|
|
30
30
|
export { serializeAsJSON, serializeLibraryAsJSON } from "./data/json";
|
|
31
31
|
export { loadFromBlob, loadSceneOrLibraryFromBlob, loadLibraryFromBlob, } from "./data/blob";
|
|
32
|
-
export { getFreeDrawSvgPath } from "@excalidraw/element
|
|
32
|
+
export { getFreeDrawSvgPath } from "@excalidraw/element";
|
|
33
33
|
export { mergeLibraryItems, getLibraryItemsHash } from "./data/library";
|
|
34
|
-
export { isLinearElement } from "@excalidraw/element
|
|
34
|
+
export { isLinearElement } from "@excalidraw/element";
|
|
35
35
|
export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS, DEFAULT_LASER_COLOR, UserIdleState, normalizeLink, } from "@excalidraw/common";
|
|
36
|
-
export { mutateElement, newElementWith, bumpVersion, } from "@excalidraw/element
|
|
37
|
-
export { CaptureUpdateAction } from "
|
|
36
|
+
export { mutateElement, newElementWith, bumpVersion, } from "@excalidraw/element";
|
|
37
|
+
export { CaptureUpdateAction } from "@excalidraw/element";
|
|
38
38
|
export { parseLibraryTokensFromUrl, useHandleLibrary } from "./data/library";
|
|
39
39
|
export { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, safelyParseJSON, } from "@excalidraw/common";
|
|
40
40
|
export { getEmbedLink } from "@excalidraw/element/embeddable";
|
|
@@ -51,9 +51,9 @@ export { TTDDialog } from "./components/TTDDialog/TTDDialog";
|
|
|
51
51
|
export { TTDDialogTrigger } from "./components/TTDDialog/TTDDialogTrigger";
|
|
52
52
|
export { zoomToFitBounds } from "./actions/actionCanvas";
|
|
53
53
|
export { convertToExcalidrawElements } from "./data/transform";
|
|
54
|
-
export { getCommonBounds, getVisibleSceneBounds
|
|
54
|
+
export { getCommonBounds, getVisibleSceneBounds } from "@excalidraw/element";
|
|
55
55
|
export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "@excalidraw/utils/withinBounds";
|
|
56
56
|
export { DiagramToCodePlugin } from "./components/DiagramToCodePlugin/DiagramToCodePlugin";
|
|
57
57
|
export { getDataURL } from "./data/blob";
|
|
58
|
-
export { isElementLink } from "@excalidraw/element
|
|
59
|
-
export { setCustomTextMetricsProvider } from "@excalidraw/element
|
|
58
|
+
export { isElementLink } from "@excalidraw/element";
|
|
59
|
+
export { setCustomTextMetricsProvider } from "@excalidraw/element";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { ExcalidrawDiamondElement, ExcalidrawRectanguloidElement } from "@excalidraw/element/types";
|
|
1
2
|
import type { StaticCanvasRenderConfig } from "../scene/types";
|
|
2
|
-
import type {
|
|
3
|
+
import type { AppState, StaticCanvasAppState } from "../types";
|
|
3
4
|
export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke?: 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, }: {
|
|
@@ -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, 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) => 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;
|
|
@@ -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, ColorPaletteCustom } from "@excalidraw/common";
|
|
2
|
-
import type { SuggestedBinding } from "@excalidraw/element
|
|
3
|
-
import type { LinearElementEditor } from "@excalidraw/element
|
|
4
|
-
import type { MaybeTransformHandleType } from "@excalidraw/element
|
|
2
|
+
import type { SuggestedBinding } from "@excalidraw/element";
|
|
3
|
+
import type { LinearElementEditor } from "@excalidraw/element";
|
|
4
|
+
import type { MaybeTransformHandleType } from "@excalidraw/element";
|
|
5
5
|
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, 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";
|
|
@@ -384,9 +384,13 @@ export interface AppState {
|
|
|
384
384
|
/** image cropping */
|
|
385
385
|
isCropping: boolean;
|
|
386
386
|
croppingElementId: ExcalidrawElement["id"] | null;
|
|
387
|
-
|
|
387
|
+
/** null if no search matches found / search closed */
|
|
388
|
+
searchMatches: Readonly<{
|
|
389
|
+
focusedId: ExcalidrawElement["id"] | null;
|
|
390
|
+
matches: readonly SearchMatch[];
|
|
391
|
+
}> | null;
|
|
388
392
|
}
|
|
389
|
-
type SearchMatch = {
|
|
393
|
+
export type SearchMatch = {
|
|
390
394
|
id: string;
|
|
391
395
|
focus: boolean;
|
|
392
396
|
matchedLines: {
|
|
@@ -394,6 +398,7 @@ type SearchMatch = {
|
|
|
394
398
|
offsetY: number;
|
|
395
399
|
width: number;
|
|
396
400
|
height: number;
|
|
401
|
+
showOnCanvas: boolean;
|
|
397
402
|
}[];
|
|
398
403
|
};
|
|
399
404
|
export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
|
|
@@ -446,6 +451,7 @@ export type OnUserFollowedPayload = {
|
|
|
446
451
|
};
|
|
447
452
|
export interface ExcalidrawProps {
|
|
448
453
|
onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
454
|
+
onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
|
|
449
455
|
initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
|
|
450
456
|
excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
|
|
451
457
|
isCollaborating?: boolean;
|
|
@@ -707,6 +713,7 @@ export interface ExcalidrawImperativeAPI {
|
|
|
707
713
|
*/
|
|
708
714
|
updateFrameRendering: InstanceType<typeof App>["updateFrameRendering"];
|
|
709
715
|
onChange: (callback: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void) => UnsubscribeCallback;
|
|
716
|
+
onIncrement: (callback: (event: DurableIncrement | EphemeralIncrement) => void) => UnsubscribeCallback;
|
|
710
717
|
onPointerDown: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: React.PointerEvent<HTMLElement>) => void) => UnsubscribeCallback;
|
|
711
718
|
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
712
719
|
onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
|
|
2
2
|
import type { Curve } from "@excalidraw/math";
|
|
3
3
|
import type { LineSegment } from "@excalidraw/utils";
|
|
4
|
-
import type { Bounds } from "@excalidraw/element
|
|
4
|
+
import type { Bounds } from "@excalidraw/element";
|
|
5
5
|
declare global {
|
|
6
6
|
interface Window {
|
|
7
7
|
visualDebug?: {
|
|
@@ -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,4 @@ 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;
|
|
@@ -86,3 +86,7 @@ export declare function vectorMagnitude(v: Vector): number;
|
|
|
86
86
|
* @returns The new normalized vector
|
|
87
87
|
*/
|
|
88
88
|
export declare const vectorNormalize: (v: Vector) => Vector;
|
|
89
|
+
/**
|
|
90
|
+
* Calculate the right-hand normal of the vector.
|
|
91
|
+
*/
|
|
92
|
+
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[];
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import type { OrderedExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
-
import type { ValueOf } from "@excalidraw/common/utility-types";
|
|
3
|
-
import { AppStateChange, ElementsChange } from "./change";
|
|
4
|
-
import { Emitter } from "./emitter";
|
|
5
|
-
import type { AppState, ObservedAppState } from "./types";
|
|
6
|
-
export declare const getObservedAppState: (appState: AppState) => ObservedAppState;
|
|
7
|
-
export declare const CaptureUpdateAction: {
|
|
8
|
-
/**
|
|
9
|
-
* Immediately undoable.
|
|
10
|
-
*
|
|
11
|
-
* Use for updates which should be captured.
|
|
12
|
-
* Should be used for most of the local updates.
|
|
13
|
-
*
|
|
14
|
-
* These updates will _immediately_ make it to the local undo / redo stacks.
|
|
15
|
-
*/
|
|
16
|
-
readonly IMMEDIATELY: "IMMEDIATELY";
|
|
17
|
-
/**
|
|
18
|
-
* Never undoable.
|
|
19
|
-
*
|
|
20
|
-
* Use for updates which should never be recorded, such as remote updates
|
|
21
|
-
* or scene initialization.
|
|
22
|
-
*
|
|
23
|
-
* These updates will _never_ make it to the local undo / redo stacks.
|
|
24
|
-
*/
|
|
25
|
-
readonly NEVER: "NEVER";
|
|
26
|
-
/**
|
|
27
|
-
* Eventually undoable.
|
|
28
|
-
*
|
|
29
|
-
* Use for updates which should not be captured immediately - likely
|
|
30
|
-
* exceptions which are part of some async multi-step process. Otherwise, all
|
|
31
|
-
* such updates would end up being captured with the next
|
|
32
|
-
* `CaptureUpdateAction.IMMEDIATELY` - triggered either by the next `updateScene`
|
|
33
|
-
* or internally by the editor.
|
|
34
|
-
*
|
|
35
|
-
* These updates will _eventually_ make it to the local undo / redo stacks.
|
|
36
|
-
*/
|
|
37
|
-
readonly EVENTUALLY: "EVENTUALLY";
|
|
38
|
-
};
|
|
39
|
-
export type CaptureUpdateActionType = ValueOf<typeof CaptureUpdateAction>;
|
|
40
|
-
/**
|
|
41
|
-
* Represent an increment to the Store.
|
|
42
|
-
*/
|
|
43
|
-
declare class StoreIncrementEvent {
|
|
44
|
-
readonly elementsChange: ElementsChange;
|
|
45
|
-
readonly appStateChange: AppStateChange;
|
|
46
|
-
constructor(elementsChange: ElementsChange, appStateChange: AppStateChange);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Store which captures the observed changes and emits them as `StoreIncrementEvent` events.
|
|
50
|
-
*
|
|
51
|
-
* @experimental this interface is experimental and subject to change.
|
|
52
|
-
*/
|
|
53
|
-
export interface IStore {
|
|
54
|
-
onStoreIncrementEmitter: Emitter<[StoreIncrementEvent]>;
|
|
55
|
-
get snapshot(): Snapshot;
|
|
56
|
-
set snapshot(snapshot: Snapshot);
|
|
57
|
-
/**
|
|
58
|
-
* Use to schedule update of the snapshot, useful on updates for which we don't need to calculate increments (i.e. remote updates).
|
|
59
|
-
*/
|
|
60
|
-
shouldUpdateSnapshot(): void;
|
|
61
|
-
/**
|
|
62
|
-
* Use to schedule calculation of a store increment.
|
|
63
|
-
*/
|
|
64
|
-
shouldCaptureIncrement(): void;
|
|
65
|
-
/**
|
|
66
|
-
* Based on the scheduled operation, either only updates store snapshot or also calculates increment and emits the result as a `StoreIncrementEvent`.
|
|
67
|
-
*
|
|
68
|
-
* @emits StoreIncrementEvent when increment is calculated.
|
|
69
|
-
*/
|
|
70
|
-
commit(elements: Map<string, OrderedExcalidrawElement> | undefined, appState: AppState | ObservedAppState | undefined): void;
|
|
71
|
-
/**
|
|
72
|
-
* Clears the store instance.
|
|
73
|
-
*/
|
|
74
|
-
clear(): void;
|
|
75
|
-
/**
|
|
76
|
-
* Filters out yet uncomitted elements from `nextElements`, which are part of in-progress local async actions (ephemerals) and thus were not yet commited to the snapshot.
|
|
77
|
-
*
|
|
78
|
-
* This is necessary in updates in which we receive reconciled elements, already containing elements which were not yet captured by the local store (i.e. collab).
|
|
79
|
-
*/
|
|
80
|
-
filterUncomittedElements(prevElements: Map<string, OrderedExcalidrawElement>, nextElements: Map<string, OrderedExcalidrawElement>): Map<string, OrderedExcalidrawElement>;
|
|
81
|
-
}
|
|
82
|
-
export declare class Store implements IStore {
|
|
83
|
-
readonly onStoreIncrementEmitter: Emitter<[StoreIncrementEvent]>;
|
|
84
|
-
private scheduledActions;
|
|
85
|
-
private _snapshot;
|
|
86
|
-
get snapshot(): Snapshot;
|
|
87
|
-
set snapshot(snapshot: Snapshot);
|
|
88
|
-
shouldCaptureIncrement: () => void;
|
|
89
|
-
shouldUpdateSnapshot: () => void;
|
|
90
|
-
private scheduleAction;
|
|
91
|
-
commit: (elements: Map<string, OrderedExcalidrawElement> | undefined, appState: AppState | ObservedAppState | undefined) => void;
|
|
92
|
-
captureIncrement: (elements: Map<string, OrderedExcalidrawElement> | undefined, appState: AppState | ObservedAppState | undefined) => void;
|
|
93
|
-
updateSnapshot: (elements: Map<string, OrderedExcalidrawElement> | undefined, appState: AppState | ObservedAppState | undefined) => void;
|
|
94
|
-
filterUncomittedElements: (prevElements: Map<string, OrderedExcalidrawElement>, nextElements: Map<string, OrderedExcalidrawElement>) => Map<string, OrderedExcalidrawElement>;
|
|
95
|
-
clear: () => void;
|
|
96
|
-
private satisfiesScheduledActionsInvariant;
|
|
97
|
-
}
|
|
98
|
-
export declare class Snapshot {
|
|
99
|
-
readonly elements: Map<string, OrderedExcalidrawElement>;
|
|
100
|
-
readonly appState: ObservedAppState;
|
|
101
|
-
readonly meta: {
|
|
102
|
-
didElementsChange: boolean;
|
|
103
|
-
didAppStateChange: boolean;
|
|
104
|
-
isEmpty?: boolean;
|
|
105
|
-
};
|
|
106
|
-
private constructor();
|
|
107
|
-
static empty(): Snapshot;
|
|
108
|
-
isEmpty(): boolean | undefined;
|
|
109
|
-
/**
|
|
110
|
-
* Efficiently clone the existing snapshot, only if we detected changes.
|
|
111
|
-
*
|
|
112
|
-
* @returns same instance if there are no changes detected, new instance otherwise.
|
|
113
|
-
*/
|
|
114
|
-
maybeClone(elements: Map<string, OrderedExcalidrawElement> | undefined, appState: AppState | ObservedAppState | undefined): Snapshot;
|
|
115
|
-
private maybeCreateAppStateSnapshot;
|
|
116
|
-
private detectChangedAppState;
|
|
117
|
-
private maybeCreateElementsSnapshot;
|
|
118
|
-
/**
|
|
119
|
-
* Detect if there any changed elements.
|
|
120
|
-
*
|
|
121
|
-
* NOTE: we shouldn't just use `sceneVersionNonce` instead, as we need to call this before the scene updates.
|
|
122
|
-
*/
|
|
123
|
-
private detectChangedElements;
|
|
124
|
-
/**
|
|
125
|
-
* Perform structural clone, cloning only elements that changed.
|
|
126
|
-
*/
|
|
127
|
-
private createElementsSnapshot;
|
|
128
|
-
}
|
|
129
|
-
export {};
|