@excalidraw/excalidraw 0.15.2-3ddcc48 → 0.15.2-5302490
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 +19 -0
- package/dist/excalidraw-assets/locales/{es-ES-json-f2467c6a875a9e288756.js → es-ES-json-4f3da97feff33cb00e6d.js} +1 -1
- package/dist/excalidraw-assets/locales/{hi-IN-json-e22f4ad73126c2971850.js → hi-IN-json-3898c9c1216b44476529.js} +1 -1
- package/dist/excalidraw-assets/locales/{id-ID-json-0e69caf5d919807ed234.js → id-ID-json-43d505d7071a0e359681.js} +1 -1
- package/dist/excalidraw-assets/locales/{kk-KZ-json-106d2a41c68f69765668.js → kk-KZ-json-f648362328b839e9313f.js} +1 -1
- package/dist/excalidraw-assets/locales/{pa-IN-json-0fd029451b07248c5194.js → pa-IN-json-d9ee09801ed220840b2b.js} +1 -1
- package/dist/excalidraw-assets/{vendor-53d1c69ef585b6dd219b.js → vendor-ef3c5d81a00ef582b871.js} +2 -2
- package/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.js → vendor-a14cd58fa2db417e42b2.js} +6 -6
- package/dist/excalidraw.development.js +2237 -2116
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +7 -2
- package/types/actions/actionAddToLibrary.d.ts +51 -25
- package/types/actions/actionAlign.d.ts +19 -20
- package/types/actions/actionBoundText.d.ts +38 -20
- package/types/actions/actionCanvas.d.ts +182 -90
- package/types/actions/actionClipboard.d.ts +81 -40
- package/types/actions/actionDeleteSelected.d.ts +45 -22
- package/types/actions/actionDistribute.d.ts +5 -6
- package/types/actions/actionDuplicateSelection.d.ts +0 -1
- package/types/actions/actionElementLock.d.ts +36 -19
- package/types/actions/actionExport.d.ts +161 -80
- package/types/actions/actionFinalize.d.ts +32 -18
- package/types/actions/actionFlip.d.ts +2 -3
- package/types/actions/actionFrame.d.ts +56 -30
- package/types/actions/actionGroup.d.ts +246 -9
- package/types/actions/actionLinearEditor.d.ts +19 -11
- package/types/actions/actionMenu.d.ts +51 -25
- package/types/actions/actionProperties.d.ts +223 -105
- package/types/actions/actionSelectAll.d.ts +121 -2
- package/types/actions/actionStyles.d.ts +17 -9
- package/types/actions/actionToggleGridMode.d.ts +17 -9
- package/types/actions/actionToggleStats.d.ts +17 -9
- package/types/actions/actionToggleViewMode.d.ts +17 -9
- package/types/actions/actionToggleZenMode.d.ts +17 -9
- package/types/actions/types.d.ts +4 -3
- package/types/appState.d.ts +7 -7
- package/types/clipboard.d.ts +1 -0
- package/types/colors.d.ts +9 -9
- package/types/components/Actions.d.ts +2 -2
- package/types/components/App.d.ts +24 -7
- package/types/components/Button.d.ts +0 -1
- package/types/components/Card.d.ts +0 -1
- package/types/components/ColorPicker/keyboardNavHandlers.d.ts +0 -1
- package/types/components/DefaultSidebar.d.ts +0 -1
- package/types/components/ExcalidrawLogo.d.ts +15 -0
- package/types/components/EyeDropper.d.ts +0 -1
- package/types/components/HintViewer.d.ts +3 -4
- package/types/components/JSONExportDialog.d.ts +1 -1
- package/types/components/LayerUI.d.ts +4 -2
- package/types/components/LibraryMenuHeaderContent.d.ts +0 -1
- package/types/components/LibraryUnit.d.ts +0 -1
- package/types/components/LoadingMessage.d.ts +0 -1
- package/types/components/MobileMenu.d.ts +4 -3
- package/types/components/Section.d.ts +1 -1
- package/types/components/Sidebar/SidebarTab.d.ts +0 -1
- package/types/components/Sidebar/SidebarTabTrigger.d.ts +0 -1
- package/types/components/Sidebar/SidebarTabTriggers.d.ts +0 -1
- package/types/components/Sidebar/SidebarTabs.d.ts +0 -1
- package/types/components/Stack.d.ts +2 -2
- package/types/components/Trans.d.ts +2 -1
- package/types/components/canvases/InteractiveCanvas.d.ts +27 -0
- package/types/components/canvases/StaticCanvas.d.ts +18 -0
- package/types/components/canvases/index.d.ts +3 -0
- package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +0 -1
- package/types/components/icons.d.ts +1 -0
- package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -1
- package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -1
- package/types/components/welcome-screen/WelcomeScreen.d.ts +0 -1
- package/types/constants.d.ts +17 -3
- package/types/data/transform.d.ts +71 -0
- package/types/data/url.d.ts +5 -0
- package/types/element/Hyperlink.d.ts +27 -13
- package/types/element/binding.d.ts +1 -0
- package/types/element/collision.d.ts +2 -2
- package/types/element/embeddable.d.ts +153 -0
- package/types/element/linearElementEditor.d.ts +20 -12
- package/types/element/newElement.d.ts +14 -7
- package/types/element/sizeHelpers.d.ts +8 -1
- package/types/element/textElement.d.ts +5 -7
- package/types/element/textWysiwyg.d.ts +1 -1
- package/types/element/transformHandles.d.ts +3 -3
- package/types/element/typeChecks.d.ts +2 -1
- package/types/element/types.d.ts +13 -2
- package/types/frame.d.ts +5 -5
- package/types/groups.d.ts +12 -12
- package/types/history.d.ts +3 -3
- package/types/hooks/useOutsideClick.d.ts +0 -1
- package/types/hooks/useScrollPosition.d.ts +0 -1
- package/types/i18n.d.ts +5 -2
- package/types/keys.d.ts +1 -0
- package/types/packages/excalidraw/example/initialData.d.ts +182 -70
- package/types/packages/excalidraw/index.d.ts +1 -0
- package/types/packages/excalidraw/webpack.dev.config.d.ts +5 -2
- package/types/packages/excalidraw/webpack.prod.config.d.ts +3 -0
- package/types/packages/utils.d.ts +2 -1
- package/types/renderer/renderElement.d.ts +10 -22
- package/types/renderer/renderScene.d.ts +18 -37
- package/types/scene/Renderer.d.ts +25 -0
- package/types/scene/Scene.d.ts +15 -0
- package/types/scene/Shape.d.ts +12 -0
- package/types/scene/ShapeCache.d.ts +20 -0
- package/types/scene/export.d.ts +1 -0
- package/types/scene/scroll.d.ts +1 -1
- package/types/scene/scrollbars.d.ts +2 -6
- package/types/scene/selection.d.ts +13 -3
- package/types/scene/types.d.ts +57 -24
- package/types/types.d.ts +63 -12
- package/types/utility-types.d.ts +3 -1
- package/types/utils.d.ts +13 -5
- /package/dist/excalidraw-assets/{vendor-53d1c69ef585b6dd219b.js.LICENSE.txt → vendor-ef3c5d81a00ef582b871.js.LICENSE.txt} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/locales/{es-ES-json-f2467c6a875a9e288756.d.ts → es-ES-json-4f3da97feff33cb00e6d.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/locales/{hi-IN-json-e22f4ad73126c2971850.d.ts → hi-IN-json-3898c9c1216b44476529.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/locales/{id-ID-json-0e69caf5d919807ed234.d.ts → id-ID-json-43d505d7071a0e359681.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/locales/{kk-KZ-json-106d2a41c68f69765668.d.ts → kk-KZ-json-f648362328b839e9313f.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/locales/{pa-IN-json-0fd029451b07248c5194.d.ts → pa-IN-json-d9ee09801ed220840b2b.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-53d1c69ef585b6dd219b.d.ts → vendor-ef3c5d81a00ef582b871.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.d.ts → vendor-a14cd58fa2db417e42b2.d.ts} +0 -0
|
@@ -8,6 +8,7 @@ import History from "../history";
|
|
|
8
8
|
import Scene from "../scene/Scene";
|
|
9
9
|
import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName } from "../types";
|
|
10
10
|
import { FileSystemHandle } from "../data/filesystem";
|
|
11
|
+
import { Renderer } from "../scene/Renderer";
|
|
11
12
|
export declare const ExcalidrawContainerContext: React.Context<{
|
|
12
13
|
container: HTMLDivElement | null;
|
|
13
14
|
id: string | null;
|
|
@@ -31,7 +32,8 @@ export declare const useExcalidrawSetAppState: () => <K extends keyof AppState>(
|
|
|
31
32
|
export declare const useExcalidrawActionManager: () => ActionManager;
|
|
32
33
|
declare class App extends React.Component<AppProps, AppState> {
|
|
33
34
|
canvas: AppClassProperties["canvas"];
|
|
34
|
-
|
|
35
|
+
interactiveCanvas: AppClassProperties["interactiveCanvas"];
|
|
36
|
+
rc: RoughCanvas;
|
|
35
37
|
unmounted: boolean;
|
|
36
38
|
actionManager: ActionManager;
|
|
37
39
|
device: Device;
|
|
@@ -39,6 +41,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
39
41
|
private excalidrawContainerRef;
|
|
40
42
|
static defaultProps: Partial<AppProps>;
|
|
41
43
|
scene: Scene;
|
|
44
|
+
renderer: Renderer;
|
|
42
45
|
private fonts;
|
|
43
46
|
private resizeObserver;
|
|
44
47
|
private nearestScrollableContainer;
|
|
@@ -49,6 +52,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
49
52
|
private excalidrawContainerValue;
|
|
50
53
|
files: BinaryFiles;
|
|
51
54
|
imageCache: AppClassProperties["imageCache"];
|
|
55
|
+
private iFrameRefs;
|
|
52
56
|
hitLinkElement?: NonDeletedExcalidrawElement;
|
|
53
57
|
lastPointerDown: React.PointerEvent<HTMLElement> | null;
|
|
54
58
|
lastPointerUp: React.PointerEvent<HTMLElement> | PointerEvent | null;
|
|
@@ -57,7 +61,13 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
57
61
|
y: number;
|
|
58
62
|
};
|
|
59
63
|
constructor(props: AppProps);
|
|
60
|
-
private
|
|
64
|
+
private onWindowMessage;
|
|
65
|
+
private updateEmbeddableRef;
|
|
66
|
+
private getHTMLIFrameElement;
|
|
67
|
+
private handleEmbeddableCenterClick;
|
|
68
|
+
private isEmbeddableCenter;
|
|
69
|
+
private updateEmbeddables;
|
|
70
|
+
private renderEmbeddables;
|
|
61
71
|
private getFrameNameDOMId;
|
|
62
72
|
frameNameBoundsCache: FrameNameBoundsCache;
|
|
63
73
|
private renderFrameNames;
|
|
@@ -86,22 +96,27 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
86
96
|
private removeEventListeners;
|
|
87
97
|
private addEventListeners;
|
|
88
98
|
componentDidUpdate(prevProps: AppProps, prevState: AppState): void;
|
|
89
|
-
private
|
|
99
|
+
private renderInteractiveSceneCallback;
|
|
90
100
|
private onScroll;
|
|
91
101
|
private onCut;
|
|
92
102
|
private onCopy;
|
|
93
103
|
private cutAll;
|
|
94
104
|
private copyAll;
|
|
95
105
|
private static resetTapTwice;
|
|
96
|
-
private
|
|
97
|
-
private
|
|
106
|
+
private onTouchStart;
|
|
107
|
+
private onTouchEnd;
|
|
98
108
|
pasteFromClipboard: (event: ClipboardEvent | null) => Promise<void>;
|
|
99
109
|
private addElementsFromPasteOrLibrary;
|
|
100
110
|
private addTextFromPaste;
|
|
101
111
|
setAppState: React.Component<any, AppState>["setState"];
|
|
102
112
|
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
|
|
103
113
|
toggleLock: (source?: "keyboard" | "ui") => void;
|
|
104
|
-
|
|
114
|
+
updateFrameRendering: (opts: Partial<{
|
|
115
|
+
enabled: boolean;
|
|
116
|
+
name: boolean;
|
|
117
|
+
outline: boolean;
|
|
118
|
+
clip: boolean;
|
|
119
|
+
}> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
|
|
105
120
|
togglePenMode: () => void;
|
|
106
121
|
onHandToolToggle: () => void;
|
|
107
122
|
/**
|
|
@@ -199,8 +214,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
199
214
|
private isHittingCommonBoundingBoxOfSelectedElements;
|
|
200
215
|
private handleTextOnPointerDown;
|
|
201
216
|
private handleFreeDrawElementOnPointerDown;
|
|
217
|
+
private insertEmbeddableElement;
|
|
202
218
|
private createImageElement;
|
|
203
219
|
private handleLinearElementOnPointerDown;
|
|
220
|
+
private getCurrentItemRoundness;
|
|
204
221
|
private createGenericElementOnPointerDown;
|
|
205
222
|
private createFrameElementOnPointerDown;
|
|
206
223
|
private onKeyDownFromPointerDownHandler;
|
|
@@ -231,7 +248,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
231
248
|
private maybeSuggestBindingsForLinearElementAtCoords;
|
|
232
249
|
private maybeSuggestBindingForAll;
|
|
233
250
|
private clearSelection;
|
|
234
|
-
private
|
|
251
|
+
private handleInteractiveCanvasRef;
|
|
235
252
|
private handleAppOnDrop;
|
|
236
253
|
loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
|
|
237
254
|
private handleCanvasContextMenu;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./ExcalidrawLogo.scss";
|
|
2
|
+
type LogoSize = "xs" | "small" | "normal" | "large" | "custom";
|
|
3
|
+
interface LogoProps {
|
|
4
|
+
size?: LogoSize;
|
|
5
|
+
withText?: boolean;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
/**
|
|
8
|
+
* If true, the logo will not be wrapped in a Link component.
|
|
9
|
+
* The link prop will be ignored as well.
|
|
10
|
+
* It will merely be a plain div.
|
|
11
|
+
*/
|
|
12
|
+
isNotLink?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const ExcalidrawLogo: ({ style, size, withText, }: LogoProps) => JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Device, UIAppState } from "../types";
|
|
1
|
+
import { AppClassProperties, Device, UIAppState } from "../types";
|
|
3
2
|
import "./HintViewer.scss";
|
|
4
3
|
interface HintViewerProps {
|
|
5
4
|
appState: UIAppState;
|
|
6
|
-
elements: readonly NonDeletedExcalidrawElement[];
|
|
7
5
|
isMobile: boolean;
|
|
8
6
|
device: Device;
|
|
7
|
+
app: AppClassProperties;
|
|
9
8
|
}
|
|
10
|
-
export declare const HintViewer: ({ appState,
|
|
9
|
+
export declare const HintViewer: ({ appState, isMobile, device, app, }: HintViewerProps) => JSX.Element | null;
|
|
11
10
|
export {};
|
|
@@ -10,6 +10,6 @@ export declare const JSONExportDialog: ({ elements, appState, files, actionManag
|
|
|
10
10
|
files: BinaryFiles;
|
|
11
11
|
actionManager: ActionManager;
|
|
12
12
|
exportOpts: ExportOpts;
|
|
13
|
-
canvas: HTMLCanvasElement
|
|
13
|
+
canvas: HTMLCanvasElement;
|
|
14
14
|
setAppState: React.Component<any, UIAppState>["setState"];
|
|
15
15
|
}) => JSX.Element;
|
|
@@ -9,7 +9,8 @@ interface LayerUIProps {
|
|
|
9
9
|
actionManager: ActionManager;
|
|
10
10
|
appState: UIAppState;
|
|
11
11
|
files: BinaryFiles;
|
|
12
|
-
canvas: HTMLCanvasElement
|
|
12
|
+
canvas: HTMLCanvasElement;
|
|
13
|
+
interactiveCanvas: HTMLCanvasElement | null;
|
|
13
14
|
setAppState: React.Component<any, AppState>["setState"];
|
|
14
15
|
elements: readonly NonDeletedExcalidrawElement[];
|
|
15
16
|
onLockToggle: () => void;
|
|
@@ -26,6 +27,7 @@ interface LayerUIProps {
|
|
|
26
27
|
onExportImage: AppClassProperties["onExportImage"];
|
|
27
28
|
renderWelcomeScreen: boolean;
|
|
28
29
|
children?: React.ReactNode;
|
|
30
|
+
app: AppClassProperties;
|
|
29
31
|
}
|
|
30
|
-
declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onImageAction, onExportImage, renderWelcomeScreen, children, }: LayerUIProps) => JSX.Element>;
|
|
32
|
+
declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, interactiveCanvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onImageAction, onExportImage, renderWelcomeScreen, children, app, }: LayerUIProps) => JSX.Element>;
|
|
31
33
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { AppState, Device, ExcalidrawProps, UIAppState } from "../types";
|
|
2
|
+
import { AppClassProperties, AppState, Device, ExcalidrawProps, UIAppState } from "../types";
|
|
3
3
|
import { ActionManager } from "../actions/manager";
|
|
4
4
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
5
5
|
type MobileMenuProps = {
|
|
@@ -12,7 +12,7 @@ type MobileMenuProps = {
|
|
|
12
12
|
onLockToggle: () => void;
|
|
13
13
|
onHandToolToggle: () => void;
|
|
14
14
|
onPenModeToggle: () => void;
|
|
15
|
-
|
|
15
|
+
interactiveCanvas: HTMLCanvasElement | null;
|
|
16
16
|
onImageAction: (data: {
|
|
17
17
|
insertOnCanvasDirectly: boolean;
|
|
18
18
|
}) => void;
|
|
@@ -21,6 +21,7 @@ type MobileMenuProps = {
|
|
|
21
21
|
renderSidebars: () => JSX.Element | null;
|
|
22
22
|
device: Device;
|
|
23
23
|
renderWelcomeScreen: boolean;
|
|
24
|
+
app: AppClassProperties;
|
|
24
25
|
};
|
|
25
|
-
export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle,
|
|
26
|
+
export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, interactiveCanvas, onImageAction, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, app, }: MobileMenuProps) => JSX.Element;
|
|
26
27
|
export {};
|
|
@@ -10,7 +10,7 @@ type StackProps = {
|
|
|
10
10
|
ref: React.RefObject<HTMLDivElement>;
|
|
11
11
|
};
|
|
12
12
|
declare const _default: {
|
|
13
|
-
Row: React.ForwardRefExoticComponent<Pick<StackProps, "style" | "className" | "children" | "
|
|
14
|
-
Col: React.ForwardRefExoticComponent<Pick<StackProps, "style" | "className" | "children" | "
|
|
13
|
+
Row: React.ForwardRefExoticComponent<Pick<StackProps, "style" | "className" | "children" | "align" | "gap" | "justifyContent"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
Col: React.ForwardRefExoticComponent<Pick<StackProps, "style" | "className" | "children" | "align" | "gap" | "justifyContent"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
15
|
};
|
|
16
16
|
export default _default;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { TranslationKeys } from "../i18n";
|
|
2
3
|
declare const Trans: ({ i18nKey, children, ...props }: {
|
|
3
4
|
[key: string]: React.ReactNode | ((el: React.ReactNode) => React.ReactNode);
|
|
4
|
-
i18nKey:
|
|
5
|
+
i18nKey: TranslationKeys;
|
|
5
6
|
}) => React.FunctionComponentElement<{
|
|
6
7
|
children?: React.ReactNode;
|
|
7
8
|
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { DOMAttributes } from "react";
|
|
3
|
+
import type { InteractiveCanvasAppState } from "../../types";
|
|
4
|
+
import type { RenderInteractiveSceneCallback } from "../../scene/types";
|
|
5
|
+
import type { NonDeletedExcalidrawElement } from "../../element/types";
|
|
6
|
+
type InteractiveCanvasProps = {
|
|
7
|
+
containerRef: React.RefObject<HTMLDivElement>;
|
|
8
|
+
canvas: HTMLCanvasElement | null;
|
|
9
|
+
elements: readonly NonDeletedExcalidrawElement[];
|
|
10
|
+
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
11
|
+
selectedElements: readonly NonDeletedExcalidrawElement[];
|
|
12
|
+
versionNonce: number | undefined;
|
|
13
|
+
selectionNonce: number | undefined;
|
|
14
|
+
scale: number;
|
|
15
|
+
appState: InteractiveCanvasAppState;
|
|
16
|
+
renderInteractiveSceneCallback: (data: RenderInteractiveSceneCallback) => void;
|
|
17
|
+
handleCanvasRef: (canvas: HTMLCanvasElement | null) => void;
|
|
18
|
+
onContextMenu: Exclude<DOMAttributes<HTMLCanvasElement | HTMLDivElement>["onContextMenu"], undefined>;
|
|
19
|
+
onPointerMove: Exclude<DOMAttributes<HTMLCanvasElement>["onPointerMove"], undefined>;
|
|
20
|
+
onPointerUp: Exclude<DOMAttributes<HTMLCanvasElement>["onPointerUp"], undefined>;
|
|
21
|
+
onPointerCancel: Exclude<DOMAttributes<HTMLCanvasElement>["onPointerCancel"], undefined>;
|
|
22
|
+
onTouchMove: Exclude<DOMAttributes<HTMLCanvasElement>["onTouchMove"], undefined>;
|
|
23
|
+
onPointerDown: Exclude<DOMAttributes<HTMLCanvasElement>["onPointerDown"], undefined>;
|
|
24
|
+
onDoubleClick: Exclude<DOMAttributes<HTMLCanvasElement>["onDoubleClick"], undefined>;
|
|
25
|
+
};
|
|
26
|
+
declare const _default: React.MemoExoticComponent<(props: InteractiveCanvasProps) => JSX.Element>;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { RoughCanvas } from "roughjs/bin/canvas";
|
|
3
|
+
import type { StaticCanvasAppState } from "../../types";
|
|
4
|
+
import type { StaticCanvasRenderConfig } from "../../scene/types";
|
|
5
|
+
import type { NonDeletedExcalidrawElement } from "../../element/types";
|
|
6
|
+
type StaticCanvasProps = {
|
|
7
|
+
canvas: HTMLCanvasElement;
|
|
8
|
+
rc: RoughCanvas;
|
|
9
|
+
elements: readonly NonDeletedExcalidrawElement[];
|
|
10
|
+
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
11
|
+
versionNonce: number | undefined;
|
|
12
|
+
selectionNonce: number | undefined;
|
|
13
|
+
scale: number;
|
|
14
|
+
appState: StaticCanvasAppState;
|
|
15
|
+
renderConfig: StaticCanvasRenderConfig;
|
|
16
|
+
};
|
|
17
|
+
declare const _default: React.MemoExoticComponent<(props: StaticCanvasProps) => JSX.Element>;
|
|
18
|
+
export default _default;
|
|
@@ -31,6 +31,7 @@ export declare const EraserIcon: JSX.Element;
|
|
|
31
31
|
export declare const ZoomInIcon: JSX.Element;
|
|
32
32
|
export declare const ZoomOutIcon: JSX.Element;
|
|
33
33
|
export declare const TrashIcon: JSX.Element;
|
|
34
|
+
export declare const EmbedIcon: JSX.Element;
|
|
34
35
|
export declare const DuplicateIcon: JSX.Element;
|
|
35
36
|
export declare const MoonIcon: JSX.Element;
|
|
36
37
|
export declare const SunIcon: JSX.Element;
|
package/types/constants.d.ts
CHANGED
|
@@ -57,8 +57,17 @@ export declare enum EVENT {
|
|
|
57
57
|
VISIBILITY_CHANGE = "visibilitychange",
|
|
58
58
|
SCROLL = "scroll",
|
|
59
59
|
EXCALIDRAW_LINK = "excalidraw-link",
|
|
60
|
-
MENU_ITEM_SELECT = "menu.itemSelect"
|
|
60
|
+
MENU_ITEM_SELECT = "menu.itemSelect",
|
|
61
|
+
MESSAGE = "message"
|
|
61
62
|
}
|
|
63
|
+
export declare const YOUTUBE_STATES: {
|
|
64
|
+
readonly UNSTARTED: -1;
|
|
65
|
+
readonly ENDED: 0;
|
|
66
|
+
readonly PLAYING: 1;
|
|
67
|
+
readonly PAUSED: 2;
|
|
68
|
+
readonly BUFFERING: 3;
|
|
69
|
+
readonly CUED: 5;
|
|
70
|
+
};
|
|
62
71
|
export declare const ENV: {
|
|
63
72
|
TEST: string;
|
|
64
73
|
DEVELOPMENT: string;
|
|
@@ -72,8 +81,8 @@ export declare const FONT_FAMILY: {
|
|
|
72
81
|
Cascadia: number;
|
|
73
82
|
};
|
|
74
83
|
export declare const THEME: {
|
|
75
|
-
LIGHT:
|
|
76
|
-
DARK:
|
|
84
|
+
readonly LIGHT: "light";
|
|
85
|
+
readonly DARK: "dark";
|
|
77
86
|
};
|
|
78
87
|
export declare const FRAME_STYLE: {
|
|
79
88
|
strokeColor: string;
|
|
@@ -89,6 +98,7 @@ export declare const FRAME_STYLE: {
|
|
|
89
98
|
radius: number;
|
|
90
99
|
};
|
|
91
100
|
export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
|
|
101
|
+
export declare const MIN_FONT_SIZE = 1;
|
|
92
102
|
export declare const DEFAULT_FONT_SIZE = 20;
|
|
93
103
|
export declare const DEFAULT_FONT_FAMILY: FontFamilyValues;
|
|
94
104
|
export declare const DEFAULT_TEXT_ALIGN = "left";
|
|
@@ -133,6 +143,7 @@ export declare const EXPORT_DATA_TYPES: {
|
|
|
133
143
|
readonly excalidraw: "excalidraw";
|
|
134
144
|
readonly excalidrawClipboard: "excalidraw/clipboard";
|
|
135
145
|
readonly excalidrawLibrary: "excalidrawlib";
|
|
146
|
+
readonly excalidrawClipboardWithAPI: "excalidraw-api/clipboard";
|
|
136
147
|
};
|
|
137
148
|
export declare const EXPORT_SOURCE: string;
|
|
138
149
|
export declare const IMAGE_RENDER_TIMEOUT = 500;
|
|
@@ -172,6 +183,8 @@ export declare const VERSIONS: {
|
|
|
172
183
|
readonly excalidrawLibrary: 2;
|
|
173
184
|
};
|
|
174
185
|
export declare const BOUND_TEXT_PADDING = 5;
|
|
186
|
+
export declare const ARROW_LABEL_WIDTH_FRACTION = 0.7;
|
|
187
|
+
export declare const ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO = 11;
|
|
175
188
|
export declare const VERTICAL_ALIGN: {
|
|
176
189
|
TOP: string;
|
|
177
190
|
MIDDLE: string;
|
|
@@ -208,3 +221,4 @@ export declare const DEFAULT_SIDEBAR: {
|
|
|
208
221
|
readonly name: "default";
|
|
209
222
|
readonly defaultTab: "library";
|
|
210
223
|
};
|
|
224
|
+
export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "image">;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ElementConstructorOpts } from "../element/newElement";
|
|
2
|
+
import { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawEmbeddableElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, TextAlign, VerticalAlign } from "../element/types";
|
|
3
|
+
import { MarkOptional } from "../utility-types";
|
|
4
|
+
export type ValidLinearElement = {
|
|
5
|
+
type: "arrow" | "line";
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
label?: {
|
|
9
|
+
text: string;
|
|
10
|
+
fontSize?: number;
|
|
11
|
+
fontFamily?: FontFamilyValues;
|
|
12
|
+
textAlign?: TextAlign;
|
|
13
|
+
verticalAlign?: VerticalAlign;
|
|
14
|
+
} & MarkOptional<ElementConstructorOpts, "x" | "y">;
|
|
15
|
+
end?: (({
|
|
16
|
+
type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
|
|
17
|
+
id?: ExcalidrawGenericElement["id"];
|
|
18
|
+
} | {
|
|
19
|
+
id: ExcalidrawGenericElement["id"];
|
|
20
|
+
type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
|
|
21
|
+
}) | (({
|
|
22
|
+
type: "text";
|
|
23
|
+
text: string;
|
|
24
|
+
} | {
|
|
25
|
+
type?: "text";
|
|
26
|
+
id: ExcalidrawTextElement["id"];
|
|
27
|
+
text: string;
|
|
28
|
+
}) & Partial<ExcalidrawTextElement>)) & MarkOptional<ElementConstructorOpts, "x" | "y">;
|
|
29
|
+
start?: (({
|
|
30
|
+
type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
|
|
31
|
+
id?: ExcalidrawGenericElement["id"];
|
|
32
|
+
} | {
|
|
33
|
+
id: ExcalidrawGenericElement["id"];
|
|
34
|
+
type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
|
|
35
|
+
}) | (({
|
|
36
|
+
type: "text";
|
|
37
|
+
text: string;
|
|
38
|
+
} | {
|
|
39
|
+
type?: "text";
|
|
40
|
+
id: ExcalidrawTextElement["id"];
|
|
41
|
+
text: string;
|
|
42
|
+
}) & Partial<ExcalidrawTextElement>)) & MarkOptional<ElementConstructorOpts, "x" | "y">;
|
|
43
|
+
} & Partial<ExcalidrawLinearElement>;
|
|
44
|
+
export type ValidContainer = {
|
|
45
|
+
type: Exclude<ExcalidrawGenericElement["type"], "selection">;
|
|
46
|
+
id?: ExcalidrawGenericElement["id"];
|
|
47
|
+
label?: {
|
|
48
|
+
text: string;
|
|
49
|
+
fontSize?: number;
|
|
50
|
+
fontFamily?: FontFamilyValues;
|
|
51
|
+
textAlign?: TextAlign;
|
|
52
|
+
verticalAlign?: VerticalAlign;
|
|
53
|
+
} & MarkOptional<ElementConstructorOpts, "x" | "y">;
|
|
54
|
+
} & ElementConstructorOpts;
|
|
55
|
+
export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, ExcalidrawEmbeddableElement | ExcalidrawFreeDrawElement | ExcalidrawFrameElement> | ({
|
|
56
|
+
type: Extract<ExcalidrawLinearElement["type"], "line">;
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
} & Partial<ExcalidrawLinearElement>) | ValidContainer | ValidLinearElement | ({
|
|
60
|
+
type: "text";
|
|
61
|
+
text: string;
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
id?: ExcalidrawTextElement["id"];
|
|
65
|
+
} & Partial<ExcalidrawTextElement>) | ({
|
|
66
|
+
type: Extract<ExcalidrawImageElement["type"], "image">;
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
fileId: FileId;
|
|
70
|
+
} & Partial<ExcalidrawImageElement>);
|
|
71
|
+
export declare const convertToExcalidrawElements: (elements: ExcalidrawElementSkeleton[] | null) => ExcalidrawElement[];
|
package/types/data/url.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export declare const normalizeLink: (link: string) => string;
|
|
2
2
|
export declare const isLocalLink: (link: string | null) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Returns URL sanitized and safe for usage in places such as
|
|
5
|
+
* iframe's src attribute or <a> href attributes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const toValidURL: (link: string) => string;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { AppState, ExcalidrawProps, UIAppState } from "../types";
|
|
3
2
|
import { NonDeletedExcalidrawElement } from "./types";
|
|
4
3
|
import { Bounds } from "./bounds";
|
|
5
4
|
import "./Hyperlink.scss";
|
|
6
5
|
export declare const EXTERNAL_LINK_IMG: HTMLImageElement;
|
|
7
|
-
export declare const Hyperlink: ({ element, setAppState, onLinkOpen, }: {
|
|
6
|
+
export declare const Hyperlink: ({ element, setAppState, onLinkOpen, setToast, }: {
|
|
8
7
|
element: NonDeletedExcalidrawElement;
|
|
9
8
|
setAppState: React.Component<any, AppState>["setState"];
|
|
10
9
|
onLinkOpen: ExcalidrawProps["onLinkOpen"];
|
|
10
|
+
setToast: (toast: {
|
|
11
|
+
message: string;
|
|
12
|
+
closable?: boolean;
|
|
13
|
+
duration?: number;
|
|
14
|
+
} | null) => void;
|
|
11
15
|
}) => JSX.Element | null;
|
|
12
16
|
export declare const actionLink: {
|
|
13
17
|
name: "hyperlink";
|
|
@@ -24,6 +28,10 @@ export declare const actionLink: {
|
|
|
24
28
|
showWelcomeScreen: boolean;
|
|
25
29
|
isLoading: boolean;
|
|
26
30
|
errorMessage: import("react").ReactNode;
|
|
31
|
+
activeEmbeddable: {
|
|
32
|
+
element: NonDeletedExcalidrawElement;
|
|
33
|
+
state: "active" | "hover";
|
|
34
|
+
} | null;
|
|
27
35
|
draggingElement: NonDeletedExcalidrawElement | null;
|
|
28
36
|
resizingElement: NonDeletedExcalidrawElement | null;
|
|
29
37
|
multiElement: import("./types").NonDeleted<import("./types").ExcalidrawLinearElement> | null;
|
|
@@ -32,7 +40,12 @@ export declare const actionLink: {
|
|
|
32
40
|
startBoundElement: import("./types").NonDeleted<import("./types").ExcalidrawBindableElement> | null;
|
|
33
41
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
34
42
|
frameToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawFrameElement> | null;
|
|
35
|
-
|
|
43
|
+
frameRendering: {
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
name: boolean;
|
|
46
|
+
outline: boolean;
|
|
47
|
+
clip: boolean;
|
|
48
|
+
};
|
|
36
49
|
editingFrame: string | null;
|
|
37
50
|
elementsToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawElement>[] | null;
|
|
38
51
|
editingElement: NonDeletedExcalidrawElement | null;
|
|
@@ -41,7 +54,7 @@ export declare const actionLink: {
|
|
|
41
54
|
lastActiveTool: import("../types").LastActiveTool;
|
|
42
55
|
locked: boolean;
|
|
43
56
|
} & ({
|
|
44
|
-
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
57
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
45
58
|
customType: null;
|
|
46
59
|
} | {
|
|
47
60
|
type: "custom";
|
|
@@ -85,11 +98,11 @@ export declare const actionLink: {
|
|
|
85
98
|
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
86
99
|
defaultSidebarDockedPreference: boolean;
|
|
87
100
|
lastPointerDownWith: import("./types").PointerType;
|
|
88
|
-
selectedElementIds: {
|
|
89
|
-
[id: string]:
|
|
90
|
-
}
|
|
101
|
+
selectedElementIds: Readonly<{
|
|
102
|
+
[id: string]: true;
|
|
103
|
+
}>;
|
|
91
104
|
previousSelectedElementIds: {
|
|
92
|
-
[id: string]:
|
|
105
|
+
[id: string]: true;
|
|
93
106
|
};
|
|
94
107
|
selectedElementsAreBeingDragged: boolean;
|
|
95
108
|
shouldCacheIgnoreZoom: boolean;
|
|
@@ -99,7 +112,7 @@ export declare const actionLink: {
|
|
|
99
112
|
duration?: number | undefined;
|
|
100
113
|
} | null;
|
|
101
114
|
zenModeEnabled: boolean;
|
|
102
|
-
theme:
|
|
115
|
+
theme: import("./types").Theme;
|
|
103
116
|
gridSize: number | null;
|
|
104
117
|
viewModeEnabled: boolean;
|
|
105
118
|
selectedGroupIds: {
|
|
@@ -131,15 +144,16 @@ export declare const actionLink: {
|
|
|
131
144
|
action: string;
|
|
132
145
|
};
|
|
133
146
|
keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
|
|
134
|
-
contextItemLabel: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => "labels.link.edit" | "labels.link.create";
|
|
147
|
+
contextItemLabel: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => "labels.link.editEmbed" | "labels.link.edit" | "labels.link.createEmbed" | "labels.link.create";
|
|
135
148
|
predicate: (elements: readonly import("./types").ExcalidrawElement[], appState: AppState) => boolean;
|
|
136
149
|
PanelComponent: ({ elements, appState, updateData }: import("../actions/types").PanelComponentProps) => JSX.Element;
|
|
137
150
|
} & {
|
|
138
151
|
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
139
152
|
};
|
|
140
|
-
export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => "labels.link.edit" | "labels.link.create";
|
|
141
|
-
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: UIAppState) => [x: number, y: number, width: number, height: number];
|
|
142
|
-
export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number]
|
|
153
|
+
export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => "labels.link.editEmbed" | "labels.link.edit" | "labels.link.createEmbed" | "labels.link.create";
|
|
154
|
+
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: Pick<UIAppState, "zoom">) => [x: number, y: number, width: number, height: number];
|
|
155
|
+
export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number]) => boolean;
|
|
156
|
+
export declare const isPointHittingLink: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number], isMobile: boolean) => boolean;
|
|
143
157
|
export declare const showHyperlinkTooltip: (element: NonDeletedExcalidrawElement, appState: AppState) => void;
|
|
144
158
|
export declare const hideHyperlinkToolip: () => void;
|
|
145
159
|
export declare const shouldHideLinkPopup: (element: NonDeletedExcalidrawElement, appState: AppState, [clientX, clientY]: readonly [number, number]) => Boolean;
|
|
@@ -15,6 +15,7 @@ export declare const maybeBindLinearElement: (linearElement: NonDeleted<Excalidr
|
|
|
15
15
|
x: number;
|
|
16
16
|
y: number;
|
|
17
17
|
}) => void;
|
|
18
|
+
export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end") => void;
|
|
18
19
|
export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
|
|
19
20
|
export declare const unbindLinearElements: (elements: NonDeleted<ExcalidrawElement>[]) => void;
|
|
20
21
|
export declare const getHoveredElementForBinding: (pointerCoords: {
|