@excalidraw/excalidraw 0.17.0-a528769 → 0.17.0-fe75f29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/excalidraw-assets-dev/{vendor-18203854dd3b1fb2cc41.js → vendor-2466bf62a35e940e8f28.js} +2 -2
- package/dist/excalidraw-with-preact.development.js +371 -74
- package/dist/excalidraw-with-preact.production.min.js +1 -1
- 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 +110 -22
- 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 +6 -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 +11 -3
- 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 +29 -2
- package/types/frame.d.ts +21 -20
- package/types/packages/excalidraw/index.d.ts +2 -0
- package/types/packages/utils.d.ts +2 -2
- 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/components/MermaidToExcalidraw.d.ts +0 -3
- /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-18203854dd3b1fb2cc41.d.ts → vendor-2466bf62a35e940e8f28.d.ts} +0 -0
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;
|
|
@@ -84,6 +85,26 @@ export type ExcalidrawEmbeddableElement = _ExcalidrawElementBase & Readonly<{
|
|
|
84
85
|
*/
|
|
85
86
|
validated: boolean | null;
|
|
86
87
|
}>;
|
|
88
|
+
export type ExcalidrawIframeElement = _ExcalidrawElementBase & Readonly<{
|
|
89
|
+
type: "iframe";
|
|
90
|
+
customData?: {
|
|
91
|
+
generationData?: MagicCacheData;
|
|
92
|
+
};
|
|
93
|
+
}>;
|
|
94
|
+
export type ExcalidrawIframeLikeElement = ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
|
|
95
|
+
export type IframeData = ({
|
|
96
|
+
intrinsicSize: {
|
|
97
|
+
w: number;
|
|
98
|
+
h: number;
|
|
99
|
+
};
|
|
100
|
+
warning?: string;
|
|
101
|
+
} & ({
|
|
102
|
+
type: "video" | "generic";
|
|
103
|
+
link: string;
|
|
104
|
+
} | {
|
|
105
|
+
type: "document";
|
|
106
|
+
srcdoc: (theme: Theme) => string;
|
|
107
|
+
}));
|
|
87
108
|
export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
|
|
88
109
|
type: "image";
|
|
89
110
|
fileId: FileId | null;
|
|
@@ -97,6 +118,11 @@ export type ExcalidrawFrameElement = _ExcalidrawElementBase & {
|
|
|
97
118
|
type: "frame";
|
|
98
119
|
name: string | null;
|
|
99
120
|
};
|
|
121
|
+
export type ExcalidrawMagicFrameElement = _ExcalidrawElementBase & {
|
|
122
|
+
type: "magicframe";
|
|
123
|
+
name: string | null;
|
|
124
|
+
};
|
|
125
|
+
export type ExcalidrawFrameLikeElement = ExcalidrawFrameElement | ExcalidrawMagicFrameElement;
|
|
100
126
|
/**
|
|
101
127
|
* These are elements that don't have any additional properties.
|
|
102
128
|
*/
|
|
@@ -106,7 +132,7 @@ export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRe
|
|
|
106
132
|
* no computed data. The list of all ExcalidrawElements should be shareable
|
|
107
133
|
* between peers and contain no state local to the peer.
|
|
108
134
|
*/
|
|
109
|
-
export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawEmbeddableElement;
|
|
135
|
+
export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement;
|
|
110
136
|
export type NonDeleted<TElement extends ExcalidrawElement> = TElement & {
|
|
111
137
|
isDeleted: boolean;
|
|
112
138
|
};
|
|
@@ -129,7 +155,7 @@ export type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
|
|
|
129
155
|
_brand: "unitlessLineHeight";
|
|
130
156
|
};
|
|
131
157
|
}>;
|
|
132
|
-
export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement;
|
|
158
|
+
export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawIframeElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement | ExcalidrawMagicFrameElement;
|
|
133
159
|
export type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawArrowElement;
|
|
134
160
|
export type ExcalidrawTextElementWithContainer = {
|
|
135
161
|
containerId: ExcalidrawTextContainer["id"];
|
|
@@ -162,4 +188,5 @@ export type ExcalidrawFreeDrawElement = _ExcalidrawElementBase & Readonly<{
|
|
|
162
188
|
export type FileId = string & {
|
|
163
189
|
_brand: "FileId";
|
|
164
190
|
};
|
|
191
|
+
export type ExcalidrawElementType = ExcalidrawElement["type"];
|
|
165
192
|
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;
|
|
@@ -24,6 +24,8 @@ export { useDevice } from "../../components/App";
|
|
|
24
24
|
export { WelcomeScreen };
|
|
25
25
|
export { LiveCollaborationTrigger };
|
|
26
26
|
export { DefaultSidebar } from "../../components/DefaultSidebar";
|
|
27
|
+
export { TTDDialog } from "../../components/TTDDialog/TTDDialog";
|
|
28
|
+
export { TTDDialogTrigger } from "../../components/TTDDialog/TTDDialogTrigger";
|
|
27
29
|
export { normalizeLink } from "../../data/url";
|
|
28
30
|
export { convertToExcalidrawElements } from "../../data/transform";
|
|
29
31
|
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;
|
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;
|
|
@@ -19,6 +19,6 @@ export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElemen
|
|
|
19
19
|
frameRendering?: AppState["frameRendering"];
|
|
20
20
|
}, files: BinaryFiles | null, opts?: {
|
|
21
21
|
renderEmbeddables?: boolean;
|
|
22
|
-
exportingFrame?:
|
|
22
|
+
exportingFrame?: ExcalidrawFrameLikeElement | null;
|
|
23
23
|
}) => Promise<SVGSVGElement>;
|
|
24
24
|
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, FileId, ExcalidrawImageElement, Theme, StrokeRoundness,
|
|
2
|
+
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, 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";
|
|
@@ -58,7 +59,8 @@ export type BinaryFileData = {
|
|
|
58
59
|
};
|
|
59
60
|
export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
|
|
60
61
|
export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
|
|
61
|
-
export type ToolType = "selection" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "embeddable" | "laser";
|
|
62
|
+
export type ToolType = "selection" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser";
|
|
63
|
+
export type ElementOrToolType = ExcalidrawElementType | ToolType | "custom";
|
|
62
64
|
export type ActiveTool = {
|
|
63
65
|
type: ToolType;
|
|
64
66
|
customType: null;
|
|
@@ -103,13 +105,11 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
103
105
|
suggestedBindings: AppState["suggestedBindings"];
|
|
104
106
|
isRotating: AppState["isRotating"];
|
|
105
107
|
elementsToHighlight: AppState["elementsToHighlight"];
|
|
106
|
-
openSidebar: AppState["openSidebar"];
|
|
107
|
-
showHyperlinkPopup: AppState["showHyperlinkPopup"];
|
|
108
108
|
collaborators: AppState["collaborators"];
|
|
109
109
|
snapLines: AppState["snapLines"];
|
|
110
110
|
zenModeEnabled: AppState["zenModeEnabled"];
|
|
111
111
|
}>;
|
|
112
|
-
export
|
|
112
|
+
export interface AppState {
|
|
113
113
|
contextMenu: {
|
|
114
114
|
items: ContextMenuItems;
|
|
115
115
|
top: number;
|
|
@@ -129,7 +129,7 @@ export type AppState = {
|
|
|
129
129
|
isBindingEnabled: boolean;
|
|
130
130
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
131
131
|
suggestedBindings: SuggestedBinding[];
|
|
132
|
-
frameToHighlight: NonDeleted<
|
|
132
|
+
frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
133
133
|
frameRendering: {
|
|
134
134
|
enabled: boolean;
|
|
135
135
|
name: boolean;
|
|
@@ -182,7 +182,15 @@ export type AppState = {
|
|
|
182
182
|
name: SidebarName;
|
|
183
183
|
tab?: SidebarTabName;
|
|
184
184
|
} | null;
|
|
185
|
-
openDialog:
|
|
185
|
+
openDialog: null | {
|
|
186
|
+
name: "imageExport" | "help" | "jsonExport";
|
|
187
|
+
} | {
|
|
188
|
+
name: "magicSettings";
|
|
189
|
+
source: "tool" | "generation" | "settings";
|
|
190
|
+
} | {
|
|
191
|
+
name: "ttd";
|
|
192
|
+
tab: string;
|
|
193
|
+
};
|
|
186
194
|
/**
|
|
187
195
|
* Reflects user preference for whether the default sidebar should be docked.
|
|
188
196
|
*
|
|
@@ -241,7 +249,7 @@ export type AppState = {
|
|
|
241
249
|
y: number;
|
|
242
250
|
} | null;
|
|
243
251
|
objectsSnapModeEnabled: boolean;
|
|
244
|
-
}
|
|
252
|
+
}
|
|
245
253
|
export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
|
|
246
254
|
export type NormalizedZoomValue = number & {
|
|
247
255
|
_brand: "normalizedZoom";
|
|
@@ -325,6 +333,7 @@ export interface ExcalidrawProps {
|
|
|
325
333
|
children?: React.ReactNode;
|
|
326
334
|
validateEmbeddable?: boolean | string[] | RegExp | RegExp[] | ((link: string) => boolean | undefined);
|
|
327
335
|
renderEmbeddable?: (element: NonDeleted<ExcalidrawEmbeddableElement>, appState: AppState) => JSX.Element | null;
|
|
336
|
+
aiEnabled?: boolean;
|
|
328
337
|
}
|
|
329
338
|
export type SceneData = {
|
|
330
339
|
elements?: ImportedDataState["elements"];
|
|
@@ -370,6 +379,7 @@ export type AppProps = Merge<ExcalidrawProps, {
|
|
|
370
379
|
handleKeyboardGlobally: boolean;
|
|
371
380
|
isCollaborating: boolean;
|
|
372
381
|
children?: React.ReactNode;
|
|
382
|
+
aiEnabled: boolean;
|
|
373
383
|
}>;
|
|
374
384
|
/** A subset of App class properties that we need to use elsewhere
|
|
375
385
|
* in the app, eg Manager. Factored out into a separate type to keep DRY. */
|
|
@@ -398,6 +408,8 @@ export type AppClassProperties = {
|
|
|
398
408
|
togglePenMode: App["togglePenMode"];
|
|
399
409
|
setActiveTool: App["setActiveTool"];
|
|
400
410
|
setOpenDialog: App["setOpenDialog"];
|
|
411
|
+
insertEmbeddableElement: App["insertEmbeddableElement"];
|
|
412
|
+
onMagicframeToolSelect: App["onMagicframeToolSelect"];
|
|
401
413
|
};
|
|
402
414
|
export type PointerDownState = Readonly<{
|
|
403
415
|
origin: Readonly<{
|
|
@@ -471,6 +483,7 @@ export type ExcalidrawImperativeAPI = {
|
|
|
471
483
|
getSceneElements: InstanceType<typeof App>["getSceneElements"];
|
|
472
484
|
getAppState: () => InstanceType<typeof App>["state"];
|
|
473
485
|
getFiles: () => InstanceType<typeof App>["files"];
|
|
486
|
+
registerAction: (action: Action) => void;
|
|
474
487
|
refresh: InstanceType<typeof App>["refresh"];
|
|
475
488
|
setToast: InstanceType<typeof App>["setToast"];
|
|
476
489
|
addFiles: (data: BinaryFileData[]) => void;
|
|
@@ -508,10 +521,10 @@ type FrameNameBounds = {
|
|
|
508
521
|
angle: number;
|
|
509
522
|
};
|
|
510
523
|
export type FrameNameBoundsCache = {
|
|
511
|
-
get: (frameElement:
|
|
524
|
+
get: (frameElement: ExcalidrawFrameLikeElement | ExcalidrawMagicFrameElement) => FrameNameBounds | null;
|
|
512
525
|
_cache: Map<string, FrameNameBounds & {
|
|
513
526
|
zoom: AppState["zoom"]["value"];
|
|
514
|
-
versionNonce:
|
|
527
|
+
versionNonce: ExcalidrawFrameLikeElement["versionNonce"];
|
|
515
528
|
}>;
|
|
516
529
|
};
|
|
517
530
|
export type KeyboardModifiersObject = {
|
|
@@ -521,4 +534,5 @@ export type KeyboardModifiersObject = {
|
|
|
521
534
|
metaKey: boolean;
|
|
522
535
|
};
|
|
523
536
|
export type Primitive = number | string | boolean | bigint | symbol | null | undefined;
|
|
537
|
+
export type JSONValue = string | number | boolean | null | object;
|
|
524
538
|
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;
|