@excalidraw/excalidraw 0.17.0-7284-25ea35d → 0.17.0-c7ee46e
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 +20 -15
- package/dist/excalidraw-assets/locales/{gl-ES-json-d11c7966c3c2f95756e0.js → gl-ES-json-95041caf90ef2a7e8a53.js} +1 -1
- package/dist/excalidraw-assets-dev/{vendor-06d9b385f406ee409106.js → vendor-37ba5d021227533892ee.js} +2 -2
- package/dist/excalidraw-with-preact.development.js +182 -50
- package/dist/excalidraw-with-preact.production.min.js +1 -1
- package/dist/excalidraw.development.js +182 -50
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +6 -6
- package/types/actions/actionBoundText.d.ts +4 -4
- package/types/actions/actionCanvas.d.ts +22 -22
- package/types/actions/actionClipboard.d.ts +14 -14
- package/types/actions/actionDeleteSelected.d.ts +6 -6
- package/types/actions/actionElementLock.d.ts +4 -4
- package/types/actions/actionExport.d.ts +22 -22
- package/types/actions/actionFinalize.d.ts +4 -4
- package/types/actions/actionFrame.d.ts +6 -6
- package/types/actions/actionGroup.d.ts +4 -4
- package/types/actions/actionLinearEditor.d.ts +2 -2
- package/types/actions/actionMenu.d.ts +5 -5
- package/types/actions/actionProperties.d.ts +26 -26
- package/types/actions/actionSelectAll.d.ts +2 -2
- package/types/actions/actionStyles.d.ts +2 -2
- package/types/actions/actionToggleGridMode.d.ts +2 -2
- package/types/actions/actionToggleObjectsSnapMode.d.ts +2 -2
- package/types/actions/actionToggleStats.d.ts +2 -2
- package/types/actions/actionToggleViewMode.d.ts +2 -2
- package/types/actions/actionToggleZenMode.d.ts +2 -2
- package/types/appState.d.ts +2 -2
- package/types/components/App.d.ts +27 -6
- 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/TextField.d.ts +16 -0
- package/types/components/icons.d.ts +5 -0
- package/types/constants.d.ts +24 -2
- 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 +2 -2
- package/types/element/collision.d.ts +2 -2
- package/types/element/embeddable.d.ts +8 -21
- package/types/element/index.d.ts +3 -4
- package/types/element/linearElementEditor.d.ts +3 -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/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 +16 -10
- package/types/utils.d.ts +1 -2
- /package/types/packages/excalidraw/dist/excalidraw-assets/locales/{gl-ES-json-d11c7966c3c2f95756e0.d.ts → gl-ES-json-95041caf90ef2a7e8a53.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-06d9b385f406ee409106.d.ts → vendor-37ba5d021227533892ee.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementConstructorOpts } from "../element/newElement";
|
|
2
|
-
import { ExcalidrawBindableElement, ExcalidrawElement,
|
|
2
|
+
import { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawIframeLikeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawMagicFrameElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, TextAlign, VerticalAlign } from "../element/types";
|
|
3
3
|
import { MarkOptional } from "../utility-types";
|
|
4
4
|
export type ValidLinearElement = {
|
|
5
5
|
type: "arrow" | "line";
|
|
@@ -13,11 +13,11 @@ export type ValidLinearElement = {
|
|
|
13
13
|
verticalAlign?: VerticalAlign;
|
|
14
14
|
} & MarkOptional<ElementConstructorOpts, "x" | "y">;
|
|
15
15
|
end?: (({
|
|
16
|
-
type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
|
|
16
|
+
type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "magicframe" | "embeddable" | "iframe">;
|
|
17
17
|
id?: ExcalidrawGenericElement["id"];
|
|
18
18
|
} | {
|
|
19
19
|
id: ExcalidrawGenericElement["id"];
|
|
20
|
-
type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
|
|
20
|
+
type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "magicframe" | "embeddable" | "iframe">;
|
|
21
21
|
}) | (({
|
|
22
22
|
type: "text";
|
|
23
23
|
text: string;
|
|
@@ -27,11 +27,11 @@ export type ValidLinearElement = {
|
|
|
27
27
|
text: string;
|
|
28
28
|
}) & Partial<ExcalidrawTextElement>)) & MarkOptional<ElementConstructorOpts, "x" | "y">;
|
|
29
29
|
start?: (({
|
|
30
|
-
type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
|
|
30
|
+
type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "magicframe" | "embeddable" | "iframe">;
|
|
31
31
|
id?: ExcalidrawGenericElement["id"];
|
|
32
32
|
} | {
|
|
33
33
|
id: ExcalidrawGenericElement["id"];
|
|
34
|
-
type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
|
|
34
|
+
type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "magicframe" | "embeddable" | "iframe">;
|
|
35
35
|
}) | (({
|
|
36
36
|
type: "text";
|
|
37
37
|
text: string;
|
|
@@ -52,7 +52,7 @@ export type ValidContainer = {
|
|
|
52
52
|
verticalAlign?: VerticalAlign;
|
|
53
53
|
} & MarkOptional<ElementConstructorOpts, "x" | "y">;
|
|
54
54
|
} & ElementConstructorOpts;
|
|
55
|
-
export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, ExcalidrawSelectionElement>,
|
|
55
|
+
export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, ExcalidrawIframeLikeElement | ExcalidrawFreeDrawElement> | ({
|
|
56
56
|
type: Extract<ExcalidrawLinearElement["type"], "line">;
|
|
57
57
|
x: number;
|
|
58
58
|
y: number;
|
|
@@ -71,7 +71,11 @@ export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, Excal
|
|
|
71
71
|
type: "frame";
|
|
72
72
|
children: readonly ExcalidrawElement["id"][];
|
|
73
73
|
name?: string;
|
|
74
|
-
} & Partial<ExcalidrawFrameElement>)
|
|
74
|
+
} & Partial<ExcalidrawFrameElement>) | ({
|
|
75
|
+
type: "magicframe";
|
|
76
|
+
children: readonly ExcalidrawElement["id"][];
|
|
77
|
+
name?: string;
|
|
78
|
+
} & Partial<ExcalidrawMagicFrameElement>);
|
|
75
79
|
export declare const convertToExcalidrawElements: (elementsSkeleton: ExcalidrawElementSkeleton[] | null, opts?: {
|
|
76
80
|
regenerateIds: boolean;
|
|
77
81
|
}) => ExcalidrawElement[];
|
|
@@ -39,7 +39,7 @@ export declare const actionLink: {
|
|
|
39
39
|
isBindingEnabled: boolean;
|
|
40
40
|
startBoundElement: import("./types").NonDeleted<import("./types").ExcalidrawBindableElement> | null;
|
|
41
41
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
42
|
-
frameToHighlight: import("./types").NonDeleted<import("./types").
|
|
42
|
+
frameToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawFrameLikeElement> | null;
|
|
43
43
|
frameRendering: {
|
|
44
44
|
enabled: boolean;
|
|
45
45
|
name: boolean;
|
|
@@ -89,7 +89,7 @@ export declare const actionLink: {
|
|
|
89
89
|
name: string;
|
|
90
90
|
tab?: string | undefined;
|
|
91
91
|
} | null;
|
|
92
|
-
openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
|
|
92
|
+
openDialog: "mermaid" | "magicSettings" | "imageExport" | "help" | "jsonExport" | null;
|
|
93
93
|
defaultSidebarDockedPreference: boolean;
|
|
94
94
|
lastPointerDownWith: import("./types").PointerType;
|
|
95
95
|
selectedElementIds: Readonly<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as GA from "../ga";
|
|
2
|
-
import { NonDeletedExcalidrawElement, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawRectangleElement,
|
|
2
|
+
import { NonDeletedExcalidrawElement, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawRectangleElement, ExcalidrawDiamondElement, ExcalidrawTextElement, ExcalidrawEllipseElement, NonDeleted, ExcalidrawImageElement, ExcalidrawFrameLikeElement, ExcalidrawIframeLikeElement } from "./types";
|
|
3
3
|
import { FrameNameBoundsCache, Point } from "../types";
|
|
4
4
|
import { AppState } from "../types";
|
|
5
5
|
export declare const hitTest: (element: NonDeletedExcalidrawElement, appState: AppState, frameNameBoundsCache: FrameNameBoundsCache, x: number, y: number) => boolean;
|
|
@@ -18,4 +18,4 @@ export declare const determineFocusPoint: (element: ExcalidrawBindableElement, f
|
|
|
18
18
|
export declare const intersectElementWithLine: (element: ExcalidrawBindableElement, a: readonly [number, number], b: readonly [number, number], gap?: number) => Point[];
|
|
19
19
|
export declare const getCircleIntersections: (center: readonly [number, number, number, number, number, number, number, number], radius: number, line: readonly [number, number, number, number, number, number, number, number]) => GA.Point[];
|
|
20
20
|
export declare const findFocusPointForEllipse: (ellipse: ExcalidrawEllipseElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
|
|
21
|
-
export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawDiamondElement | ExcalidrawTextElement |
|
|
21
|
+
export declare const findFocusPointForRectangulars: (element: ExcalidrawRectangleElement | ExcalidrawImageElement | ExcalidrawDiamondElement | ExcalidrawTextElement | ExcalidrawIframeLikeElement | ExcalidrawFrameLikeElement, relativeDistance: number, point: readonly [number, number, number, number, number, number, number, number]) => readonly [number, number, number, number, number, number, number, number];
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
import { ExcalidrawProps } from "../types";
|
|
2
|
-
import { ExcalidrawElement,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
warning?: string;
|
|
9
|
-
} & ({
|
|
10
|
-
type: "video" | "generic";
|
|
11
|
-
link: string;
|
|
12
|
-
} | {
|
|
13
|
-
type: "document";
|
|
14
|
-
srcdoc: (theme: Theme) => string;
|
|
15
|
-
})) | null;
|
|
16
|
-
export declare const getEmbedLink: (link: string | null | undefined) => EmbeddedLink;
|
|
17
|
-
export declare const isEmbeddableOrLabel: (element: NonDeletedExcalidrawElement) => Boolean;
|
|
18
|
-
export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawEmbeddableElement) => ExcalidrawElement;
|
|
2
|
+
import { ExcalidrawElement, ExcalidrawIframeLikeElement, IframeData, NonDeletedExcalidrawElement } from "./types";
|
|
3
|
+
export declare const createSrcDoc: (body: string) => string;
|
|
4
|
+
export declare const getEmbedLink: (link: string | null | undefined) => IframeData | null;
|
|
5
|
+
export declare const isIframeLikeOrItsLabel: (element: NonDeletedExcalidrawElement) => Boolean;
|
|
6
|
+
export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawIframeLikeElement) => ExcalidrawElement;
|
|
19
7
|
export declare const actionSetEmbeddableAsActiveTool: {
|
|
20
8
|
name: "setEmbeddableAsActiveTool";
|
|
21
9
|
trackEvent: {
|
|
@@ -47,7 +35,7 @@ export declare const actionSetEmbeddableAsActiveTool: {
|
|
|
47
35
|
isBindingEnabled: boolean;
|
|
48
36
|
startBoundElement: import("./types").NonDeleted<import("./types").ExcalidrawBindableElement> | null;
|
|
49
37
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
50
|
-
frameToHighlight: import("./types").NonDeleted<import("./types").
|
|
38
|
+
frameToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawFrameLikeElement> | null;
|
|
51
39
|
frameRendering: {
|
|
52
40
|
enabled: boolean;
|
|
53
41
|
name: boolean;
|
|
@@ -94,7 +82,7 @@ export declare const actionSetEmbeddableAsActiveTool: {
|
|
|
94
82
|
name: string;
|
|
95
83
|
tab?: string | undefined;
|
|
96
84
|
} | null;
|
|
97
|
-
openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
|
|
85
|
+
openDialog: "mermaid" | "magicSettings" | "imageExport" | "help" | "jsonExport" | null;
|
|
98
86
|
defaultSidebarDockedPreference: boolean;
|
|
99
87
|
lastPointerDownWith: import("./types").PointerType;
|
|
100
88
|
selectedElementIds: Readonly<{
|
|
@@ -111,7 +99,7 @@ export declare const actionSetEmbeddableAsActiveTool: {
|
|
|
111
99
|
duration?: number | undefined;
|
|
112
100
|
} | null;
|
|
113
101
|
zenModeEnabled: boolean;
|
|
114
|
-
theme: Theme;
|
|
102
|
+
theme: import("./types").Theme;
|
|
115
103
|
gridSize: number | null;
|
|
116
104
|
viewModeEnabled: boolean;
|
|
117
105
|
selectedGroupIds: {
|
|
@@ -150,4 +138,3 @@ export declare const actionSetEmbeddableAsActiveTool: {
|
|
|
150
138
|
};
|
|
151
139
|
export declare const extractSrc: (htmlString: string) => string;
|
|
152
140
|
export declare const embeddableURLValidator: (url: string | null | undefined, validateEmbeddable: ExcalidrawProps["validateEmbeddable"]) => boolean;
|
|
153
|
-
export {};
|
package/types/element/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted
|
|
1
|
+
import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted } from "./types";
|
|
2
2
|
export { newElement, newTextElement, updateTextElement, refreshTextDimensions, newLinearElement, newImageElement, duplicateElement, } from "./newElement";
|
|
3
3
|
export { getElementAbsoluteCoords, getElementBounds, getCommonBounds, getDiamondPoints, getArrowheadPoints, getClosestElementBounds, } from "./bounds";
|
|
4
4
|
export { OMIT_SIDES_FOR_MULTIPLE_ELEMENTS, getTransformHandlesFromCoords, getTransformHandles, } from "./transformHandles";
|
|
@@ -6,15 +6,14 @@ export { hitTest, isHittingElementBoundingBoxWithoutHittingElement, } from "./co
|
|
|
6
6
|
export { resizeTest, getCursorForResizingElement, getElementWithTransformHandleType, getTransformHandleTypeFromCoords, } from "./resizeTest";
|
|
7
7
|
export { transformElements, getResizeOffsetXY, getResizeArrowDirection, } from "./resizeElements";
|
|
8
8
|
export { dragSelectedElements, getDragOffsetXY, dragNewElement, } from "./dragElements";
|
|
9
|
-
export { isTextElement, isExcalidrawElement
|
|
9
|
+
export { isTextElement, isExcalidrawElement } from "./typeChecks";
|
|
10
10
|
export { textWysiwyg } from "./textWysiwyg";
|
|
11
11
|
export { redrawTextBoundingBox } from "./textElement";
|
|
12
12
|
export { getPerfectElementSize, getLockedLinearCursorAlignSize, isInvisiblySmallElement, resizePerfectLineForNWHandler, getNormalizedDimensions, } from "./sizeHelpers";
|
|
13
13
|
export { showSelectedShapeActions } from "./showSelectedShapeActions";
|
|
14
14
|
export declare const getSceneVersion: (elements: readonly ExcalidrawElement[]) => number;
|
|
15
15
|
export declare const getVisibleElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
|
|
16
|
-
export declare const getNonDeletedElements: (elements: readonly
|
|
17
|
-
export declare const getNonDeletedFrames: (frames: readonly ExcalidrawFrameElement[]) => readonly NonDeleted<ExcalidrawFrameElement>[];
|
|
16
|
+
export declare const getNonDeletedElements: <T extends ExcalidrawElement>(elements: readonly T[]) => readonly NonDeleted<T>[];
|
|
18
17
|
export declare const isNonDeletedElement: <T extends ExcalidrawElement>(element: T) => element is NonDeleted<T>;
|
|
19
18
|
export declare const clearElementsForDatabase: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
20
19
|
export declare const clearElementsForExport: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
@@ -126,7 +126,7 @@ export declare class LinearElementEditor {
|
|
|
126
126
|
contextMenu: {
|
|
127
127
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
128
128
|
top: number;
|
|
129
|
-
left: number;
|
|
129
|
+
left: number; /** @returns whether point was dragged */
|
|
130
130
|
} | null;
|
|
131
131
|
showWelcomeScreen: boolean;
|
|
132
132
|
isLoading: boolean;
|
|
@@ -142,7 +142,7 @@ export declare class LinearElementEditor {
|
|
|
142
142
|
isBindingEnabled: boolean;
|
|
143
143
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
144
144
|
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
145
|
-
frameToHighlight: NonDeleted<import("./types").
|
|
145
|
+
frameToHighlight: NonDeleted<import("./types").ExcalidrawFrameLikeElement> | null;
|
|
146
146
|
frameRendering: {
|
|
147
147
|
enabled: boolean;
|
|
148
148
|
name: boolean;
|
|
@@ -192,7 +192,7 @@ export declare class LinearElementEditor {
|
|
|
192
192
|
name: string;
|
|
193
193
|
tab?: string | undefined;
|
|
194
194
|
} | null;
|
|
195
|
-
openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
|
|
195
|
+
openDialog: "mermaid" | "magicSettings" | "imageExport" | "help" | "jsonExport" | null;
|
|
196
196
|
defaultSidebarDockedPreference: boolean;
|
|
197
197
|
lastPointerDownWith: import("./types").PointerType;
|
|
198
198
|
selectedElementIds: Readonly<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement } from "../element/types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement } from "../element/types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
3
|
import { MarkOptional, Mutable } from "../utility-types";
|
|
4
4
|
export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity">;
|
|
@@ -9,9 +9,15 @@ export declare const newEmbeddableElement: (opts: {
|
|
|
9
9
|
type: "embeddable";
|
|
10
10
|
validated: ExcalidrawEmbeddableElement["validated"];
|
|
11
11
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawEmbeddableElement>;
|
|
12
|
+
export declare const newIframeElement: (opts: {
|
|
13
|
+
type: "iframe";
|
|
14
|
+
} & ElementConstructorOpts) => NonDeleted<ExcalidrawIframeElement>;
|
|
12
15
|
export declare const newFrameElement: (opts: {
|
|
13
16
|
name?: string;
|
|
14
17
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawFrameElement>;
|
|
18
|
+
export declare const newMagicFrameElement: (opts: {
|
|
19
|
+
name?: string;
|
|
20
|
+
} & ElementConstructorOpts) => NonDeleted<ExcalidrawMagicFrameElement>;
|
|
15
21
|
export declare const newTextElement: (opts: {
|
|
16
22
|
text: string;
|
|
17
23
|
fontSize?: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawElementType, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./types";
|
|
2
2
|
import { MaybeTransformHandleType } from "./transformHandles";
|
|
3
3
|
import { AppState } from "../types";
|
|
4
4
|
import { ExtractSetType } from "../utility-types";
|
|
@@ -66,7 +66,7 @@ export declare const suppportsHorizontalAlign: (selectedElements: NonDeletedExca
|
|
|
66
66
|
export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], appState: AppState, x: number, y: number) => ExcalidrawTextContainer | null;
|
|
67
67
|
declare const VALID_CONTAINER_TYPES: Set<string>;
|
|
68
68
|
export declare const isValidTextContainer: (element: {
|
|
69
|
-
type:
|
|
69
|
+
type: ExcalidrawElementType;
|
|
70
70
|
}) => boolean;
|
|
71
71
|
export declare const computeContainerDimensionForBoundText: (dimension: number, containerType: ExtractSetType<typeof VALID_CONTAINER_TYPES>) => number;
|
|
72
72
|
export declare const getBoundTextMaxWidth: (container: ExcalidrawElement, boundTextElement?: ExcalidrawTextElement | null) => number;
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementOrToolType } from "../types";
|
|
2
2
|
import { MarkNonNullable } from "../utility-types";
|
|
3
|
-
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement,
|
|
4
|
-
export declare const isGenericElement: (element: ExcalidrawElement | null) => element is ExcalidrawGenericElement;
|
|
3
|
+
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeElement, ExcalidrawIframeLikeElement, ExcalidrawMagicFrameElement } from "./types";
|
|
5
4
|
export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
|
|
6
5
|
export declare const isImageElement: (element: ExcalidrawElement | null) => element is ExcalidrawImageElement;
|
|
7
6
|
export declare const isEmbeddableElement: (element: ExcalidrawElement | null | undefined) => element is ExcalidrawEmbeddableElement;
|
|
7
|
+
export declare const isIframeElement: (element: ExcalidrawElement | null) => element is ExcalidrawIframeElement;
|
|
8
|
+
export declare const isIframeLikeElement: (element: ExcalidrawElement | null) => element is ExcalidrawIframeLikeElement;
|
|
8
9
|
export declare const isTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawTextElement;
|
|
9
10
|
export declare const isFrameElement: (element: ExcalidrawElement | null) => element is ExcalidrawFrameElement;
|
|
11
|
+
export declare const isMagicFrameElement: (element: ExcalidrawElement | null) => element is ExcalidrawMagicFrameElement;
|
|
12
|
+
export declare const isFrameLikeElement: (element: ExcalidrawElement | null) => element is ExcalidrawFrameLikeElement;
|
|
10
13
|
export declare const isFreeDrawElement: (element?: ExcalidrawElement | null) => element is ExcalidrawFreeDrawElement;
|
|
11
|
-
export declare const isFreeDrawElementType: (elementType:
|
|
14
|
+
export declare const isFreeDrawElementType: (elementType: ExcalidrawElementType) => boolean;
|
|
12
15
|
export declare const isLinearElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLinearElement;
|
|
13
16
|
export declare const isArrowElement: (element?: ExcalidrawElement | null) => element is ExcalidrawLinearElement;
|
|
14
|
-
export declare const isLinearElementType: (elementType:
|
|
17
|
+
export declare const isLinearElementType: (elementType: ElementOrToolType) => boolean;
|
|
15
18
|
export declare const isBindingElement: (element?: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawLinearElement;
|
|
16
|
-
export declare const isBindingElementType: (elementType:
|
|
19
|
+
export declare const isBindingElementType: (elementType: ElementOrToolType) => boolean;
|
|
17
20
|
export declare const isBindableElement: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawBindableElement;
|
|
18
21
|
export declare const isTextBindableContainer: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawTextContainer;
|
|
19
22
|
export declare const isExcalidrawElement: (element: any) => element is ExcalidrawElement;
|
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;
|
|
@@ -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;
|