@zsviczian/excalidraw 0.17.1-obsidian-15 → 0.17.1-obsidian-16
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 +105 -83
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/styles.development.css +405 -357
- package/dist/styles.production.css +12 -12
- package/package.json +1 -1
- package/types/excalidraw/actions/actionAddToLibrary.d.ts +6 -6
- package/types/excalidraw/actions/actionBoundText.d.ts +4 -4
- package/types/excalidraw/actions/actionCanvas.d.ts +28 -28
- package/types/excalidraw/actions/actionClipboard.d.ts +14 -14
- package/types/excalidraw/actions/actionDeleteSelected.d.ts +7 -7
- package/types/excalidraw/actions/actionDuplicateSelection.d.ts +1 -1
- package/types/excalidraw/actions/actionElementLock.d.ts +4 -4
- package/types/excalidraw/actions/actionExport.d.ts +18 -18
- package/types/excalidraw/actions/actionFinalize.d.ts +4 -4
- package/types/excalidraw/actions/actionFrame.d.ts +6 -6
- package/types/excalidraw/actions/actionGroup.d.ts +4 -4
- package/types/excalidraw/actions/actionLinearEditor.d.ts +2 -2
- package/types/excalidraw/actions/actionLink.d.ts +197 -0
- package/types/excalidraw/actions/actionMenu.d.ts +6 -6
- package/types/excalidraw/actions/actionNavigate.d.ts +4 -4
- package/types/excalidraw/actions/actionProperties.d.ts +26 -26
- package/types/excalidraw/actions/actionSelectAll.d.ts +2 -2
- package/types/excalidraw/actions/actionStyles.d.ts +2 -2
- package/types/excalidraw/actions/actionToggleGridMode.d.ts +2 -2
- package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +2 -2
- package/types/excalidraw/actions/actionToggleStats.d.ts +2 -2
- package/types/excalidraw/actions/actionToggleViewMode.d.ts +2 -2
- package/types/excalidraw/actions/actionToggleZenMode.d.ts +2 -2
- package/types/excalidraw/actions/index.d.ts +1 -1
- package/types/excalidraw/appState.d.ts +1 -1
- package/types/excalidraw/components/App.d.ts +3 -0
- package/types/excalidraw/components/Button.d.ts +1 -0
- package/types/excalidraw/components/FilledButton.d.ts +2 -2
- package/types/excalidraw/components/ImageExportDialog.d.ts +2 -1
- package/types/excalidraw/components/ProjectName.d.ts +0 -1
- package/types/excalidraw/components/TextField.d.ts +5 -2
- package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +18 -0
- package/types/excalidraw/components/hyperlink/helpers.d.ts +7 -0
- package/types/excalidraw/constants.d.ts +5 -0
- package/types/excalidraw/data/filesystem.d.ts +1 -1
- package/types/excalidraw/data/index.d.ts +2 -1
- package/types/excalidraw/data/json.d.ts +1 -1
- package/types/excalidraw/data/resave.d.ts +1 -1
- package/types/excalidraw/element/ElementCanvasButtons.d.ts +3 -2
- package/types/excalidraw/element/binding.d.ts +9 -9
- package/types/excalidraw/element/bounds.d.ts +6 -6
- package/types/excalidraw/element/collision.d.ts +8 -8
- package/types/excalidraw/element/embeddable.d.ts +2 -2
- package/types/excalidraw/element/linearElementEditor.d.ts +30 -30
- package/types/excalidraw/element/newElement.d.ts +4 -4
- package/types/excalidraw/element/resizeElements.d.ts +1 -1
- package/types/excalidraw/element/resizeTest.d.ts +3 -3
- package/types/excalidraw/element/sizeHelpers.d.ts +2 -2
- package/types/excalidraw/element/textElement.d.ts +5 -5
- package/types/excalidraw/element/transformHandles.d.ts +2 -2
- package/types/excalidraw/frame.d.ts +11 -11
- package/types/excalidraw/history.d.ts +1 -1
- package/types/excalidraw/scene/Scene.d.ts +2 -7
- package/types/excalidraw/scene/scrollbars.d.ts +3 -2
- package/types/excalidraw/scene/selection.d.ts +3 -3
- package/types/excalidraw/snapping.d.ts +7 -7
- package/types/excalidraw/types.d.ts +5 -3
|
@@ -4,18 +4,18 @@ import { FrameNameBoundsCache, Point } from "../types";
|
|
|
4
4
|
import { AppState } from "../types";
|
|
5
5
|
export declare const hitTest: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache, x: number, y: number, elementsMap: ElementsMap) => boolean;
|
|
6
6
|
export declare const isHittingElementBoundingBoxWithoutHittingElement: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache, x: number, y: number, elementsMap: ElementsMap) => boolean;
|
|
7
|
-
export declare const isHittingElementNotConsideringBoundingBox: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache | null, point: readonly [number, number]) => boolean;
|
|
8
|
-
export declare const isPointHittingElementBoundingBox: (element: NonDeleted<ExcalidrawElement>, [x, y]: readonly [number, number], threshold: number, frameNameBoundsCache: FrameNameBoundsCache | null) => boolean;
|
|
7
|
+
export declare const isHittingElementNotConsideringBoundingBox: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache | null, point: readonly [number, number], elementsMap: ElementsMap) => boolean;
|
|
8
|
+
export declare const isPointHittingElementBoundingBox: (element: NonDeleted<ExcalidrawElement>, elementsMap: ElementsMap, [x, y]: readonly [number, number], threshold: number, frameNameBoundsCache: FrameNameBoundsCache | null) => boolean;
|
|
9
9
|
export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
|
|
10
10
|
x: number;
|
|
11
11
|
y: number;
|
|
12
|
-
}) => boolean;
|
|
12
|
+
}, elementsMap: ElementsMap) => boolean;
|
|
13
13
|
export declare const maxBindingGap: (element: ExcalidrawElement, elementWidth: number, elementHeight: number) => number;
|
|
14
|
-
export declare const distanceToBindableElement: (element: ExcalidrawBindableElement, point: readonly [number, number]) => number;
|
|
15
|
-
export declare const pointInAbsoluteCoords: (element: ExcalidrawElement, point: readonly [number, number]) => readonly [number, number];
|
|
16
|
-
export declare const determineFocusDistance: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number]) => number;
|
|
17
|
-
export declare const determineFocusPoint: (element: ExcalidrawBindableElement, focus: number, adjecentPoint: readonly [number, number]) => readonly [number, number];
|
|
18
|
-
export declare const intersectElementWithLine: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], gap
|
|
14
|
+
export declare const distanceToBindableElement: (element: ExcalidrawBindableElement, point: readonly [number, number], elementsMap: ElementsMap) => number;
|
|
15
|
+
export declare const pointInAbsoluteCoords: (element: ExcalidrawElement, elementsMap: ElementsMap, point: readonly [number, number]) => readonly [number, number];
|
|
16
|
+
export declare const determineFocusDistance: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], elementsMap: ElementsMap) => number;
|
|
17
|
+
export declare const determineFocusPoint: (element: ExcalidrawBindableElement, focus: number, adjecentPoint: readonly [number, number], elementsMap: ElementsMap) => readonly [number, number];
|
|
18
|
+
export declare const intersectElementWithLine: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], gap: number | undefined, elementsMap: ElementsMap) => Point[];
|
|
19
19
|
export declare const getCircleIntersections: (center: readonly [number, number, number, number, number, number, number, number], radius: number, line: readonly [number, number, number, number, number, number, number, number]) => GA.Point[];
|
|
20
20
|
export declare const findFocusPointForEllipse: (ellipse: ExcalidrawEllipseElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
|
|
21
21
|
export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawDiamondElement | ExcalidrawTextElement | ExcalidrawIframeLikeElement | ExcalidrawFrameLikeElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
|
|
@@ -69,7 +69,7 @@ export declare const actionSetEmbeddableAsActiveTool: {
|
|
|
69
69
|
scrollY: number;
|
|
70
70
|
cursorButton: "up" | "down";
|
|
71
71
|
scrolledOutside: boolean;
|
|
72
|
-
name: string;
|
|
72
|
+
name: string | null;
|
|
73
73
|
isResizing: boolean;
|
|
74
74
|
isRotating: boolean;
|
|
75
75
|
zoom: Readonly<{
|
|
@@ -147,7 +147,7 @@ export declare const actionSetEmbeddableAsActiveTool: {
|
|
|
147
147
|
data: import("../charts").Spreadsheet;
|
|
148
148
|
};
|
|
149
149
|
pendingImageElementId: string | null;
|
|
150
|
-
showHyperlinkPopup: false | "
|
|
150
|
+
showHyperlinkPopup: false | "info" | "editor";
|
|
151
151
|
linkOpacity: number;
|
|
152
152
|
trayModeEnabled: boolean;
|
|
153
153
|
colorPalette?: {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap } from "./types";
|
|
1
|
+
import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "./types";
|
|
2
2
|
import { Bounds } from "./bounds";
|
|
3
3
|
import { Point, AppState, PointerCoords, InteractiveCanvasAppState } from "../types";
|
|
4
4
|
import History from "../history";
|
|
5
|
-
import Scene from "../scene/Scene";
|
|
6
5
|
declare const editorMidPointsCache: {
|
|
7
6
|
version: number | null;
|
|
8
7
|
points: (Point | null)[];
|
|
@@ -39,47 +38,48 @@ export declare class LinearElementEditor {
|
|
|
39
38
|
readonly endBindingElement: ExcalidrawBindableElement | null | "keep";
|
|
40
39
|
readonly hoverPointIndex: number;
|
|
41
40
|
readonly segmentMidPointHoveredCoords: Point | null;
|
|
42
|
-
constructor(element: NonDeleted<ExcalidrawLinearElement
|
|
41
|
+
constructor(element: NonDeleted<ExcalidrawLinearElement>);
|
|
43
42
|
static POINT_HANDLE_SIZE: number;
|
|
44
43
|
/**
|
|
45
44
|
* @param id the `elementId` from the instance of this class (so that we can
|
|
46
45
|
* statically guarantee this method returns an ExcalidrawLinearElement)
|
|
47
46
|
*/
|
|
48
|
-
static getElement(id: InstanceType<typeof LinearElementEditor>["elementId"]): NonDeleted<ExcalidrawLinearElement> | null;
|
|
49
|
-
static handleBoxSelection(event: PointerEvent, appState: AppState, setState: React.Component<any, AppState>["setState"]): false | undefined;
|
|
47
|
+
static getElement(id: InstanceType<typeof LinearElementEditor>["elementId"], elementsMap: ElementsMap): NonDeleted<ExcalidrawLinearElement> | null;
|
|
48
|
+
static handleBoxSelection(event: PointerEvent, appState: AppState, setState: React.Component<any, AppState>["setState"], elementsMap: NonDeletedSceneElementsMap): false | undefined;
|
|
50
49
|
/** @returns whether point was dragged */
|
|
51
50
|
static handlePointDragging(event: PointerEvent, appState: AppState, scenePointerX: number, scenePointerY: number, maybeSuggestBinding: (element: NonDeleted<ExcalidrawLinearElement>, pointSceneCoords: {
|
|
52
51
|
x: number;
|
|
53
52
|
y: number;
|
|
54
|
-
}[]) => void, linearElementEditor: LinearElementEditor, elementsMap:
|
|
55
|
-
static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState): LinearElementEditor;
|
|
53
|
+
}[]) => void, linearElementEditor: LinearElementEditor, elementsMap: NonDeletedSceneElementsMap): boolean;
|
|
54
|
+
static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap): LinearElementEditor;
|
|
56
55
|
static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => (typeof editorMidPointsCache)["points"];
|
|
57
|
-
static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, appState: InteractiveCanvasAppState) => void;
|
|
56
|
+
static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, appState: InteractiveCanvasAppState) => void;
|
|
58
57
|
static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
|
|
59
58
|
x: number;
|
|
60
59
|
y: number;
|
|
61
60
|
}, appState: AppState, elementsMap: ElementsMap) => readonly [number, number] | null;
|
|
62
61
|
static isSegmentTooShort(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, zoom: AppState["zoom"]): boolean;
|
|
63
|
-
static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, endPointIndex: number): readonly [number, number];
|
|
62
|
+
static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, endPointIndex: number, elementsMap: ElementsMap): readonly [number, number];
|
|
64
63
|
static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: Point, elementsMap: ElementsMap): number;
|
|
65
64
|
static handlePointerDown(event: React.PointerEvent<HTMLElement>, appState: AppState, history: History, scenePointer: {
|
|
66
65
|
x: number;
|
|
67
66
|
y: number;
|
|
68
|
-
}, linearElementEditor: LinearElementEditor, elementsMap:
|
|
67
|
+
}, linearElementEditor: LinearElementEditor, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap): {
|
|
69
68
|
didAddPoint: boolean;
|
|
70
69
|
hitElement: NonDeleted<ExcalidrawElement> | null;
|
|
71
70
|
linearElementEditor: LinearElementEditor | null;
|
|
72
71
|
};
|
|
73
72
|
static arePointsEqual(point1: Point | null, point2: Point | null): boolean;
|
|
74
|
-
static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, appState: AppState): LinearElementEditor | null;
|
|
73
|
+
static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, appState: AppState, elementsMap: ElementsMap): LinearElementEditor | null;
|
|
75
74
|
/** scene coords */
|
|
76
|
-
static getPointGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, point: Point): readonly [number, number];
|
|
75
|
+
static getPointGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, point: Point, elementsMap: ElementsMap): readonly [number, number];
|
|
77
76
|
/** scene coords */
|
|
78
|
-
static getPointsGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement
|
|
79
|
-
static getPointAtIndexGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, indexMaybeFromEnd: number
|
|
80
|
-
|
|
81
|
-
static
|
|
82
|
-
static
|
|
77
|
+
static getPointsGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap): Point[];
|
|
78
|
+
static getPointAtIndexGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, indexMaybeFromEnd: number, // -1 for last element
|
|
79
|
+
elementsMap: ElementsMap): Point;
|
|
80
|
+
static pointFromAbsoluteCoords(element: NonDeleted<ExcalidrawLinearElement>, absoluteCoords: Point, elementsMap: ElementsMap): Point;
|
|
81
|
+
static getPointIndexUnderCursor(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, zoom: AppState["zoom"], x: number, y: number): number;
|
|
82
|
+
static createPointAt(element: NonDeleted<ExcalidrawLinearElement>, elementsMap: ElementsMap, scenePointerX: number, scenePointerY: number, gridSize: number | null): Point;
|
|
83
83
|
/**
|
|
84
84
|
* Normalizes line points so that the start point is at [0,0]. This is
|
|
85
85
|
* expected in various parts of the codebase. Also returns new x/y to account
|
|
@@ -91,7 +91,7 @@ export declare class LinearElementEditor {
|
|
|
91
91
|
y: number;
|
|
92
92
|
};
|
|
93
93
|
static normalizePoints(element: NonDeleted<ExcalidrawLinearElement>): void;
|
|
94
|
-
static duplicateSelectedPoints(appState: AppState): false | {
|
|
94
|
+
static duplicateSelectedPoints(appState: AppState, elementsMap: ElementsMap): false | {
|
|
95
95
|
appState: {
|
|
96
96
|
editingLinearElement: {
|
|
97
97
|
selectedPointsIndices: number[];
|
|
@@ -132,13 +132,13 @@ export declare class LinearElementEditor {
|
|
|
132
132
|
isLoading: boolean;
|
|
133
133
|
errorMessage: import("react").ReactNode;
|
|
134
134
|
activeEmbeddable: {
|
|
135
|
-
element:
|
|
135
|
+
element: NonDeletedExcalidrawElement;
|
|
136
136
|
state: "active" | "hover";
|
|
137
137
|
} | null;
|
|
138
|
-
draggingElement:
|
|
139
|
-
resizingElement:
|
|
138
|
+
draggingElement: NonDeletedExcalidrawElement | null;
|
|
139
|
+
resizingElement: NonDeletedExcalidrawElement | null;
|
|
140
140
|
multiElement: NonDeleted<ExcalidrawLinearElement> | null;
|
|
141
|
-
selectionElement:
|
|
141
|
+
selectionElement: NonDeletedExcalidrawElement | null;
|
|
142
142
|
isBindingEnabled: boolean;
|
|
143
143
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
144
144
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
@@ -151,7 +151,7 @@ export declare class LinearElementEditor {
|
|
|
151
151
|
};
|
|
152
152
|
editingFrame: string | null;
|
|
153
153
|
elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
|
|
154
|
-
editingElement:
|
|
154
|
+
editingElement: NonDeletedExcalidrawElement | null;
|
|
155
155
|
activeTool: {
|
|
156
156
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
157
157
|
locked: boolean;
|
|
@@ -180,7 +180,7 @@ export declare class LinearElementEditor {
|
|
|
180
180
|
scrollY: number;
|
|
181
181
|
cursorButton: "up" | "down";
|
|
182
182
|
scrolledOutside: boolean;
|
|
183
|
-
name: string;
|
|
183
|
+
name: string | null;
|
|
184
184
|
isResizing: boolean;
|
|
185
185
|
isRotating: boolean;
|
|
186
186
|
zoom: Readonly<{
|
|
@@ -232,7 +232,7 @@ export declare class LinearElementEditor {
|
|
|
232
232
|
offsetLeft: number;
|
|
233
233
|
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
234
234
|
collaborators: Map<import("../types").SocketId, Readonly<{
|
|
235
|
-
pointer?: import("../types").CollaboratorPointer | undefined;
|
|
235
|
+
pointer?: import("../types").CollaboratorPointer | undefined; /** indices */
|
|
236
236
|
button?: "up" | "down" | undefined;
|
|
237
237
|
selectedElementIds?: Readonly<{
|
|
238
238
|
[id: string]: true;
|
|
@@ -258,7 +258,7 @@ export declare class LinearElementEditor {
|
|
|
258
258
|
data: import("../charts").Spreadsheet;
|
|
259
259
|
};
|
|
260
260
|
pendingImageElementId: string | null;
|
|
261
|
-
showHyperlinkPopup: false | "
|
|
261
|
+
showHyperlinkPopup: false | "info" | "editor";
|
|
262
262
|
linkOpacity: number;
|
|
263
263
|
trayModeEnabled: boolean;
|
|
264
264
|
colorPalette?: {
|
|
@@ -314,18 +314,18 @@ export declare class LinearElementEditor {
|
|
|
314
314
|
startBinding?: PointBinding;
|
|
315
315
|
endBinding?: PointBinding;
|
|
316
316
|
}): void;
|
|
317
|
-
static shouldAddMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState): boolean;
|
|
318
|
-
static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, snapToGrid: boolean): {
|
|
317
|
+
static shouldAddMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, elementsMap: ElementsMap): boolean;
|
|
318
|
+
static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, snapToGrid: boolean, elementsMap: ElementsMap): {
|
|
319
319
|
pointerDownState: LinearElementEditor["pointerDownState"];
|
|
320
320
|
selectedPointsIndices: LinearElementEditor["selectedPointsIndices"];
|
|
321
321
|
} | undefined;
|
|
322
322
|
private static _updatePoints;
|
|
323
323
|
private static _getShiftLockedDelta;
|
|
324
|
-
static getBoundTextElementPosition: (element: ExcalidrawLinearElement, boundTextElement: ExcalidrawTextElementWithContainer) => {
|
|
324
|
+
static getBoundTextElementPosition: (element: ExcalidrawLinearElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
|
|
325
325
|
x: number;
|
|
326
326
|
y: number;
|
|
327
327
|
};
|
|
328
|
-
static getMinMaxXYWithBoundText: (element: ExcalidrawLinearElement, elementBounds: Bounds, boundTextElement: ExcalidrawTextElementWithContainer) => [number, number, number, number, number, number];
|
|
328
|
+
static getMinMaxXYWithBoundText: (element: ExcalidrawLinearElement, elementsMap: ElementsMap, elementBounds: Bounds, boundTextElement: ExcalidrawTextElementWithContainer) => [number, number, number, number, number, number];
|
|
329
329
|
static getElementAbsoluteCoords: (element: ExcalidrawLinearElement, elementsMap: ElementsMap, includeBoundText?: boolean) => [number, number, number, number, number, number];
|
|
330
330
|
}
|
|
331
331
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement } from "./types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement, ElementsMap } from "./types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
3
|
import { MarkOptional, Mutable } from "../utility-types";
|
|
4
|
-
export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity">;
|
|
4
|
+
export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity" | "customData">;
|
|
5
5
|
export declare const newElement: (opts: {
|
|
6
6
|
type: ExcalidrawGenericElement["type"];
|
|
7
7
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
|
|
@@ -28,7 +28,7 @@ export declare const newTextElement: (opts: {
|
|
|
28
28
|
lineHeight?: ExcalidrawTextElement["lineHeight"];
|
|
29
29
|
strokeWidth?: ExcalidrawTextElement["strokeWidth"];
|
|
30
30
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
|
|
31
|
-
export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null, text?: string) => {
|
|
31
|
+
export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null, elementsMap: ElementsMap, text?: string) => {
|
|
32
32
|
x: number;
|
|
33
33
|
y: number;
|
|
34
34
|
width: number;
|
|
@@ -36,7 +36,7 @@ export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement,
|
|
|
36
36
|
baseline: number;
|
|
37
37
|
text: string;
|
|
38
38
|
} | undefined;
|
|
39
|
-
export declare const updateTextElement: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null, { text, isDeleted, originalText, rawText, link, }: {
|
|
39
|
+
export declare const updateTextElement: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null, elementsMap: ElementsMap, { text, isDeleted, originalText, rawText, link, }: {
|
|
40
40
|
text: string;
|
|
41
41
|
isDeleted?: boolean | undefined;
|
|
42
42
|
originalText: string;
|
|
@@ -5,5 +5,5 @@ export declare const normalizeAngle: (angle: number) => number;
|
|
|
5
5
|
export declare const transformElements: (originalElements: PointerDownState["originalElements"], transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
|
|
6
6
|
export declare const resizeSingleElement: (originalElements: PointerDownState["originalElements"], shouldMaintainAspectRatio: boolean, element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, transformHandleDirection: TransformHandleDirection, shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
|
|
7
7
|
export declare const resizeMultipleElements: (originalElements: PointerDownState["originalElements"], selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, transformHandleType: "nw" | "ne" | "sw" | "se", shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
|
|
8
|
-
export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
|
|
8
|
+
export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap, x: number, y: number) => [number, number];
|
|
9
9
|
export declare const getResizeArrowDirection: (transformHandleType: MaybeTransformHandleType, element: NonDeleted<ExcalidrawLinearElement>) => "origin" | "end";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ExcalidrawElement, PointerType, NonDeletedExcalidrawElement } from "./types";
|
|
1
|
+
import { ExcalidrawElement, PointerType, NonDeletedExcalidrawElement, ElementsMap } from "./types";
|
|
2
2
|
import { MaybeTransformHandleType } from "./transformHandles";
|
|
3
3
|
import { AppState, Zoom } from "../types";
|
|
4
4
|
import { Bounds } from "./bounds";
|
|
5
|
-
export declare const resizeTest: (element: NonDeletedExcalidrawElement, appState: AppState, x: number, y: number, zoom: Zoom, pointerType: PointerType) => MaybeTransformHandleType;
|
|
6
|
-
export declare const getElementWithTransformHandleType: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType) => {
|
|
5
|
+
export declare const resizeTest: (element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, x: number, y: number, zoom: Zoom, pointerType: PointerType) => MaybeTransformHandleType;
|
|
6
|
+
export declare const getElementWithTransformHandleType: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, scenePointerX: number, scenePointerY: number, zoom: Zoom, pointerType: PointerType, elementsMap: ElementsMap) => {
|
|
7
7
|
element: NonDeletedExcalidrawElement;
|
|
8
8
|
transformHandleType: MaybeTransformHandleType;
|
|
9
9
|
} | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExcalidrawElement } from "./types";
|
|
1
|
+
import { ElementsMap, ExcalidrawElement } from "./types";
|
|
2
2
|
import { AppState, Zoom } from "../types";
|
|
3
3
|
export declare const isInvisiblySmallElement: (element: ExcalidrawElement) => boolean;
|
|
4
4
|
export declare const isElementInViewport: (element: ExcalidrawElement, width: number, height: number, viewTransformations: {
|
|
@@ -7,7 +7,7 @@ export declare const isElementInViewport: (element: ExcalidrawElement, width: nu
|
|
|
7
7
|
offsetTop: number;
|
|
8
8
|
scrollX: number;
|
|
9
9
|
scrollY: number;
|
|
10
|
-
}) => boolean;
|
|
10
|
+
}, elementsMap: ElementsMap) => boolean;
|
|
11
11
|
/**
|
|
12
12
|
* Makes a perfect shape or diagonal/horizontal/vertical line
|
|
13
13
|
*/
|
|
@@ -3,10 +3,10 @@ import { MaybeTransformHandleType } from "./transformHandles";
|
|
|
3
3
|
import { AppState } from "../types";
|
|
4
4
|
import { ExtractSetType } from "../utility-types";
|
|
5
5
|
export declare const normalizeText: (text: string) => string;
|
|
6
|
-
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
|
|
7
|
-
export declare const bindTextToShapeAfterDuplication: (
|
|
6
|
+
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, elementsMap: ElementsMap) => void;
|
|
7
|
+
export declare const bindTextToShapeAfterDuplication: (newElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
8
8
|
export declare const handleBindTextResize: (container: NonDeletedExcalidrawElement, elementsMap: ElementsMap, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean) => void;
|
|
9
|
-
export declare const computeBoundTextPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => {
|
|
9
|
+
export declare const computeBoundTextPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
|
|
10
10
|
x: number;
|
|
11
11
|
y: number;
|
|
12
12
|
};
|
|
@@ -53,13 +53,13 @@ export declare const getContainerCoords: (container: NonDeletedExcalidrawElement
|
|
|
53
53
|
y: number;
|
|
54
54
|
};
|
|
55
55
|
export declare const getTextElementAngle: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null) => number;
|
|
56
|
-
export declare const getBoundTextElementPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => {
|
|
56
|
+
export declare const getBoundTextElementPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
|
|
57
57
|
x: number;
|
|
58
58
|
y: number;
|
|
59
59
|
} | undefined;
|
|
60
60
|
export declare const shouldAllowVerticalAlign: (selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap) => boolean;
|
|
61
61
|
export declare const suppportsHorizontalAlign: (selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap) => boolean;
|
|
62
|
-
export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], appState: AppState, x: number, y: number) => ExcalidrawTextContainer | null;
|
|
62
|
+
export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], appState: AppState, x: number, y: number, elementsMap: ElementsMap) => ExcalidrawTextContainer | null;
|
|
63
63
|
declare const VALID_CONTAINER_TYPES: Set<string>;
|
|
64
64
|
export declare const isValidTextContainer: (element: {
|
|
65
65
|
type: ExcalidrawElementType;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExcalidrawElement, NonDeletedExcalidrawElement, PointerType } from "./types";
|
|
1
|
+
import { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement, PointerType } from "./types";
|
|
2
2
|
import { Bounds } from "./bounds";
|
|
3
3
|
import { InteractiveCanvasAppState, Zoom } from "../types";
|
|
4
4
|
export type TransformHandleDirection = "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se";
|
|
@@ -32,5 +32,5 @@ export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2, cx, cy]: [
|
|
|
32
32
|
se?: boolean | undefined;
|
|
33
33
|
rotation?: boolean | undefined;
|
|
34
34
|
}, margin?: number) => TransformHandles;
|
|
35
|
-
export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, pointerType?: PointerType) => TransformHandles;
|
|
35
|
+
export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, elementsMap: ElementsMap, pointerType?: PointerType) => TransformHandles;
|
|
36
36
|
export declare const shouldShowBoundingBox: (elements: readonly NonDeletedExcalidrawElement[], appState: InteractiveCanvasAppState) => boolean;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
|
|
2
2
|
import { AppClassProperties, AppState, StaticCanvasAppState } from "./types";
|
|
3
|
-
import { ExcalidrawElementsIncludingDeleted } from "./scene/Scene";
|
|
3
|
+
import type { ExcalidrawElementsIncludingDeleted } from "./scene/Scene";
|
|
4
4
|
import { ReadonlySetLike } from "./utility-types";
|
|
5
5
|
export declare const bindElementsToFramesAfterDuplication: (nextElements: ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
6
|
-
export declare function isElementIntersectingFrame(element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement): boolean;
|
|
7
|
-
export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
|
|
8
|
-
export declare const isElementContainingFrame: (elements: readonly ExcalidrawElement[], element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement) => boolean;
|
|
6
|
+
export declare function isElementIntersectingFrame(element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap): boolean;
|
|
7
|
+
export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => ExcalidrawElement[];
|
|
8
|
+
export declare const isElementContainingFrame: (elements: readonly ExcalidrawElement[], element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => boolean;
|
|
9
9
|
export declare const getElementsIntersectingFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
|
|
10
|
-
export declare const elementsAreInFrameBounds: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => boolean;
|
|
11
|
-
export declare const elementOverlapsWithFrame: (element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement) => boolean;
|
|
10
|
+
export declare const elementsAreInFrameBounds: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => boolean;
|
|
11
|
+
export declare const elementOverlapsWithFrame: (element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => boolean;
|
|
12
12
|
export declare const isCursorInFrame: (cursorCoords: {
|
|
13
13
|
x: number;
|
|
14
14
|
y: number;
|
|
15
|
-
}, frame: NonDeleted<ExcalidrawFrameLikeElement
|
|
15
|
+
}, frame: NonDeleted<ExcalidrawFrameLikeElement>, elementsMap: ElementsMap) => boolean;
|
|
16
16
|
export declare const groupsAreAtLeastIntersectingTheFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameLikeElement) => boolean;
|
|
17
17
|
export declare const groupsAreCompletelyOutOfFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameLikeElement) => boolean;
|
|
18
18
|
/**
|
|
@@ -30,9 +30,9 @@ export declare const getFrameLikeElements: (allElements: ExcalidrawElementsInclu
|
|
|
30
30
|
* Considers non-frame bound elements (container or arrow labels) as root.
|
|
31
31
|
*/
|
|
32
32
|
export declare const getRootElements: (allElements: ExcalidrawElementsIncludingDeleted) => ExcalidrawElement[];
|
|
33
|
-
export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, appState: AppState) => ExcalidrawElement[];
|
|
34
|
-
export declare const getElementsInNewFrame: (
|
|
35
|
-
export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap
|
|
33
|
+
export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, appState: AppState, elementsMap: ElementsMap) => ExcalidrawElement[];
|
|
34
|
+
export declare const getElementsInNewFrame: (elements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => ExcalidrawElement[];
|
|
35
|
+
export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap: ElementsMap) => ExcalidrawFrameLikeElement | null;
|
|
36
36
|
/** */
|
|
37
37
|
export declare const filterElementsEligibleAsFrameChildren: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
|
|
38
38
|
/**
|
|
@@ -58,6 +58,6 @@ export declare const omitGroupsContainingFrameLikes: (allElements: ElementsMapOr
|
|
|
58
58
|
* is going to be added to or remove from
|
|
59
59
|
*/
|
|
60
60
|
export declare const getTargetFrame: (element: ExcalidrawElement, elementsMap: ElementsMap, appState: StaticCanvasAppState) => import("./element/types").ExcalidrawFrameElement | import("./element/types").ExcalidrawMagicFrameElement | null;
|
|
61
|
-
export declare const isElementInFrame: (element: ExcalidrawElement,
|
|
61
|
+
export declare const isElementInFrame: (element: ExcalidrawElement, allElementsMap: ElementsMap, appState: StaticCanvasAppState) => boolean;
|
|
62
62
|
export declare const getFrameLikeTitle: (element: ExcalidrawFrameLikeElement, frameIdx: number) => string;
|
|
63
63
|
export declare const getElementsOverlappingFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => NonDeletedExcalidrawElement[];
|
|
@@ -14,7 +14,7 @@ declare const clearAppStatePropertiesForHistory: (appState: AppState) => {
|
|
|
14
14
|
viewBackgroundColor: string;
|
|
15
15
|
editingLinearElement: import("./element/linearElementEditor").LinearElementEditor | null;
|
|
16
16
|
editingGroupId: string | null;
|
|
17
|
-
name: string;
|
|
17
|
+
name: string | null;
|
|
18
18
|
};
|
|
19
19
|
declare class History {
|
|
20
20
|
private elementCache;
|
|
@@ -9,12 +9,7 @@ export type ExcalidrawElementsIncludingDeleted = readonly ExcalidrawElement[];
|
|
|
9
9
|
declare class Scene {
|
|
10
10
|
private static sceneMapByElement;
|
|
11
11
|
private static sceneMapById;
|
|
12
|
-
static mapElementToScene(elementKey: ElementKey, scene: Scene
|
|
13
|
-
/**
|
|
14
|
-
* needed because of frame exporting hack.
|
|
15
|
-
* elementId:Scene mapping will be removed completely, soon.
|
|
16
|
-
*/
|
|
17
|
-
mapElementIds?: boolean): void;
|
|
12
|
+
static mapElementToScene(elementKey: ElementKey, scene: Scene): void;
|
|
18
13
|
static getScene(elementKey: ElementKey): Scene | null;
|
|
19
14
|
private callbacks;
|
|
20
15
|
private nonDeletedElements;
|
|
@@ -58,7 +53,7 @@ declare class Scene {
|
|
|
58
53
|
* @returns whether a change was made
|
|
59
54
|
*/
|
|
60
55
|
mapElements(iteratee: (element: ExcalidrawElement) => ExcalidrawElement): boolean;
|
|
61
|
-
replaceAllElements(nextElements: ElementsMapOrArray
|
|
56
|
+
replaceAllElements(nextElements: ElementsMapOrArray): void;
|
|
62
57
|
informMutation(): void;
|
|
63
58
|
addCallback(cb: SceneStateCallback): SceneStateCallbackRemover;
|
|
64
59
|
destroy(): void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { InteractiveCanvasAppState } from "../types";
|
|
2
|
-
import {
|
|
2
|
+
import { ScrollBars } from "./types";
|
|
3
|
+
import { ExcalidrawElement } from "../element/types";
|
|
3
4
|
export declare const SCROLLBAR_MARGIN = 4;
|
|
4
5
|
export declare const SCROLLBAR_WIDTH = 6;
|
|
5
6
|
export declare const SCROLLBAR_COLOR = "rgba(128,128,128,0.3)";
|
|
6
|
-
export declare const getScrollBars: (elements:
|
|
7
|
+
export declare const getScrollBars: (elements: readonly ExcalidrawElement[], viewportWidth: number, viewportHeight: number, appState: InteractiveCanvasAppState) => ScrollBars;
|
|
7
8
|
export declare const isOverScrollBars: (scrollBars: ScrollBars, x: number, y: number) => {
|
|
8
9
|
isOverEither: boolean;
|
|
9
10
|
isOverHorizontal: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementsMapOrArray, ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
1
|
+
import { ElementsMap, ElementsMapOrArray, ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
import { AppState, InteractiveCanvasAppState } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Frames and their containing elements are not to be selected at the same time.
|
|
@@ -7,8 +7,8 @@ import { AppState, InteractiveCanvasAppState } from "../types";
|
|
|
7
7
|
* @param selectedElements
|
|
8
8
|
*/
|
|
9
9
|
export declare const excludeElementsInFramesFromSelection: <T extends ExcalidrawElement>(selectedElements: readonly T[]) => T[];
|
|
10
|
-
export declare const getElementsWithinSelection: (elements: readonly NonDeletedExcalidrawElement[], selection: NonDeletedExcalidrawElement, excludeElementsInFrames?: boolean) => NonDeletedExcalidrawElement[];
|
|
11
|
-
export declare const getVisibleAndNonSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], selectedElements: readonly NonDeletedExcalidrawElement[], appState: AppState) => NonDeletedExcalidrawElement[];
|
|
10
|
+
export declare const getElementsWithinSelection: (elements: readonly NonDeletedExcalidrawElement[], selection: NonDeletedExcalidrawElement, elementsMap: ElementsMap, excludeElementsInFrames?: boolean) => NonDeletedExcalidrawElement[];
|
|
11
|
+
export declare const getVisibleAndNonSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], selectedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, elementsMap: ElementsMap) => NonDeletedExcalidrawElement[];
|
|
12
12
|
export declare const isSomeElementSelected: {
|
|
13
13
|
(elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">): boolean;
|
|
14
14
|
clearCache(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Bounds } from "./element/bounds";
|
|
2
2
|
import { MaybeTransformHandleType } from "./element/transformHandles";
|
|
3
|
-
import { ExcalidrawElement, NonDeletedExcalidrawElement } from "./element/types";
|
|
3
|
+
import { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement } from "./element/types";
|
|
4
4
|
import { AppState, KeyboardModifiersObject, Point } from "./types";
|
|
5
5
|
export declare const getSnapDistance: (zoomValue: number) => number;
|
|
6
6
|
type Vector2D = {
|
|
@@ -66,17 +66,17 @@ export declare const isSnappingEnabled: ({ event, appState, selectedElements, }:
|
|
|
66
66
|
selectedElements: NonDeletedExcalidrawElement[];
|
|
67
67
|
}) => boolean;
|
|
68
68
|
export declare const areRoughlyEqual: (a: number, b: number, precision?: number) => boolean;
|
|
69
|
-
export declare const getElementsCorners: (elements: ExcalidrawElement[], { omitCenter, boundingBoxCorners, dragOffset, }?: {
|
|
69
|
+
export declare const getElementsCorners: (elements: ExcalidrawElement[], elementsMap: ElementsMap, { omitCenter, boundingBoxCorners, dragOffset, }?: {
|
|
70
70
|
omitCenter?: boolean | undefined;
|
|
71
71
|
boundingBoxCorners?: boolean | undefined;
|
|
72
72
|
dragOffset?: Vector2D | undefined;
|
|
73
73
|
}) => Point[];
|
|
74
|
-
export declare const getVisibleGaps: (elements: readonly NonDeletedExcalidrawElement[], selectedElements: ExcalidrawElement[], appState: AppState) => {
|
|
74
|
+
export declare const getVisibleGaps: (elements: readonly NonDeletedExcalidrawElement[], selectedElements: ExcalidrawElement[], appState: AppState, elementsMap: ElementsMap) => {
|
|
75
75
|
horizontalGaps: Gap[];
|
|
76
76
|
verticalGaps: Gap[];
|
|
77
77
|
};
|
|
78
|
-
export declare const getReferenceSnapPoints: (elements: readonly NonDeletedExcalidrawElement[], selectedElements: ExcalidrawElement[], appState: AppState) => (readonly [number, number])[];
|
|
79
|
-
export declare const snapDraggedElements: (
|
|
78
|
+
export declare const getReferenceSnapPoints: (elements: readonly NonDeletedExcalidrawElement[], selectedElements: ExcalidrawElement[], appState: AppState, elementsMap: ElementsMap) => (readonly [number, number])[];
|
|
79
|
+
export declare const snapDraggedElements: (elements: ExcalidrawElement[], dragOffset: Vector2D, appState: AppState, event: KeyboardModifiersObject, elementsMap: ElementsMap) => {
|
|
80
80
|
snapOffset: {
|
|
81
81
|
x: number;
|
|
82
82
|
y: number;
|
|
@@ -90,14 +90,14 @@ export declare const snapResizingElements: (selectedElements: ExcalidrawElement[
|
|
|
90
90
|
};
|
|
91
91
|
snapLines: PointSnapLine[];
|
|
92
92
|
};
|
|
93
|
-
export declare const snapNewElement: (draggingElement: ExcalidrawElement, appState: AppState, event: KeyboardModifiersObject, origin: Vector2D, dragOffset: Vector2D) => {
|
|
93
|
+
export declare const snapNewElement: (draggingElement: ExcalidrawElement, appState: AppState, event: KeyboardModifiersObject, origin: Vector2D, dragOffset: Vector2D, elementsMap: ElementsMap) => {
|
|
94
94
|
snapOffset: {
|
|
95
95
|
x: number;
|
|
96
96
|
y: number;
|
|
97
97
|
};
|
|
98
98
|
snapLines: PointSnapLine[];
|
|
99
99
|
};
|
|
100
|
-
export declare const getSnapLinesAtPointer: (elements: readonly ExcalidrawElement[], appState: AppState, pointer: Vector2D, event: KeyboardModifiersObject) => {
|
|
100
|
+
export declare const getSnapLinesAtPointer: (elements: readonly ExcalidrawElement[], appState: AppState, pointer: Vector2D, event: KeyboardModifiersObject, elementsMap: ElementsMap) => {
|
|
101
101
|
originOffset: {
|
|
102
102
|
x: number;
|
|
103
103
|
y: number;
|
|
@@ -185,7 +185,7 @@ export interface AppState {
|
|
|
185
185
|
scrollY: number;
|
|
186
186
|
cursorButton: "up" | "down";
|
|
187
187
|
scrolledOutside: boolean;
|
|
188
|
-
name: string;
|
|
188
|
+
name: string | null;
|
|
189
189
|
isResizing: boolean;
|
|
190
190
|
isRotating: boolean;
|
|
191
191
|
zoom: Zoom;
|
|
@@ -417,7 +417,7 @@ export declare enum UserIdleState {
|
|
|
417
417
|
}
|
|
418
418
|
export type ExportOpts = {
|
|
419
419
|
saveFileToDisk?: boolean;
|
|
420
|
-
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles
|
|
420
|
+
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles) => void;
|
|
421
421
|
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => JSX.Element;
|
|
422
422
|
};
|
|
423
423
|
export type CanvasActions = Partial<{
|
|
@@ -480,6 +480,7 @@ export type AppClassProperties = {
|
|
|
480
480
|
setOpenDialog: App["setOpenDialog"];
|
|
481
481
|
insertEmbeddableElement: App["insertEmbeddableElement"];
|
|
482
482
|
onMagicframeToolSelect: App["onMagicframeToolSelect"];
|
|
483
|
+
getName: App["getName"];
|
|
483
484
|
};
|
|
484
485
|
export type PointerDownState = Readonly<{
|
|
485
486
|
origin: Readonly<{
|
|
@@ -543,12 +544,13 @@ export type ExcalidrawImperativeAPI = {
|
|
|
543
544
|
history: {
|
|
544
545
|
clear: InstanceType<typeof App>["resetHistory"];
|
|
545
546
|
};
|
|
546
|
-
scrollToContent: InstanceType<typeof App>["scrollToContent"];
|
|
547
547
|
zoomToFit: InstanceType<typeof App>["zoomToFit"];
|
|
548
548
|
startLineEditor: InstanceType<typeof App>["startLineEditor"];
|
|
549
549
|
getSceneElements: InstanceType<typeof App>["getSceneElements"];
|
|
550
550
|
getAppState: () => InstanceType<typeof App>["state"];
|
|
551
551
|
getFiles: () => InstanceType<typeof App>["files"];
|
|
552
|
+
getName: InstanceType<typeof App>["getName"];
|
|
553
|
+
scrollToContent: InstanceType<typeof App>["scrollToContent"];
|
|
552
554
|
registerAction: (action: Action) => void;
|
|
553
555
|
refresh: InstanceType<typeof App>["refresh"];
|
|
554
556
|
setToast: InstanceType<typeof App>["setToast"];
|