@zsviczian/excalidraw 0.17.6-22 → 0.17.6-24
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 +25 -25
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/excalidraw/components/App.d.ts +2 -1
- package/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/types/excalidraw/components/TTDDialog/MermaidToExcalidrawLib.d.ts +3 -3
- package/types/excalidraw/element/binding.d.ts +9 -6
- package/types/excalidraw/element/cropElement.d.ts +5 -0
- package/types/excalidraw/element/linearElementEditor.d.ts +3 -2
- package/types/excalidraw/element/resizeElements.d.ts +28 -5
- package/types/excalidraw/element/routing.d.ts +3 -0
- package/types/excalidraw/fonts/Fonts.d.ts +1 -2
- package/types/excalidraw/obsidianUtils.d.ts +3 -3
package/package.json
CHANGED
|
@@ -249,6 +249,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
249
249
|
private renderEmbeddables;
|
|
250
250
|
private getFrameNameDOMId;
|
|
251
251
|
frameNameBoundsCache: FrameNameBoundsCache;
|
|
252
|
+
private resetEditingFrame;
|
|
252
253
|
private renderFrameNames;
|
|
253
254
|
private toggleOverscrollBehavior;
|
|
254
255
|
render(): JSX.Element;
|
|
@@ -356,7 +357,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
356
357
|
/** use when changing scrollX/scrollY/zoom based on user interaction */
|
|
357
358
|
private translateCanvas;
|
|
358
359
|
zoomToFit: (target?: readonly ExcalidrawElement[], maxZoom?: number, margin?: number) => void;
|
|
359
|
-
getColorAtScenePoint: ({ sceneX, sceneY }: {
|
|
360
|
+
getColorAtScenePoint: ({ sceneX, sceneY, }: {
|
|
360
361
|
sceneX: number;
|
|
361
362
|
sceneY: number;
|
|
362
363
|
}) => string | null;
|
|
@@ -14,7 +14,6 @@ export declare const newOrigin: (x1: number, y1: number, w1: number, h1: number,
|
|
|
14
14
|
x: number;
|
|
15
15
|
y: number;
|
|
16
16
|
};
|
|
17
|
-
export declare const resizeElement: (nextWidth: number, nextHeight: number, keepAspectRatio: boolean, origElement: ExcalidrawElement, elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[], scene: Scene, shouldInformMutation?: boolean) => void;
|
|
18
17
|
export declare const moveElement: (newTopLeftX: number, newTopLeftY: number, originalElement: ExcalidrawElement, elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[], scene: Scene, originalElementsMap: ElementsMap, shouldInformMutation?: boolean) => void;
|
|
19
18
|
export declare const getAtomicUnits: (targetElements: readonly ExcalidrawElement[], appState: AppState) => AtomicUnit[];
|
|
20
19
|
export declare const updateBindings: (latestElement: ExcalidrawElement, elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[], scene: Scene, options?: {
|
|
@@ -23,4 +22,5 @@ export declare const updateBindings: (latestElement: ExcalidrawElement, elements
|
|
|
23
22
|
width: number;
|
|
24
23
|
height: number;
|
|
25
24
|
};
|
|
25
|
+
zoom?: AppState["zoom"];
|
|
26
26
|
}) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MermaidConfig } from "@zsviczian/mermaid-to-excalidraw";
|
|
2
|
-
import { ExcalidrawElement } from "../../element/types";
|
|
3
|
-
import { MermaidToExcalidrawLibProps } from "./common";
|
|
1
|
+
import type { MermaidConfig } from "@zsviczian/mermaid-to-excalidraw";
|
|
2
|
+
import type { ExcalidrawElement } from "../../element/types";
|
|
3
|
+
import type { MermaidToExcalidrawLibProps } from "./common";
|
|
4
4
|
export declare const loadMermaidToExcalidrawLib: () => Promise<MermaidToExcalidrawLibProps>;
|
|
5
5
|
export declare const loadMermaidLib: () => Promise<MermaidToExcalidrawLibProps>;
|
|
6
6
|
export declare const mermaidToExcalidraw: (mermaidDefinition: string, opts: MermaidConfig, forceSVG?: boolean) => Promise<{
|
|
@@ -15,9 +15,11 @@ export type SuggestedPointBinding = [
|
|
|
15
15
|
export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEvent<HTMLElement>) => boolean;
|
|
16
16
|
export declare const isBindingEnabled: (appState: AppState) => boolean;
|
|
17
17
|
export declare const FIXED_BINDING_DISTANCE = 5;
|
|
18
|
+
export declare const BINDING_HIGHLIGHT_THICKNESS = 10;
|
|
19
|
+
export declare const BINDING_HIGHLIGHT_OFFSET = 4;
|
|
18
20
|
export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", elementsMap: NonDeletedSceneElementsMap, scene: Scene) => void;
|
|
19
|
-
export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[], scene: Scene, isBindingEnabled: boolean, draggingPoints: readonly number[] | null) => void;
|
|
20
|
-
export declare const getSuggestedBindingsForArrows: (selectedElements: NonDeleted<ExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap) => SuggestedBinding[];
|
|
21
|
+
export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[], scene: Scene, isBindingEnabled: boolean, draggingPoints: readonly number[] | null, zoom?: AppState["zoom"]) => void;
|
|
22
|
+
export declare const getSuggestedBindingsForArrows: (selectedElements: NonDeleted<ExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, zoom: AppState["zoom"]) => SuggestedBinding[];
|
|
21
23
|
export declare const maybeBindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, appState: AppState, pointerCoords: {
|
|
22
24
|
x: number;
|
|
23
25
|
y: number;
|
|
@@ -27,7 +29,7 @@ export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDe
|
|
|
27
29
|
export declare const getHoveredElementForBinding: (pointerCoords: {
|
|
28
30
|
x: number;
|
|
29
31
|
y: number;
|
|
30
|
-
}, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap, fullShape?: boolean) => NonDeleted<ExcalidrawBindableElement> | null;
|
|
32
|
+
}, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap, zoom?: AppState["zoom"], fullShape?: boolean) => NonDeleted<ExcalidrawBindableElement> | null;
|
|
31
33
|
export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, options?: {
|
|
32
34
|
simultaneouslyUpdated?: readonly ExcalidrawElement[];
|
|
33
35
|
newSize?: {
|
|
@@ -35,8 +37,9 @@ export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawE
|
|
|
35
37
|
height: number;
|
|
36
38
|
};
|
|
37
39
|
changedElements?: Map<string, OrderedExcalidrawElement>;
|
|
40
|
+
zoom?: AppState["zoom"];
|
|
38
41
|
}) => void;
|
|
39
|
-
export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, elementsMap: ElementsMap, origPoint: GlobalPoint) => Heading;
|
|
42
|
+
export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, elementsMap: ElementsMap, origPoint: GlobalPoint, zoom?: AppState["zoom"]) => Heading;
|
|
40
43
|
export declare const bindPointToSnapToElementOutline: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined, elementsMap: ElementsMap) => GlobalPoint;
|
|
41
44
|
export declare const avoidRectangularCorner: (element: ExcalidrawBindableElement, p: GlobalPoint) => GlobalPoint;
|
|
42
45
|
export declare const snapToMid: (element: ExcalidrawBindableElement, p: GlobalPoint, tolerance?: number) => GlobalPoint;
|
|
@@ -48,8 +51,8 @@ export declare const fixBindingsAfterDeletion: (sceneElements: readonly Excalidr
|
|
|
48
51
|
export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
|
|
49
52
|
x: number;
|
|
50
53
|
y: number;
|
|
51
|
-
}, elementsMap: NonDeletedSceneElementsMap, fullShape?: boolean) => boolean;
|
|
52
|
-
export declare const maxBindingGap: (element: ExcalidrawElement, elementWidth: number, elementHeight: number) => number;
|
|
54
|
+
}, elementsMap: NonDeletedSceneElementsMap, zoom?: AppState["zoom"], fullShape?: boolean) => boolean;
|
|
55
|
+
export declare const maxBindingGap: (element: ExcalidrawElement, elementWidth: number, elementHeight: number, zoom?: AppState["zoom"]) => number;
|
|
53
56
|
export declare const distanceToBindableElement: (element: ExcalidrawBindableElement, point: GlobalPoint, elementsMap: ElementsMap) => number;
|
|
54
57
|
export declare const determineFocusDistance: (element: ExcalidrawBindableElement, a: GlobalPoint, b: GlobalPoint, elementsMap: ElementsMap) => number;
|
|
55
58
|
export declare const intersectElementWithLine: (element: ExcalidrawBindableElement, a: GlobalPoint, b: GlobalPoint, gap: number | undefined, elementsMap: ElementsMap) => GlobalPoint[] | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TransformHandleType } from "./transformHandles";
|
|
2
2
|
import type { ElementsMap, ExcalidrawImageElement, ImageCrop } from "./types";
|
|
3
|
+
export declare const MINIMAL_CROP_SIZE = 10;
|
|
3
4
|
export declare const cropElement: (element: ExcalidrawImageElement, transformHandle: TransformHandleType, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, widthAspectRatio?: number) => {
|
|
4
5
|
x: number;
|
|
5
6
|
y: number;
|
|
@@ -12,3 +13,7 @@ export declare const getUncroppedWidthAndHeight: (element: ExcalidrawImageElemen
|
|
|
12
13
|
width: number;
|
|
13
14
|
height: number;
|
|
14
15
|
};
|
|
16
|
+
export declare const getFlipAdjustedCropPosition: (element: ExcalidrawImageElement, natural?: boolean) => {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
} | null;
|
|
@@ -96,10 +96,10 @@ export declare class LinearElementEditor {
|
|
|
96
96
|
};
|
|
97
97
|
static normalizePoints(element: NonDeleted<ExcalidrawLinearElement>): void;
|
|
98
98
|
static duplicateSelectedPoints(appState: AppState, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap): AppState;
|
|
99
|
-
static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[], elementsMap: NonDeletedSceneElementsMap | SceneElementsMap): void;
|
|
99
|
+
static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[], elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, zoom: AppState["zoom"]): void;
|
|
100
100
|
static addPoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
|
|
101
101
|
point: LocalPoint;
|
|
102
|
-
}[], elementsMap: NonDeletedSceneElementsMap | SceneElementsMap): void;
|
|
102
|
+
}[], elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, zoom: AppState["zoom"]): void;
|
|
103
103
|
static movePoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
|
|
104
104
|
index: number;
|
|
105
105
|
point: LocalPoint;
|
|
@@ -110,6 +110,7 @@ export declare class LinearElementEditor {
|
|
|
110
110
|
}, options?: {
|
|
111
111
|
changedElements?: Map<string, OrderedExcalidrawElement>;
|
|
112
112
|
isDragging?: boolean;
|
|
113
|
+
zoom?: AppState["zoom"];
|
|
113
114
|
}): void;
|
|
114
115
|
static shouldAddMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, elementsMap: ElementsMap): boolean;
|
|
115
116
|
static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, app: AppClassProperties, snapToGrid: boolean, elementsMap: ElementsMap): {
|
|
@@ -1,16 +1,39 @@
|
|
|
1
|
-
import type { ExcalidrawLinearElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, NonDeleted,
|
|
1
|
+
import type { ExcalidrawLinearElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawElement, ElementsMap, SceneElementsMap } from "./types";
|
|
2
|
+
import type { BoundingBox } from "./bounds";
|
|
2
3
|
import type { MaybeTransformHandleType, TransformHandleDirection } from "./transformHandles";
|
|
3
4
|
import type { PointerDownState } from "../types";
|
|
4
|
-
|
|
5
|
+
import type Scene from "../scene/Scene";
|
|
6
|
+
import { type LocalPoint } from "../../math";
|
|
7
|
+
export declare const transformElements: (originalElements: PointerDownState["originalElements"], transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: SceneElementsMap, scene: Scene, shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
|
|
5
8
|
export declare const rescalePointsInElement: (element: NonDeletedExcalidrawElement, width: number, height: number, normalizePoints: boolean) => {
|
|
6
|
-
points:
|
|
9
|
+
points: LocalPoint[];
|
|
7
10
|
} | {
|
|
8
11
|
points?: undefined;
|
|
9
12
|
};
|
|
10
13
|
export declare const measureFontSizeFromWidth: (element: NonDeleted<ExcalidrawTextElement>, elementsMap: ElementsMap, nextWidth: number) => {
|
|
11
14
|
size: number;
|
|
12
15
|
} | null;
|
|
13
|
-
export declare const resizeSingleElement: (originalElements: PointerDownState["originalElements"], shouldMaintainAspectRatio: boolean, element: NonDeletedExcalidrawElement, elementsMap: SceneElementsMap, transformHandleDirection: TransformHandleDirection, shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
|
|
14
|
-
export declare const resizeMultipleElements: (originalElements: PointerDownState["originalElements"], selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, transformHandleType: TransformHandleDirection, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number) => void;
|
|
15
16
|
export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap, x: number, y: number) => [number, number];
|
|
16
17
|
export declare const getResizeArrowDirection: (transformHandleType: MaybeTransformHandleType, element: NonDeleted<ExcalidrawLinearElement>) => "origin" | "end";
|
|
18
|
+
export declare const resizeSingleElement: (nextWidth: number, nextHeight: number, latestElement: ExcalidrawElement, origElement: ExcalidrawElement, elementsMap: ElementsMap, originalElementsMap: ElementsMap, handleDirection: TransformHandleDirection, { shouldInformMutation, shouldMaintainAspectRatio, shouldResizeFromCenter, }?: {
|
|
19
|
+
shouldMaintainAspectRatio?: boolean | undefined;
|
|
20
|
+
shouldResizeFromCenter?: boolean | undefined;
|
|
21
|
+
shouldInformMutation?: boolean | undefined;
|
|
22
|
+
}) => void;
|
|
23
|
+
export declare const getNextSingleWidthAndHeightFromPointer: (latestElement: ExcalidrawElement, origElement: ExcalidrawElement, elementsMap: ElementsMap, originalElementsMap: ElementsMap, handleDirection: TransformHandleDirection, pointerX: number, pointerY: number, { shouldMaintainAspectRatio, shouldResizeFromCenter, }?: {
|
|
24
|
+
shouldMaintainAspectRatio?: boolean | undefined;
|
|
25
|
+
shouldResizeFromCenter?: boolean | undefined;
|
|
26
|
+
}) => {
|
|
27
|
+
nextWidth: number;
|
|
28
|
+
nextHeight: number;
|
|
29
|
+
};
|
|
30
|
+
export declare const resizeMultipleElements: (selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, handleDirection: TransformHandleDirection, scene: Scene, { shouldMaintainAspectRatio, shouldResizeFromCenter, flipByX, flipByY, nextHeight, nextWidth, originalElementsMap, originalBoundingBox, }?: {
|
|
31
|
+
nextWidth?: number | undefined;
|
|
32
|
+
nextHeight?: number | undefined;
|
|
33
|
+
shouldMaintainAspectRatio?: boolean | undefined;
|
|
34
|
+
shouldResizeFromCenter?: boolean | undefined;
|
|
35
|
+
flipByX?: boolean | undefined;
|
|
36
|
+
flipByY?: boolean | undefined;
|
|
37
|
+
originalElementsMap?: ElementsMap | undefined;
|
|
38
|
+
originalBoundingBox?: BoundingBox | undefined;
|
|
39
|
+
}) => void;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { type LocalPoint, type Vector } from "../../math";
|
|
2
|
+
import type { AppState } from "../types";
|
|
2
3
|
import type { ElementUpdate } from "./mutateElement";
|
|
3
4
|
import type { ExcalidrawElbowArrowElement, NonDeletedSceneElementsMap, SceneElementsMap } from "./types";
|
|
4
5
|
export declare const mutateElbowArrow: (arrow: ExcalidrawElbowArrowElement, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, nextPoints: readonly LocalPoint[], offset?: Vector, otherUpdates?: Omit<ElementUpdate<ExcalidrawElbowArrowElement>, "angle" | "x" | "y" | "width" | "height" | "elbowed" | "points">, options?: {
|
|
5
6
|
isDragging?: boolean;
|
|
6
7
|
informMutation?: boolean;
|
|
8
|
+
zoom?: AppState["zoom"];
|
|
7
9
|
}) => void;
|
|
8
10
|
export declare const updateElbowArrow: (arrow: ExcalidrawElbowArrowElement, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, nextPoints: readonly LocalPoint[], offset?: Vector, options?: {
|
|
9
11
|
isDragging?: boolean;
|
|
10
12
|
disableBinding?: boolean;
|
|
11
13
|
informMutation?: boolean;
|
|
14
|
+
zoom?: AppState["zoom"];
|
|
12
15
|
}) => ElementUpdate<ExcalidrawElbowArrowElement> | null;
|
|
@@ -67,8 +67,7 @@ export declare class Fonts {
|
|
|
67
67
|
* @param metadata font metadata
|
|
68
68
|
* @param fontFacesDecriptors font faces descriptors
|
|
69
69
|
*/
|
|
70
|
-
static register(
|
|
71
|
-
this: Fonts | {
|
|
70
|
+
static register(this: Fonts | {
|
|
72
71
|
registered: Map<number, {
|
|
73
72
|
metadata: FontMetadata;
|
|
74
73
|
fontFaces: ExcalidrawFontFace[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MermaidToExcalidrawLibProps } from "./components/TTDDialog/common";
|
|
2
|
-
import { NonDeletedExcalidrawElement } from "./element/types";
|
|
1
|
+
import type { MermaidToExcalidrawLibProps } from "./components/TTDDialog/common";
|
|
2
|
+
import type { NonDeletedExcalidrawElement } from "./element/types";
|
|
3
3
|
import type { FontMetadata } from "./fonts/FontMetadata";
|
|
4
|
-
import { AppState } from "./types";
|
|
4
|
+
import type { AppState } from "./types";
|
|
5
5
|
export declare let hostPlugin: any;
|
|
6
6
|
export declare function destroyObsidianUtils(): void;
|
|
7
7
|
export declare function initializeObsidianUtils(): void;
|