@excalidraw/excalidraw 0.15.2-6546-eae7ba2 → 0.15.2-6546-3398d86
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 +19 -0
- package/dist/excalidraw-assets/locales/{es-ES-json-f2467c6a875a9e288756.js → es-ES-json-4f3da97feff33cb00e6d.js} +1 -1
- package/dist/excalidraw-assets/locales/{hi-IN-json-e22f4ad73126c2971850.js → hi-IN-json-3898c9c1216b44476529.js} +1 -1
- package/dist/excalidraw-assets/locales/{id-ID-json-0e69caf5d919807ed234.js → id-ID-json-43d505d7071a0e359681.js} +1 -1
- package/dist/excalidraw-assets/locales/{kk-KZ-json-106d2a41c68f69765668.js → kk-KZ-json-f648362328b839e9313f.js} +1 -1
- package/dist/excalidraw-assets/locales/{pa-IN-json-0fd029451b07248c5194.js → pa-IN-json-d9ee09801ed220840b2b.js} +1 -1
- package/dist/excalidraw-assets/{vendor-53d1c69ef585b6dd219b.js → vendor-ef3c5d81a00ef582b871.js} +2 -2
- package/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.js → vendor-a14cd58fa2db417e42b2.js} +6 -6
- package/dist/excalidraw.development.js +2163 -2119
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +15 -0
- package/package.json +7 -2
- package/types/actions/actionAddToLibrary.d.ts +21 -10
- package/types/actions/actionAlign.d.ts +0 -1
- package/types/actions/actionBoundText.d.ts +14 -7
- package/types/actions/actionCanvas.d.ts +76 -39
- package/types/actions/actionClipboard.d.ts +32 -16
- package/types/actions/actionDeleteSelected.d.ts +18 -10
- package/types/actions/actionDistribute.d.ts +0 -1
- package/types/actions/actionDuplicateSelection.d.ts +0 -1
- package/types/actions/actionElementLock.d.ts +14 -7
- package/types/actions/actionExport.d.ts +71 -35
- package/types/actions/actionFinalize.d.ts +11 -7
- package/types/actions/actionFlip.d.ts +0 -1
- package/types/actions/actionFrame.d.ts +21 -10
- package/types/actions/actionGroup.d.ts +0 -1
- package/types/actions/actionLinearEditor.d.ts +7 -4
- package/types/actions/actionMenu.d.ts +21 -10
- package/types/actions/actionProperties.d.ts +91 -40
- package/types/actions/actionSelectAll.d.ts +0 -1
- package/types/actions/actionStyles.d.ts +7 -4
- package/types/actions/actionToggleGridMode.d.ts +7 -4
- package/types/actions/actionToggleStats.d.ts +7 -4
- package/types/actions/actionToggleViewMode.d.ts +7 -4
- package/types/actions/actionToggleZenMode.d.ts +7 -4
- package/types/actions/types.d.ts +1 -1
- package/types/appState.d.ts +3 -3
- package/types/clipboard.d.ts +1 -2
- package/types/colors.d.ts +9 -9
- package/types/components/App.d.ts +10 -0
- package/types/components/Button.d.ts +0 -1
- package/types/components/Card.d.ts +0 -1
- package/types/components/ColorPicker/keyboardNavHandlers.d.ts +0 -1
- package/types/components/DefaultSidebar.d.ts +0 -1
- package/types/components/EyeDropper.d.ts +0 -1
- package/types/components/LibraryMenuHeaderContent.d.ts +0 -1
- package/types/components/LibraryUnit.d.ts +0 -1
- package/types/components/LoadingMessage.d.ts +0 -1
- package/types/components/Section.d.ts +1 -1
- package/types/components/Sidebar/SidebarTab.d.ts +0 -1
- package/types/components/Sidebar/SidebarTabTrigger.d.ts +0 -1
- package/types/components/Sidebar/SidebarTabTriggers.d.ts +0 -1
- package/types/components/Sidebar/SidebarTabs.d.ts +0 -1
- package/types/components/Stack.d.ts +2 -2
- package/types/components/Trans.d.ts +2 -1
- package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +0 -1
- package/types/components/icons.d.ts +1 -0
- package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -1
- package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -1
- package/types/components/welcome-screen/WelcomeScreen.d.ts +0 -1
- package/types/constants.d.ts +16 -3
- package/types/data/transform.d.ts +7 -11
- package/types/data/url.d.ts +5 -0
- package/types/element/Hyperlink.d.ts +16 -7
- package/types/element/collision.d.ts +2 -2
- package/types/element/embeddable.d.ts +153 -0
- package/types/element/linearElementEditor.d.ts +8 -5
- package/types/element/newElement.d.ts +5 -2
- package/types/element/textElement.d.ts +4 -7
- package/types/element/transformHandles.d.ts +1 -1
- package/types/element/typeChecks.d.ts +2 -1
- package/types/element/types.d.ts +13 -2
- package/types/hooks/useOutsideClick.d.ts +0 -1
- package/types/hooks/useScrollPosition.d.ts +0 -1
- package/types/i18n.d.ts +5 -2
- package/types/keys.d.ts +1 -0
- package/types/packages/excalidraw/example/initialData.d.ts +2 -1
- package/types/packages/excalidraw/webpack.dev.config.d.ts +5 -2
- package/types/packages/excalidraw/webpack.prod.config.d.ts +3 -0
- package/types/packages/utils.d.ts +2 -1
- package/types/renderer/renderElement.d.ts +1 -1
- package/types/renderer/renderScene.d.ts +2 -1
- package/types/scene/export.d.ts +1 -0
- package/types/types.d.ts +9 -3
- package/types/utility-types.d.ts +1 -1
- package/types/utils.d.ts +2 -1
- /package/dist/excalidraw-assets/{vendor-53d1c69ef585b6dd219b.js.LICENSE.txt → vendor-ef3c5d81a00ef582b871.js.LICENSE.txt} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/locales/{es-ES-json-f2467c6a875a9e288756.d.ts → es-ES-json-4f3da97feff33cb00e6d.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/locales/{hi-IN-json-e22f4ad73126c2971850.d.ts → hi-IN-json-3898c9c1216b44476529.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/locales/{id-ID-json-0e69caf5d919807ed234.d.ts → id-ID-json-43d505d7071a0e359681.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/locales/{kk-KZ-json-106d2a41c68f69765668.d.ts → kk-KZ-json-f648362328b839e9313f.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/locales/{pa-IN-json-0fd029451b07248c5194.d.ts → pa-IN-json-d9ee09801ed220840b2b.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-53d1c69ef585b6dd219b.d.ts → vendor-ef3c5d81a00ef582b871.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.d.ts → vendor-a14cd58fa2db417e42b2.d.ts} +0 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { ExcalidrawProps } from "../types";
|
|
2
|
+
import { ExcalidrawElement, ExcalidrawEmbeddableElement, NonDeletedExcalidrawElement, Theme } from "./types";
|
|
3
|
+
type EmbeddedLink = ({
|
|
4
|
+
aspectRatio: {
|
|
5
|
+
w: number;
|
|
6
|
+
h: number;
|
|
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 isEmbeddableOrFrameLabel: (element: NonDeletedExcalidrawElement) => Boolean;
|
|
18
|
+
export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawEmbeddableElement) => ExcalidrawElement;
|
|
19
|
+
export declare const actionSetEmbeddableAsActiveTool: {
|
|
20
|
+
name: "setEmbeddableAsActiveTool";
|
|
21
|
+
trackEvent: {
|
|
22
|
+
category: "toolbar";
|
|
23
|
+
};
|
|
24
|
+
perform: (elements: readonly ExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, app: import("../types").AppClassProperties) => {
|
|
25
|
+
elements: readonly ExcalidrawElement[];
|
|
26
|
+
appState: {
|
|
27
|
+
activeTool: {
|
|
28
|
+
lastActiveTool: import("../types").LastActiveTool;
|
|
29
|
+
locked: boolean;
|
|
30
|
+
} & ({
|
|
31
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
32
|
+
customType: null;
|
|
33
|
+
} | {
|
|
34
|
+
type: "custom";
|
|
35
|
+
customType: string;
|
|
36
|
+
});
|
|
37
|
+
contextMenu: {
|
|
38
|
+
items: import("../components/ContextMenu").ContextMenuItems;
|
|
39
|
+
top: number;
|
|
40
|
+
left: number;
|
|
41
|
+
} | null;
|
|
42
|
+
showWelcomeScreen: boolean;
|
|
43
|
+
isLoading: boolean;
|
|
44
|
+
errorMessage: import("react").ReactNode;
|
|
45
|
+
activeEmbeddable: {
|
|
46
|
+
element: NonDeletedExcalidrawElement;
|
|
47
|
+
state: "active" | "hover";
|
|
48
|
+
} | null;
|
|
49
|
+
draggingElement: NonDeletedExcalidrawElement | null;
|
|
50
|
+
resizingElement: NonDeletedExcalidrawElement | null;
|
|
51
|
+
multiElement: import("./types").NonDeleted<import("./types").ExcalidrawLinearElement> | null;
|
|
52
|
+
selectionElement: NonDeletedExcalidrawElement | null;
|
|
53
|
+
isBindingEnabled: boolean;
|
|
54
|
+
startBoundElement: import("./types").NonDeleted<import("./types").ExcalidrawBindableElement> | null;
|
|
55
|
+
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
56
|
+
frameToHighlight: import("./types").NonDeleted<import("./types").ExcalidrawFrameElement> | null;
|
|
57
|
+
frameRendering: {
|
|
58
|
+
enabled: boolean;
|
|
59
|
+
name: boolean;
|
|
60
|
+
outline: boolean;
|
|
61
|
+
clip: boolean;
|
|
62
|
+
};
|
|
63
|
+
editingFrame: string | null;
|
|
64
|
+
elementsToHighlight: import("./types").NonDeleted<ExcalidrawElement>[] | null;
|
|
65
|
+
editingElement: NonDeletedExcalidrawElement | null;
|
|
66
|
+
editingLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
67
|
+
penMode: boolean;
|
|
68
|
+
penDetected: boolean;
|
|
69
|
+
exportBackground: boolean;
|
|
70
|
+
exportEmbedScene: boolean;
|
|
71
|
+
exportWithDarkMode: boolean;
|
|
72
|
+
exportScale: number;
|
|
73
|
+
currentItemStrokeColor: string;
|
|
74
|
+
currentItemBackgroundColor: string;
|
|
75
|
+
currentItemFillStyle: import("./types").FillStyle;
|
|
76
|
+
currentItemStrokeWidth: number;
|
|
77
|
+
currentItemStrokeStyle: import("./types").StrokeStyle;
|
|
78
|
+
currentItemRoughness: number;
|
|
79
|
+
currentItemOpacity: number;
|
|
80
|
+
currentItemFontFamily: number;
|
|
81
|
+
currentItemFontSize: number;
|
|
82
|
+
currentItemTextAlign: string;
|
|
83
|
+
currentItemStartArrowhead: import("./types").Arrowhead | null;
|
|
84
|
+
currentItemEndArrowhead: import("./types").Arrowhead | null;
|
|
85
|
+
currentItemRoundness: import("./types").StrokeRoundness;
|
|
86
|
+
viewBackgroundColor: string;
|
|
87
|
+
scrollX: number;
|
|
88
|
+
scrollY: number;
|
|
89
|
+
cursorButton: "up" | "down";
|
|
90
|
+
scrolledOutside: boolean;
|
|
91
|
+
name: string;
|
|
92
|
+
isResizing: boolean;
|
|
93
|
+
isRotating: boolean;
|
|
94
|
+
zoom: Readonly<{
|
|
95
|
+
value: import("../types").NormalizedZoomValue;
|
|
96
|
+
}>;
|
|
97
|
+
openMenu: "canvas" | "shape" | null;
|
|
98
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
99
|
+
openSidebar: {
|
|
100
|
+
name: string;
|
|
101
|
+
tab?: string | undefined;
|
|
102
|
+
} | null;
|
|
103
|
+
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
104
|
+
defaultSidebarDockedPreference: boolean;
|
|
105
|
+
lastPointerDownWith: import("./types").PointerType;
|
|
106
|
+
selectedElementIds: Readonly<{
|
|
107
|
+
[id: string]: true;
|
|
108
|
+
}>;
|
|
109
|
+
previousSelectedElementIds: {
|
|
110
|
+
[id: string]: true;
|
|
111
|
+
};
|
|
112
|
+
selectedElementsAreBeingDragged: boolean;
|
|
113
|
+
shouldCacheIgnoreZoom: boolean;
|
|
114
|
+
toast: {
|
|
115
|
+
message: string;
|
|
116
|
+
closable?: boolean | undefined;
|
|
117
|
+
duration?: number | undefined;
|
|
118
|
+
} | null;
|
|
119
|
+
zenModeEnabled: boolean;
|
|
120
|
+
theme: Theme;
|
|
121
|
+
gridSize: number | null;
|
|
122
|
+
viewModeEnabled: boolean;
|
|
123
|
+
selectedGroupIds: {
|
|
124
|
+
[groupId: string]: boolean;
|
|
125
|
+
};
|
|
126
|
+
editingGroupId: string | null;
|
|
127
|
+
width: number;
|
|
128
|
+
height: number;
|
|
129
|
+
offsetTop: number;
|
|
130
|
+
offsetLeft: number;
|
|
131
|
+
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
132
|
+
collaborators: Map<string, import("../types").Collaborator>;
|
|
133
|
+
showStats: boolean;
|
|
134
|
+
currentChartType: import("./types").ChartType;
|
|
135
|
+
pasteDialog: {
|
|
136
|
+
shown: false;
|
|
137
|
+
data: null;
|
|
138
|
+
} | {
|
|
139
|
+
shown: true;
|
|
140
|
+
data: import("../charts").Spreadsheet;
|
|
141
|
+
};
|
|
142
|
+
pendingImageElementId: string | null;
|
|
143
|
+
showHyperlinkPopup: false | "editor" | "info";
|
|
144
|
+
selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
|
|
145
|
+
};
|
|
146
|
+
commitToHistory: false;
|
|
147
|
+
};
|
|
148
|
+
} & {
|
|
149
|
+
keyTest?: undefined;
|
|
150
|
+
};
|
|
151
|
+
export declare const extractSrc: (htmlString: string) => string;
|
|
152
|
+
export declare const embeddableURLValidator: (url: string | null | undefined, validateEmbeddable: ExcalidrawProps["validateEmbeddable"]) => boolean;
|
|
153
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer } from "./types";
|
|
3
2
|
import { Point, AppState, PointerCoords } from "../types";
|
|
4
3
|
import History from "../history";
|
|
@@ -131,6 +130,10 @@ export declare class LinearElementEditor {
|
|
|
131
130
|
showWelcomeScreen: boolean;
|
|
132
131
|
isLoading: boolean;
|
|
133
132
|
errorMessage: import("react").ReactNode;
|
|
133
|
+
activeEmbeddable: {
|
|
134
|
+
element: import("./types").NonDeletedExcalidrawElement;
|
|
135
|
+
state: "active" | "hover";
|
|
136
|
+
} | null;
|
|
134
137
|
draggingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
135
138
|
resizingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
136
139
|
multiElement: NonDeleted<ExcalidrawLinearElement> | null;
|
|
@@ -152,7 +155,7 @@ export declare class LinearElementEditor {
|
|
|
152
155
|
lastActiveTool: import("../types").LastActiveTool;
|
|
153
156
|
locked: boolean;
|
|
154
157
|
} & ({
|
|
155
|
-
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
158
|
+
type: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "eraser" | "hand";
|
|
156
159
|
customType: null;
|
|
157
160
|
} | {
|
|
158
161
|
type: "custom";
|
|
@@ -176,7 +179,7 @@ export declare class LinearElementEditor {
|
|
|
176
179
|
currentItemTextAlign: string;
|
|
177
180
|
currentItemStartArrowhead: import("./types").Arrowhead | null;
|
|
178
181
|
currentItemEndArrowhead: import("./types").Arrowhead | null;
|
|
179
|
-
currentItemRoundness: import("./types").StrokeRoundness;
|
|
182
|
+
currentItemRoundness: import("./types").StrokeRoundness; /** @returns whether point was dragged */
|
|
180
183
|
viewBackgroundColor: string;
|
|
181
184
|
scrollX: number;
|
|
182
185
|
scrollY: number;
|
|
@@ -211,7 +214,7 @@ export declare class LinearElementEditor {
|
|
|
211
214
|
duration?: number | undefined;
|
|
212
215
|
} | null;
|
|
213
216
|
zenModeEnabled: boolean;
|
|
214
|
-
theme:
|
|
217
|
+
theme: import("./types").Theme;
|
|
215
218
|
gridSize: number | null;
|
|
216
219
|
viewModeEnabled: boolean;
|
|
217
220
|
selectedGroupIds: {
|
|
@@ -234,7 +237,7 @@ export declare class LinearElementEditor {
|
|
|
234
237
|
data: import("../charts").Spreadsheet;
|
|
235
238
|
};
|
|
236
239
|
pendingImageElementId: string | null;
|
|
237
|
-
showHyperlinkPopup: false | "
|
|
240
|
+
showHyperlinkPopup: false | "editor" | "info";
|
|
238
241
|
selectedLinearElement: LinearElementEditor | null;
|
|
239
242
|
};
|
|
240
243
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement } from "../element/types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement } from "../element/types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
3
|
import { MarkOptional, Mutable } from "../utility-types";
|
|
4
4
|
export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity">;
|
|
5
5
|
export declare const newElement: (opts: {
|
|
6
6
|
type: ExcalidrawGenericElement["type"];
|
|
7
7
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
|
|
8
|
+
export declare const newEmbeddableElement: (opts: {
|
|
9
|
+
type: "embeddable";
|
|
10
|
+
validated: ExcalidrawEmbeddableElement["validated"];
|
|
11
|
+
} & ElementConstructorOpts) => NonDeleted<ExcalidrawEmbeddableElement>;
|
|
8
12
|
export declare const newFrameElement: (opts: ElementConstructorOpts) => NonDeleted<ExcalidrawFrameElement>;
|
|
9
13
|
export declare const newTextElement: (opts: {
|
|
10
14
|
text: string;
|
|
@@ -15,7 +19,6 @@ export declare const newTextElement: (opts: {
|
|
|
15
19
|
containerId?: ExcalidrawTextContainer["id"] | null;
|
|
16
20
|
lineHeight?: ExcalidrawTextElement["lineHeight"];
|
|
17
21
|
strokeWidth?: ExcalidrawTextElement["strokeWidth"];
|
|
18
|
-
isFrameName?: boolean;
|
|
19
22
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
|
|
20
23
|
export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, text?: string) => {
|
|
21
24
|
x: number;
|
|
@@ -6,7 +6,7 @@ export declare const normalizeText: (text: string) => string;
|
|
|
6
6
|
export declare const splitIntoLines: (text: string) => string[];
|
|
7
7
|
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
|
|
8
8
|
export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
9
|
-
export declare const handleBindTextResize: (container: NonDeletedExcalidrawElement, transformHandleType: MaybeTransformHandleType) => void;
|
|
9
|
+
export declare const handleBindTextResize: (container: NonDeletedExcalidrawElement, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean) => void;
|
|
10
10
|
export declare const computeBoundTextPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => {
|
|
11
11
|
x: number;
|
|
12
12
|
y: number;
|
|
@@ -47,10 +47,6 @@ export declare const getBoundTextElement: (element: ExcalidrawElement | null) =>
|
|
|
47
47
|
export declare const getContainerElement: (element: (ExcalidrawElement & {
|
|
48
48
|
containerId: ExcalidrawElement["id"] | null;
|
|
49
49
|
}) | null) => ExcalidrawElement | null;
|
|
50
|
-
export declare const getContainerDims: (element: ExcalidrawElement) => {
|
|
51
|
-
width: number;
|
|
52
|
-
height: number;
|
|
53
|
-
};
|
|
54
50
|
export declare const getContainerCenter: (container: ExcalidrawElement, appState: AppState) => {
|
|
55
51
|
x: number;
|
|
56
52
|
y: number;
|
|
@@ -68,14 +64,15 @@ export declare const getBoundTextElementPosition: (container: ExcalidrawElement,
|
|
|
68
64
|
export declare const shouldAllowVerticalAlign: (selectedElements: NonDeletedExcalidrawElement[]) => boolean;
|
|
69
65
|
export declare const suppportsHorizontalAlign: (selectedElements: NonDeletedExcalidrawElement[]) => boolean;
|
|
70
66
|
export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], appState: AppState, x: number, y: number) => ExcalidrawTextContainer | null;
|
|
71
|
-
|
|
67
|
+
declare const VALID_CONTAINER_TYPES: Set<string>;
|
|
72
68
|
export declare const isValidTextContainer: (element: {
|
|
73
69
|
type: ExcalidrawElement["type"];
|
|
74
70
|
}) => boolean;
|
|
75
71
|
export declare const computeContainerDimensionForBoundText: (dimension: number, containerType: ExtractSetType<typeof VALID_CONTAINER_TYPES>) => number;
|
|
76
|
-
export declare const getBoundTextMaxWidth: (container: ExcalidrawElement) => number;
|
|
72
|
+
export declare const getBoundTextMaxWidth: (container: ExcalidrawElement, boundTextElement?: ExcalidrawTextElement | null) => number;
|
|
77
73
|
export declare const getBoundTextMaxHeight: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => number;
|
|
78
74
|
export declare const isMeasureTextSupported: () => boolean;
|
|
79
75
|
export declare const getDefaultLineHeight: (fontFamily: FontFamilyValues) => number & {
|
|
80
76
|
_brand: "unitlessLineHeight";
|
|
81
77
|
};
|
|
78
|
+
export {};
|
|
@@ -23,8 +23,8 @@ export declare const OMIT_SIDES_FOR_FRAME: {
|
|
|
23
23
|
export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2, cx, cy]: [number, number, number, number, number, number], angle: number, zoom: Zoom, pointerType: PointerType, omitSides?: {
|
|
24
24
|
s?: boolean | undefined;
|
|
25
25
|
e?: boolean | undefined;
|
|
26
|
-
n?: boolean | undefined;
|
|
27
26
|
w?: boolean | undefined;
|
|
27
|
+
n?: boolean | undefined;
|
|
28
28
|
nw?: boolean | undefined;
|
|
29
29
|
ne?: boolean | undefined;
|
|
30
30
|
sw?: boolean | undefined;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AppState } from "../types";
|
|
2
2
|
import { MarkNonNullable } from "../utility-types";
|
|
3
|
-
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType } from "./types";
|
|
3
|
+
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawEmbeddableElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer, ExcalidrawFrameElement, RoundnessType } from "./types";
|
|
4
4
|
export declare const isGenericElement: (element: ExcalidrawElement | null) => element is ExcalidrawGenericElement;
|
|
5
5
|
export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
|
|
6
6
|
export declare const isImageElement: (element: ExcalidrawElement | null) => element is ExcalidrawImageElement;
|
|
7
|
+
export declare const isEmbeddableElement: (element: ExcalidrawElement | null | undefined) => element is ExcalidrawEmbeddableElement;
|
|
7
8
|
export declare const isTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawTextElement;
|
|
8
9
|
export declare const isFrameElement: (element: ExcalidrawElement | null) => element is ExcalidrawFrameElement;
|
|
9
10
|
export declare const isFreeDrawElement: (element?: ExcalidrawElement | null) => element is ExcalidrawFreeDrawElement;
|
package/types/element/types.d.ts
CHANGED
|
@@ -73,6 +73,17 @@ export type ExcalidrawDiamondElement = _ExcalidrawElementBase & {
|
|
|
73
73
|
export type ExcalidrawEllipseElement = _ExcalidrawElementBase & {
|
|
74
74
|
type: "ellipse";
|
|
75
75
|
};
|
|
76
|
+
export type ExcalidrawEmbeddableElement = _ExcalidrawElementBase & Readonly<{
|
|
77
|
+
type: "embeddable";
|
|
78
|
+
/**
|
|
79
|
+
* indicates whether the embeddable src (url) has been validated for rendering.
|
|
80
|
+
* null value indicates that the validation is pending. We reset the
|
|
81
|
+
* value on each restore (or url change) so that we can guarantee
|
|
82
|
+
* the validation came from a trusted source (the editor). Also because we
|
|
83
|
+
* may not have access to host-app supplied url validator during restore.
|
|
84
|
+
*/
|
|
85
|
+
validated: boolean | null;
|
|
86
|
+
}>;
|
|
76
87
|
export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
|
|
77
88
|
type: "image";
|
|
78
89
|
fileId: FileId | null;
|
|
@@ -95,7 +106,7 @@ export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRe
|
|
|
95
106
|
* no computed data. The list of all ExcalidrawElements should be shareable
|
|
96
107
|
* between peers and contain no state local to the peer.
|
|
97
108
|
*/
|
|
98
|
-
export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement;
|
|
109
|
+
export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement | ExcalidrawEmbeddableElement;
|
|
99
110
|
export type NonDeleted<TElement extends ExcalidrawElement> = TElement & {
|
|
100
111
|
isDeleted: boolean;
|
|
101
112
|
};
|
|
@@ -118,7 +129,7 @@ export type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
|
|
|
118
129
|
_brand: "unitlessLineHeight";
|
|
119
130
|
};
|
|
120
131
|
}>;
|
|
121
|
-
export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawFrameElement;
|
|
132
|
+
export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawEmbeddableElement | ExcalidrawFrameElement;
|
|
122
133
|
export type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawArrowElement;
|
|
123
134
|
export type ExcalidrawTextElementWithContainer = {
|
|
124
135
|
containerId: ExcalidrawTextContainer["id"];
|
package/types/i18n.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import fallbackLangData from "./locales/en.json";
|
|
2
|
+
import { NestedKeyOf } from "./utility-types";
|
|
1
3
|
export interface Language {
|
|
2
4
|
code: string;
|
|
3
5
|
label: string;
|
|
4
6
|
rtl?: boolean;
|
|
5
7
|
}
|
|
8
|
+
export type TranslationKeys = NestedKeyOf<typeof fallbackLangData>;
|
|
6
9
|
export declare const defaultLang: {
|
|
7
10
|
code: string;
|
|
8
11
|
label: string;
|
|
@@ -10,11 +13,11 @@ export declare const defaultLang: {
|
|
|
10
13
|
export declare const languages: Language[];
|
|
11
14
|
export declare const setLanguage: (lang: Language) => Promise<void>;
|
|
12
15
|
export declare const getLanguage: () => Language;
|
|
13
|
-
export declare const t: (path:
|
|
16
|
+
export declare const t: (path: NestedKeyOf<typeof fallbackLangData>, replacement?: {
|
|
14
17
|
[key: string]: string | number;
|
|
15
18
|
} | null | undefined, fallback?: string) => string;
|
|
16
19
|
export declare const useI18n: () => {
|
|
17
|
-
t: (path:
|
|
20
|
+
t: (path: NestedKeyOf<typeof fallbackLangData>, replacement?: {
|
|
18
21
|
[key: string]: string | number;
|
|
19
22
|
} | null | undefined, fallback?: string) => string;
|
|
20
23
|
langCode: string;
|
package/types/keys.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ExcalidrawElementSkeleton } from "../../../data/transform";
|
|
1
2
|
declare const _default: {
|
|
2
|
-
elements:
|
|
3
|
+
elements: ExcalidrawElementSkeleton[];
|
|
3
4
|
appState: {
|
|
4
5
|
viewBackgroundColor: string;
|
|
5
6
|
currentItemFontFamily: number;
|
|
@@ -36,13 +36,16 @@ export namespace module {
|
|
|
36
36
|
} | {
|
|
37
37
|
test: RegExp;
|
|
38
38
|
exclude: RegExp;
|
|
39
|
-
use: {
|
|
39
|
+
use: ({
|
|
40
|
+
loader: string;
|
|
41
|
+
options?: undefined;
|
|
42
|
+
} | {
|
|
40
43
|
loader: string;
|
|
41
44
|
options: {
|
|
42
45
|
transpileOnly: boolean;
|
|
43
46
|
configFile: string;
|
|
44
47
|
};
|
|
45
|
-
}[];
|
|
48
|
+
})[];
|
|
46
49
|
type?: undefined;
|
|
47
50
|
} | {
|
|
48
51
|
test: RegExp;
|
|
@@ -21,8 +21,9 @@ export declare const exportToBlob: (opts: ExportOpts & {
|
|
|
21
21
|
quality?: number;
|
|
22
22
|
exportPadding?: number;
|
|
23
23
|
}) => Promise<Blob>;
|
|
24
|
-
export declare const exportToSvg: ({ elements, appState, files, exportPadding, }: Omit<ExportOpts, "getDimensions"> & {
|
|
24
|
+
export declare const exportToSvg: ({ elements, appState, files, exportPadding, renderEmbeddables, }: Omit<ExportOpts, "getDimensions"> & {
|
|
25
25
|
exportPadding?: number | undefined;
|
|
26
|
+
renderEmbeddables?: boolean | undefined;
|
|
26
27
|
}) => Promise<SVGSVGElement>;
|
|
27
28
|
export declare const exportToClipboard: (opts: ExportOpts & {
|
|
28
29
|
mimeType?: string;
|
|
@@ -29,7 +29,7 @@ export declare const setShapeForElement: <T extends ExcalidrawElement>(element:
|
|
|
29
29
|
export declare const invalidateShapeForElement: (element: ExcalidrawElement) => boolean;
|
|
30
30
|
export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
|
|
31
31
|
export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: RenderConfig, appState: AppState) => void;
|
|
32
|
-
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number, exportWithDarkMode?: boolean, exportingFrameId?: string | null) => void;
|
|
32
|
+
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number, exportWithDarkMode?: boolean, exportingFrameId?: string | null, renderEmbeddables?: boolean) => void;
|
|
33
33
|
export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
|
|
34
34
|
export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
|
|
35
35
|
export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
|
|
@@ -42,9 +42,10 @@ export declare const isVisibleElement: (element: ExcalidrawElement, canvasWidth:
|
|
|
42
42
|
scrollX: number;
|
|
43
43
|
scrollY: number;
|
|
44
44
|
}) => boolean;
|
|
45
|
-
export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode, exportingFrameId, }?: {
|
|
45
|
+
export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode, exportingFrameId, renderEmbeddables, }?: {
|
|
46
46
|
offsetX?: number | undefined;
|
|
47
47
|
offsetY?: number | undefined;
|
|
48
48
|
exportWithDarkMode?: boolean | undefined;
|
|
49
49
|
exportingFrameId?: string | null | undefined;
|
|
50
|
+
renderEmbeddables?: boolean | undefined;
|
|
50
51
|
}) => void;
|
package/types/scene/export.d.ts
CHANGED
|
@@ -20,5 +20,6 @@ export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElemen
|
|
|
20
20
|
renderFrame?: boolean;
|
|
21
21
|
}, files: BinaryFiles | null, opts?: {
|
|
22
22
|
serializeAsJSON?: () => string;
|
|
23
|
+
renderEmbeddables?: boolean;
|
|
23
24
|
}) => Promise<SVGSVGElement>;
|
|
24
25
|
export declare const getExportSize: (elements: readonly NonDeletedExcalidrawElement[], exportPadding: number, scale: number) => [number, number];
|
package/types/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawFrameElement } from "./element/types";
|
|
2
|
+
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawFrameElement, ExcalidrawEmbeddableElement } from "./element/types";
|
|
3
3
|
import { SHAPES } from "./shapes";
|
|
4
4
|
import { Point as RoughPoint } from "roughjs/bin/geometry";
|
|
5
5
|
import { LinearElementEditor } from "./element/linearElementEditor";
|
|
@@ -57,7 +57,7 @@ export type BinaryFileData = {
|
|
|
57
57
|
export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
|
|
58
58
|
export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
|
|
59
59
|
export type LastActiveTool = {
|
|
60
|
-
type: typeof SHAPES[number]["value"] | "eraser" | "hand" | "frame";
|
|
60
|
+
type: typeof SHAPES[number]["value"] | "eraser" | "hand" | "frame" | "embeddable";
|
|
61
61
|
customType: null;
|
|
62
62
|
} | {
|
|
63
63
|
type: "custom";
|
|
@@ -74,6 +74,10 @@ export type AppState = {
|
|
|
74
74
|
showWelcomeScreen: boolean;
|
|
75
75
|
isLoading: boolean;
|
|
76
76
|
errorMessage: React.ReactNode;
|
|
77
|
+
activeEmbeddable: {
|
|
78
|
+
element: NonDeletedExcalidrawElement;
|
|
79
|
+
state: "hover" | "active";
|
|
80
|
+
} | null;
|
|
77
81
|
draggingElement: NonDeletedExcalidrawElement | null;
|
|
78
82
|
resizingElement: NonDeletedExcalidrawElement | null;
|
|
79
83
|
multiElement: NonDeleted<ExcalidrawLinearElement> | null;
|
|
@@ -100,7 +104,7 @@ export type AppState = {
|
|
|
100
104
|
lastActiveTool: LastActiveTool;
|
|
101
105
|
locked: boolean;
|
|
102
106
|
} & ({
|
|
103
|
-
type: typeof SHAPES[number]["value"] | "eraser" | "hand" | "frame";
|
|
107
|
+
type: typeof SHAPES[number]["value"] | "eraser" | "hand" | "frame" | "embeddable";
|
|
104
108
|
customType: null;
|
|
105
109
|
} | {
|
|
106
110
|
type: "custom";
|
|
@@ -277,6 +281,8 @@ export interface ExcalidrawProps {
|
|
|
277
281
|
onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
|
|
278
282
|
onScrollChange?: (scrollX: number, scrollY: number) => void;
|
|
279
283
|
children?: React.ReactNode;
|
|
284
|
+
validateEmbeddable?: boolean | string[] | RegExp | RegExp[] | ((link: string) => boolean | undefined);
|
|
285
|
+
renderEmbeddable?: (element: NonDeleted<ExcalidrawEmbeddableElement>, appState: AppState) => JSX.Element | null;
|
|
280
286
|
}
|
|
281
287
|
export type SceneData = {
|
|
282
288
|
elements?: ImportedDataState["elements"];
|
package/types/utility-types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export type Mutable<T> = {
|
|
3
2
|
-readonly [P in keyof T]: T[P];
|
|
4
3
|
};
|
|
@@ -22,3 +21,4 @@ export type ForwardRef<T, P = any> = Parameters<CallableType<React.ForwardRefRen
|
|
|
22
21
|
export type ExtractSetType<T extends Set<any>> = T extends Set<infer U> ? U : never;
|
|
23
22
|
export type SameType<T, U> = T extends U ? (U extends T ? true : false) : false;
|
|
24
23
|
export type Assert<T extends true> = T;
|
|
24
|
+
export type NestedKeyOf<T, K = keyof T> = K extends keyof T & (string | number) ? `${K}` | (T[K] extends object ? `${K}.${NestedKeyOf<T[K]>}` : never) : never;
|
package/types/utils.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export declare const selectNode: (node: Element) => void;
|
|
|
81
81
|
export declare const removeSelection: () => void;
|
|
82
82
|
export declare const distance: (x: number, y: number) => number;
|
|
83
83
|
export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">, data: ({
|
|
84
|
-
type: (typeof SHAPES)[number]["value"] | "eraser" | "hand" | "frame";
|
|
84
|
+
type: (typeof SHAPES)[number]["value"] | "eraser" | "hand" | "frame" | "embeddable";
|
|
85
85
|
} | {
|
|
86
86
|
type: "custom";
|
|
87
87
|
customType: string;
|
|
@@ -190,3 +190,4 @@ export declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E
|
|
|
190
190
|
checkForDefaultPrevented?: boolean | undefined;
|
|
191
191
|
}) => (event: E) => void;
|
|
192
192
|
export declare const isOnlyExportingSingleFrame: (elements: readonly NonDeletedExcalidrawElement[]) => boolean;
|
|
193
|
+
export declare const assertNever: (value: never, message: string, softAssert?: boolean) => never;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|