@zsviczian/excalidraw 0.14.2-obsidian-5 → 0.15.2-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 +2 -2
- package/dist/excalidraw.development.js +469 -226
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +18 -6
- package/types/actions/actionBoundText.d.ts +14 -6
- package/types/actions/actionCanvas.d.ts +60 -20
- package/types/actions/actionClipboard.d.ts +30 -10
- package/types/actions/actionDeleteSelected.d.ts +18 -6
- package/types/actions/actionExport.d.ts +54 -18
- package/types/actions/actionFinalize.d.ts +12 -4
- package/types/actions/actionLinearEditor.d.ts +6 -2
- package/types/actions/actionMenu.d.ts +20 -8
- package/types/actions/actionProperties.d.ts +78 -26
- package/types/actions/actionStyles.d.ts +6 -2
- package/types/actions/actionToggleGridMode.d.ts +6 -2
- package/types/actions/actionToggleLock.d.ts +6 -2
- package/types/actions/actionToggleStats.d.ts +6 -2
- package/types/actions/actionToggleViewMode.d.ts +6 -2
- package/types/actions/actionToggleZenMode.d.ts +6 -2
- package/types/actions/types.d.ts +1 -1
- package/types/appState.d.ts +5 -2
- package/types/clipboard.d.ts +2 -2
- package/types/components/Actions.d.ts +5 -5
- package/types/components/App.d.ts +10 -3
- package/types/components/Button.d.ts +3 -1
- package/types/components/DefaultSidebar.d.ts +30 -0
- package/types/components/HintViewer.d.ts +2 -2
- package/types/components/ImageExportDialog.d.ts +4 -4
- package/types/components/JSONExportDialog.d.ts +3 -3
- package/types/components/LayerUI.d.ts +3 -10
- package/types/components/LibraryMenu.d.ts +32 -13
- package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
- package/types/components/LibraryMenuControlButtons.d.ts +9 -0
- package/types/components/LibraryMenuHeaderContent.d.ts +9 -28
- package/types/components/LibraryMenuItems.d.ts +2 -2
- package/types/components/MobileMenu.d.ts +3 -3
- package/types/components/PasteChartDialog.d.ts +4 -5
- package/types/components/PublishLibrary.d.ts +2 -2
- package/types/components/Sidebar/Sidebar.d.ts +68 -45
- package/types/components/Sidebar/SidebarHeader.d.ts +6 -19
- package/types/components/Sidebar/SidebarTab.d.ts +9 -0
- package/types/components/Sidebar/SidebarTabTrigger.d.ts +10 -0
- package/types/components/Sidebar/SidebarTabTriggers.d.ts +7 -0
- package/types/components/Sidebar/SidebarTabs.d.ts +7 -0
- package/types/components/Sidebar/SidebarTrigger.d.ts +6 -0
- package/types/components/Sidebar/common.d.ts +23 -6
- package/types/components/Stats.d.ts +3 -3
- package/types/components/Trans.d.ts +8 -0
- package/types/components/footer/Footer.d.ts +2 -2
- package/types/constants.d.ts +34 -7
- package/types/context/tunnels.d.ts +18 -0
- package/types/context/ui-appState.d.ts +4 -0
- package/types/data/blob.d.ts +2 -2
- package/types/data/filesystem.d.ts +2 -1
- package/types/data/types.d.ts +2 -4
- package/types/element/Hyperlink.d.ts +8 -4
- package/types/element/image.d.ts +11 -1
- package/types/element/linearElementEditor.d.ts +7 -6
- package/types/element/newElement.d.ts +31 -7
- package/types/element/showSelectedShapeActions.d.ts +2 -2
- package/types/element/textElement.d.ts +3 -2
- package/types/hooks/useOutsideClick.d.ts +1 -1
- package/types/packages/excalidraw/index.d.ts +2 -1
- package/types/packages/utils.d.ts +1 -1
- package/types/renderer/renderElement.d.ts +1 -0
- package/types/scene/export.d.ts +4 -1
- package/types/scene/selection.d.ts +4 -4
- package/types/types.d.ts +28 -16
- package/types/utils.d.ts +2 -2
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import "./Sidebar.scss";
|
|
3
|
-
/**
|
|
4
|
-
* the
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Flags whether the currently rendered Sidebar is docked or not, for use
|
|
5
|
+
* in upstream components that need to act on this (e.g. LayerUI to shift the
|
|
6
|
+
* UI). We use an atom because of potential host app sidebars (for the default
|
|
7
|
+
* sidebar we could just read from appState.defaultSidebarDockedPreference).
|
|
8
|
+
*
|
|
9
|
+
* Since we can only render one Sidebar at a time, we can use a simple flag.
|
|
10
|
+
*/
|
|
11
|
+
export declare const isSidebarDockedAtom: import("jotai").Atom<boolean> & {
|
|
9
12
|
write: (get: {
|
|
10
13
|
<Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
|
|
11
14
|
<Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
|
|
@@ -23,51 +26,71 @@ export declare const hostSidebarCountersAtom: import("jotai").Atom<{
|
|
|
23
26
|
}, set: {
|
|
24
27
|
<Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
|
|
25
28
|
<Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
|
|
26
|
-
}, update:
|
|
27
|
-
|
|
28
|
-
docked: number;
|
|
29
|
-
} | ((prev: {
|
|
30
|
-
rendered: number;
|
|
31
|
-
docked: number;
|
|
32
|
-
}) => {
|
|
33
|
-
rendered: number;
|
|
34
|
-
docked: number;
|
|
35
|
-
})) => void;
|
|
36
|
-
onMount?: (<S extends (update: {
|
|
37
|
-
rendered: number;
|
|
38
|
-
docked: number;
|
|
39
|
-
} | ((prev: {
|
|
40
|
-
rendered: number;
|
|
41
|
-
docked: number;
|
|
42
|
-
}) => {
|
|
43
|
-
rendered: number;
|
|
44
|
-
docked: number;
|
|
45
|
-
})) => void>(setAtom: S) => void | (() => void)) | undefined;
|
|
29
|
+
}, update: boolean | ((prev: boolean) => boolean)) => void;
|
|
30
|
+
onMount?: (<S extends (update: boolean | ((prev: boolean) => boolean)) => void>(setAtom: S) => void | (() => void)) | undefined;
|
|
46
31
|
} & {
|
|
47
|
-
init:
|
|
48
|
-
rendered: number;
|
|
49
|
-
docked: number;
|
|
50
|
-
};
|
|
32
|
+
init: boolean;
|
|
51
33
|
};
|
|
52
|
-
export declare const
|
|
53
|
-
|
|
54
|
-
|
|
34
|
+
export declare const SidebarInner: React.ForwardRefExoticComponent<Pick<{
|
|
35
|
+
name: string;
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
onStateChange?: ((state: {
|
|
38
|
+
name: string;
|
|
39
|
+
tab?: string | undefined;
|
|
40
|
+
} | null) => void) | undefined;
|
|
55
41
|
onDock?: ((docked: boolean) => void) | undefined;
|
|
56
42
|
docked?: boolean | undefined;
|
|
57
|
-
initialDockedState?: boolean | undefined;
|
|
58
|
-
dockable?: boolean | undefined;
|
|
59
43
|
className?: string | undefined;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
__fallback?: boolean | undefined;
|
|
45
|
+
} & Omit<React.RefAttributes<HTMLDivElement>, "onSelect">, "className" | "name" | "children" | "key" | "onDock" | "docked" | "onStateChange" | "__fallback"> & React.RefAttributes<HTMLDivElement>>;
|
|
46
|
+
export declare const Sidebar: React.ForwardRefExoticComponent<{
|
|
47
|
+
name: string;
|
|
48
|
+
children: React.ReactNode;
|
|
49
|
+
onStateChange?: ((state: {
|
|
50
|
+
name: string;
|
|
51
|
+
tab?: string | undefined;
|
|
52
|
+
} | null) => void) | undefined;
|
|
53
|
+
onDock?: ((docked: boolean) => void) | undefined;
|
|
54
|
+
docked?: boolean | undefined;
|
|
55
|
+
className?: string | undefined;
|
|
56
|
+
__fallback?: boolean | undefined;
|
|
57
|
+
} & React.RefAttributes<HTMLDivElement>> & {
|
|
64
58
|
Header: {
|
|
65
|
-
(
|
|
66
|
-
children?:
|
|
59
|
+
({ children, className, }: {
|
|
60
|
+
children?: React.ReactNode;
|
|
67
61
|
className?: string | undefined;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
}): JSX.Element;
|
|
63
|
+
displayName: string;
|
|
64
|
+
};
|
|
65
|
+
TabTriggers: {
|
|
66
|
+
({ children, ...rest }: {
|
|
67
|
+
children: React.ReactNode;
|
|
68
|
+
} & Omit<React.RefAttributes<HTMLDivElement>, "onSelect">): JSX.Element;
|
|
69
|
+
displayName: string;
|
|
70
|
+
};
|
|
71
|
+
TabTrigger: {
|
|
72
|
+
({ children, tab, onSelect, ...rest }: {
|
|
73
|
+
children: React.ReactNode;
|
|
74
|
+
tab: string;
|
|
75
|
+
onSelect?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
76
|
+
} & Omit<React.HTMLAttributes<HTMLButtonElement>, "onSelect">): JSX.Element;
|
|
77
|
+
displayName: string;
|
|
78
|
+
};
|
|
79
|
+
Tabs: {
|
|
80
|
+
({ children, ...rest }: {
|
|
81
|
+
children: React.ReactNode;
|
|
82
|
+
} & Omit<React.RefAttributes<HTMLDivElement>, "onSelect">): JSX.Element | null;
|
|
83
|
+
displayName: string;
|
|
84
|
+
};
|
|
85
|
+
Tab: {
|
|
86
|
+
({ tab, children, ...rest }: {
|
|
87
|
+
tab: string;
|
|
88
|
+
children: React.ReactNode;
|
|
89
|
+
} & React.HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
90
|
+
displayName: string;
|
|
91
|
+
};
|
|
92
|
+
Trigger: {
|
|
93
|
+
({ name, tab, icon, title, children, onToggle, className, style, }: import("./common").SidebarTriggerProps): JSX.Element;
|
|
71
94
|
displayName: string;
|
|
72
95
|
};
|
|
73
96
|
};
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
export declare const SidebarHeaderComponents: {
|
|
8
|
-
Context: import("react").FC<{
|
|
9
|
-
children: import("react").ReactNode;
|
|
10
|
-
}>;
|
|
11
|
-
Component: {
|
|
12
|
-
(props: {
|
|
13
|
-
children?: React.ReactNode;
|
|
14
|
-
className?: string | undefined;
|
|
15
|
-
} & {
|
|
16
|
-
__isFallback?: boolean | undefined;
|
|
17
|
-
}): JSX.Element | null;
|
|
18
|
-
displayName: string;
|
|
19
|
-
};
|
|
1
|
+
export declare const SidebarHeader: {
|
|
2
|
+
({ children, className, }: {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
className?: string | undefined;
|
|
5
|
+
}): JSX.Element;
|
|
6
|
+
displayName: string;
|
|
20
7
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SidebarTabName } from "../../types";
|
|
3
|
+
export declare const SidebarTab: {
|
|
4
|
+
({ tab, children, ...rest }: {
|
|
5
|
+
tab: SidebarTabName;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
} & import("react").HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SidebarTabName } from "../../types";
|
|
3
|
+
export declare const SidebarTabTrigger: {
|
|
4
|
+
({ children, tab, onSelect, ...rest }: {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
tab: SidebarTabName;
|
|
7
|
+
onSelect?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
8
|
+
} & Omit<import("react").HTMLAttributes<HTMLButtonElement>, "onSelect">): JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { AppState, SidebarName, SidebarTabName } from "../../types";
|
|
3
|
+
export declare type SidebarTriggerProps = {
|
|
4
|
+
name: SidebarName;
|
|
5
|
+
tab?: SidebarTabName;
|
|
6
|
+
icon?: JSX.Element;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
title?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
onToggle?: (open: boolean) => void;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
};
|
|
2
13
|
export declare type SidebarProps<P = {}> = {
|
|
14
|
+
name: SidebarName;
|
|
3
15
|
children: React.ReactNode;
|
|
4
16
|
/**
|
|
5
|
-
* Called on sidebar close
|
|
17
|
+
* Called on sidebar open/close or tab change.
|
|
18
|
+
*/
|
|
19
|
+
onStateChange?: (state: AppState["openSidebar"]) => void;
|
|
20
|
+
/**
|
|
21
|
+
* supply alongside `docked` prop in order to make the Sidebar user-dockable
|
|
6
22
|
*/
|
|
7
|
-
onClose?: () => void | boolean;
|
|
8
|
-
/** if not supplied, sidebar won't be dockable */
|
|
9
23
|
onDock?: (docked: boolean) => void;
|
|
10
24
|
docked?: boolean;
|
|
11
|
-
initialDockedState?: boolean;
|
|
12
|
-
dockable?: boolean;
|
|
13
25
|
className?: string;
|
|
26
|
+
/** @private internal */
|
|
27
|
+
__fallback?: boolean;
|
|
14
28
|
} & P;
|
|
15
|
-
export declare type SidebarPropsContextValue = Pick<SidebarProps, "
|
|
29
|
+
export declare type SidebarPropsContextValue = Pick<SidebarProps, "onDock" | "docked"> & {
|
|
30
|
+
onCloseRequest: () => void;
|
|
31
|
+
shouldRenderDockButton: boolean;
|
|
32
|
+
};
|
|
16
33
|
export declare const SidebarPropsContext: React.Context<SidebarPropsContextValue>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
3
|
-
import {
|
|
3
|
+
import { ExcalidrawProps, UIAppState } from "../types";
|
|
4
4
|
import "./Stats.scss";
|
|
5
5
|
export declare const Stats: (props: {
|
|
6
|
-
appState:
|
|
7
|
-
setAppState: React.Component<any,
|
|
6
|
+
appState: UIAppState;
|
|
7
|
+
setAppState: React.Component<any, UIAppState>["setState"];
|
|
8
8
|
elements: readonly NonDeletedExcalidrawElement[];
|
|
9
9
|
onClose: () => void;
|
|
10
10
|
renderCustomStats: ExcalidrawProps["renderCustomStats"];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const Trans: ({ i18nKey, children, ...props }: {
|
|
3
|
+
[key: string]: React.ReactNode | ((el: React.ReactNode) => React.ReactNode);
|
|
4
|
+
i18nKey: string;
|
|
5
|
+
}) => React.FunctionComponentElement<{
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}>;
|
|
8
|
+
export default Trans;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionManager } from "../../actions/manager";
|
|
2
|
-
import {
|
|
2
|
+
import { UIAppState } from "../../types";
|
|
3
3
|
declare const Footer: {
|
|
4
4
|
({ appState, actionManager, showExitZenModeBtn, renderWelcomeScreen, }: {
|
|
5
|
-
appState:
|
|
5
|
+
appState: UIAppState;
|
|
6
6
|
actionManager: ActionManager;
|
|
7
7
|
showExitZenModeBtn: boolean;
|
|
8
8
|
renderWelcomeScreen: boolean;
|
package/types/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppProps } from "./types";
|
|
2
|
-
import { FontFamilyValues } from "./element/types";
|
|
2
|
+
import { ExcalidrawElement, FontFamilyValues } from "./element/types";
|
|
3
3
|
export declare const isDarwin: boolean;
|
|
4
4
|
export declare const isWindows: boolean;
|
|
5
5
|
export declare const isAndroid: boolean;
|
|
@@ -85,19 +85,32 @@ export declare const DEFAULT_VERTICAL_ALIGN = "top";
|
|
|
85
85
|
export declare const DEFAULT_VERSION = "{version}";
|
|
86
86
|
export declare const CANVAS_ONLY_ACTIONS: string[];
|
|
87
87
|
export declare const GRID_SIZE = 20;
|
|
88
|
+
export declare const IMAGE_MIME_TYPES: {
|
|
89
|
+
readonly svg: "image/svg+xml";
|
|
90
|
+
readonly png: "image/png";
|
|
91
|
+
readonly jpg: "image/jpeg";
|
|
92
|
+
readonly gif: "image/gif";
|
|
93
|
+
readonly webp: "image/webp";
|
|
94
|
+
readonly bmp: "image/bmp";
|
|
95
|
+
readonly ico: "image/x-icon";
|
|
96
|
+
readonly avif: "image/avif";
|
|
97
|
+
readonly jfif: "image/jfif";
|
|
98
|
+
};
|
|
88
99
|
export declare const MIME_TYPES: {
|
|
89
|
-
readonly excalidraw: "application/vnd.excalidraw+json";
|
|
90
|
-
readonly excalidrawlib: "application/vnd.excalidrawlib+json";
|
|
91
|
-
readonly json: "application/json";
|
|
92
100
|
readonly svg: "image/svg+xml";
|
|
93
|
-
readonly "excalidraw.svg": "image/svg+xml";
|
|
94
101
|
readonly png: "image/png";
|
|
95
|
-
readonly "excalidraw.png": "image/png";
|
|
96
102
|
readonly jpg: "image/jpeg";
|
|
97
103
|
readonly gif: "image/gif";
|
|
98
104
|
readonly webp: "image/webp";
|
|
99
105
|
readonly bmp: "image/bmp";
|
|
100
106
|
readonly ico: "image/x-icon";
|
|
107
|
+
readonly avif: "image/avif";
|
|
108
|
+
readonly jfif: "image/jfif";
|
|
109
|
+
readonly json: "application/json";
|
|
110
|
+
readonly excalidraw: "application/vnd.excalidraw+json";
|
|
111
|
+
readonly excalidrawlib: "application/vnd.excalidrawlib+json";
|
|
112
|
+
readonly "excalidraw.svg": "image/svg+xml";
|
|
113
|
+
readonly "excalidraw.png": "image/png";
|
|
101
114
|
readonly binary: "application/octet-stream";
|
|
102
115
|
};
|
|
103
116
|
export declare const EXPORT_DATA_TYPES: {
|
|
@@ -135,7 +148,6 @@ export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
|
|
|
135
148
|
export declare const EXPORT_SCALES: number[];
|
|
136
149
|
export declare const DEFAULT_EXPORT_PADDING = 10;
|
|
137
150
|
export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
|
|
138
|
-
export declare const ALLOWED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml", "image/gif", "image/webp", "image/bmp", "image/x-icon"];
|
|
139
151
|
export declare const MAX_ALLOWED_FILE_BYTES: number;
|
|
140
152
|
export declare const SVG_NS = "http://www.w3.org/2000/svg";
|
|
141
153
|
export declare const ENCRYPTION_KEY_BITS = 128;
|
|
@@ -168,3 +180,18 @@ export declare const PRECEDING_ELEMENT_KEY = "__precedingElement__";
|
|
|
168
180
|
export declare const COLOR_NAMES: {
|
|
169
181
|
[key: string]: string;
|
|
170
182
|
};
|
|
183
|
+
export declare const DEFAULT_ELEMENT_PROPS: {
|
|
184
|
+
strokeColor: ExcalidrawElement["strokeColor"];
|
|
185
|
+
backgroundColor: ExcalidrawElement["backgroundColor"];
|
|
186
|
+
fillStyle: ExcalidrawElement["fillStyle"];
|
|
187
|
+
strokeWidth: ExcalidrawElement["strokeWidth"];
|
|
188
|
+
strokeStyle: ExcalidrawElement["strokeStyle"];
|
|
189
|
+
roughness: ExcalidrawElement["roughness"];
|
|
190
|
+
opacity: ExcalidrawElement["opacity"];
|
|
191
|
+
locked: ExcalidrawElement["locked"];
|
|
192
|
+
};
|
|
193
|
+
export declare const LIBRARY_SIDEBAR_TAB = "library";
|
|
194
|
+
export declare const DEFAULT_SIDEBAR: {
|
|
195
|
+
readonly name: "default";
|
|
196
|
+
readonly defaultTab: "library";
|
|
197
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import tunnel from "tunnel-rat";
|
|
3
|
+
export declare type Tunnel = ReturnType<typeof tunnel>;
|
|
4
|
+
declare type TunnelsContextValue = {
|
|
5
|
+
MainMenuTunnel: Tunnel;
|
|
6
|
+
WelcomeScreenMenuHintTunnel: Tunnel;
|
|
7
|
+
WelcomeScreenToolbarHintTunnel: Tunnel;
|
|
8
|
+
WelcomeScreenHelpHintTunnel: Tunnel;
|
|
9
|
+
WelcomeScreenCenterTunnel: Tunnel;
|
|
10
|
+
FooterCenterTunnel: Tunnel;
|
|
11
|
+
DefaultSidebarTriggerTunnel: Tunnel;
|
|
12
|
+
DefaultSidebarTabTriggersTunnel: Tunnel;
|
|
13
|
+
jotaiScope: symbol;
|
|
14
|
+
};
|
|
15
|
+
export declare const TunnelsContext: React.Context<TunnelsContextValue>;
|
|
16
|
+
export declare const useTunnels: () => TunnelsContextValue;
|
|
17
|
+
export declare const useInitializeTunnels: () => TunnelsContextValue;
|
|
18
|
+
export {};
|
package/types/data/blob.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IMAGE_MIME_TYPES, MIME_TYPES } from "../constants";
|
|
2
2
|
import { ExcalidrawElement, FileId } from "../element/types";
|
|
3
3
|
import { AppState, DataURL, LibraryItem } from "../types";
|
|
4
4
|
import { ValueOf } from "../utility-types";
|
|
@@ -9,7 +9,7 @@ export declare const getFileHandleType: (handle: FileSystemHandle | null) => str
|
|
|
9
9
|
export declare const isImageFileHandleType: (type: string | null) => type is "svg" | "png";
|
|
10
10
|
export declare const isImageFileHandle: (handle: FileSystemHandle | null) => boolean;
|
|
11
11
|
export declare const isSupportedImageFile: (blob: Blob | null | undefined) => blob is Blob & {
|
|
12
|
-
type:
|
|
12
|
+
type: ValueOf<typeof IMAGE_MIME_TYPES>;
|
|
13
13
|
};
|
|
14
14
|
export declare const loadSceneOrLibraryFromBlob: (blob: Blob | File, localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null, fileHandle?: FileSystemHandle | null) => Promise<{
|
|
15
15
|
type: "application/vnd.excalidraw+json";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FileSystemHandle, supported as nativeFileSystemSupported } from "browser-fs-access";
|
|
2
|
-
|
|
2
|
+
import { MIME_TYPES } from "../constants";
|
|
3
|
+
declare type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
|
|
3
4
|
export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
|
|
4
5
|
extensions?: FILE_EXTENSION[] | undefined;
|
|
5
6
|
description: string;
|
package/types/data/types.d.ts
CHANGED
|
@@ -18,10 +18,8 @@ export interface ExportedDataState {
|
|
|
18
18
|
* Don't consume on its own.
|
|
19
19
|
*/
|
|
20
20
|
export declare type LegacyAppState = {
|
|
21
|
-
/** @deprecated #
|
|
22
|
-
|
|
23
|
-
/** @deprecated #5663 TODO remove 22-12-15 */
|
|
24
|
-
isLibraryMenuDocked: [boolean, "isSidebarDocked"];
|
|
21
|
+
/** @deprecated #6213 TODO remove 23-06-01 */
|
|
22
|
+
isSidebarDocked: [boolean, "defaultSidebarDockedPreference"];
|
|
25
23
|
};
|
|
26
24
|
export interface ImportedDataState {
|
|
27
25
|
type?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AppState, ExcalidrawProps } from "../types";
|
|
2
|
+
import { AppState, ExcalidrawProps, UIAppState } from "../types";
|
|
3
3
|
import { NonDeletedExcalidrawElement } from "./types";
|
|
4
4
|
import { Bounds } from "./bounds";
|
|
5
5
|
import "./Hyperlink.scss";
|
|
@@ -76,9 +76,12 @@ export declare const actionLink: {
|
|
|
76
76
|
value: import("../types").NormalizedZoomValue;
|
|
77
77
|
}>;
|
|
78
78
|
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
79
|
-
openSidebar:
|
|
79
|
+
openSidebar: {
|
|
80
|
+
name: string;
|
|
81
|
+
tab?: string | undefined;
|
|
82
|
+
} | null;
|
|
80
83
|
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
81
|
-
|
|
84
|
+
defaultSidebarDockedPreference: boolean;
|
|
82
85
|
lastPointerDownWith: import("./types").PointerType;
|
|
83
86
|
selectedElementIds: {
|
|
84
87
|
[id: string]: boolean;
|
|
@@ -132,6 +135,7 @@ export declare const actionLink: {
|
|
|
132
135
|
resetCustomPen?: any;
|
|
133
136
|
gridColor: string;
|
|
134
137
|
dynamicStyle: string;
|
|
138
|
+
invertBindingBehaviour: boolean;
|
|
135
139
|
selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
136
140
|
};
|
|
137
141
|
commitToHistory: true;
|
|
@@ -148,7 +152,7 @@ export declare const actionLink: {
|
|
|
148
152
|
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
149
153
|
};
|
|
150
154
|
export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => "labels.link.edit" | "labels.link.create";
|
|
151
|
-
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState:
|
|
155
|
+
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: UIAppState) => [x: number, y: number, width: number, height: number];
|
|
152
156
|
export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number], isMobile: boolean) => boolean;
|
|
153
157
|
export declare const showHyperlinkTooltip: (element: NonDeletedExcalidrawElement, appState: AppState) => void;
|
|
154
158
|
export declare const hideHyperlinkToolip: () => void;
|
package/types/element/image.d.ts
CHANGED
|
@@ -10,7 +10,17 @@ export declare const updateImageCache: ({ fileIds, files, imageCache, }: {
|
|
|
10
10
|
}) => Promise<{
|
|
11
11
|
imageCache: Map<FileId, {
|
|
12
12
|
image: HTMLImageElement | Promise<HTMLImageElement>;
|
|
13
|
-
mimeType: "
|
|
13
|
+
mimeType: import("../utility-types").ValueOf<{
|
|
14
|
+
readonly svg: "image/svg+xml";
|
|
15
|
+
readonly png: "image/png";
|
|
16
|
+
readonly jpg: "image/jpeg";
|
|
17
|
+
readonly gif: "image/gif";
|
|
18
|
+
readonly webp: "image/webp";
|
|
19
|
+
readonly bmp: "image/bmp";
|
|
20
|
+
readonly ico: "image/x-icon";
|
|
21
|
+
readonly avif: "image/avif";
|
|
22
|
+
readonly jfif: "image/jfif";
|
|
23
|
+
}>;
|
|
14
24
|
}>;
|
|
15
25
|
/** includes errored files because they cache was updated nonetheless */
|
|
16
26
|
updatedFiles: Map<FileId, true>;
|
|
@@ -138,10 +138,7 @@ export declare class LinearElementEditor {
|
|
|
138
138
|
isBindingEnabled: boolean;
|
|
139
139
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
140
140
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
141
|
-
editingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
142
|
-
* @param id the `elementId` from the instance of this class (so that we can
|
|
143
|
-
* statically guarantee this method returns an ExcalidrawLinearElement)
|
|
144
|
-
*/
|
|
141
|
+
editingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
145
142
|
activeTool: {
|
|
146
143
|
lastActiveTool: import("../types").LastActiveTool;
|
|
147
144
|
locked: boolean;
|
|
@@ -184,9 +181,12 @@ export declare class LinearElementEditor {
|
|
|
184
181
|
}>;
|
|
185
182
|
openMenu: "canvas" | "shape" | null;
|
|
186
183
|
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
187
|
-
openSidebar:
|
|
184
|
+
openSidebar: {
|
|
185
|
+
name: string;
|
|
186
|
+
tab?: string | undefined;
|
|
187
|
+
} | null;
|
|
188
188
|
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
189
|
-
|
|
189
|
+
defaultSidebarDockedPreference: boolean;
|
|
190
190
|
lastPointerDownWith: import("./types").PointerType;
|
|
191
191
|
selectedElementIds: {
|
|
192
192
|
[id: string]: boolean;
|
|
@@ -241,6 +241,7 @@ export declare class LinearElementEditor {
|
|
|
241
241
|
resetCustomPen?: any;
|
|
242
242
|
gridColor: string;
|
|
243
243
|
dynamicStyle: string;
|
|
244
|
+
invertBindingBehaviour: boolean;
|
|
244
245
|
selectedLinearElement: LinearElementEditor | null;
|
|
245
246
|
};
|
|
246
247
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer } from "../element/types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
3
|
import { MarkOptional, Mutable } from "../utility-types";
|
|
4
|
-
declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "boundElements" | "seed" | "version" | "versionNonce" | "link">;
|
|
4
|
+
declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "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>;
|
|
8
8
|
export declare const newTextElement: (opts: {
|
|
9
9
|
text: string;
|
|
10
10
|
rawText: string;
|
|
11
|
-
fontSize
|
|
12
|
-
fontFamily
|
|
13
|
-
textAlign
|
|
14
|
-
verticalAlign
|
|
11
|
+
fontSize?: number;
|
|
12
|
+
fontFamily?: FontFamilyValues;
|
|
13
|
+
textAlign?: TextAlign;
|
|
14
|
+
verticalAlign?: VerticalAlign;
|
|
15
15
|
containerId?: ExcalidrawTextContainer["id"];
|
|
16
16
|
lineHeight?: ExcalidrawTextElement["lineHeight"];
|
|
17
|
+
strokeWidth?: ExcalidrawTextElement["strokeWidth"];
|
|
17
18
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
|
|
18
19
|
export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, text?: string) => {
|
|
19
20
|
x: number;
|
|
@@ -47,7 +48,16 @@ export declare const newImageElement: (opts: {
|
|
|
47
48
|
fileId?: ExcalidrawImageElement["fileId"];
|
|
48
49
|
scale?: ExcalidrawImageElement["scale"];
|
|
49
50
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawImageElement>;
|
|
50
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Clones ExcalidrawElement data structure. Does not regenerate id, nonce, or
|
|
53
|
+
* any value. The purpose is to to break object references for immutability
|
|
54
|
+
* reasons, whenever we want to keep the original element, but ensure it's not
|
|
55
|
+
* mutated.
|
|
56
|
+
*
|
|
57
|
+
* Only clones plain objects and arrays. Doesn't clone Date, RegExp, Map, Set,
|
|
58
|
+
* Typed arrays and other non-null objects.
|
|
59
|
+
*/
|
|
60
|
+
export declare const deepCopyElement: <T extends ExcalidrawElement>(val: T) => Mutable<T>;
|
|
51
61
|
/**
|
|
52
62
|
* Duplicate an element, often used in the alt-drag operation.
|
|
53
63
|
* Note that this method has gotten a bit complicated since the
|
|
@@ -62,5 +72,19 @@ export declare const deepCopyElement: (val: any, depth?: number) => any;
|
|
|
62
72
|
* @param element Element to duplicate
|
|
63
73
|
* @param overrides Any element properties to override
|
|
64
74
|
*/
|
|
65
|
-
export declare const duplicateElement: <TElement extends
|
|
75
|
+
export declare const duplicateElement: <TElement extends ExcalidrawElement>(editingGroupId: AppState["editingGroupId"], groupIdMapForOperation: Map<GroupId, GroupId>, element: TElement, overrides?: Partial<TElement> | undefined) => Readonly<TElement>;
|
|
76
|
+
/**
|
|
77
|
+
* Clones elements, regenerating their ids (including bindings) and group ids.
|
|
78
|
+
*
|
|
79
|
+
* If bindings don't exist in the elements array, they are removed. Therefore,
|
|
80
|
+
* it's advised to supply the whole elements array, or sets of elements that
|
|
81
|
+
* are encapsulated (such as library items), if the purpose is to retain
|
|
82
|
+
* bindings to the cloned elements intact.
|
|
83
|
+
*
|
|
84
|
+
* NOTE by default does not randomize or regenerate anything except the id.
|
|
85
|
+
*/
|
|
86
|
+
export declare const duplicateElements: (elements: readonly ExcalidrawElement[], opts?: {
|
|
87
|
+
/** NOTE also updates version flags and `updated` */
|
|
88
|
+
randomizeSeed: boolean;
|
|
89
|
+
}) => ExcalidrawElement[];
|
|
66
90
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AppState } from "../types";
|
|
2
1
|
import { NonDeletedExcalidrawElement } from "./types";
|
|
3
|
-
|
|
2
|
+
import { UIAppState } from "../types";
|
|
3
|
+
export declare const showSelectedShapeActions: (appState: UIAppState, elements: readonly NonDeletedExcalidrawElement[]) => boolean;
|
|
@@ -32,6 +32,7 @@ export declare const getLineHeightInPx: (fontSize: ExcalidrawTextElement["fontSi
|
|
|
32
32
|
export declare const getApproxMinLineHeight: (fontSize: ExcalidrawTextElement["fontSize"], lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
|
|
33
33
|
export declare const getTextWidth: (text: string, font: FontString) => number;
|
|
34
34
|
export declare const getTextHeight: (text: string, fontSize: number, lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
|
|
35
|
+
export declare const parseTokens: (text: string) => string[];
|
|
35
36
|
export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
|
|
36
37
|
export declare const charWidth: {
|
|
37
38
|
calculate: (char: string, font: FontString) => number;
|
|
@@ -70,8 +71,8 @@ export declare const getTextBindableContainerAtPosition: (elements: readonly Exc
|
|
|
70
71
|
declare const VALID_CONTAINER_TYPES: Set<string>;
|
|
71
72
|
export declare const isValidTextContainer: (element: ExcalidrawElement) => boolean;
|
|
72
73
|
export declare const computeContainerDimensionForBoundText: (dimension: number, containerType: ExtractSetType<typeof VALID_CONTAINER_TYPES>, legacy?: boolean) => number;
|
|
73
|
-
export declare const
|
|
74
|
-
export declare const
|
|
74
|
+
export declare const getBoundTextMaxWidth: (container: ExcalidrawElement) => number;
|
|
75
|
+
export declare const getBoundTextMaxHeight: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => number;
|
|
75
76
|
export declare const isMeasureTextSupported: () => boolean;
|
|
76
77
|
export declare const getDefaultLineHeight: (fontFamily: FontFamilyValues) => number & {
|
|
77
78
|
_brand: "unitlessLineHeight";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const useOutsideClick: (handler: (event: Event) => void) => import("react").MutableRefObject<null>;
|
|
@@ -19,7 +19,7 @@ measureText, //zsviczian
|
|
|
19
19
|
getDefaultLineHeight, //zsviczian
|
|
20
20
|
wrapText, //zsviczian
|
|
21
21
|
getFontString, //zsviczian
|
|
22
|
-
|
|
22
|
+
getBoundTextMaxWidth, //zsviczian
|
|
23
23
|
exportToClipboard, mergeLibraryItems, } from "../../packages/utils";
|
|
24
24
|
export { isLinearElement } from "../../element/typeChecks";
|
|
25
25
|
export { FONT_FAMILY, THEME, MIME_TYPES } from "../../constants";
|
|
@@ -33,3 +33,4 @@ export { MainMenu };
|
|
|
33
33
|
export { useDevice } from "../../components/App";
|
|
34
34
|
export { WelcomeScreen };
|
|
35
35
|
export { LiveCollaborationTrigger };
|
|
36
|
+
export { DefaultSidebar } from "../../components/DefaultSidebar";
|
|
@@ -38,5 +38,5 @@ export { intersectElementWithLine } from "../element/collision";
|
|
|
38
38
|
export { determineFocusDistance } from "../element/collision";
|
|
39
39
|
export { measureText, wrapText, getDefaultLineHeight } from "../element/textElement";
|
|
40
40
|
export { getFontString } from "../utils";
|
|
41
|
-
export {
|
|
41
|
+
export { getBoundTextMaxWidth } from "../element/textElement";
|
|
42
42
|
export { mergeLibraryItems } from "../data/library";
|