@zsviczian/excalidraw 0.15.2-obsidian-12 → 0.15.3-obsidian
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 +119 -42
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +12 -3
- package/types/actions/actionBoundText.d.ts +8 -2
- package/types/actions/actionCanvas.d.ts +48 -12
- package/types/actions/actionClipboard.d.ts +20 -5
- package/types/actions/actionDeleteSelected.d.ts +12 -3
- package/types/actions/actionElementLock.d.ts +8 -2
- package/types/actions/actionExport.d.ts +36 -9
- package/types/actions/actionFinalize.d.ts +9 -3
- package/types/actions/actionFrame.d.ts +12 -3
- package/types/actions/actionGroup.d.ts +291 -3
- package/types/actions/actionLinearEditor.d.ts +4 -1
- package/types/actions/actionMenu.d.ts +12 -3
- package/types/actions/actionProperties.d.ts +52 -13
- package/types/actions/actionSelectAll.d.ts +146 -1
- package/types/actions/actionStyles.d.ts +4 -1
- package/types/actions/actionToggleGridMode.d.ts +4 -1
- package/types/actions/actionToggleStats.d.ts +4 -1
- package/types/actions/actionToggleViewMode.d.ts +4 -1
- package/types/actions/actionToggleZenMode.d.ts +4 -1
- package/types/clipboard.d.ts +1 -0
- package/types/components/Actions.d.ts +2 -2
- package/types/components/App.d.ts +8 -6
- package/types/components/JSONExportDialog.d.ts +1 -1
- package/types/components/LayerUI.d.ts +3 -2
- package/types/components/MobileMenu.d.ts +2 -2
- 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/constants.d.ts +1 -0
- package/types/data/transform.d.ts +71 -0
- package/types/element/Hyperlink.d.ts +5 -2
- package/types/element/binding.d.ts +1 -0
- package/types/element/embeddable.d.ts +4 -1
- package/types/element/linearElementEditor.d.ts +7 -4
- package/types/element/newElement.d.ts +9 -5
- package/types/element/sizeHelpers.d.ts +8 -1
- package/types/element/textElement.d.ts +3 -1
- package/types/element/textWysiwyg.d.ts +1 -1
- package/types/element/transformHandles.d.ts +2 -2
- package/types/frame.d.ts +3 -3
- package/types/groups.d.ts +11 -11
- package/types/packages/excalidraw/example/initialData.d.ts +182 -70
- package/types/packages/excalidraw/index.d.ts +1 -0
- package/types/renderer/renderElement.d.ts +9 -21
- package/types/renderer/renderScene.d.ts +16 -36
- package/types/scene/Renderer.d.ts +25 -0
- package/types/scene/Scene.d.ts +2 -0
- package/types/scene/Shape.d.ts +12 -0
- package/types/scene/ShapeCache.d.ts +20 -0
- package/types/scene/scroll.d.ts +1 -1
- package/types/scene/scrollbars.d.ts +2 -6
- package/types/scene/selection.d.ts +2 -2
- package/types/scene/types.d.ts +57 -24
- package/types/types.d.ts +49 -4
- package/types/utils.d.ts +12 -4
- package/types/actions/actionToggleLock.d.ts +0 -139
- package/types/bug-issue-template.d.ts +0 -2
- package/types/components/ActiveFile.d.ts +0 -7
- package/types/components/BackgroundPickerAndDarkModeToggle.d.ts +0 -4
- package/types/components/ClearCanvas.d.ts +0 -4
- package/types/components/CollabButton.d.ts +0 -7
- package/types/components/ColorPicker.d.ts +0 -19
- package/types/components/EncryptedIcon.d.ts +0 -2
- package/types/components/Footer.d.ts +0 -10
- package/types/components/HelpIcon.d.ts +0 -8
- package/types/components/LibraryButton.d.ts +0 -8
- package/types/components/MenuItem.d.ts +0 -11
- package/types/components/MenuUtils.d.ts +0 -2
- package/types/components/SidebarLockButton.d.ts +0 -8
- package/types/components/SingleLibraryItem.d.ts +0 -10
- package/types/components/TopErrorBoundary.d.ts +0 -15
- package/types/components/WelcomeScreen.d.ts +0 -8
- package/types/components/WelcomeScreenDecor.d.ts +0 -6
- package/types/components/context/tunnels.d.ts +0 -16
- package/types/components/hoc/withUpstreamOverride.d.ts +0 -10
- package/types/components/mainMenu/DefaultItems.d.ts +0 -44
- package/types/components/mainMenu/MainMenu.d.ts +0 -63
- package/types/element/iframe.d.ts +0 -167
- package/types/excalidraw-app/CustomStats.d.ts +0 -9
- package/types/excalidraw-app/app_constants.d.ts +0 -32
- package/types/excalidraw-app/collab/Collab.d.ts +0 -163
- package/types/excalidraw-app/collab/Portal.d.ts +0 -28
- package/types/excalidraw-app/collab/RoomDialog.d.ts +0 -13
- package/types/excalidraw-app/collab/reconciliation.d.ts +0 -10
- package/types/excalidraw-app/components/ExportToExcalidrawPlus.d.ts +0 -9
- package/types/excalidraw-app/components/LanguageList.d.ts +0 -4
- package/types/excalidraw-app/components/icons.d.ts +0 -1
- package/types/excalidraw-app/data/FileManager.d.ts +0 -66
- package/types/excalidraw-app/data/LocalData.d.ts +0 -32
- package/types/excalidraw-app/data/Locker.d.ts +0 -8
- package/types/excalidraw-app/data/firebase.d.ts +0 -25
- package/types/excalidraw-app/data/index.d.ts +0 -190
- package/types/excalidraw-app/data/localStorage.d.ts +0 -116
- package/types/excalidraw-app/data/tabSync.d.ts +0 -9
- package/types/excalidraw-app/index.d.ts +0 -26
- package/types/packages/common.webpack.dev.config.d.ts +0 -72
- package/types/packages/common.webpack.prod.config.d.ts +0 -84
- package/types/packages/excalidraw/example/sidebar/Sidebar.d.ts +0 -5
|
@@ -140,7 +140,10 @@ export declare const actionCopyStyles: {
|
|
|
140
140
|
customPens?: any[] | undefined;
|
|
141
141
|
currentStrokeOptions?: any;
|
|
142
142
|
resetCustomPen?: any;
|
|
143
|
-
gridColor:
|
|
143
|
+
gridColor: {
|
|
144
|
+
Bold: string;
|
|
145
|
+
Regular: string;
|
|
146
|
+
};
|
|
144
147
|
dynamicStyle: string;
|
|
145
148
|
invertBindingBehaviour: boolean;
|
|
146
149
|
selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
@@ -144,7 +144,10 @@ export declare const actionToggleGridMode: {
|
|
|
144
144
|
customPens?: any[] | undefined;
|
|
145
145
|
currentStrokeOptions?: any;
|
|
146
146
|
resetCustomPen?: any;
|
|
147
|
-
gridColor:
|
|
147
|
+
gridColor: {
|
|
148
|
+
Bold: string;
|
|
149
|
+
Regular: string;
|
|
150
|
+
};
|
|
148
151
|
dynamicStyle: string;
|
|
149
152
|
invertBindingBehaviour: boolean;
|
|
150
153
|
selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
@@ -142,7 +142,10 @@ export declare const actionToggleStats: {
|
|
|
142
142
|
customPens?: any[] | undefined;
|
|
143
143
|
currentStrokeOptions?: any;
|
|
144
144
|
resetCustomPen?: any;
|
|
145
|
-
gridColor:
|
|
145
|
+
gridColor: {
|
|
146
|
+
Bold: string;
|
|
147
|
+
Regular: string;
|
|
148
|
+
};
|
|
146
149
|
dynamicStyle: string;
|
|
147
150
|
invertBindingBehaviour: boolean;
|
|
148
151
|
selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
@@ -143,7 +143,10 @@ export declare const actionToggleViewMode: {
|
|
|
143
143
|
customPens?: any[] | undefined;
|
|
144
144
|
currentStrokeOptions?: any;
|
|
145
145
|
resetCustomPen?: any;
|
|
146
|
-
gridColor:
|
|
146
|
+
gridColor: {
|
|
147
|
+
Bold: string;
|
|
148
|
+
Regular: string;
|
|
149
|
+
};
|
|
147
150
|
dynamicStyle: string;
|
|
148
151
|
invertBindingBehaviour: boolean;
|
|
149
152
|
selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
@@ -143,7 +143,10 @@ export declare const actionToggleZenMode: {
|
|
|
143
143
|
customPens?: any[] | undefined;
|
|
144
144
|
currentStrokeOptions?: any;
|
|
145
145
|
resetCustomPen?: any;
|
|
146
|
-
gridColor:
|
|
146
|
+
gridColor: {
|
|
147
|
+
Bold: string;
|
|
148
|
+
Regular: string;
|
|
149
|
+
};
|
|
147
150
|
dynamicStyle: string;
|
|
148
151
|
invertBindingBehaviour: boolean;
|
|
149
152
|
selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
package/types/clipboard.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface ClipboardData {
|
|
|
7
7
|
files?: BinaryFiles;
|
|
8
8
|
text?: string;
|
|
9
9
|
errorMessage?: string;
|
|
10
|
+
programmaticAPI?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare const probablySupportsClipboardReadText: boolean;
|
|
12
13
|
export declare const probablySupportsClipboardWriteText: boolean;
|
|
@@ -8,8 +8,8 @@ export declare const SelectedShapeActions: ({ appState, elements, renderAction,
|
|
|
8
8
|
elements: readonly ExcalidrawElement[];
|
|
9
9
|
renderAction: ActionManager["renderAction"];
|
|
10
10
|
}) => JSX.Element;
|
|
11
|
-
export declare const ShapesSwitcher: ({
|
|
12
|
-
|
|
11
|
+
export declare const ShapesSwitcher: ({ interactiveCanvas, activeTool, setAppState, onImageAction, appState, }: {
|
|
12
|
+
interactiveCanvas: HTMLCanvasElement | null;
|
|
13
13
|
activeTool: UIAppState["activeTool"];
|
|
14
14
|
setAppState: React.Component<any, UIAppState>["setState"];
|
|
15
15
|
onImageAction: (data: {
|
|
@@ -9,6 +9,7 @@ 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
11
|
export declare let showFourthFont: boolean;
|
|
12
|
+
import { Renderer } from "../scene/Renderer";
|
|
12
13
|
export declare const ExcalidrawContainerContext: React.Context<{
|
|
13
14
|
container: HTMLDivElement | null;
|
|
14
15
|
id: string | null;
|
|
@@ -32,7 +33,8 @@ export declare const useExcalidrawSetAppState: () => <K extends keyof AppState>(
|
|
|
32
33
|
export declare const useExcalidrawActionManager: () => ActionManager;
|
|
33
34
|
declare class App extends React.Component<AppProps, AppState> {
|
|
34
35
|
canvas: AppClassProperties["canvas"];
|
|
35
|
-
|
|
36
|
+
interactiveCanvas: AppClassProperties["interactiveCanvas"];
|
|
37
|
+
rc: RoughCanvas;
|
|
36
38
|
unmounted: boolean;
|
|
37
39
|
actionManager: ActionManager;
|
|
38
40
|
device: Device;
|
|
@@ -40,6 +42,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
40
42
|
private excalidrawContainerRef;
|
|
41
43
|
static defaultProps: Partial<AppProps>;
|
|
42
44
|
scene: Scene;
|
|
45
|
+
renderer: Renderer;
|
|
43
46
|
private fonts;
|
|
44
47
|
private resizeObserver;
|
|
45
48
|
private nearestScrollableContainer;
|
|
@@ -60,7 +63,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
60
63
|
};
|
|
61
64
|
allowMobileMode: boolean;
|
|
62
65
|
constructor(props: AppProps);
|
|
63
|
-
private renderCanvas;
|
|
64
66
|
private onWindowMessage;
|
|
65
67
|
private updateEmbeddableRef;
|
|
66
68
|
private getHTMLIFrameElement;
|
|
@@ -96,15 +98,15 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
96
98
|
private removeEventListeners;
|
|
97
99
|
private addEventListeners;
|
|
98
100
|
componentDidUpdate(prevProps: AppProps, prevState: AppState): void;
|
|
99
|
-
private
|
|
101
|
+
private renderInteractiveSceneCallback;
|
|
100
102
|
private onScroll;
|
|
101
103
|
private onCut;
|
|
102
104
|
private onCopy;
|
|
103
105
|
private cutAll;
|
|
104
106
|
private copyAll;
|
|
105
107
|
private static resetTapTwice;
|
|
106
|
-
private
|
|
107
|
-
private
|
|
108
|
+
private onTouchStart;
|
|
109
|
+
private onTouchEnd;
|
|
108
110
|
pasteFromClipboard: (event: ClipboardEvent | null) => Promise<void>;
|
|
109
111
|
private addElementsFromPasteOrLibrary;
|
|
110
112
|
private addTextFromPaste;
|
|
@@ -258,7 +260,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
258
260
|
private maybeSuggestBindingsForLinearElementAtCoords;
|
|
259
261
|
private maybeSuggestBindingForAll;
|
|
260
262
|
private clearSelection;
|
|
261
|
-
private
|
|
263
|
+
private handleInteractiveCanvasRef;
|
|
262
264
|
private handleAppOnDrop;
|
|
263
265
|
loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
|
|
264
266
|
private handleCanvasContextMenu;
|
|
@@ -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;
|
|
@@ -28,5 +29,5 @@ interface LayerUIProps {
|
|
|
28
29
|
children?: React.ReactNode;
|
|
29
30
|
app: AppClassProperties;
|
|
30
31
|
}
|
|
31
|
-
declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onImageAction, onExportImage, renderWelcomeScreen, children, app, }: 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>;
|
|
32
33
|
export default _default;
|
|
@@ -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;
|
|
@@ -23,5 +23,5 @@ type MobileMenuProps = {
|
|
|
23
23
|
renderWelcomeScreen: boolean;
|
|
24
24
|
app: AppClassProperties;
|
|
25
25
|
};
|
|
26
|
-
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;
|
|
27
27
|
export {};
|
|
@@ -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;
|
package/types/constants.d.ts
CHANGED
|
@@ -146,6 +146,7 @@ export declare const EXPORT_DATA_TYPES: {
|
|
|
146
146
|
readonly excalidraw: "excalidraw";
|
|
147
147
|
readonly excalidrawClipboard: "excalidraw/clipboard";
|
|
148
148
|
readonly excalidrawLibrary: "excalidrawlib";
|
|
149
|
+
readonly excalidrawClipboardWithAPI: "excalidraw-api/clipboard";
|
|
149
150
|
};
|
|
150
151
|
export declare const EXPORT_SOURCE: string;
|
|
151
152
|
export declare const IMAGE_RENDER_TIMEOUT = 500;
|
|
@@ -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[];
|
|
@@ -154,7 +154,10 @@ export declare const actionLink: {
|
|
|
154
154
|
customPens?: any[] | undefined;
|
|
155
155
|
currentStrokeOptions?: any;
|
|
156
156
|
resetCustomPen?: any;
|
|
157
|
-
gridColor:
|
|
157
|
+
gridColor: {
|
|
158
|
+
Bold: string;
|
|
159
|
+
Regular: string;
|
|
160
|
+
};
|
|
158
161
|
dynamicStyle: string;
|
|
159
162
|
invertBindingBehaviour: boolean;
|
|
160
163
|
selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
@@ -173,7 +176,7 @@ export declare const actionLink: {
|
|
|
173
176
|
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
174
177
|
};
|
|
175
178
|
export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => "labels.link.editEmbed" | "labels.link.edit" | "labels.link.createEmbed" | "labels.link.create";
|
|
176
|
-
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: UIAppState) => [x: number, y: number, width: number, height: number];
|
|
179
|
+
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: Pick<UIAppState, "zoom">) => [x: number, y: number, width: number, height: number];
|
|
177
180
|
export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number]) => boolean;
|
|
178
181
|
export declare const isPointHittingLink: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number], isMobile: boolean) => boolean;
|
|
179
182
|
export declare const showHyperlinkTooltip: (element: NonDeletedExcalidrawElement, appState: AppState) => void;
|
|
@@ -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: {
|
|
@@ -160,7 +160,10 @@ export declare const actionSetEmbeddableAsActiveTool: {
|
|
|
160
160
|
customPens?: any[] | undefined;
|
|
161
161
|
currentStrokeOptions?: any;
|
|
162
162
|
resetCustomPen?: any;
|
|
163
|
-
gridColor:
|
|
163
|
+
gridColor: {
|
|
164
|
+
Bold: string;
|
|
165
|
+
Regular: string;
|
|
166
|
+
};
|
|
164
167
|
dynamicStyle: string;
|
|
165
168
|
invertBindingBehaviour: boolean;
|
|
166
169
|
selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer } from "./types";
|
|
2
|
-
import { Point, AppState, PointerCoords } from "../types";
|
|
2
|
+
import { Point, AppState, PointerCoords, InteractiveCanvasAppState } from "../types";
|
|
3
3
|
import History from "../history";
|
|
4
4
|
import Scene from "../scene/Scene";
|
|
5
5
|
declare const editorMidPointsCache: {
|
|
@@ -52,8 +52,8 @@ export declare class LinearElementEditor {
|
|
|
52
52
|
y: number;
|
|
53
53
|
}[]) => void, linearElementEditor: LinearElementEditor): boolean;
|
|
54
54
|
static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState): LinearElementEditor;
|
|
55
|
-
static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, appState:
|
|
56
|
-
static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, appState:
|
|
55
|
+
static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, appState: InteractiveCanvasAppState) => (typeof editorMidPointsCache)["points"];
|
|
56
|
+
static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, appState: InteractiveCanvasAppState) => void;
|
|
57
57
|
static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
|
|
58
58
|
x: number;
|
|
59
59
|
y: number;
|
|
@@ -257,7 +257,10 @@ export declare class LinearElementEditor {
|
|
|
257
257
|
customPens?: any[] | undefined;
|
|
258
258
|
currentStrokeOptions?: any;
|
|
259
259
|
resetCustomPen?: any;
|
|
260
|
-
gridColor:
|
|
260
|
+
gridColor: {
|
|
261
|
+
Bold: string;
|
|
262
|
+
Regular: string;
|
|
263
|
+
};
|
|
261
264
|
dynamicStyle: string;
|
|
262
265
|
invertBindingBehaviour: boolean;
|
|
263
266
|
selectedLinearElement: LinearElementEditor | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement } from "../element/types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
3
|
import { MarkOptional, Mutable } from "../utility-types";
|
|
4
|
-
type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity">;
|
|
4
|
+
export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity">;
|
|
5
5
|
export declare const newElement: (opts: {
|
|
6
6
|
type: ExcalidrawGenericElement["type"];
|
|
7
7
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
|
|
@@ -17,7 +17,7 @@ export declare const newTextElement: (opts: {
|
|
|
17
17
|
fontFamily?: FontFamilyValues;
|
|
18
18
|
textAlign?: TextAlign;
|
|
19
19
|
verticalAlign?: VerticalAlign;
|
|
20
|
-
containerId?: ExcalidrawTextContainer["id"];
|
|
20
|
+
containerId?: ExcalidrawTextContainer["id"] | null;
|
|
21
21
|
lineHeight?: ExcalidrawTextElement["lineHeight"];
|
|
22
22
|
strokeWidth?: ExcalidrawTextElement["strokeWidth"];
|
|
23
23
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
|
|
@@ -43,8 +43,8 @@ export declare const newFreeDrawElement: (opts: {
|
|
|
43
43
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawFreeDrawElement>;
|
|
44
44
|
export declare const newLinearElement: (opts: {
|
|
45
45
|
type: ExcalidrawLinearElement["type"];
|
|
46
|
-
startArrowhead
|
|
47
|
-
endArrowhead
|
|
46
|
+
startArrowhead?: Arrowhead | null;
|
|
47
|
+
endArrowhead?: Arrowhead | null;
|
|
48
48
|
points?: ExcalidrawLinearElement["points"];
|
|
49
49
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawLinearElement>;
|
|
50
50
|
export declare const newImageElement: (opts: {
|
|
@@ -63,6 +63,11 @@ export declare const newImageElement: (opts: {
|
|
|
63
63
|
* Typed arrays and other non-null objects.
|
|
64
64
|
*/
|
|
65
65
|
export declare const deepCopyElement: <T extends ExcalidrawElement>(val: T) => Mutable<T>;
|
|
66
|
+
/**
|
|
67
|
+
* utility wrapper to generate new id. In test env it reuses the old + postfix
|
|
68
|
+
* for test assertions.
|
|
69
|
+
*/
|
|
70
|
+
export declare const regenerateId: (previousId: string | null) => string;
|
|
66
71
|
/**
|
|
67
72
|
* Duplicate an element, often used in the alt-drag operation.
|
|
68
73
|
* Note that this method has gotten a bit complicated since the
|
|
@@ -92,4 +97,3 @@ export declare const duplicateElements: (elements: readonly ExcalidrawElement[],
|
|
|
92
97
|
/** NOTE also updates version flags and `updated` */
|
|
93
98
|
randomizeSeed: boolean;
|
|
94
99
|
}) => ExcalidrawElement[];
|
|
95
|
-
export {};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "./types";
|
|
2
|
-
import { AppState } from "../types";
|
|
2
|
+
import { AppState, Zoom } from "../types";
|
|
3
3
|
export declare const isInvisiblySmallElement: (element: ExcalidrawElement) => boolean;
|
|
4
|
+
export declare const isElementInViewport: (element: ExcalidrawElement, width: number, height: number, viewTransformations: {
|
|
5
|
+
zoom: Zoom;
|
|
6
|
+
offsetLeft: number;
|
|
7
|
+
offsetTop: number;
|
|
8
|
+
scrollX: number;
|
|
9
|
+
scrollY: number;
|
|
10
|
+
}) => boolean;
|
|
4
11
|
/**
|
|
5
12
|
* Makes a perfect shape or diagonal/horizontal/vertical line
|
|
6
13
|
*/
|
|
@@ -65,7 +65,9 @@ export declare const shouldAllowVerticalAlign: (selectedElements: NonDeletedExca
|
|
|
65
65
|
export declare const suppportsHorizontalAlign: (selectedElements: NonDeletedExcalidrawElement[]) => boolean;
|
|
66
66
|
export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], appState: AppState, x: number, y: number) => ExcalidrawTextContainer | null;
|
|
67
67
|
declare const VALID_CONTAINER_TYPES: Set<string>;
|
|
68
|
-
export declare const isValidTextContainer: (element:
|
|
68
|
+
export declare const isValidTextContainer: (element: {
|
|
69
|
+
type: ExcalidrawElement["type"];
|
|
70
|
+
}) => boolean;
|
|
69
71
|
export declare const computeContainerDimensionForBoundText: (dimension: number, containerType: ExtractSetType<typeof VALID_CONTAINER_TYPES>, legacy?: boolean) => number;
|
|
70
72
|
export declare const getBoundTextMaxWidth: (container: ExcalidrawElement, boundTextElement?: ExcalidrawTextElement | null) => number;
|
|
71
73
|
export declare const getBoundTextMaxHeight: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => number;
|
|
@@ -15,7 +15,7 @@ export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords,
|
|
|
15
15
|
}) => void;
|
|
16
16
|
getViewportCoords: (x: number, y: number) => [number, number];
|
|
17
17
|
element: ExcalidrawTextElement;
|
|
18
|
-
canvas: HTMLCanvasElement
|
|
18
|
+
canvas: HTMLCanvasElement;
|
|
19
19
|
excalidrawContainer: HTMLDivElement | null;
|
|
20
20
|
app: App;
|
|
21
21
|
}) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExcalidrawElement, NonDeletedExcalidrawElement, PointerType } from "./types";
|
|
2
|
-
import {
|
|
2
|
+
import { InteractiveCanvasAppState, Zoom } from "../types";
|
|
3
3
|
export type TransformHandleDirection = "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se";
|
|
4
4
|
export type TransformHandleType = TransformHandleDirection | "rotation";
|
|
5
5
|
export type TransformHandle = [number, number, number, number];
|
|
@@ -32,4 +32,4 @@ export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2, cx, cy]: [
|
|
|
32
32
|
rotation?: boolean | undefined;
|
|
33
33
|
}, margin?: number) => TransformHandles;
|
|
34
34
|
export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, pointerType?: PointerType) => TransformHandles;
|
|
35
|
-
export declare const shouldShowBoundingBox: (elements: NonDeletedExcalidrawElement[], appState:
|
|
35
|
+
export declare const shouldShowBoundingBox: (elements: readonly NonDeletedExcalidrawElement[], appState: InteractiveCanvasAppState) => boolean;
|
package/types/frame.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExcalidrawElement, ExcalidrawFrameElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
|
|
2
|
-
import { AppClassProperties, AppState } from "./types";
|
|
2
|
+
import { AppClassProperties, AppState, StaticCanvasAppState } from "./types";
|
|
3
3
|
import { ExcalidrawElementsIncludingDeleted } from "./scene/Scene";
|
|
4
4
|
export declare const bindElementsToFramesAfterDuplication: (nextElements: ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
5
5
|
export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
@@ -36,5 +36,5 @@ export declare const omitGroupsContainingFrames: (allElements: ExcalidrawElement
|
|
|
36
36
|
* depending on the appState, return target frame, which is the frame the given element
|
|
37
37
|
* is going to be added to or remove from
|
|
38
38
|
*/
|
|
39
|
-
export declare const getTargetFrame: (element: ExcalidrawElement, appState:
|
|
40
|
-
export declare const isElementInFrame: (element: ExcalidrawElement, allElements: ExcalidrawElementsIncludingDeleted, appState:
|
|
39
|
+
export declare const getTargetFrame: (element: ExcalidrawElement, appState: StaticCanvasAppState) => ExcalidrawFrameElement | null;
|
|
40
|
+
export declare const isElementInFrame: (element: ExcalidrawElement, allElements: ExcalidrawElementsIncludingDeleted, appState: StaticCanvasAppState) => boolean;
|
package/types/groups.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { GroupId, ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
|
|
2
|
-
import { AppClassProperties, AppState } from "./types";
|
|
3
|
-
|
|
2
|
+
import { AppClassProperties, AppState, InteractiveCanvasAppState } from "./types";
|
|
3
|
+
import { Mutable } from "./utility-types";
|
|
4
|
+
export declare const selectGroup: (groupId: GroupId, appState: InteractiveCanvasAppState, elements: readonly NonDeleted<ExcalidrawElement>[]) => Pick<InteractiveCanvasAppState, "selectedGroupIds" | "selectedElementIds" | "editingGroupId">;
|
|
5
|
+
export declare const selectGroupsForSelectedElements: {
|
|
6
|
+
(appState: Pick<AppState, "selectedElementIds" | "editingGroupId">, elements: readonly NonDeletedExcalidrawElement[], prevAppState: InteractiveCanvasAppState, app: AppClassProperties | null): Mutable<Pick<InteractiveCanvasAppState, "selectedGroupIds" | "editingGroupId" | "selectedElementIds">>;
|
|
7
|
+
clearCache(): void;
|
|
8
|
+
};
|
|
4
9
|
/**
|
|
5
10
|
* If the element's group is selected, don't render an individual
|
|
6
11
|
* selection border around it.
|
|
7
12
|
*/
|
|
8
|
-
export declare const isSelectedViaGroup: (appState:
|
|
9
|
-
export declare const getSelectedGroupForElement: (appState:
|
|
10
|
-
export declare const getSelectedGroupIds: (appState:
|
|
11
|
-
|
|
12
|
-
* When you select an element, you often want to actually select the whole group it's in, unless
|
|
13
|
-
* you're currently editing that group.
|
|
14
|
-
*/
|
|
15
|
-
export declare const selectGroupsForSelectedElements: (appState: AppState, elements: readonly NonDeletedExcalidrawElement[], prevAppState: AppState, app: AppClassProperties | null) => AppState;
|
|
16
|
-
export declare const selectGroupsFromGivenElements: (elements: readonly NonDeleted<ExcalidrawElement>[], appState: AppState) => {
|
|
13
|
+
export declare const isSelectedViaGroup: (appState: InteractiveCanvasAppState, element: ExcalidrawElement) => boolean;
|
|
14
|
+
export declare const getSelectedGroupForElement: (appState: InteractiveCanvasAppState, element: ExcalidrawElement) => string | undefined;
|
|
15
|
+
export declare const getSelectedGroupIds: (appState: InteractiveCanvasAppState) => GroupId[];
|
|
16
|
+
export declare const selectGroupsFromGivenElements: (elements: readonly NonDeleted<ExcalidrawElement>[], appState: InteractiveCanvasAppState) => {
|
|
17
17
|
[groupId: string]: boolean;
|
|
18
18
|
};
|
|
19
19
|
export declare const editGroupForSelectedElement: (appState: AppState, element: NonDeleted<ExcalidrawElement>) => AppState;
|