@dwelle/excalidraw 0.4.0-9b4bdd5 → 0.4.0-cfd6fb7
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/CHANGELOG.md +4 -0
- package/README.md +9 -1
- package/dist/excalidraw.development.js +34 -23
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionClipboard.d.ts +1 -0
- package/types/actions/actionDeleteSelected.d.ts +1 -0
- package/types/components/Actions.d.ts +1 -2
- package/types/components/App.d.ts +3 -2
- package/types/components/LayerUI.d.ts +1 -1
- package/types/components/LibraryMenu.d.ts +1 -2
- package/types/element/Hyperlink.d.ts +1 -2
- package/types/element/bounds.d.ts +1 -1
- package/types/element/linearElementEditor.d.ts +10 -2
- package/types/element/transformHandles.d.ts +2 -2
- package/types/element/types.d.ts +1 -0
- package/types/points.d.ts +2 -1
- package/types/polyfill.d.ts +2 -0
- package/types/renderer/renderScene.d.ts +17 -2
- package/types/types.d.ts +0 -1
package/package.json
CHANGED
|
@@ -2,11 +2,10 @@ import React from "react";
|
|
|
2
2
|
import { ActionManager } from "../actions/manager";
|
|
3
3
|
import { ExcalidrawElement, PointerType } from "../element/types";
|
|
4
4
|
import { AppState, Zoom } from "../types";
|
|
5
|
-
export declare const SelectedShapeActions: ({ appState, elements, renderAction,
|
|
5
|
+
export declare const SelectedShapeActions: ({ appState, elements, renderAction, }: {
|
|
6
6
|
appState: AppState;
|
|
7
7
|
elements: readonly ExcalidrawElement[];
|
|
8
8
|
renderAction: ActionManager["renderAction"];
|
|
9
|
-
activeTool: AppState["activeTool"]["type"];
|
|
10
9
|
}) => JSX.Element;
|
|
11
10
|
export declare const ShapesSwitcher: ({ canvas, activeTool, setAppState, onImageAction, appState, }: {
|
|
12
11
|
canvas: HTMLCanvasElement | null;
|
|
@@ -18,6 +18,8 @@ export declare const useExcalidrawContainer: () => {
|
|
|
18
18
|
container: HTMLDivElement | null;
|
|
19
19
|
id?: string | null | undefined;
|
|
20
20
|
};
|
|
21
|
+
export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawElement[];
|
|
22
|
+
export declare const useExcalidrawAppState: () => AppState;
|
|
21
23
|
declare class App extends React.Component<AppProps, AppState> {
|
|
22
24
|
canvas: AppClassProperties["canvas"];
|
|
23
25
|
rc: RoughCanvas | null;
|
|
@@ -94,7 +96,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
94
96
|
wasAddedToSelection: boolean;
|
|
95
97
|
hasBeenDuplicated: boolean;
|
|
96
98
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
97
|
-
hasHitElementInside: boolean;
|
|
98
99
|
};
|
|
99
100
|
withCmdOrCtrl: boolean;
|
|
100
101
|
drag: {
|
|
@@ -172,7 +173,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
172
173
|
wasAddedToSelection: boolean;
|
|
173
174
|
hasBeenDuplicated: boolean;
|
|
174
175
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
175
|
-
hasHitElementInside: boolean;
|
|
176
176
|
};
|
|
177
177
|
withCmdOrCtrl: boolean;
|
|
178
178
|
drag: {
|
|
@@ -227,6 +227,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
227
227
|
private removeEventListeners;
|
|
228
228
|
private addEventListeners;
|
|
229
229
|
componentDidUpdate(prevProps: AppProps, prevState: AppState): void;
|
|
230
|
+
private renderScene;
|
|
230
231
|
private onScroll;
|
|
231
232
|
private onCut;
|
|
232
233
|
private onCopy;
|
|
@@ -34,5 +34,5 @@ interface LayerUIProps {
|
|
|
34
34
|
insertOnCanvasDirectly: boolean;
|
|
35
35
|
}) => void;
|
|
36
36
|
}
|
|
37
|
-
declare const _default: React.MemoExoticComponent<({ onHomeButtonClick, actionManager, appState, files, setAppState,
|
|
37
|
+
declare const _default: React.MemoExoticComponent<({ onHomeButtonClick, actionManager, appState, files, setAppState, elements, canvas, onCollabButtonClick, onLockToggle, onPenModeToggle, onInsertElements, showExitZenModeBtn, showThemeBtn, isCollaborating, renderTopRightUI, renderCustomFooter, renderCustomStats, libraryReturnUrl, UIOptions, focusContainer, library, id, onImageAction, }: LayerUIProps) => JSX.Element>;
|
|
38
38
|
export default _default;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import Library from "../data/library";
|
|
2
2
|
import { LibraryItems, LibraryItem, AppState, BinaryFiles, ExcalidrawProps } from "../types";
|
|
3
3
|
import "./LibraryMenu.scss";
|
|
4
|
-
export declare const LibraryMenu: ({ onClose, onInsertLibraryItems, pendingElements, onAddToLibrary,
|
|
4
|
+
export declare const LibraryMenu: ({ onClose, onInsertLibraryItems, pendingElements, onAddToLibrary, setAppState, files, libraryReturnUrl, focusContainer, library, id, appState, }: {
|
|
5
5
|
pendingElements: LibraryItem["elements"];
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
onInsertLibraryItems: (libraryItems: LibraryItems) => void;
|
|
8
8
|
onAddToLibrary: () => void;
|
|
9
|
-
theme: AppState["theme"];
|
|
10
9
|
files: BinaryFiles;
|
|
11
10
|
setAppState: React.Component<any, AppState>["setState"];
|
|
12
11
|
libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
|
|
@@ -4,9 +4,8 @@ import { NonDeletedExcalidrawElement } from "./types";
|
|
|
4
4
|
import { Bounds } from "./bounds";
|
|
5
5
|
import "./Hyperlink.scss";
|
|
6
6
|
export declare const EXTERNAL_LINK_IMG: HTMLImageElement;
|
|
7
|
-
export declare const Hyperlink: ({ element,
|
|
7
|
+
export declare const Hyperlink: ({ element, setAppState, onLinkOpen, }: {
|
|
8
8
|
element: NonDeletedExcalidrawElement;
|
|
9
|
-
appState: AppState;
|
|
10
9
|
setAppState: React.Component<any, AppState>["setState"];
|
|
11
10
|
onLinkOpen: ExcalidrawProps["onLinkOpen"];
|
|
12
11
|
}) => JSX.Element | null;
|
|
@@ -8,7 +8,7 @@ export declare const getCurvePathOps: (shape: Drawable) => Op[];
|
|
|
8
8
|
export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
|
|
9
9
|
export declare const getElementBounds: (element: ExcalidrawElement) => [number, number, number, number];
|
|
10
10
|
export declare const getCommonBounds: (elements: readonly ExcalidrawElement[]) => [number, number, number, number];
|
|
11
|
-
export declare const getResizedElementAbsoluteCoords: (element: ExcalidrawElement, nextWidth: number, nextHeight: number) => [number, number, number, number];
|
|
11
|
+
export declare const getResizedElementAbsoluteCoords: (element: ExcalidrawElement, nextWidth: number, nextHeight: number, normalizePoints: boolean) => [number, number, number, number];
|
|
12
12
|
export declare const getElementPointsCoords: (element: ExcalidrawLinearElement, points: readonly (readonly [number, number])[], sharpness: ExcalidrawElement["strokeSharpness"]) => [number, number, number, number];
|
|
13
13
|
export declare const getClosestElementBounds: (elements: readonly ExcalidrawElement[], from: {
|
|
14
14
|
x: number;
|
|
@@ -24,6 +24,7 @@ export declare class LinearElementEditor {
|
|
|
24
24
|
readonly startBindingElement: ExcalidrawBindableElement | null | "keep";
|
|
25
25
|
readonly endBindingElement: ExcalidrawBindableElement | null | "keep";
|
|
26
26
|
readonly hoverPointIndex: number;
|
|
27
|
+
readonly midPointHovered: boolean;
|
|
27
28
|
constructor(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene);
|
|
28
29
|
static POINT_HANDLE_SIZE: number;
|
|
29
30
|
/**
|
|
@@ -38,6 +39,11 @@ export declare class LinearElementEditor {
|
|
|
38
39
|
y: number;
|
|
39
40
|
}[]) => void, linearElementEditor: LinearElementEditor): boolean;
|
|
40
41
|
static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState): LinearElementEditor;
|
|
42
|
+
static isHittingMidPoint: (linearElementEditor: LinearElementEditor, scenePointer: {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
}, appState: AppState) => boolean;
|
|
46
|
+
static getMidPoint(linearElementEditor: LinearElementEditor): readonly [number, number] | null;
|
|
41
47
|
static handlePointerDown(event: React.PointerEvent<HTMLCanvasElement>, appState: AppState, history: History, scenePointer: {
|
|
42
48
|
x: number;
|
|
43
49
|
y: number;
|
|
@@ -45,12 +51,13 @@ export declare class LinearElementEditor {
|
|
|
45
51
|
didAddPoint: boolean;
|
|
46
52
|
hitElement: NonDeleted<ExcalidrawElement> | null;
|
|
47
53
|
linearElementEditor: LinearElementEditor | null;
|
|
54
|
+
isMidPoint: boolean;
|
|
48
55
|
};
|
|
49
56
|
static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, linearElementEditor: LinearElementEditor, gridSize: number | null): LinearElementEditor;
|
|
50
57
|
/** scene coords */
|
|
51
58
|
static getPointGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, point: Point): readonly [number, number];
|
|
52
59
|
/** scene coords */
|
|
53
|
-
static getPointsGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>):
|
|
60
|
+
static getPointsGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>): Point[];
|
|
54
61
|
static getPointAtIndexGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, indexMaybeFromEnd: number): Point;
|
|
55
62
|
static pointFromAbsoluteCoords(element: NonDeleted<ExcalidrawLinearElement>, absoluteCoords: Point): Point;
|
|
56
63
|
static getPointIndexUnderCursor(element: NonDeleted<ExcalidrawLinearElement>, zoom: AppState["zoom"], x: number, y: number): number;
|
|
@@ -87,6 +94,7 @@ export declare class LinearElementEditor {
|
|
|
87
94
|
startBindingElement: ExcalidrawBindableElement | "keep" | null;
|
|
88
95
|
endBindingElement: ExcalidrawBindableElement | "keep" | null;
|
|
89
96
|
hoverPointIndex: number;
|
|
97
|
+
midPointHovered: boolean;
|
|
90
98
|
};
|
|
91
99
|
isLoading: boolean;
|
|
92
100
|
errorMessage: string | null;
|
|
@@ -136,7 +144,7 @@ export declare class LinearElementEditor {
|
|
|
136
144
|
scrolledOutside: boolean;
|
|
137
145
|
name: string;
|
|
138
146
|
isResizing: boolean;
|
|
139
|
-
isRotating: boolean;
|
|
147
|
+
isRotating: boolean;
|
|
140
148
|
zoom: Readonly<{
|
|
141
149
|
value: import("../types").NormalizedZoomValue;
|
|
142
150
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement, NonDeletedExcalidrawElement, PointerType } from "./types";
|
|
2
2
|
import { Bounds } from "./bounds";
|
|
3
|
-
import { Zoom } from "../types";
|
|
3
|
+
import { AppState, Zoom } from "../types";
|
|
4
4
|
export declare type TransformHandleDirection = "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se";
|
|
5
5
|
export declare type TransformHandleType = TransformHandleDirection | "rotation";
|
|
6
6
|
export declare type TransformHandle = [number, number, number, number];
|
|
@@ -26,4 +26,4 @@ export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2]: Bounds, a
|
|
|
26
26
|
rotation?: boolean | undefined;
|
|
27
27
|
}, margin?: number) => TransformHandles;
|
|
28
28
|
export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, pointerType?: PointerType) => TransformHandles;
|
|
29
|
-
export declare const shouldShowBoundingBox: (elements: NonDeletedExcalidrawElement[]) => boolean;
|
|
29
|
+
export declare const shouldShowBoundingBox: (elements: NonDeletedExcalidrawElement[], appState: AppState) => boolean;
|
package/types/element/types.d.ts
CHANGED
package/types/points.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export declare const getSizeFromPoints: (points: readonly Point[]) => {
|
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
/** @arg dimension, 0 for rescaling only x, 1 for y */
|
|
7
|
+
export declare const rescalePoints: (dimension: 0 | 1, newSize: number, points: readonly Point[], normalize: boolean) => Point[];
|
|
@@ -4,7 +4,14 @@ import { AppState, BinaryFiles } from "../types";
|
|
|
4
4
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
5
5
|
import { RenderConfig } from "../scene/types";
|
|
6
6
|
export declare const DEFAULT_SPACING = 4;
|
|
7
|
-
export declare const _renderScene: (elements
|
|
7
|
+
export declare const _renderScene: ({ elements, appState, scale, rc, canvas, renderConfig, }: {
|
|
8
|
+
elements: readonly NonDeletedExcalidrawElement[];
|
|
9
|
+
appState: AppState;
|
|
10
|
+
scale: number;
|
|
11
|
+
rc: RoughCanvas;
|
|
12
|
+
canvas: HTMLCanvasElement;
|
|
13
|
+
renderConfig: RenderConfig;
|
|
14
|
+
}) => {
|
|
8
15
|
atLeastOneVisibleElement: boolean;
|
|
9
16
|
scrollBars?: undefined;
|
|
10
17
|
} | {
|
|
@@ -12,7 +19,15 @@ export declare const _renderScene: (elements: readonly NonDeletedExcalidrawEleme
|
|
|
12
19
|
scrollBars: import("../scene/types").ScrollBars | undefined;
|
|
13
20
|
};
|
|
14
21
|
/** renderScene throttled to animation framerate */
|
|
15
|
-
export declare const renderScene: <T extends boolean = false>(
|
|
22
|
+
export declare const renderScene: <T extends boolean = false>(config: {
|
|
23
|
+
elements: readonly NonDeletedExcalidrawElement[];
|
|
24
|
+
appState: AppState;
|
|
25
|
+
scale: number;
|
|
26
|
+
rc: RoughCanvas;
|
|
27
|
+
canvas: HTMLCanvasElement;
|
|
28
|
+
renderConfig: RenderConfig;
|
|
29
|
+
callback?: ((data: ReturnType<typeof _renderScene>) => void) | undefined;
|
|
30
|
+
}, throttle?: T | undefined) => T extends true ? void : {
|
|
16
31
|
atLeastOneVisibleElement: boolean;
|
|
17
32
|
scrollBars?: undefined;
|
|
18
33
|
} | {
|
package/types/types.d.ts
CHANGED