@zsviczian/excalidraw 0.17.0-obsidian-1 → 0.17.0-obsidian-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/excalidraw.development.js +371 -74
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +30 -6
- package/types/actions/actionBoundText.d.ts +20 -4
- package/types/actions/actionCanvas.d.ts +130 -26
- package/types/actions/actionClipboard.d.ts +70 -14
- package/types/actions/actionDeleteSelected.d.ts +30 -6
- package/types/actions/actionElementLock.d.ts +20 -4
- package/types/actions/actionExport.d.ts +86 -22
- package/types/actions/actionFinalize.d.ts +20 -4
- package/types/actions/actionFrame.d.ts +30 -6
- package/types/actions/actionGroup.d.ts +20 -4
- package/types/actions/actionLinearEditor.d.ts +10 -2
- package/types/actions/actionMenu.d.ts +24 -6
- package/types/actions/actionProperties.d.ts +130 -26
- package/types/actions/actionSelectAll.d.ts +10 -2
- package/types/actions/actionStyles.d.ts +10 -2
- package/types/actions/actionToggleGridMode.d.ts +10 -2
- package/types/actions/actionToggleObjectsSnapMode.d.ts +10 -2
- package/types/actions/actionToggleStats.d.ts +10 -2
- package/types/actions/actionToggleViewMode.d.ts +10 -2
- package/types/actions/actionToggleZenMode.d.ts +10 -2
- package/types/appState.d.ts +2 -2
- package/types/components/App.d.ts +27 -6
- package/types/components/Button.d.ts +1 -1
- package/types/components/InlineIcon.d.ts +3 -0
- package/types/components/LayerUI.d.ts +5 -1
- package/types/components/MagicButton.d.ts +9 -0
- package/types/components/MagicSettings.d.ts +8 -0
- package/types/components/Paragraph.d.ts +4 -0
- package/types/components/TTDDialog/MermaidToExcalidraw.d.ts +13 -0
- package/types/components/TTDDialog/TTDDialog.d.ts +29 -0
- package/types/components/TTDDialog/TTDDialogInput.d.ts +9 -0
- package/types/components/TTDDialog/TTDDialogOutput.d.ts +7 -0
- package/types/components/TTDDialog/TTDDialogPanel.d.ts +16 -0
- package/types/components/TTDDialog/TTDDialogPanels.d.ts +4 -0
- package/types/components/TTDDialog/TTDDialogTab.d.ts +7 -0
- package/types/components/TTDDialog/TTDDialogTabTrigger.d.ts +8 -0
- package/types/components/TTDDialog/TTDDialogTabTriggers.d.ts +6 -0
- package/types/components/TTDDialog/TTDDialogTabs.d.ts +9 -0
- package/types/components/TTDDialog/TTDDialogTrigger.d.ts +8 -0
- package/types/components/TTDDialog/common.d.ts +33 -0
- package/types/components/TextField.d.ts +16 -0
- package/types/components/dropdownMenu/DropdownMenu.d.ts +6 -0
- package/types/components/dropdownMenu/DropdownMenuItem.d.ts +12 -0
- package/types/components/icons.d.ts +6 -0
- package/types/components/main-menu/MainMenu.d.ts +6 -0
- package/types/constants.d.ts +24 -2
- package/types/context/tunnels.d.ts +1 -0
- package/types/data/EditorLocalStorage.d.ts +8 -0
- package/types/data/ai/types.d.ts +242 -0
- package/types/data/index.d.ts +3 -3
- package/types/data/magic.d.ts +23 -0
- package/types/data/transform.d.ts +11 -7
- package/types/element/ElementCanvasButtons.d.ts +6 -0
- package/types/element/Hyperlink.d.ts +10 -2
- package/types/element/collision.d.ts +2 -2
- package/types/element/embeddable.d.ts +16 -21
- package/types/element/index.d.ts +3 -4
- package/types/element/linearElementEditor.d.ts +10 -2
- package/types/element/newElement.d.ts +7 -1
- package/types/element/textElement.d.ts +2 -2
- package/types/element/typeChecks.d.ts +9 -6
- package/types/element/types.d.ts +30 -2
- package/types/frame.d.ts +21 -20
- package/types/packages/excalidraw/index.d.ts +2 -0
- package/types/packages/utils.d.ts +3 -3
- package/types/scene/Scene.d.ts +4 -4
- package/types/scene/ShapeCache.d.ts +1 -1
- package/types/scene/comparisons.d.ts +7 -6
- package/types/scene/export.d.ts +3 -3
- package/types/scene/types.d.ts +2 -0
- package/types/shapes.d.ts +1 -1
- package/types/types.d.ts +24 -10
- package/types/utils.d.ts +2 -2
package/types/element/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Point } from "../types";
|
|
2
2
|
import { FONT_FAMILY, ROUNDNESS, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "../constants";
|
|
3
3
|
import { MarkNonNullable, ValueOf } from "../utility-types";
|
|
4
|
+
import { MagicCacheData } from "../data/magic";
|
|
4
5
|
export type ChartType = "bar" | "line";
|
|
5
6
|
export type FillStyle = "hachure" | "cross-hatch" | "solid" | "zigzag";
|
|
6
7
|
export type FontFamilyKeys = keyof typeof FONT_FAMILY;
|
|
@@ -85,6 +86,27 @@ export type ExcalidrawEmbeddableElement = _ExcalidrawElementBase & Readonly<{
|
|
|
85
86
|
validated: boolean | null;
|
|
86
87
|
scale: [number, number];
|
|
87
88
|
}>;
|
|
89
|
+
export type ExcalidrawIframeElement = _ExcalidrawElementBase & Readonly<{
|
|
90
|
+
type: "iframe";
|
|
91
|
+
customData?: {
|
|
92
|
+
generationData?: MagicCacheData;
|
|
93
|
+
};
|
|
94
|
+
scale: [number, number];
|
|
95
|
+
}>;
|
|
96
|
+
export type ExcalidrawIframeLikeElement = ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
|
|
97
|
+
export type IframeData = ({
|
|
98
|
+
intrinsicSize: {
|
|
99
|
+
w: number;
|
|
100
|
+
h: number;
|
|
101
|
+
};
|
|
102
|
+
warning?: string;
|
|
103
|
+
} & ({
|
|
104
|
+
type: "video" | "generic";
|
|
105
|
+
link: string;
|
|
106
|
+
} | {
|
|
107
|
+
type: "document";
|
|
108
|
+
srcdoc: (theme: Theme) => string;
|
|
109
|
+
}));
|
|
88
110
|
export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
|
|
89
111
|
type: "image";
|
|
90
112
|
fileId: FileId | null;
|
|
@@ -98,6 +120,11 @@ export type ExcalidrawFrameElement = _ExcalidrawElementBase & {
|
|
|
98
120
|
type: "frame";
|
|
99
121
|
name: string | null;
|
|
100
122
|
};
|
|
123
|
+
export type ExcalidrawMagicFrameElement = _ExcalidrawElementBase & {
|
|
124
|
+
type: "magicframe";
|
|
125
|
+
name: string | null;
|
|
126
|
+
};
|
|
127
|
+
export type ExcalidrawFrameLikeElement = ExcalidrawFrameElement | ExcalidrawMagicFrameElement;
|
|
101
128
|
/**
|
|
102
129
|
* These are elements that don't have any additional properties.
|
|
103
130
|
*/
|
|
@@ -107,7 +134,7 @@ export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRe
|
|
|
107
134
|
* no computed data. The list of all ExcalidrawElements should be shareable
|
|
108
135
|
* between peers and contain no state local to the peer.
|
|
109
136
|
*/
|
|
110
|
-
export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawEmbeddableElement;
|
|
137
|
+
export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
|
|
111
138
|
export type NonDeleted<TElement extends ExcalidrawElement> = TElement & {
|
|
112
139
|
isDeleted: boolean;
|
|
113
140
|
};
|
|
@@ -131,7 +158,7 @@ export type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
|
|
|
131
158
|
_brand: "unitlessLineHeight";
|
|
132
159
|
};
|
|
133
160
|
}>;
|
|
134
|
-
export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement;
|
|
161
|
+
export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement;
|
|
135
162
|
export type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawArrowElement;
|
|
136
163
|
export type ExcalidrawTextElementWithContainer = {
|
|
137
164
|
containerId: ExcalidrawTextContainer["id"];
|
|
@@ -164,4 +191,5 @@ export type ExcalidrawFreeDrawElement = _ExcalidrawElementBase & Readonly<{
|
|
|
164
191
|
export type FileId = string & {
|
|
165
192
|
_brand: "FileId";
|
|
166
193
|
};
|
|
194
|
+
export type ExcalidrawElementType = ExcalidrawElement["type"];
|
|
167
195
|
export {};
|
package/types/frame.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { ExcalidrawElement,
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
|
|
2
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
|
-
export declare function isElementIntersectingFrame(element: ExcalidrawElement, frame:
|
|
6
|
-
export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame:
|
|
7
|
-
export declare const isElementContainingFrame: (elements: readonly ExcalidrawElement[], element: ExcalidrawElement, frame:
|
|
8
|
-
export declare const getElementsIntersectingFrame: (elements: readonly ExcalidrawElement[], frame:
|
|
9
|
-
export declare const elementsAreInFrameBounds: (elements: readonly ExcalidrawElement[], frame:
|
|
10
|
-
export declare const elementOverlapsWithFrame: (element: ExcalidrawElement, frame:
|
|
5
|
+
export declare function isElementIntersectingFrame(element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement): boolean;
|
|
6
|
+
export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
|
|
7
|
+
export declare const isElementContainingFrame: (elements: readonly ExcalidrawElement[], element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement) => boolean;
|
|
8
|
+
export declare const getElementsIntersectingFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
|
|
9
|
+
export declare const elementsAreInFrameBounds: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => boolean;
|
|
10
|
+
export declare const elementOverlapsWithFrame: (element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement) => boolean;
|
|
11
11
|
export declare const isCursorInFrame: (cursorCoords: {
|
|
12
12
|
x: number;
|
|
13
13
|
y: number;
|
|
14
|
-
}, frame: NonDeleted<
|
|
15
|
-
export declare const groupsAreAtLeastIntersectingTheFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame:
|
|
16
|
-
export declare const groupsAreCompletelyOutOfFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame:
|
|
14
|
+
}, frame: NonDeleted<ExcalidrawFrameLikeElement>) => boolean;
|
|
15
|
+
export declare const groupsAreAtLeastIntersectingTheFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameLikeElement) => boolean;
|
|
16
|
+
export declare const groupsAreCompletelyOutOfFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameLikeElement) => boolean;
|
|
17
17
|
/**
|
|
18
18
|
* Returns a map of frameId to frame elements. Includes empty frames.
|
|
19
19
|
*/
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const groupByFrameLikes: (elements: readonly ExcalidrawElement[]) => Map<string, ExcalidrawElement[]>;
|
|
21
21
|
export declare const getFrameChildren: (allElements: ExcalidrawElementsIncludingDeleted, frameId: string) => ExcalidrawElement[];
|
|
22
|
-
export declare const
|
|
22
|
+
export declare const getFrameLikeElements: (allElements: ExcalidrawElementsIncludingDeleted) => ExcalidrawFrameLikeElement[];
|
|
23
23
|
/**
|
|
24
24
|
* Returns ExcalidrawFrameElements and non-frame-children elements.
|
|
25
25
|
*
|
|
@@ -29,28 +29,29 @@ export declare const getFrameElements: (allElements: ExcalidrawElementsIncluding
|
|
|
29
29
|
* Considers non-frame bound elements (container or arrow labels) as root.
|
|
30
30
|
*/
|
|
31
31
|
export declare const getRootElements: (allElements: ExcalidrawElementsIncludingDeleted) => ExcalidrawElement[];
|
|
32
|
-
export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame:
|
|
33
|
-
export declare const getElementsInNewFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame:
|
|
34
|
-
export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap?: Map<string, ExcalidrawElement>) =>
|
|
32
|
+
export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, appState: AppState) => ExcalidrawElement[];
|
|
33
|
+
export declare const getElementsInNewFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
|
|
34
|
+
export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap?: Map<string, ExcalidrawElement>) => ExcalidrawFrameLikeElement | null;
|
|
35
35
|
/**
|
|
36
36
|
* Retains (or repairs for target frame) the ordering invriant where children
|
|
37
37
|
* elements come right before the parent frame:
|
|
38
38
|
* [el, el, child, child, frame, el]
|
|
39
39
|
*/
|
|
40
|
-
export declare const addElementsToFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToAdd: NonDeletedExcalidrawElement[], frame:
|
|
40
|
+
export declare const addElementsToFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToAdd: NonDeletedExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
|
|
41
41
|
export declare const removeElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToRemove: NonDeletedExcalidrawElement[], appState: AppState) => ExcalidrawElement[];
|
|
42
|
-
export declare const removeAllElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame:
|
|
43
|
-
export declare const replaceAllElementsInFrame: (allElements: ExcalidrawElementsIncludingDeleted, nextElementsInFrame: ExcalidrawElement[], frame:
|
|
42
|
+
export declare const removeAllElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, appState: AppState) => ExcalidrawElement[];
|
|
43
|
+
export declare const replaceAllElementsInFrame: (allElements: ExcalidrawElementsIncludingDeleted, nextElementsInFrame: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, appState: AppState) => ExcalidrawElement[];
|
|
44
44
|
/** does not mutate elements, but returns new ones */
|
|
45
45
|
export declare const updateFrameMembershipOfSelectedElements: (allElements: ExcalidrawElementsIncludingDeleted, appState: AppState, app: AppClassProperties) => ExcalidrawElementsIncludingDeleted;
|
|
46
46
|
/**
|
|
47
47
|
* filters out elements that are inside groups that contain a frame element
|
|
48
48
|
* anywhere in the group tree
|
|
49
49
|
*/
|
|
50
|
-
export declare const
|
|
50
|
+
export declare const omitGroupsContainingFrameLikes: (allElements: ExcalidrawElementsIncludingDeleted, selectedElements?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
51
51
|
/**
|
|
52
52
|
* depending on the appState, return target frame, which is the frame the given element
|
|
53
53
|
* is going to be added to or remove from
|
|
54
54
|
*/
|
|
55
|
-
export declare const getTargetFrame: (element: ExcalidrawElement, appState: StaticCanvasAppState) => ExcalidrawFrameElement | null;
|
|
55
|
+
export declare const getTargetFrame: (element: ExcalidrawElement, appState: StaticCanvasAppState) => import("./element/types").ExcalidrawFrameElement | import("./element/types").ExcalidrawMagicFrameElement | null;
|
|
56
56
|
export declare const isElementInFrame: (element: ExcalidrawElement, allElements: ExcalidrawElementsIncludingDeleted, appState: StaticCanvasAppState) => boolean;
|
|
57
|
+
export declare const getFrameLikeTitle: (element: ExcalidrawFrameLikeElement, frameIdx: number) => string;
|
|
@@ -34,6 +34,8 @@ export { useDevice } from "../../components/App";
|
|
|
34
34
|
export { WelcomeScreen };
|
|
35
35
|
export { LiveCollaborationTrigger };
|
|
36
36
|
export { DefaultSidebar } from "../../components/DefaultSidebar";
|
|
37
|
+
export { TTDDialog } from "../../components/TTDDialog/TTDDialog";
|
|
38
|
+
export { TTDDialogTrigger } from "../../components/TTDDialog/TTDDialogTrigger";
|
|
37
39
|
export { normalizeLink } from "../../data/url";
|
|
38
40
|
export { convertToExcalidrawElements } from "../../data/transform";
|
|
39
41
|
export { getCommonBounds } from "../../element/bounds";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppState, BinaryFiles } from "../types";
|
|
2
|
-
import { ExcalidrawElement,
|
|
2
|
+
import { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted } from "../element/types";
|
|
3
3
|
import { MIME_TYPES } from "../constants";
|
|
4
4
|
export { MIME_TYPES };
|
|
5
5
|
type ExportOpts = {
|
|
@@ -7,7 +7,7 @@ type ExportOpts = {
|
|
|
7
7
|
appState?: Partial<Omit<AppState, "offsetTop" | "offsetLeft">>;
|
|
8
8
|
files: BinaryFiles | null;
|
|
9
9
|
maxWidthOrHeight?: number;
|
|
10
|
-
exportingFrame?:
|
|
10
|
+
exportingFrame?: ExcalidrawFrameLikeElement | null;
|
|
11
11
|
getDimensions?: (width: number, height: number) => {
|
|
12
12
|
width: number;
|
|
13
13
|
height: number;
|
|
@@ -44,4 +44,4 @@ export { measureText, wrapText, getDefaultLineHeight, } from "../element/textEle
|
|
|
44
44
|
export { getFontString } from "../utils";
|
|
45
45
|
export { getBoundTextMaxWidth } from "../element/textElement";
|
|
46
46
|
export { mergeLibraryItems } from "../data/library";
|
|
47
|
-
export { mermaidToExcalidraw } from "../components/MermaidToExcalidraw";
|
|
47
|
+
export { mermaidToExcalidraw } from "../components/TTDDialog/MermaidToExcalidraw";
|
package/types/scene/Scene.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted,
|
|
1
|
+
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameLikeElement } from "../element/types";
|
|
2
2
|
import { LinearElementEditor } from "../element/linearElementEditor";
|
|
3
3
|
import { AppState } from "../types";
|
|
4
4
|
type ElementIdKey = InstanceType<typeof LinearElementEditor>["elementId"];
|
|
@@ -19,14 +19,14 @@ declare class Scene {
|
|
|
19
19
|
private callbacks;
|
|
20
20
|
private nonDeletedElements;
|
|
21
21
|
private elements;
|
|
22
|
-
private
|
|
22
|
+
private nonDeletedFramesLikes;
|
|
23
23
|
private frames;
|
|
24
24
|
private elementsMap;
|
|
25
25
|
private selectedElementsCache;
|
|
26
26
|
private versionNonce;
|
|
27
27
|
getElementsIncludingDeleted(): readonly ExcalidrawElement[];
|
|
28
28
|
getNonDeletedElements(): readonly NonDeletedExcalidrawElement[];
|
|
29
|
-
getFramesIncludingDeleted(): readonly
|
|
29
|
+
getFramesIncludingDeleted(): readonly ExcalidrawFrameLikeElement[];
|
|
30
30
|
getSelectedElements(opts: {
|
|
31
31
|
selectedElementIds: AppState["selectedElementIds"];
|
|
32
32
|
/**
|
|
@@ -38,7 +38,7 @@ declare class Scene {
|
|
|
38
38
|
includeBoundTextElement?: boolean;
|
|
39
39
|
includeElementsInFrames?: boolean;
|
|
40
40
|
}): NonDeleted<ExcalidrawElement>[];
|
|
41
|
-
|
|
41
|
+
getNonDeletedFramesLikes(): readonly NonDeleted<ExcalidrawFrameLikeElement>[];
|
|
42
42
|
getElement<T extends ExcalidrawElement>(id: T["id"]): T | null;
|
|
43
43
|
getVersionNonce(): number | undefined;
|
|
44
44
|
getNonDeletedElement(id: ExcalidrawElement["id"]): NonDeleted<ExcalidrawElement> | null;
|
|
@@ -16,5 +16,5 @@ export declare class ShapeCache {
|
|
|
16
16
|
* Generates & caches shape for element if not already cached, otherwise
|
|
17
17
|
* returns cached shape.
|
|
18
18
|
*/
|
|
19
|
-
static generateElementShape: <T extends import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawEmbeddableElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawFrameElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawFreeDrawElement>(element: T, isExporting?: boolean) => ((T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined) & ({} | null)) | (T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable | null);
|
|
19
|
+
static generateElementShape: <T extends import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawEmbeddableElement | import("../element/types").ExcalidrawIframeElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawFrameElement | import("../element/types").ExcalidrawMagicFrameElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawFreeDrawElement>(element: T, isExporting?: boolean) => ((T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined) & ({} | null)) | (T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable | null);
|
|
20
20
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
2
|
+
import { ElementOrToolType } from "../types";
|
|
3
|
+
export declare const hasBackground: (type: ElementOrToolType) => boolean;
|
|
4
|
+
export declare const hasStrokeColor: (type: ElementOrToolType) => boolean;
|
|
5
|
+
export declare const hasStrokeWidth: (type: ElementOrToolType) => boolean;
|
|
6
|
+
export declare const hasStrokeStyle: (type: ElementOrToolType) => boolean;
|
|
7
|
+
export declare const canChangeRoundness: (type: ElementOrToolType) => boolean;
|
|
8
|
+
export declare const canHaveArrowheads: (type: ElementOrToolType) => boolean;
|
|
8
9
|
export declare const getElementAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement | null;
|
|
9
10
|
export declare const getElementsAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement[];
|
package/types/scene/export.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
import { AppState, BinaryFiles } from "../types";
|
|
3
3
|
export declare const exportToCanvas: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, exportingFrame, }: {
|
|
4
4
|
exportBackground: boolean;
|
|
5
5
|
exportPadding?: number | undefined;
|
|
6
6
|
viewBackgroundColor: string;
|
|
7
|
-
exportingFrame?:
|
|
7
|
+
exportingFrame?: ExcalidrawFrameLikeElement | null | undefined;
|
|
8
8
|
}, createCanvas?: (width: number, height: number) => {
|
|
9
9
|
canvas: HTMLCanvasElement;
|
|
10
10
|
scale: number;
|
|
@@ -20,6 +20,6 @@ export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElemen
|
|
|
20
20
|
frameColor?: AppState["frameColor"];
|
|
21
21
|
}, files: BinaryFiles | null, opts?: {
|
|
22
22
|
renderEmbeddables?: boolean;
|
|
23
|
-
exportingFrame?:
|
|
23
|
+
exportingFrame?: ExcalidrawFrameLikeElement | null;
|
|
24
24
|
}) => Promise<SVGSVGElement>;
|
|
25
25
|
export declare const getExportSize: (elements: readonly NonDeletedExcalidrawElement[], exportPadding: number, scale: number) => [number, number];
|
package/types/scene/types.d.ts
CHANGED
|
@@ -82,6 +82,7 @@ export type ElementShapes = {
|
|
|
82
82
|
rectangle: Drawable;
|
|
83
83
|
ellipse: Drawable;
|
|
84
84
|
diamond: Drawable;
|
|
85
|
+
iframe: Drawable;
|
|
85
86
|
embeddable: Drawable;
|
|
86
87
|
freedraw: Drawable | null;
|
|
87
88
|
arrow: Drawable[];
|
|
@@ -89,4 +90,5 @@ export type ElementShapes = {
|
|
|
89
90
|
text: null;
|
|
90
91
|
image: null;
|
|
91
92
|
frame: null;
|
|
93
|
+
magicframe: null;
|
|
92
94
|
};
|
package/types/shapes.d.ts
CHANGED
|
@@ -59,4 +59,4 @@ export declare const SHAPES: readonly [{
|
|
|
59
59
|
readonly numericKey: "0";
|
|
60
60
|
readonly fillable: false;
|
|
61
61
|
}];
|
|
62
|
-
export declare const findShapeByKey: (key: string) => "
|
|
62
|
+
export declare const findShapeByKey: (key: string) => "text" | "image" | "line" | "arrow" | "selection" | "rectangle" | "diamond" | "ellipse" | "freedraw" | "eraser" | null;
|
package/types/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme, StrokeRoundness,
|
|
2
|
+
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType } from "./element/types";
|
|
3
|
+
import { Action } from "./actions/types";
|
|
3
4
|
import { Point as RoughPoint } from "roughjs/bin/geometry";
|
|
4
5
|
import { LinearElementEditor } from "./element/linearElementEditor";
|
|
5
6
|
import { SuggestedBinding } from "./element/binding";
|
|
@@ -59,7 +60,8 @@ export type BinaryFileData = {
|
|
|
59
60
|
};
|
|
60
61
|
export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
|
|
61
62
|
export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
|
|
62
|
-
export type ToolType = "selection" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "embeddable" | "laser" | "mermaid";
|
|
63
|
+
export type ToolType = "selection" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser" | "mermaid";
|
|
64
|
+
export type ElementOrToolType = ExcalidrawElementType | ToolType | "custom";
|
|
63
65
|
export type ActiveTool = {
|
|
64
66
|
type: ToolType;
|
|
65
67
|
customType: null;
|
|
@@ -107,13 +109,11 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
107
109
|
suggestedBindings: AppState["suggestedBindings"];
|
|
108
110
|
isRotating: AppState["isRotating"];
|
|
109
111
|
elementsToHighlight: AppState["elementsToHighlight"];
|
|
110
|
-
openSidebar: AppState["openSidebar"];
|
|
111
|
-
showHyperlinkPopup: AppState["showHyperlinkPopup"];
|
|
112
112
|
collaborators: AppState["collaborators"];
|
|
113
113
|
snapLines: AppState["snapLines"];
|
|
114
114
|
zenModeEnabled: AppState["zenModeEnabled"];
|
|
115
115
|
}>;
|
|
116
|
-
export
|
|
116
|
+
export interface AppState {
|
|
117
117
|
contextMenu: {
|
|
118
118
|
items: ContextMenuItems;
|
|
119
119
|
top: number;
|
|
@@ -133,7 +133,7 @@ export type AppState = {
|
|
|
133
133
|
isBindingEnabled: boolean;
|
|
134
134
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
135
135
|
suggestedBindings: SuggestedBinding[];
|
|
136
|
-
frameToHighlight: NonDeleted<
|
|
136
|
+
frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
137
137
|
frameRendering: {
|
|
138
138
|
enabled: boolean;
|
|
139
139
|
name: boolean;
|
|
@@ -186,7 +186,15 @@ export type AppState = {
|
|
|
186
186
|
name: SidebarName;
|
|
187
187
|
tab?: SidebarTabName;
|
|
188
188
|
} | null;
|
|
189
|
-
openDialog:
|
|
189
|
+
openDialog: null | {
|
|
190
|
+
name: "imageExport" | "help" | "jsonExport";
|
|
191
|
+
} | {
|
|
192
|
+
name: "magicSettings";
|
|
193
|
+
source: "tool" | "generation" | "settings";
|
|
194
|
+
} | {
|
|
195
|
+
name: "ttd";
|
|
196
|
+
tab: string;
|
|
197
|
+
};
|
|
190
198
|
/**
|
|
191
199
|
* Reflects user preference for whether the default sidebar should be docked.
|
|
192
200
|
*
|
|
@@ -278,7 +286,7 @@ export type AppState = {
|
|
|
278
286
|
y: number;
|
|
279
287
|
} | null;
|
|
280
288
|
objectsSnapModeEnabled: boolean;
|
|
281
|
-
}
|
|
289
|
+
}
|
|
282
290
|
export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
|
|
283
291
|
export type NormalizedZoomValue = number & {
|
|
284
292
|
_brand: "normalizedZoom";
|
|
@@ -373,6 +381,7 @@ export interface ExcalidrawProps {
|
|
|
373
381
|
renderEmbeddableMenu?: (appState: AppState) => JSX.Element | null;
|
|
374
382
|
renderMermaid?: boolean;
|
|
375
383
|
onContextMenu?: (element: readonly NonDeletedExcalidrawElement[], appState: AppState, onClose: (callback?: () => void) => void) => JSX.Element | null;
|
|
384
|
+
aiEnabled?: boolean;
|
|
376
385
|
}
|
|
377
386
|
export type SceneData = {
|
|
378
387
|
elements?: ImportedDataState["elements"];
|
|
@@ -418,6 +427,7 @@ export type AppProps = Merge<ExcalidrawProps, {
|
|
|
418
427
|
handleKeyboardGlobally: boolean;
|
|
419
428
|
isCollaborating: boolean;
|
|
420
429
|
children?: React.ReactNode;
|
|
430
|
+
aiEnabled: boolean;
|
|
421
431
|
}>;
|
|
422
432
|
/** A subset of App class properties that we need to use elsewhere
|
|
423
433
|
* in the app, eg Manager. Factored out into a separate type to keep DRY. */
|
|
@@ -447,6 +457,8 @@ export type AppClassProperties = {
|
|
|
447
457
|
togglePenMode: App["togglePenMode"];
|
|
448
458
|
setActiveTool: App["setActiveTool"];
|
|
449
459
|
setOpenDialog: App["setOpenDialog"];
|
|
460
|
+
insertEmbeddableElement: App["insertEmbeddableElement"];
|
|
461
|
+
onMagicframeToolSelect: App["onMagicframeToolSelect"];
|
|
450
462
|
};
|
|
451
463
|
export type PointerDownState = Readonly<{
|
|
452
464
|
origin: Readonly<{
|
|
@@ -522,6 +534,7 @@ export type ExcalidrawImperativeAPI = {
|
|
|
522
534
|
getSceneElements: InstanceType<typeof App>["getSceneElements"];
|
|
523
535
|
getAppState: () => InstanceType<typeof App>["state"];
|
|
524
536
|
getFiles: () => InstanceType<typeof App>["files"];
|
|
537
|
+
registerAction: (action: Action) => void;
|
|
525
538
|
refresh: InstanceType<typeof App>["refresh"];
|
|
526
539
|
setToast: InstanceType<typeof App>["setToast"];
|
|
527
540
|
addFiles: (data: BinaryFileData[]) => void;
|
|
@@ -568,10 +581,10 @@ type FrameNameBounds = {
|
|
|
568
581
|
angle: number;
|
|
569
582
|
};
|
|
570
583
|
export type FrameNameBoundsCache = {
|
|
571
|
-
get: (frameElement:
|
|
584
|
+
get: (frameElement: ExcalidrawFrameLikeElement | ExcalidrawMagicFrameElement) => FrameNameBounds | null;
|
|
572
585
|
_cache: Map<string, FrameNameBounds & {
|
|
573
586
|
zoom: AppState["zoom"]["value"];
|
|
574
|
-
versionNonce:
|
|
587
|
+
versionNonce: ExcalidrawFrameLikeElement["versionNonce"];
|
|
575
588
|
}>;
|
|
576
589
|
};
|
|
577
590
|
export type KeyboardModifiersObject = {
|
|
@@ -581,4 +594,5 @@ export type KeyboardModifiersObject = {
|
|
|
581
594
|
metaKey: boolean;
|
|
582
595
|
};
|
|
583
596
|
export type Primitive = number | string | boolean | bigint | symbol | null | undefined;
|
|
597
|
+
export type JSONValue = string | number | boolean | null | object;
|
|
584
598
|
export {};
|
package/types/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EVENT } from "./constants";
|
|
2
|
-
import { FontFamilyValues, FontString
|
|
2
|
+
import { FontFamilyValues, FontString } from "./element/types";
|
|
3
3
|
import { ActiveTool, AppState, ToolType, Zoom } from "./types";
|
|
4
4
|
export declare const setDateTimeForTests: (dateTime: string) => void;
|
|
5
5
|
export declare const getDateTime: () => string;
|
|
@@ -186,7 +186,6 @@ export declare const isShallowEqual: <T extends Record<string, any>, I extends k
|
|
|
186
186
|
export declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E) => void) | undefined, ourEventHandler?: ((event: E) => void) | undefined, { checkForDefaultPrevented }?: {
|
|
187
187
|
checkForDefaultPrevented?: boolean | undefined;
|
|
188
188
|
}) => (event: E) => void;
|
|
189
|
-
export declare const isOnlyExportingSingleFrame: (elements: readonly NonDeletedExcalidrawElement[]) => boolean;
|
|
190
189
|
/**
|
|
191
190
|
* supply `null` as message if non-never value is valid, you just need to
|
|
192
191
|
* typecheck against it
|
|
@@ -202,3 +201,4 @@ export declare const isRenderThrottlingEnabled: () => boolean;
|
|
|
202
201
|
/** Checks if value is inside given collection. Useful for type-safety. */
|
|
203
202
|
export declare const isMemberOf: <T extends string>(collection: Set<T> | Record<T, any> | Map<T, any> | readonly T[], value: string) => value is T;
|
|
204
203
|
export declare const cloneJSON: <T>(obj: T) => T;
|
|
204
|
+
export declare const isFiniteNumber: (value: any) => value is number;
|