@myoc/element 0.19.510 → 0.19.512
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/index.js +0 -11
- package/dist/dev/index.js.map +2 -2
- package/dist/prod/index.js +8 -8
- package/dist/types/common/src/constants.d.ts +2 -16
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +0 -4
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +0 -22
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +0 -4
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +0 -6
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +0 -4
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionExport.d.ts +0 -4
- package/dist/types/excalidraw/actions/actionFrame.d.ts +0 -8
- package/dist/types/excalidraw/actions/actionGroup.d.ts +0 -4
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +0 -4
- package/dist/types/excalidraw/actions/actionLink.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionProperties.d.ts +0 -4
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionStyles.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +0 -2
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +0 -2
- package/dist/types/excalidraw/actions/index.d.ts +0 -1
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +2 -2
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/components/App.d.ts +3 -7
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +3 -1
- package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
- package/dist/types/excalidraw/components/icons.d.ts +0 -1
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +0 -6
- package/dist/types/excalidraw/data/blob.d.ts +3 -184
- package/dist/types/excalidraw/data/json.d.ts +2 -7
- package/dist/types/excalidraw/data/restore.d.ts +1 -2
- package/dist/types/excalidraw/data/types.d.ts +1 -16
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
- package/dist/types/excalidraw/lasso/index.d.ts +2 -3
- package/dist/types/excalidraw/renderer/animation.d.ts +4 -1
- package/dist/types/excalidraw/types.d.ts +12 -30
- package/dist/types/math/src/point.d.ts +1 -0
- package/package.json +4 -4
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +0 -512
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +0 -19
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +0 -19
- package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +0 -2
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +0 -24
- package/dist/types/excalidraw/components/ConfirmDialog.d.ts +0 -10
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +0 -10
- package/dist/types/excalidraw/components/LibraryMenuBrowseButton.d.ts +0 -7
- package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +0 -9
- package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +0 -17
- package/dist/types/excalidraw/components/LibraryMenuItems.d.ts +0 -14
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +0 -23
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +0 -14
- package/dist/types/excalidraw/components/PublishLibrary.d.ts +0 -17
- package/dist/types/excalidraw/data/EditorLocalStorage.d.ts +0 -8
- package/dist/types/excalidraw/data/library.d.ts +0 -127
- package/dist/types/excalidraw/deburr.d.ts +0 -1
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +0 -11
- package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +0 -1
- package/dist/types/excalidraw/hooks/useStableCallback.d.ts +0 -4
- package/dist/types/excalidraw/hooks/useTransition.d.ts +0 -2
|
@@ -8,7 +8,6 @@ type Opts = {
|
|
|
8
8
|
} & React.SVGProps<SVGSVGElement>;
|
|
9
9
|
export declare const createIcon: (d: string | React.ReactNode, opts?: number | Opts) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export declare const PlusPromoIcon: import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare const LibraryIcon: import("react/jsx-runtime").JSX.Element;
|
|
12
11
|
export declare const PlusIcon: import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
export declare const DotsIcon: import("react/jsx-runtime").JSX.Element;
|
|
14
13
|
export declare const DotsHorizontalIcon: import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,12 +12,6 @@ export declare const SaveAsImage: {
|
|
|
12
12
|
(): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
displayName: string;
|
|
14
14
|
};
|
|
15
|
-
export declare const CommandPalette: {
|
|
16
|
-
(opts?: {
|
|
17
|
-
className?: string;
|
|
18
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
displayName: string;
|
|
20
|
-
};
|
|
21
15
|
export declare const SearchMenu: {
|
|
22
16
|
(opts?: {
|
|
23
17
|
className?: string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { IMAGE_MIME_TYPES, MIME_TYPES } from "@excalidraw/common";
|
|
2
2
|
import type { ValueOf } from "@excalidraw/common/utility-types";
|
|
3
3
|
import type { ExcalidrawElement, FileId } from "@excalidraw/element/types";
|
|
4
|
-
import type { AppState, CompressImageFile, DataURL
|
|
5
|
-
import type { ImportedLibraryData } from "./types";
|
|
4
|
+
import type { AppState, CompressImageFile, DataURL } from "../types";
|
|
6
5
|
export declare const getMimeType: (blob: Blob | string) => string;
|
|
7
6
|
export declare const getFileHandleType: (handle: FileSystemFileHandle | null) => string | null;
|
|
8
7
|
export declare const isImageFileHandleType: (type: string | null) => type is "png" | "svg";
|
|
@@ -11,183 +10,7 @@ export declare const isSupportedImageFileType: (type: string | null | undefined)
|
|
|
11
10
|
export declare const isSupportedImageFile: (blob: Blob | null | undefined) => blob is Blob & {
|
|
12
11
|
type: ValueOf<typeof IMAGE_MIME_TYPES>;
|
|
13
12
|
};
|
|
14
|
-
export declare const
|
|
15
|
-
/** @see restore.localAppState */
|
|
16
|
-
localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null,
|
|
17
|
-
/** FileSystemFileHandle. Defaults to `blob.handle` if defined, otherwise null. */
|
|
18
|
-
fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
19
|
-
type: "application/vnd.excalidraw+json";
|
|
20
|
-
data: {
|
|
21
|
-
elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
22
|
-
appState: {
|
|
23
|
-
viewBackgroundColor: string;
|
|
24
|
-
theme: import("@excalidraw/element/types").Theme;
|
|
25
|
-
frameRendering: {
|
|
26
|
-
enabled: boolean;
|
|
27
|
-
name: boolean;
|
|
28
|
-
outline: boolean;
|
|
29
|
-
clip: boolean;
|
|
30
|
-
};
|
|
31
|
-
name: string | null;
|
|
32
|
-
zoom: import("../types").Zoom;
|
|
33
|
-
scrollX: number;
|
|
34
|
-
scrollY: number;
|
|
35
|
-
viewModeEnabled: boolean;
|
|
36
|
-
openDialog: null | {
|
|
37
|
-
name: "imageExport" | "help" | "jsonExport";
|
|
38
|
-
} | {
|
|
39
|
-
name: "commandPalette";
|
|
40
|
-
} | {
|
|
41
|
-
name: "settings";
|
|
42
|
-
} | {
|
|
43
|
-
name: "elementLinkSelector";
|
|
44
|
-
sourceElementId: ExcalidrawElement["id"];
|
|
45
|
-
} | {
|
|
46
|
-
name: "charts";
|
|
47
|
-
data: import("../charts").Spreadsheet;
|
|
48
|
-
rawText: string;
|
|
49
|
-
};
|
|
50
|
-
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
51
|
-
selectedElementIds: Readonly<{
|
|
52
|
-
[id: string]: true;
|
|
53
|
-
}>;
|
|
54
|
-
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
55
|
-
activeTool: {
|
|
56
|
-
lastActiveTool: import("../types").ActiveTool | null;
|
|
57
|
-
locked: boolean;
|
|
58
|
-
fromSelection: boolean;
|
|
59
|
-
} & import("../types").ActiveTool;
|
|
60
|
-
activeEmbeddable: {
|
|
61
|
-
element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
|
|
62
|
-
state: "hover" | "active";
|
|
63
|
-
} | null;
|
|
64
|
-
selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
65
|
-
selectedGroupIds: {
|
|
66
|
-
[groupId: string]: boolean;
|
|
67
|
-
};
|
|
68
|
-
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
69
|
-
multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
70
|
-
newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
71
|
-
isBindingEnabled: boolean;
|
|
72
|
-
isMidpointSnappingEnabled: boolean;
|
|
73
|
-
suggestedBinding: {
|
|
74
|
-
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
75
|
-
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
76
|
-
} | null;
|
|
77
|
-
isRotating: boolean;
|
|
78
|
-
elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
|
|
79
|
-
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
80
|
-
snapLines: readonly import("../snapping").SnapLine[];
|
|
81
|
-
zenModeEnabled: boolean;
|
|
82
|
-
editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
|
|
83
|
-
isCropping: boolean;
|
|
84
|
-
croppingElementId: ExcalidrawElement["id"] | null;
|
|
85
|
-
searchMatches: Readonly<{
|
|
86
|
-
focusedId: ExcalidrawElement["id"] | null;
|
|
87
|
-
matches: readonly import("../types").SearchMatch[];
|
|
88
|
-
}> | null;
|
|
89
|
-
activeLockedId: string | null;
|
|
90
|
-
hoveredElementIds: Readonly<{
|
|
91
|
-
[id: string]: true;
|
|
92
|
-
}>;
|
|
93
|
-
shouldCacheIgnoreZoom: boolean;
|
|
94
|
-
exportScale: number;
|
|
95
|
-
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
96
|
-
bindMode: import("@excalidraw/element/types").BindMode;
|
|
97
|
-
gridSize: number;
|
|
98
|
-
gridModeEnabled: boolean;
|
|
99
|
-
objectsSnapModeEnabled: boolean;
|
|
100
|
-
wheelZoomsOnDefault?: boolean | undefined;
|
|
101
|
-
selectedElementsAreBeingDragged: boolean;
|
|
102
|
-
gridStep: number;
|
|
103
|
-
currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
|
|
104
|
-
contextMenu: {
|
|
105
|
-
items: import("../components/ContextMenu").ContextMenuItems;
|
|
106
|
-
top: number;
|
|
107
|
-
left: number;
|
|
108
|
-
} | null;
|
|
109
|
-
showWelcomeScreen: boolean;
|
|
110
|
-
isLoading: boolean;
|
|
111
|
-
myocSimplifiedMode: boolean;
|
|
112
|
-
dontResizeLimitMBs: number;
|
|
113
|
-
hideMainMenus: boolean;
|
|
114
|
-
arrangeConfiguration: {
|
|
115
|
-
algorithm: import("@excalidraw/element/types").ArrangeAlgorithms;
|
|
116
|
-
gap: number;
|
|
117
|
-
};
|
|
118
|
-
normaliseConfiguration: {
|
|
119
|
-
mode: import("../types").NormaliseMode;
|
|
120
|
-
metric: import("../types").NormaliseMetric;
|
|
121
|
-
};
|
|
122
|
-
errorMessage: React.ReactNode;
|
|
123
|
-
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
124
|
-
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
125
|
-
bindingPreference: "enabled" | "disabled";
|
|
126
|
-
editingFrame: string | null;
|
|
127
|
-
preferredSelectionTool: {
|
|
128
|
-
type: "selection" | "lasso";
|
|
129
|
-
initialized: boolean;
|
|
130
|
-
};
|
|
131
|
-
penMode: boolean;
|
|
132
|
-
penDetected: boolean;
|
|
133
|
-
exportBackground: boolean;
|
|
134
|
-
exportEmbedScene: boolean;
|
|
135
|
-
exportWithDarkMode: boolean;
|
|
136
|
-
currentItemStrokeColor: string;
|
|
137
|
-
currentItemBackgroundColor: string;
|
|
138
|
-
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
139
|
-
currentItemStrokeWidth: number;
|
|
140
|
-
currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
|
|
141
|
-
currentItemRoughness: number;
|
|
142
|
-
currentItemOpacity: number;
|
|
143
|
-
currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
|
|
144
|
-
currentItemFontSize: number;
|
|
145
|
-
currentItemTextAlign: import("@excalidraw/element/types").TextAlign;
|
|
146
|
-
currentItemStartArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
147
|
-
currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
148
|
-
currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
|
|
149
|
-
cursorButton: "up" | "down";
|
|
150
|
-
scrolledOutside: boolean;
|
|
151
|
-
isResizing: boolean;
|
|
152
|
-
openMenu: "canvas" | null;
|
|
153
|
-
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
154
|
-
openSidebar: {
|
|
155
|
-
name: import("../types").SidebarName;
|
|
156
|
-
tab?: import("../types").SidebarTabName;
|
|
157
|
-
} | null;
|
|
158
|
-
defaultSidebarDockedPreference: boolean;
|
|
159
|
-
lastPointerDownWith: import("@excalidraw/element/types").PointerType;
|
|
160
|
-
previousSelectedElementIds: {
|
|
161
|
-
[id: string]: true;
|
|
162
|
-
};
|
|
163
|
-
toast: {
|
|
164
|
-
message: React.ReactNode;
|
|
165
|
-
closable?: boolean;
|
|
166
|
-
duration?: number;
|
|
167
|
-
} | null;
|
|
168
|
-
fileHandle: FileSystemFileHandle | null;
|
|
169
|
-
stats: {
|
|
170
|
-
open: boolean;
|
|
171
|
-
panels: number;
|
|
172
|
-
};
|
|
173
|
-
showHyperlinkPopup: false | "info" | "editor";
|
|
174
|
-
originSnapOffset: {
|
|
175
|
-
x: number;
|
|
176
|
-
y: number;
|
|
177
|
-
} | null;
|
|
178
|
-
userToFollow: import("../types").UserToFollow | null;
|
|
179
|
-
followedBy: Set<import("../types").SocketId>;
|
|
180
|
-
lockedMultiSelections: {
|
|
181
|
-
[groupId: string]: true;
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
files: import("../types").BinaryFiles;
|
|
185
|
-
};
|
|
186
|
-
} | {
|
|
187
|
-
type: "application/vnd.excalidrawlib+json";
|
|
188
|
-
data: ImportedLibraryData;
|
|
189
|
-
}>;
|
|
190
|
-
export declare const loadFromBlob: (blob: Blob,
|
|
13
|
+
export declare const loadFromBlob: (blob: Blob | File,
|
|
191
14
|
/** @see restore.localAppState */
|
|
192
15
|
localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null,
|
|
193
16
|
/** FileSystemFileHandle. Defaults to `blob.handle` if defined, otherwise null. */
|
|
@@ -209,8 +32,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
209
32
|
viewModeEnabled: boolean;
|
|
210
33
|
openDialog: null | {
|
|
211
34
|
name: "imageExport" | "help" | "jsonExport";
|
|
212
|
-
} | {
|
|
213
|
-
name: "commandPalette";
|
|
214
35
|
} | {
|
|
215
36
|
name: "settings";
|
|
216
37
|
} | {
|
|
@@ -357,8 +178,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
357
178
|
};
|
|
358
179
|
files: import("../types").BinaryFiles;
|
|
359
180
|
}>;
|
|
360
|
-
export declare const parseLibraryJSON: (json: string, defaultStatus?: LibraryItem["status"]) => LibraryItem[];
|
|
361
|
-
export declare const loadLibraryFromBlob: (blob: Blob, defaultStatus?: LibraryItem["status"]) => Promise<LibraryItem[]>;
|
|
362
181
|
export declare const canvasToBlob: (canvas: HTMLCanvasElement | Promise<HTMLCanvasElement>) => Promise<Blob>;
|
|
363
182
|
/** generates SHA-1 digest from supplied file (if not supported, falls back
|
|
364
183
|
to a 40-char base64 random id) */
|
|
@@ -377,6 +196,6 @@ export declare const getFileHandle: (event: DragEvent | React.DragEvent | DataTr
|
|
|
377
196
|
export declare const createFile: (blob: File | Blob | ArrayBuffer, mimeType: string, name: string | undefined) => File;
|
|
378
197
|
/** attempts to detect correct mimeType if none is set, or if an image
|
|
379
198
|
* has an incorrect extension.
|
|
380
|
-
* Note: doesn't handle missing .excalidraw
|
|
199
|
+
* Note: doesn't handle missing .excalidraw extension */
|
|
381
200
|
export declare const normalizeFile: (file: File) => Promise<File>;
|
|
382
201
|
export declare const blobToArrayBuffer: (blob: Blob) => Promise<ArrayBuffer>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExcalidrawElement, NonDeleted } from "@excalidraw/element/types";
|
|
2
2
|
import type { MaybePromise } from "@excalidraw/common/utility-types";
|
|
3
|
-
import type { AppState, BinaryFiles
|
|
4
|
-
import type { ImportedDataState
|
|
3
|
+
import type { AppState, BinaryFiles } from "../types";
|
|
4
|
+
import type { ImportedDataState } from "./types";
|
|
5
5
|
export type JSONExportData = {
|
|
6
6
|
elements: readonly NonDeleted<ExcalidrawElement>[];
|
|
7
7
|
appState: AppState;
|
|
@@ -33,8 +33,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
33
33
|
viewModeEnabled: boolean;
|
|
34
34
|
openDialog: null | {
|
|
35
35
|
name: "imageExport" | "help" | "jsonExport";
|
|
36
|
-
} | {
|
|
37
|
-
name: "commandPalette";
|
|
38
36
|
} | {
|
|
39
37
|
name: "settings";
|
|
40
38
|
} | {
|
|
@@ -186,6 +184,3 @@ export declare const isValidExcalidrawData: (data?: {
|
|
|
186
184
|
elements?: any;
|
|
187
185
|
appState?: any;
|
|
188
186
|
}) => data is ImportedDataState;
|
|
189
|
-
export declare const isValidLibrary: (json: any) => json is ImportedLibraryData;
|
|
190
|
-
export declare const serializeLibraryAsJSON: (libraryItems: LibraryItems) => string;
|
|
191
|
-
export declare const saveLibraryAsJSON: (libraryItems: LibraryItems) => Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CombineBrandsIfNeeded } from "@excalidraw/common";
|
|
2
2
|
import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawSelectionElement, OrderedExcalidrawElement } from "@excalidraw/element/types";
|
|
3
|
-
import type { AppState, BinaryFiles
|
|
3
|
+
import type { AppState, BinaryFiles } from "../types";
|
|
4
4
|
import type { ImportedDataState } from "./types";
|
|
5
5
|
type RestoredAppState = Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
6
6
|
export declare const AllowedExcalidrawActiveTools: Record<AppState["activeTool"]["type"], boolean>;
|
|
@@ -37,5 +37,4 @@ existingElements: Readonly<ElementsMapOrArray> | null | undefined, opts?: {
|
|
|
37
37
|
*/
|
|
38
38
|
export declare const bumpElementVersions: <T extends ExcalidrawElement>(targetElements: readonly T[], localElements: Readonly<ElementsMapOrArray> | null | undefined) => T[];
|
|
39
39
|
export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
|
|
40
|
-
export declare const restoreLibraryItems: (libraryItems: ImportedDataState["libraryItems"], defaultStatus: LibraryItem["status"]) => LibraryItem[];
|
|
41
40
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { VERSIONS } from "@excalidraw/common";
|
|
2
1
|
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
3
2
|
import type { cleanAppStateForExport } from "../appState";
|
|
4
|
-
import type { AppState, BinaryFiles
|
|
3
|
+
import type { AppState, BinaryFiles } from "../types";
|
|
5
4
|
export interface ExportedDataState {
|
|
6
5
|
type: string;
|
|
7
6
|
version: number;
|
|
@@ -30,19 +29,5 @@ export interface ImportedDataState {
|
|
|
30
29
|
[T in keyof LegacyAppState]: LegacyAppState[T][0];
|
|
31
30
|
}>> | null;
|
|
32
31
|
scrollToContent?: boolean;
|
|
33
|
-
libraryItems?: LibraryItems_anyVersion;
|
|
34
32
|
files?: BinaryFiles;
|
|
35
33
|
}
|
|
36
|
-
export interface ExportedLibraryData {
|
|
37
|
-
type: string;
|
|
38
|
-
version: typeof VERSIONS.excalidrawLibrary;
|
|
39
|
-
source: string;
|
|
40
|
-
libraryItems: LibraryItems;
|
|
41
|
-
}
|
|
42
|
-
export interface ImportedLibraryData extends Partial<ExportedLibraryData> {
|
|
43
|
-
/** @deprecated v1 */
|
|
44
|
-
library?: LibraryItems;
|
|
45
|
-
}
|
|
46
|
-
export type ExcalidrawLibraryIds = {
|
|
47
|
-
itemIds: LibraryItem["id"][];
|
|
48
|
-
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { AnimatedTrail } from "../
|
|
2
|
-
import type { AnimationFrameHandler } from "../animation-frame-handler";
|
|
1
|
+
import { AnimatedTrail } from "../animatedTrail";
|
|
3
2
|
import type App from "../components/App";
|
|
4
3
|
export declare class EraserTrail extends AnimatedTrail {
|
|
5
4
|
private elementsToErase;
|
|
6
5
|
private groupsToErase;
|
|
7
|
-
constructor(
|
|
6
|
+
constructor(app: App);
|
|
8
7
|
startPath(x: number, y: number): void;
|
|
9
8
|
addPointToPath(x: number, y: number, restore?: boolean): string[];
|
|
10
9
|
private updateElementsToBeErased;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { AnimatedTrail } from "./
|
|
2
|
-
import type { Trail } from "./
|
|
3
|
-
import type { AnimationFrameHandler } from "./animation-frame-handler";
|
|
1
|
+
import { AnimatedTrail } from "./animatedTrail";
|
|
2
|
+
import type { Trail } from "./animatedTrail";
|
|
4
3
|
import type App from "./components/App";
|
|
5
4
|
export declare class LaserTrails implements Trail {
|
|
6
|
-
private animationFrameHandler;
|
|
7
5
|
private app;
|
|
8
6
|
localTrail: AnimatedTrail;
|
|
9
7
|
private collabTrails;
|
|
10
8
|
private container?;
|
|
11
|
-
constructor(
|
|
9
|
+
constructor(app: App);
|
|
12
10
|
private getTrailOptions;
|
|
13
11
|
startPath(x: number, y: number): void;
|
|
14
12
|
addPointToPath(x: number, y: number): void;
|
|
15
13
|
endPath(): void;
|
|
16
14
|
start(container: SVGSVGElement): void;
|
|
17
15
|
stop(): void;
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
private stopCollabTrails;
|
|
17
|
+
updateCollabTrails(collaborators: App["state"]["collaborators"]): void;
|
|
20
18
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AnimatedTrail } from "../animated-trail";
|
|
1
|
+
import { AnimatedTrail } from "../animatedTrail";
|
|
3
2
|
import type App from "../components/App";
|
|
4
3
|
export declare class LassoTrail extends AnimatedTrail {
|
|
5
4
|
private intersectedElements;
|
|
@@ -7,7 +6,7 @@ export declare class LassoTrail extends AnimatedTrail {
|
|
|
7
6
|
private elementsSegments;
|
|
8
7
|
private canvasTranslate;
|
|
9
8
|
private keepPreviousSelection;
|
|
10
|
-
constructor(
|
|
9
|
+
constructor(app: App);
|
|
11
10
|
startPath(x: number, y: number, keepPreviousSelection?: boolean): void;
|
|
12
11
|
selectElementsFromIds: (ids: string[]) => void;
|
|
13
12
|
addPointToPath: (x: number, y: number, keepPreviousSelection?: boolean) => void;
|
|
@@ -3,9 +3,12 @@ export type Animation<R extends object> = (params: {
|
|
|
3
3
|
state?: R;
|
|
4
4
|
}) => R | null | undefined;
|
|
5
5
|
export declare class AnimationController {
|
|
6
|
-
private static
|
|
6
|
+
private static scheduledFrame;
|
|
7
7
|
private static animations;
|
|
8
8
|
static start<R extends object>(key: string, animation: Animation<R>): void;
|
|
9
|
+
private static scheduleNextFrame;
|
|
10
|
+
private static cancelScheduledFrame;
|
|
11
|
+
private static cancelScheduledFrameIfIdle;
|
|
9
12
|
private static tick;
|
|
10
13
|
static running(key: string): boolean;
|
|
11
14
|
static cancel(key: string): void;
|
|
@@ -9,7 +9,6 @@ import type { Action } from "./actions/types";
|
|
|
9
9
|
import type { Spreadsheet } from "./charts";
|
|
10
10
|
import type { ClipboardData } from "./clipboard";
|
|
11
11
|
import type App from "./components/App";
|
|
12
|
-
import type Library from "./data/library";
|
|
13
12
|
import type { ContextMenuItems } from "./components/ContextMenu";
|
|
14
13
|
import type { SnapLine } from "./snapping";
|
|
15
14
|
import type { ImportedDataState } from "./data/types";
|
|
@@ -322,8 +321,6 @@ export interface AppState {
|
|
|
322
321
|
} | null;
|
|
323
322
|
openDialog: null | {
|
|
324
323
|
name: "imageExport" | "help" | "jsonExport";
|
|
325
|
-
} | {
|
|
326
|
-
name: "commandPalette";
|
|
327
324
|
} | {
|
|
328
325
|
name: "settings";
|
|
329
326
|
} | {
|
|
@@ -446,26 +443,7 @@ export declare class GestureEvent extends UIEvent {
|
|
|
446
443
|
readonly rotation: number;
|
|
447
444
|
readonly scale: number;
|
|
448
445
|
}
|
|
449
|
-
|
|
450
|
-
export type LibraryItem_v1 = readonly NonDeleted<ExcalidrawElement>[];
|
|
451
|
-
/** @deprecated legacy: do not use outside of migration paths */
|
|
452
|
-
type LibraryItems_v1 = readonly LibraryItem_v1[];
|
|
453
|
-
/** v2 library item */
|
|
454
|
-
export type LibraryItem = {
|
|
455
|
-
id: string;
|
|
456
|
-
status: "published" | "unpublished";
|
|
457
|
-
elements: readonly NonDeleted<ExcalidrawElement>[];
|
|
458
|
-
/** timestamp in epoch (ms) */
|
|
459
|
-
created: number;
|
|
460
|
-
name?: string;
|
|
461
|
-
error?: string;
|
|
462
|
-
};
|
|
463
|
-
export type LibraryItems = readonly LibraryItem[];
|
|
464
|
-
export type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1;
|
|
465
|
-
export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => MaybePromise<LibraryItems_anyVersion | Blob>) | MaybePromise<LibraryItems_anyVersion | Blob>;
|
|
466
|
-
export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
|
|
467
|
-
libraryItems?: MaybePromise<Required<ImportedDataState>["libraryItems"]>;
|
|
468
|
-
}>;
|
|
446
|
+
export type ExcalidrawInitialDataState = ImportedDataState;
|
|
469
447
|
export type OnUserFollowedPayload = {
|
|
470
448
|
userToFollow: UserToFollow;
|
|
471
449
|
action: "FOLLOW" | "UNFOLLOW";
|
|
@@ -521,8 +499,7 @@ export interface ExcalidrawProps {
|
|
|
521
499
|
* Called when element(s) are duplicated so you can listen or modify as
|
|
522
500
|
* needed.
|
|
523
501
|
*
|
|
524
|
-
* Called when duplicating via mouse-drag, keyboard, paste,
|
|
525
|
-
* etc.
|
|
502
|
+
* Called when duplicating via mouse-drag, keyboard, paste, etc.
|
|
526
503
|
*
|
|
527
504
|
* Returned elements will be used in place of the next elements
|
|
528
505
|
* (you should return all elements, including deleted, and not mutate
|
|
@@ -538,16 +515,18 @@ export interface ExcalidrawProps {
|
|
|
538
515
|
zenModeEnabled?: boolean;
|
|
539
516
|
gridModeEnabled?: boolean;
|
|
540
517
|
objectsSnapModeEnabled?: boolean;
|
|
541
|
-
libraryReturnUrl?: string;
|
|
542
518
|
theme?: Theme;
|
|
543
519
|
name?: string;
|
|
544
520
|
renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => JSX.Element;
|
|
545
521
|
editorPreferences?: EditorPreferences;
|
|
546
522
|
onEditorPreferencesChange?: (next: EditorPreferences) => void;
|
|
547
523
|
UIOptions?: Partial<UIOptions>;
|
|
524
|
+
/**
|
|
525
|
+
* dimensions and size constraints for inserted images
|
|
526
|
+
*/
|
|
527
|
+
imageOptions?: ImageOptions;
|
|
548
528
|
detectScroll?: boolean;
|
|
549
529
|
handleKeyboardGlobally?: boolean;
|
|
550
|
-
onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
|
|
551
530
|
autoFocus?: boolean;
|
|
552
531
|
compressImageFile: CompressImageFile;
|
|
553
532
|
generateIdForFile?: (file: File) => string | Promise<string>;
|
|
@@ -602,6 +581,10 @@ export type ExportOpts = {
|
|
|
602
581
|
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles) => void;
|
|
603
582
|
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => JSX.Element;
|
|
604
583
|
};
|
|
584
|
+
export type ImageOptions = Partial<{
|
|
585
|
+
maxWidthOrHeight: number;
|
|
586
|
+
maxFileSizeBytes: number;
|
|
587
|
+
}>;
|
|
605
588
|
export type CanvasActions = Partial<{
|
|
606
589
|
changeViewBackgroundColor: boolean;
|
|
607
590
|
export: false | ExportOpts;
|
|
@@ -630,6 +613,7 @@ export type AppProps = Merge<ExcalidrawProps, {
|
|
|
630
613
|
export: ExportOpts;
|
|
631
614
|
};
|
|
632
615
|
}>;
|
|
616
|
+
imageOptions: Required<ImageOptions>;
|
|
633
617
|
wheelZoomsOnDefault?: boolean;
|
|
634
618
|
detectScroll: boolean;
|
|
635
619
|
handleKeyboardGlobally: boolean;
|
|
@@ -647,7 +631,6 @@ export type AppClassProperties = {
|
|
|
647
631
|
/** static canvas */
|
|
648
632
|
canvas: HTMLCanvasElement;
|
|
649
633
|
focusContainer(): void;
|
|
650
|
-
library: Library;
|
|
651
634
|
imageCache: Map<FileId, {
|
|
652
635
|
image: HTMLImageElement | Promise<HTMLImageElement>;
|
|
653
636
|
mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
|
|
@@ -665,7 +648,7 @@ export type AppClassProperties = {
|
|
|
665
648
|
scrollToViewport: App["scrollToViewport"];
|
|
666
649
|
scrollToContent: App["scrollToContent"];
|
|
667
650
|
addFiles: App["addFiles"];
|
|
668
|
-
|
|
651
|
+
addElementsFromPaste: App["addElementsFromPaste"];
|
|
669
652
|
togglePenMode: App["togglePenMode"];
|
|
670
653
|
toggleLock: App["toggleLock"];
|
|
671
654
|
setActiveTool: App["setActiveTool"];
|
|
@@ -764,7 +747,6 @@ export interface ExcalidrawImperativeAPI {
|
|
|
764
747
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
765
748
|
applyDeltas: InstanceType<typeof App>["applyDeltas"];
|
|
766
749
|
mutateElement: InstanceType<typeof App>["mutateElement"];
|
|
767
|
-
updateLibrary: InstanceType<typeof Library>["updateLibrary"];
|
|
768
750
|
resetScene: InstanceType<typeof App>["resetScene"];
|
|
769
751
|
getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
|
|
770
752
|
getSceneElementsMapIncludingDeleted: InstanceType<typeof App>["getSceneElementsMapIncludingDeleted"];
|
|
@@ -125,3 +125,4 @@ export declare const pointScaleFromOrigin: <P extends GlobalPoint | LocalPoint>(
|
|
|
125
125
|
* @returns TRUE if q is indeed between p and r
|
|
126
126
|
*/
|
|
127
127
|
export declare const isPointWithinBounds: <P extends GlobalPoint | LocalPoint>(p: P, q: P, r: P) => boolean;
|
|
128
|
+
export declare const isValidPoint: (point: unknown) => point is LocalPoint;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myoc/element",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.512",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/types/element/src/index.d.ts",
|
|
6
6
|
"main": "./dist/prod/index.js",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@excalidraw/common": "npm:@myoc/common@0.19.
|
|
68
|
-
"@excalidraw/fractional-indexing": "npm:@myoc/fractional-indexing@0.19.
|
|
69
|
-
"@excalidraw/math": "npm:@myoc/math@0.19.
|
|
67
|
+
"@excalidraw/common": "npm:@myoc/common@0.19.512",
|
|
68
|
+
"@excalidraw/fractional-indexing": "npm:@myoc/fractional-indexing@0.19.512",
|
|
69
|
+
"@excalidraw/math": "npm:@myoc/math@0.19.512"
|
|
70
70
|
}
|
|
71
71
|
}
|