@zsviczian/excalidraw 0.13.0-obsidian → 0.13.0-obsidian-2
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/README.md +1 -1
- package/dist/excalidraw.development.js +1149 -166
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +104 -0
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +9 -9
- package/types/actions/actionAlign.d.ts +18 -6
- package/types/actions/actionBoundText.d.ts +3 -3
- package/types/actions/actionCanvas.d.ts +62 -43
- package/types/actions/actionClipboard.d.ts +24 -15
- package/types/actions/actionDeleteSelected.d.ts +21 -10
- package/types/actions/actionDistribute.d.ts +6 -2
- package/types/actions/actionDuplicateSelection.d.ts +3 -1
- package/types/actions/actionExport.d.ts +61 -44
- package/types/actions/actionFinalize.d.ts +9 -7
- package/types/actions/actionGroup.d.ts +6 -2
- package/types/actions/actionLinearEditor.d.ts +3 -3
- package/types/actions/actionMenu.d.ts +20 -12
- package/types/actions/actionNavigate.d.ts +4 -1
- package/types/actions/actionProperties.d.ts +80 -54
- package/types/actions/actionStyles.d.ts +3 -3
- package/types/actions/actionToggleGridMode.d.ts +4 -3
- package/types/actions/actionToggleLock.d.ts +3 -3
- package/types/actions/actionToggleStats.d.ts +4 -3
- package/types/actions/actionToggleViewMode.d.ts +4 -3
- package/types/actions/actionToggleZenMode.d.ts +4 -3
- package/types/actions/actionZindex.d.ts +12 -4
- package/types/actions/manager.d.ts +1 -1
- package/types/actions/shortcuts.d.ts +1 -1
- package/types/actions/types.d.ts +7 -2
- package/types/appState.d.ts +11 -11
- package/types/bug-issue-template.d.ts +2 -0
- package/types/clients.d.ts +1 -1
- package/types/clipboard.d.ts +6 -1
- package/types/components/Actions.d.ts +1 -0
- package/types/components/App.d.ts +47 -1
- package/types/components/Avatar.d.ts +1 -1
- package/types/components/CollabButton.d.ts +2 -1
- package/types/components/ContextMenu.d.ts +9 -10
- package/types/components/DialogActionButton.d.ts +10 -0
- package/types/components/EncryptedIcon.d.ts +2 -0
- package/types/components/Footer.d.ts +2 -1
- package/types/components/HelpButton.d.ts +8 -0
- package/types/components/ImageExportDialog.d.ts +3 -1
- package/types/components/LayerUI.d.ts +2 -1
- package/types/components/LibraryButton.d.ts +1 -0
- package/types/components/LibraryMenuBrowseButton.d.ts +7 -0
- package/types/components/LibraryMenuItems.d.ts +5 -2
- package/types/components/MenuItem.d.ts +11 -0
- package/types/components/MenuUtils.d.ts +2 -0
- package/types/components/MobileMenu.d.ts +2 -1
- package/types/components/Sidebar/Sidebar.d.ts +1 -1
- package/types/components/Sidebar/common.d.ts +1 -0
- package/types/components/TopErrorBoundary.d.ts +15 -0
- package/types/components/WelcomeScreen.d.ts +8 -0
- package/types/components/WelcomeScreenDecor.d.ts +6 -0
- package/types/components/icons.d.ts +83 -124
- package/types/constants.d.ts +8 -5
- package/types/element/Hyperlink.d.ts +6 -4
- package/types/element/bounds.d.ts +3 -2
- package/types/element/linearElementEditor.d.ts +34 -6
- package/types/element/newElement.d.ts +2 -2
- package/types/element/resizeElements.d.ts +0 -1
- package/types/element/textElement.d.ts +17 -2
- package/types/element/transformHandles.d.ts +3 -4
- package/types/element/typeChecks.d.ts +10 -1
- package/types/element/types.d.ts +11 -4
- package/types/excalidraw-app/CustomStats.d.ts +9 -0
- package/types/excalidraw-app/app_constants.d.ts +32 -0
- package/types/excalidraw-app/collab/Collab.d.ts +163 -0
- package/types/excalidraw-app/collab/Portal.d.ts +28 -0
- package/types/excalidraw-app/collab/RoomDialog.d.ts +13 -0
- package/types/excalidraw-app/collab/reconciliation.d.ts +10 -0
- package/types/excalidraw-app/components/ExportToExcalidrawPlus.d.ts +9 -0
- package/types/excalidraw-app/components/LanguageList.d.ts +4 -0
- package/types/excalidraw-app/components/icons.d.ts +1 -0
- package/types/excalidraw-app/data/FileManager.d.ts +66 -0
- package/types/excalidraw-app/data/LocalData.d.ts +32 -0
- package/types/excalidraw-app/data/Locker.d.ts +8 -0
- package/types/excalidraw-app/data/firebase.d.ts +25 -0
- package/types/excalidraw-app/data/index.d.ts +185 -0
- package/types/excalidraw-app/data/localStorage.d.ts +111 -0
- package/types/excalidraw-app/data/tabSync.d.ts +9 -0
- package/types/excalidraw-app/index.d.ts +26 -0
- package/types/hooks/useOutsideClick.d.ts +2 -0
- package/types/keys.d.ts +10 -0
- package/types/math.d.ts +2 -1
- package/types/packages/excalidraw/index.d.ts +3 -0
- package/types/packages/utils.d.ts +3 -1
- package/types/renderer/renderElement.d.ts +4 -3
- package/types/renderer/renderScene.d.ts +1 -1
- package/types/scene/Fonts.d.ts +21 -0
- package/types/scene/Scene.d.ts +15 -0
- package/types/scene/comparisons.d.ts +2 -3
- package/types/scene/index.d.ts +1 -1
- package/types/scene/types.d.ts +1 -0
- package/types/shapes.d.ts +27 -3
- package/types/types.d.ts +15 -4
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { ExcalidrawElement } from "../../element/types";
|
|
2
|
+
export declare const saveUsernameToLocalStorage: (username: string) => void;
|
|
3
|
+
export declare const importUsernameFromLocalStorage: () => string | null;
|
|
4
|
+
export declare const importFromLocalStorage: () => {
|
|
5
|
+
elements: ExcalidrawElement[];
|
|
6
|
+
appState: {
|
|
7
|
+
theme: string;
|
|
8
|
+
name: string;
|
|
9
|
+
activeTool: {
|
|
10
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser";
|
|
11
|
+
lastActiveToolBeforeEraser: import("../../types").LastActiveToolBeforeEraser;
|
|
12
|
+
locked: boolean;
|
|
13
|
+
customType: null;
|
|
14
|
+
} | {
|
|
15
|
+
type: "custom";
|
|
16
|
+
customType: string;
|
|
17
|
+
lastActiveToolBeforeEraser: import("../../types").LastActiveToolBeforeEraser;
|
|
18
|
+
locked: boolean;
|
|
19
|
+
};
|
|
20
|
+
showWelcomeScreen: boolean;
|
|
21
|
+
penMode: boolean;
|
|
22
|
+
penDetected: boolean;
|
|
23
|
+
exportBackground: boolean;
|
|
24
|
+
exportEmbedScene: boolean;
|
|
25
|
+
exportWithDarkMode: boolean;
|
|
26
|
+
exportScale: number;
|
|
27
|
+
currentItemStrokeColor: string;
|
|
28
|
+
currentItemBackgroundColor: string;
|
|
29
|
+
currentItemFillStyle: import("../../element/types").FillStyle;
|
|
30
|
+
currentItemStrokeWidth: number;
|
|
31
|
+
currentItemStrokeStyle: import("../../element/types").StrokeStyle;
|
|
32
|
+
currentItemRoughness: number;
|
|
33
|
+
currentItemOpacity: number;
|
|
34
|
+
currentItemFontFamily: number;
|
|
35
|
+
currentItemFontSize: number;
|
|
36
|
+
currentItemTextAlign: string;
|
|
37
|
+
currentItemStartArrowhead: import("../../element/types").Arrowhead | null;
|
|
38
|
+
currentItemEndArrowhead: import("../../element/types").Arrowhead | null;
|
|
39
|
+
currentItemRoundness: import("../../element/types").StrokeRoundness;
|
|
40
|
+
viewBackgroundColor: string;
|
|
41
|
+
scrollX: number;
|
|
42
|
+
scrollY: number;
|
|
43
|
+
cursorButton: "up" | "down";
|
|
44
|
+
scrolledOutside: boolean;
|
|
45
|
+
zoom: Readonly<{
|
|
46
|
+
value: import("../../types").NormalizedZoomValue;
|
|
47
|
+
}>;
|
|
48
|
+
openMenu: "canvas" | "shape" | null;
|
|
49
|
+
openSidebar: "library" | "customSidebar" | null;
|
|
50
|
+
isSidebarDocked: boolean;
|
|
51
|
+
lastPointerDownWith: import("../../element/types").PointerType;
|
|
52
|
+
selectedElementIds: {
|
|
53
|
+
[id: string]: boolean;
|
|
54
|
+
};
|
|
55
|
+
previousSelectedElementIds: {
|
|
56
|
+
[id: string]: boolean;
|
|
57
|
+
};
|
|
58
|
+
shouldCacheIgnoreZoom: boolean;
|
|
59
|
+
zenModeEnabled: boolean;
|
|
60
|
+
gridSize: number | null;
|
|
61
|
+
selectedGroupIds: {
|
|
62
|
+
[groupId: string]: boolean;
|
|
63
|
+
};
|
|
64
|
+
editingGroupId: string | null;
|
|
65
|
+
showStats: boolean;
|
|
66
|
+
currentChartType: import("../../element/types").ChartType;
|
|
67
|
+
selectedLinearElement: import("../../element/linearElementEditor").LinearElementEditor | null;
|
|
68
|
+
isLoading: boolean;
|
|
69
|
+
errorMessage: string | null;
|
|
70
|
+
draggingElement: import("../../element/types").NonDeletedExcalidrawElement | null;
|
|
71
|
+
resizingElement: import("../../element/types").NonDeletedExcalidrawElement | null;
|
|
72
|
+
multiElement: import("../../element/types").NonDeleted<import("../../element/types").ExcalidrawLinearElement> | null;
|
|
73
|
+
selectionElement: import("../../element/types").NonDeletedExcalidrawElement | null;
|
|
74
|
+
isBindingEnabled: boolean;
|
|
75
|
+
startBoundElement: import("../../element/types").NonDeleted<import("../../element/types").ExcalidrawBindableElement> | null;
|
|
76
|
+
suggestedBindings: import("../../element/binding").SuggestedBinding[];
|
|
77
|
+
editingElement: import("../../element/types").NonDeletedExcalidrawElement | null;
|
|
78
|
+
editingLinearElement: import("../../element/linearElementEditor").LinearElementEditor | null;
|
|
79
|
+
isResizing: boolean;
|
|
80
|
+
isRotating: boolean;
|
|
81
|
+
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
82
|
+
openDialog: "imageExport" | "help" | null;
|
|
83
|
+
toast: {
|
|
84
|
+
message: string;
|
|
85
|
+
closable?: boolean | undefined;
|
|
86
|
+
duration?: number | undefined;
|
|
87
|
+
} | null;
|
|
88
|
+
viewModeEnabled: boolean;
|
|
89
|
+
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
90
|
+
collaborators: Map<string, import("../../types").Collaborator>;
|
|
91
|
+
pasteDialog: {
|
|
92
|
+
shown: false;
|
|
93
|
+
data: null;
|
|
94
|
+
} | {
|
|
95
|
+
shown: true;
|
|
96
|
+
data: import("../../charts").Spreadsheet;
|
|
97
|
+
};
|
|
98
|
+
pendingImageElementId: string | null;
|
|
99
|
+
showHyperlinkPopup: false | "info" | "editor";
|
|
100
|
+
linkOpacity: number;
|
|
101
|
+
trayModeEnabled: boolean;
|
|
102
|
+
colorPalette: {
|
|
103
|
+
canvasBackground?: string[] | undefined;
|
|
104
|
+
elementBackground?: string[] | undefined;
|
|
105
|
+
elementStroke?: string[] | undefined;
|
|
106
|
+
};
|
|
107
|
+
} | null;
|
|
108
|
+
};
|
|
109
|
+
export declare const getElementsStorageSize: () => number;
|
|
110
|
+
export declare const getTotalStorageSize: () => number;
|
|
111
|
+
export declare const getLibraryItemsFromStorage: () => import("../../types").LibraryItems_anyVersion;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const LOCAL_STATE_VERSIONS: {
|
|
2
|
+
"version-dataState": number;
|
|
3
|
+
"version-files": number;
|
|
4
|
+
};
|
|
5
|
+
declare type BrowserStateTypes = keyof typeof LOCAL_STATE_VERSIONS;
|
|
6
|
+
export declare const isBrowserStorageStateNewer: (type: BrowserStateTypes) => boolean;
|
|
7
|
+
export declare const updateBrowserStateVersion: (type: BrowserStateTypes) => void;
|
|
8
|
+
export declare const resetBrowserStateVersions: () => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "./index.scss";
|
|
2
|
+
export declare const langCodeAtom: import("jotai").Atom<string> & {
|
|
3
|
+
write: (get: {
|
|
4
|
+
<Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
|
|
5
|
+
<Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
|
|
6
|
+
<Value_2>(atom: import("jotai").Atom<Value_2>): Value_2 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_2;
|
|
7
|
+
} & {
|
|
8
|
+
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
|
|
9
|
+
unstable_promise: true;
|
|
10
|
+
}): Value_3 | Promise<Value_3>;
|
|
11
|
+
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
|
|
12
|
+
unstable_promise: true;
|
|
13
|
+
}): Value_4 | Promise<Value_4>;
|
|
14
|
+
<Value_5>(atom: import("jotai").Atom<Value_5>, options: {
|
|
15
|
+
unstable_promise: true;
|
|
16
|
+
}): (Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5) | Promise<Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5>;
|
|
17
|
+
}, set: {
|
|
18
|
+
<Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
|
|
19
|
+
<Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
|
|
20
|
+
}, update: string | ((prev: string) => string)) => void;
|
|
21
|
+
onMount?: (<S extends (update: string | ((prev: string) => string)) => void>(setAtom: S) => void | (() => void)) | undefined;
|
|
22
|
+
} & {
|
|
23
|
+
init: string;
|
|
24
|
+
};
|
|
25
|
+
declare const ExcalidrawApp: () => JSX.Element;
|
|
26
|
+
export default ExcalidrawApp;
|
package/types/keys.d.ts
CHANGED
|
@@ -60,6 +60,16 @@ export declare const KEYS: {
|
|
|
60
60
|
readonly Y: "y";
|
|
61
61
|
readonly Z: "z";
|
|
62
62
|
readonly K: "k";
|
|
63
|
+
readonly 0: "0";
|
|
64
|
+
readonly 1: "1";
|
|
65
|
+
readonly 2: "2";
|
|
66
|
+
readonly 3: "3";
|
|
67
|
+
readonly 4: "4";
|
|
68
|
+
readonly 5: "5";
|
|
69
|
+
readonly 6: "6";
|
|
70
|
+
readonly 7: "7";
|
|
71
|
+
readonly 8: "8";
|
|
72
|
+
readonly 9: "9";
|
|
63
73
|
};
|
|
64
74
|
export declare type Key = keyof typeof KEYS;
|
|
65
75
|
export declare const isArrowKey: (key: string) => boolean;
|
package/types/math.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Point, Zoom } from "./types";
|
|
2
|
-
import { ExcalidrawLinearElement, NonDeleted } from "./element/types";
|
|
2
|
+
import { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted } from "./element/types";
|
|
3
3
|
export declare const rotate: (x1: number, y1: number, x2: number, y2: number, angle: number) => [number, number];
|
|
4
4
|
export declare const rotatePoint: (point: readonly [number, number], center: readonly [number, number], angle: number) => [number, number];
|
|
5
5
|
export declare const adjustXYWithRotation: (sides: {
|
|
@@ -18,6 +18,7 @@ export declare const centerPoint: (a: readonly [number, number], b: readonly [nu
|
|
|
18
18
|
export declare const isPathALoop: (points: ExcalidrawLinearElement["points"], zoomValue?: Zoom["value"]) => boolean;
|
|
19
19
|
export declare const isPointInPolygon: (points: Point[], x: number, y: number) => boolean;
|
|
20
20
|
export declare const getGridPoint: (x: number, y: number, gridSize: number | null) => [number, number];
|
|
21
|
+
export declare const getCornerRadius: (x: number, element: ExcalidrawElement) => number;
|
|
21
22
|
export declare const getControlPointsForBezierCurve: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => [number, number][] | null;
|
|
22
23
|
export declare const getBezierXY: (p0: readonly [number, number], p1: readonly [number, number], p2: readonly [number, number], p3: readonly [number, number], t: number) => number[];
|
|
23
24
|
export declare const getPointsInBezierCurve: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => [number, number][];
|
|
@@ -12,6 +12,9 @@ getMaximumGroups, //zsviczian
|
|
|
12
12
|
intersectElementWithLine, //zsviczian
|
|
13
13
|
determineFocusDistance, //zsviczian
|
|
14
14
|
measureText, //zsviczian
|
|
15
|
+
wrapText, //zsviczian
|
|
16
|
+
getFontString, //zsviczian
|
|
17
|
+
getMaxContainerWidth, //zsviczian
|
|
15
18
|
exportToClipboard, mergeLibraryItems, } from "../../packages/utils";
|
|
16
19
|
export { isLinearElement } from "../../element/typeChecks";
|
|
17
20
|
export { FONT_FAMILY, THEME, MIME_TYPES } from "../../constants";
|
|
@@ -36,5 +36,7 @@ export { getCommonBoundingBox } from "../element/bounds";
|
|
|
36
36
|
export { getMaximumGroups } from "../groups";
|
|
37
37
|
export { intersectElementWithLine } from "../element/collision";
|
|
38
38
|
export { determineFocusDistance } from "../element/collision";
|
|
39
|
-
export { measureText } from "../element/textElement";
|
|
39
|
+
export { measureText, wrapText } from "../element/textElement";
|
|
40
|
+
export { getFontString } from "../utils";
|
|
41
|
+
export { getMaxContainerWidth } from "../element/newElement";
|
|
40
42
|
export { mergeLibraryItems } from "../data/library";
|
|
@@ -3,7 +3,7 @@ import { RoughCanvas } from "roughjs/bin/canvas";
|
|
|
3
3
|
import { Drawable, Options } from "roughjs/bin/core";
|
|
4
4
|
import { RoughSVG } from "roughjs/bin/svg";
|
|
5
5
|
import { RenderConfig } from "../scene/types";
|
|
6
|
-
import { BinaryFiles, Zoom } from "../types";
|
|
6
|
+
import { AppState, BinaryFiles, Zoom } from "../types";
|
|
7
7
|
export interface ExcalidrawElementWithCanvas {
|
|
8
8
|
element: ExcalidrawElement | ExcalidrawTextElement;
|
|
9
9
|
canvas: HTMLCanvasElement;
|
|
@@ -11,6 +11,7 @@ export interface ExcalidrawElementWithCanvas {
|
|
|
11
11
|
canvasZoom: Zoom["value"];
|
|
12
12
|
canvasOffsetX: number;
|
|
13
13
|
canvasOffsetY: number;
|
|
14
|
+
boundTextElementVersion: number | null;
|
|
14
15
|
}
|
|
15
16
|
export declare const DEFAULT_LINK_SIZE = 14;
|
|
16
17
|
declare type ElementShape = Drawable | Drawable[] | null;
|
|
@@ -25,8 +26,8 @@ export declare const getShapeForElement: <T extends ExcalidrawElement>(element:
|
|
|
25
26
|
export declare const setShapeForElement: <T extends ExcalidrawElement>(element: T, shape: T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable) => WeakMap<ExcalidrawElement, ElementShape>;
|
|
26
27
|
export declare const invalidateShapeForElement: (element: ExcalidrawElement) => boolean;
|
|
27
28
|
export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
|
|
28
|
-
export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: RenderConfig) => void;
|
|
29
|
-
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX
|
|
29
|
+
export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: RenderConfig, appState: AppState) => void;
|
|
30
|
+
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number, exportWithDarkMode?: boolean) => void;
|
|
30
31
|
export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
|
|
31
32
|
export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
|
|
32
33
|
export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
|
|
@@ -3,7 +3,7 @@ import { RoughSVG } from "roughjs/bin/svg";
|
|
|
3
3
|
import { AppState, BinaryFiles } from "../types";
|
|
4
4
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
5
5
|
import { RenderConfig } from "../scene/types";
|
|
6
|
-
export declare const DEFAULT_SPACING =
|
|
6
|
+
export declare const DEFAULT_SPACING = 2;
|
|
7
7
|
export declare const _renderScene: ({ elements, appState, scale, rc, canvas, renderConfig, }: {
|
|
8
8
|
elements: readonly NonDeletedExcalidrawElement[];
|
|
9
9
|
appState: AppState;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ExcalidrawElement } from "../element/types";
|
|
2
|
+
import type Scene from "./Scene";
|
|
3
|
+
export declare class Fonts {
|
|
4
|
+
private scene;
|
|
5
|
+
private onSceneUpdated;
|
|
6
|
+
constructor({ scene, onSceneUpdated, }: {
|
|
7
|
+
scene: Scene;
|
|
8
|
+
onSceneUpdated: () => void;
|
|
9
|
+
});
|
|
10
|
+
private static loadedFontFaces;
|
|
11
|
+
/**
|
|
12
|
+
* if we load a (new) font, it's likely that text elements using it have
|
|
13
|
+
* already been rendered using a fallback font. Thus, we want invalidate
|
|
14
|
+
* their shapes and rerender. See #637.
|
|
15
|
+
*
|
|
16
|
+
* Invalidates text elements and rerenders scene, provided that at least one
|
|
17
|
+
* of the supplied fontFaces has not already been processed.
|
|
18
|
+
*/
|
|
19
|
+
onFontsLoaded: (fontFaces: readonly FontFace[]) => false | undefined;
|
|
20
|
+
loadFontsForElements: (elements: readonly ExcalidrawElement[]) => Promise<void>;
|
|
21
|
+
}
|
package/types/scene/Scene.d.ts
CHANGED
|
@@ -17,9 +17,24 @@ declare class Scene {
|
|
|
17
17
|
getNonDeletedElements(): readonly NonDeletedExcalidrawElement[];
|
|
18
18
|
getElement<T extends ExcalidrawElement>(id: T["id"]): T | null;
|
|
19
19
|
getNonDeletedElement(id: ExcalidrawElement["id"]): NonDeleted<ExcalidrawElement> | null;
|
|
20
|
+
/**
|
|
21
|
+
* A utility method to help with updating all scene elements, with the added
|
|
22
|
+
* performance optimization of not renewing the array if no change is made.
|
|
23
|
+
*
|
|
24
|
+
* Maps all current excalidraw elements, invoking the callback for each
|
|
25
|
+
* element. The callback should either return a new mapped element, or the
|
|
26
|
+
* original element if no changes are made. If no changes are made to any
|
|
27
|
+
* element, this results in a no-op. Otherwise, the newly mapped elements
|
|
28
|
+
* are set as the next scene's elements.
|
|
29
|
+
*
|
|
30
|
+
* @returns whether a change was made
|
|
31
|
+
*/
|
|
32
|
+
mapElements(iteratee: (element: ExcalidrawElement) => ExcalidrawElement): boolean;
|
|
20
33
|
replaceAllElements(nextElements: readonly ExcalidrawElement[]): void;
|
|
21
34
|
informMutation(): void;
|
|
22
35
|
addCallback(cb: SceneStateCallback): SceneStateCallbackRemover;
|
|
23
36
|
destroy(): void;
|
|
37
|
+
insertElementAtIndex(element: ExcalidrawElement, index: number): void;
|
|
38
|
+
getElementIndex(elementId: string): number;
|
|
24
39
|
}
|
|
25
40
|
export default Scene;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
export declare const hasBackground: (type: string) => boolean;
|
|
3
3
|
export declare const hasStrokeColor: (type: string) => boolean;
|
|
4
4
|
export declare const hasStrokeWidth: (type: string) => boolean;
|
|
5
5
|
export declare const hasStrokeStyle: (type: string) => boolean;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const canChangeRoundness: (type: string) => boolean;
|
|
7
7
|
export declare const hasText: (type: string) => boolean;
|
|
8
8
|
export declare const canHaveArrowheads: (type: string) => boolean;
|
|
9
9
|
export declare const getElementAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement | null;
|
|
10
10
|
export declare const getElementsAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement[];
|
|
11
|
-
export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], x: number, y: number) => ExcalidrawTextContainer | null;
|
package/types/scene/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { isOverScrollBars } from "./scrollbars";
|
|
2
2
|
export { isSomeElementSelected, getElementsWithinSelection, getCommonAttributeOfSelectedElements, getSelectedElements, getTargetElements, } from "./selection";
|
|
3
3
|
export { calculateScrollCenter } from "./scroll";
|
|
4
|
-
export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads,
|
|
4
|
+
export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeRoundness, getElementAtPosition, hasText, getElementsAtPosition, } from "./comparisons";
|
|
5
5
|
export { getNormalizedZoom } from "./zoom";
|
package/types/scene/types.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare type RenderConfig = {
|
|
|
33
33
|
/** when exporting the behavior is slightly different (e.g. we can't use
|
|
34
34
|
CSS filters), and we disable render optimizations for best output */
|
|
35
35
|
isExporting: boolean;
|
|
36
|
+
selectionColor?: string;
|
|
36
37
|
};
|
|
37
38
|
export declare type SceneScroll = {
|
|
38
39
|
scrollX: number;
|
package/types/shapes.d.ts
CHANGED
|
@@ -2,37 +2,61 @@ export declare const SHAPES: readonly [{
|
|
|
2
2
|
readonly icon: JSX.Element;
|
|
3
3
|
readonly value: "selection";
|
|
4
4
|
readonly key: "v";
|
|
5
|
+
readonly numericKey: "1";
|
|
6
|
+
readonly fillable: true;
|
|
5
7
|
}, {
|
|
6
8
|
readonly icon: JSX.Element;
|
|
7
9
|
readonly value: "rectangle";
|
|
8
10
|
readonly key: "r";
|
|
11
|
+
readonly numericKey: "2";
|
|
12
|
+
readonly fillable: true;
|
|
9
13
|
}, {
|
|
10
14
|
readonly icon: JSX.Element;
|
|
11
15
|
readonly value: "diamond";
|
|
12
16
|
readonly key: "d";
|
|
17
|
+
readonly numericKey: "3";
|
|
18
|
+
readonly fillable: true;
|
|
13
19
|
}, {
|
|
14
20
|
readonly icon: JSX.Element;
|
|
15
21
|
readonly value: "ellipse";
|
|
16
22
|
readonly key: "o";
|
|
23
|
+
readonly numericKey: "4";
|
|
24
|
+
readonly fillable: true;
|
|
17
25
|
}, {
|
|
18
26
|
readonly icon: JSX.Element;
|
|
19
27
|
readonly value: "arrow";
|
|
20
28
|
readonly key: "a";
|
|
29
|
+
readonly numericKey: "5";
|
|
30
|
+
readonly fillable: true;
|
|
21
31
|
}, {
|
|
22
32
|
readonly icon: JSX.Element;
|
|
23
33
|
readonly value: "line";
|
|
24
|
-
readonly key:
|
|
34
|
+
readonly key: "l";
|
|
35
|
+
readonly numericKey: "6";
|
|
36
|
+
readonly fillable: true;
|
|
25
37
|
}, {
|
|
26
38
|
readonly icon: JSX.Element;
|
|
27
39
|
readonly value: "freedraw";
|
|
28
|
-
readonly key: readonly ["
|
|
40
|
+
readonly key: readonly ["p", "x"];
|
|
41
|
+
readonly numericKey: "7";
|
|
42
|
+
readonly fillable: false;
|
|
29
43
|
}, {
|
|
30
44
|
readonly icon: JSX.Element;
|
|
31
45
|
readonly value: "text";
|
|
32
46
|
readonly key: "t";
|
|
47
|
+
readonly numericKey: "8";
|
|
48
|
+
readonly fillable: false;
|
|
33
49
|
}, {
|
|
34
50
|
readonly icon: JSX.Element;
|
|
35
51
|
readonly value: "image";
|
|
36
52
|
readonly key: null;
|
|
53
|
+
readonly numericKey: "9";
|
|
54
|
+
readonly fillable: false;
|
|
55
|
+
}, {
|
|
56
|
+
readonly icon: JSX.Element;
|
|
57
|
+
readonly value: "eraser";
|
|
58
|
+
readonly key: "e";
|
|
59
|
+
readonly numericKey: "0";
|
|
60
|
+
readonly fillable: false;
|
|
37
61
|
}];
|
|
38
|
-
export declare const findShapeByKey: (key: string) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
|
|
62
|
+
export declare const findShapeByKey: (key: string) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser" | null;
|
package/types/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme } from "./element/types";
|
|
2
|
+
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme, StrokeRoundness } from "./element/types";
|
|
3
3
|
import { SHAPES } from "./shapes";
|
|
4
4
|
import { Point as RoughPoint } from "roughjs/bin/geometry";
|
|
5
5
|
import { LinearElementEditor } from "./element/linearElementEditor";
|
|
@@ -39,7 +39,18 @@ export declare type BinaryFileData = {
|
|
|
39
39
|
mimeType: typeof ALLOWED_IMAGE_MIME_TYPES[number] | typeof MIME_TYPES.binary;
|
|
40
40
|
id: FileId;
|
|
41
41
|
dataURL: DataURL;
|
|
42
|
+
/**
|
|
43
|
+
* Epoch timestamp in milliseconds
|
|
44
|
+
*/
|
|
42
45
|
created: number;
|
|
46
|
+
/**
|
|
47
|
+
* Indicates when the file was last retrieved from storage to be loaded
|
|
48
|
+
* onto the scene. We use this flag to determine whether to delete unused
|
|
49
|
+
* files from storage.
|
|
50
|
+
*
|
|
51
|
+
* Epoch timestamp in milliseconds.
|
|
52
|
+
*/
|
|
53
|
+
lastRetrieved?: number;
|
|
43
54
|
};
|
|
44
55
|
export declare type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
|
|
45
56
|
export declare type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
|
|
@@ -51,6 +62,7 @@ export declare type LastActiveToolBeforeEraser = {
|
|
|
51
62
|
customType: string;
|
|
52
63
|
} | null;
|
|
53
64
|
export declare type AppState = {
|
|
65
|
+
showWelcomeScreen: boolean;
|
|
54
66
|
isLoading: boolean;
|
|
55
67
|
errorMessage: string | null;
|
|
56
68
|
draggingElement: NonDeletedExcalidrawElement | null;
|
|
@@ -89,10 +101,9 @@ export declare type AppState = {
|
|
|
89
101
|
currentItemFontFamily: FontFamilyValues;
|
|
90
102
|
currentItemFontSize: number;
|
|
91
103
|
currentItemTextAlign: TextAlign;
|
|
92
|
-
currentItemStrokeSharpness: ExcalidrawElement["strokeSharpness"];
|
|
93
104
|
currentItemStartArrowhead: Arrowhead | null;
|
|
94
105
|
currentItemEndArrowhead: Arrowhead | null;
|
|
95
|
-
|
|
106
|
+
currentItemRoundness: StrokeRoundness;
|
|
96
107
|
viewBackgroundColor: string;
|
|
97
108
|
scrollX: number;
|
|
98
109
|
scrollY: number;
|
|
@@ -105,6 +116,7 @@ export declare type AppState = {
|
|
|
105
116
|
openMenu: "canvas" | "shape" | null;
|
|
106
117
|
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
107
118
|
openSidebar: "library" | "customSidebar" | null;
|
|
119
|
+
openDialog: "imageExport" | "help" | null;
|
|
108
120
|
isSidebarDocked: boolean;
|
|
109
121
|
lastPointerDownWith: PointerType;
|
|
110
122
|
selectedElementIds: {
|
|
@@ -114,7 +126,6 @@ export declare type AppState = {
|
|
|
114
126
|
[id: string]: boolean;
|
|
115
127
|
};
|
|
116
128
|
shouldCacheIgnoreZoom: boolean;
|
|
117
|
-
showHelpDialog: boolean;
|
|
118
129
|
toast: {
|
|
119
130
|
message: string;
|
|
120
131
|
closable?: boolean;
|