@zsviczian/excalidraw 0.13.0-obsidian-1 → 0.14.0-obsidian
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/README.md +418 -20
- package/dist/excalidraw.development.js +571 -1154
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +0 -102
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +21 -9
- package/types/actions/actionAlign.d.ts +6 -18
- package/types/actions/actionBoundText.d.ts +9 -5
- package/types/actions/actionCanvas.d.ts +83 -55
- package/types/actions/actionClipboard.d.ts +63 -16
- package/types/actions/actionDeleteSelected.d.ts +31 -12
- package/types/actions/actionDistribute.d.ts +2 -6
- package/types/actions/actionDuplicateSelection.d.ts +1 -3
- package/types/actions/actionExport.d.ts +79 -58
- package/types/actions/actionFinalize.d.ts +15 -9
- package/types/actions/actionFlip.d.ts +2 -2
- package/types/actions/actionGroup.d.ts +4 -8
- package/types/actions/actionLinearEditor.d.ts +8 -4
- package/types/actions/actionMenu.d.ts +24 -17
- package/types/actions/actionNavigate.d.ts +2 -3
- package/types/actions/actionProperties.d.ts +106 -80
- package/types/actions/actionStyles.d.ts +7 -3
- package/types/actions/actionToggleGridMode.d.ts +9 -3
- package/types/actions/actionToggleLock.d.ts +7 -3
- package/types/actions/actionToggleStats.d.ts +8 -3
- package/types/actions/actionToggleViewMode.d.ts +9 -3
- package/types/actions/actionToggleZenMode.d.ts +9 -3
- package/types/actions/actionZindex.d.ts +4 -12
- package/types/actions/manager.d.ts +2 -1
- package/types/actions/types.d.ts +6 -5
- package/types/appState.d.ts +8 -9
- package/types/clipboard.d.ts +6 -1
- package/types/components/App.d.ts +8 -51
- package/types/components/Button.d.ts +15 -0
- package/types/components/CollabButton.d.ts +1 -2
- package/types/components/ContextMenu.d.ts +8 -21
- package/types/components/JSONExportDialog.d.ts +3 -1
- package/types/components/LayerUI.d.ts +2 -3
- package/types/components/LibraryMenuHeaderContent.d.ts +23 -0
- package/types/components/MobileMenu.d.ts +4 -6
- package/types/components/UserList.d.ts +0 -2
- package/types/components/dropdownMenu/DropdownMenu.d.ts +64 -0
- package/types/components/dropdownMenu/DropdownMenuContent.d.ts +11 -0
- package/types/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -0
- package/types/components/dropdownMenu/DropdownMenuItem.d.ts +13 -0
- package/types/components/dropdownMenu/DropdownMenuItemContent.d.ts +6 -0
- package/types/components/dropdownMenu/DropdownMenuItemCustom.d.ts +6 -0
- package/types/components/dropdownMenu/DropdownMenuItemLink.d.ts +12 -0
- package/types/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -0
- package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +9 -0
- package/types/components/dropdownMenu/dropdownMenuUtils.d.ts +3 -0
- package/types/components/footer/Footer.d.ts +13 -0
- package/types/components/footer/FooterCenter.d.ts +8 -0
- package/types/components/icons.d.ts +1 -1
- package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +10 -0
- package/types/components/main-menu/DefaultItems.d.ts +44 -0
- package/types/components/main-menu/MainMenu.d.ts +55 -0
- package/types/components/mainMenu/DefaultItems.d.ts +44 -0
- package/types/components/mainMenu/MainMenu.d.ts +63 -0
- package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +58 -0
- package/types/components/welcome-screen/WelcomeScreen.Hints.d.ts +19 -0
- package/types/components/welcome-screen/WelcomeScreen.d.ts +85 -0
- package/types/constants.d.ts +6 -7
- package/types/element/Hyperlink.d.ts +9 -7
- package/types/element/bounds.d.ts +3 -2
- package/types/element/linearElementEditor.d.ts +38 -6
- package/types/element/newElement.d.ts +2 -2
- package/types/element/resizeElements.d.ts +0 -1
- package/types/element/textElement.d.ts +24 -2
- package/types/element/textWysiwyg.d.ts +6 -1
- package/types/element/transformHandles.d.ts +2 -3
- package/types/element/typeChecks.d.ts +10 -1
- package/types/element/types.d.ts +11 -4
- package/types/excalidraw-app/data/index.d.ts +13 -9
- package/types/excalidraw-app/data/localStorage.d.ts +13 -9
- package/types/keys.d.ts +2 -0
- package/types/math.d.ts +2 -1
- package/types/packages/excalidraw/example/CustomFooter.d.ts +5 -0
- package/types/packages/excalidraw/example/MobileFooter.d.ts +5 -0
- package/types/packages/excalidraw/index.d.ts +10 -0
- package/types/renderer/easingFunctions.d.ts +6 -0
- package/types/renderer/renderElement.d.ts +4 -3
- package/types/scene/Fonts.d.ts +21 -0
- package/types/scene/Scene.d.ts +15 -0
- package/types/scene/comparisons.d.ts +2 -3
- package/types/scene/index.d.ts +1 -1
- package/types/types.d.ts +43 -22
- package/types/utils.d.ts +17 -0
package/types/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme } from "./element/types";
|
|
2
|
+
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme, StrokeRoundness } 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";
|
|
@@ -15,6 +15,7 @@ import { MaybeTransformHandleType } from "./element/transformHandles";
|
|
|
15
15
|
import Library from "./data/library";
|
|
16
16
|
import type { FileSystemHandle } from "./data/filesystem";
|
|
17
17
|
import type { ALLOWED_IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
|
|
18
|
+
import { ContextMenuItems } from "./components/ContextMenu";
|
|
18
19
|
export declare type Point = Readonly<RoughPoint>;
|
|
19
20
|
export declare type Collaborator = {
|
|
20
21
|
pointer?: {
|
|
@@ -62,6 +63,11 @@ export declare type LastActiveToolBeforeEraser = {
|
|
|
62
63
|
customType: string;
|
|
63
64
|
} | null;
|
|
64
65
|
export declare type AppState = {
|
|
66
|
+
contextMenu: {
|
|
67
|
+
items: ContextMenuItems;
|
|
68
|
+
top: number;
|
|
69
|
+
left: number;
|
|
70
|
+
} | null;
|
|
65
71
|
showWelcomeScreen: boolean;
|
|
66
72
|
isLoading: boolean;
|
|
67
73
|
errorMessage: string | null;
|
|
@@ -101,10 +107,9 @@ export declare type AppState = {
|
|
|
101
107
|
currentItemFontFamily: FontFamilyValues;
|
|
102
108
|
currentItemFontSize: number;
|
|
103
109
|
currentItemTextAlign: TextAlign;
|
|
104
|
-
currentItemStrokeSharpness: ExcalidrawElement["strokeSharpness"];
|
|
105
110
|
currentItemStartArrowhead: Arrowhead | null;
|
|
106
111
|
currentItemEndArrowhead: Arrowhead | null;
|
|
107
|
-
|
|
112
|
+
currentItemRoundness: StrokeRoundness;
|
|
108
113
|
viewBackgroundColor: string;
|
|
109
114
|
scrollX: number;
|
|
110
115
|
scrollY: number;
|
|
@@ -117,7 +122,7 @@ export declare type AppState = {
|
|
|
117
122
|
openMenu: "canvas" | "shape" | null;
|
|
118
123
|
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
119
124
|
openSidebar: "library" | "customSidebar" | null;
|
|
120
|
-
openDialog: "imageExport" | "help" | null;
|
|
125
|
+
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
121
126
|
isSidebarDocked: boolean;
|
|
122
127
|
lastPointerDownWith: PointerType;
|
|
123
128
|
selectedElementIds: {
|
|
@@ -221,7 +226,6 @@ export interface ExcalidrawProps {
|
|
|
221
226
|
onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
222
227
|
initialData?: ExcalidrawInitialDataState | null | Promise<ExcalidrawInitialDataState | null>;
|
|
223
228
|
excalidrawRef?: ForwardRef<ExcalidrawAPIRefValue>;
|
|
224
|
-
onCollabButtonClick?: () => void;
|
|
225
229
|
isCollaborating?: boolean;
|
|
226
230
|
onPointerUpdate?: (payload: {
|
|
227
231
|
pointer: {
|
|
@@ -234,7 +238,6 @@ export interface ExcalidrawProps {
|
|
|
234
238
|
onPaste?: (data: ClipboardData, event: ClipboardEvent | null) => Promise<boolean> | boolean;
|
|
235
239
|
onDrop?: (event: React.DragEvent<HTMLDivElement>) => Promise<boolean> | boolean;
|
|
236
240
|
renderTopRightUI?: (isMobile: boolean, appState: AppState) => JSX.Element | null;
|
|
237
|
-
renderFooter?: (isMobile: boolean, appState: AppState) => JSX.Element | null;
|
|
238
241
|
langCode?: Language["code"];
|
|
239
242
|
viewModeEnabled?: boolean;
|
|
240
243
|
zenModeEnabled?: boolean;
|
|
@@ -244,10 +247,7 @@ export interface ExcalidrawProps {
|
|
|
244
247
|
theme?: Theme;
|
|
245
248
|
name?: string;
|
|
246
249
|
renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => JSX.Element;
|
|
247
|
-
UIOptions?:
|
|
248
|
-
dockedSidebarBreakpoint?: number;
|
|
249
|
-
canvasActions?: CanvasActions;
|
|
250
|
-
};
|
|
250
|
+
UIOptions?: Partial<UIOptions>;
|
|
251
251
|
detectScroll?: boolean;
|
|
252
252
|
handleKeyboardGlobally?: boolean;
|
|
253
253
|
onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
|
|
@@ -267,6 +267,7 @@ export interface ExcalidrawProps {
|
|
|
267
267
|
* Render function that renders custom <Sidebar /> component.
|
|
268
268
|
*/
|
|
269
269
|
renderSidebar?: () => JSX.Element | null;
|
|
270
|
+
children?: React.ReactNode;
|
|
270
271
|
}
|
|
271
272
|
export declare type SceneData = {
|
|
272
273
|
elements?: ImportedDataState["elements"];
|
|
@@ -284,22 +285,26 @@ export declare type ExportOpts = {
|
|
|
284
285
|
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => void;
|
|
285
286
|
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => JSX.Element;
|
|
286
287
|
};
|
|
287
|
-
declare type CanvasActions = {
|
|
288
|
-
changeViewBackgroundColor
|
|
289
|
-
clearCanvas
|
|
290
|
-
export
|
|
291
|
-
loadScene
|
|
292
|
-
saveToActiveFile
|
|
293
|
-
toggleTheme
|
|
294
|
-
saveAsImage
|
|
295
|
-
}
|
|
288
|
+
declare type CanvasActions = Partial<{
|
|
289
|
+
changeViewBackgroundColor: boolean;
|
|
290
|
+
clearCanvas: boolean;
|
|
291
|
+
export: false | ExportOpts;
|
|
292
|
+
loadScene: boolean;
|
|
293
|
+
saveToActiveFile: boolean;
|
|
294
|
+
toggleTheme: boolean | null;
|
|
295
|
+
saveAsImage: boolean;
|
|
296
|
+
}>;
|
|
297
|
+
declare type UIOptions = Partial<{
|
|
298
|
+
dockedSidebarBreakpoint: number;
|
|
299
|
+
welcomeScreen: boolean;
|
|
300
|
+
canvasActions: CanvasActions;
|
|
301
|
+
}>;
|
|
296
302
|
export declare type AppProps = Merge<ExcalidrawProps, {
|
|
297
|
-
UIOptions: {
|
|
303
|
+
UIOptions: Merge<MarkRequired<UIOptions, "welcomeScreen">, {
|
|
298
304
|
canvasActions: Required<CanvasActions> & {
|
|
299
305
|
export: ExportOpts;
|
|
300
306
|
};
|
|
301
|
-
|
|
302
|
-
};
|
|
307
|
+
}>;
|
|
303
308
|
detectScroll: boolean;
|
|
304
309
|
handleKeyboardGlobally: boolean;
|
|
305
310
|
isCollaborating: boolean;
|
|
@@ -319,6 +324,7 @@ export declare type AppClassProperties = {
|
|
|
319
324
|
files: BinaryFiles;
|
|
320
325
|
device: App["device"];
|
|
321
326
|
scene: App["scene"];
|
|
327
|
+
pasteFromClipboard: App["pasteFromClipboard"];
|
|
322
328
|
};
|
|
323
329
|
export declare type PointerDownState = Readonly<{
|
|
324
330
|
origin: Readonly<{
|
|
@@ -418,4 +424,19 @@ export declare type Device = Readonly<{
|
|
|
418
424
|
isTouchScreen: boolean;
|
|
419
425
|
canDeviceFitSidebar: boolean;
|
|
420
426
|
}>;
|
|
427
|
+
export declare type UIChildrenComponents = {
|
|
428
|
+
[k in "FooterCenter" | "Menu" | "WelcomeScreen"]?: React.ReactElement<{
|
|
429
|
+
children?: React.ReactNode;
|
|
430
|
+
}, React.JSXElementConstructor<any>>;
|
|
431
|
+
};
|
|
432
|
+
export declare type UIWelcomeScreenComponents = {
|
|
433
|
+
[k in "Center" | "MenuHint" | "ToolbarHint" | "HelpHint"]?: React.ReactElement<{
|
|
434
|
+
children?: React.ReactNode;
|
|
435
|
+
}, React.JSXElementConstructor<any>>;
|
|
436
|
+
};
|
|
437
|
+
export declare type UIWelcomeScreenCenterComponents = {
|
|
438
|
+
[k in "Logo" | "Heading" | "Menu" | "MenuItemLoadScene" | "MenuItemHelp"]?: React.ReactElement<{
|
|
439
|
+
children?: React.ReactNode;
|
|
440
|
+
}, React.JSXElementConstructor<any>>;
|
|
441
|
+
};
|
|
421
442
|
export {};
|
package/types/utils.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { EVENT } from "./constants";
|
|
|
2
2
|
import { FontFamilyValues, FontString } from "./element/types";
|
|
3
3
|
import { AppState, LastActiveToolBeforeEraser, Zoom } from "./types";
|
|
4
4
|
import { SHAPES } from "./shapes";
|
|
5
|
+
import React from "react";
|
|
5
6
|
export declare const setDateTimeForTests: (dateTime: string) => void;
|
|
6
7
|
export declare const getDateTime: () => string;
|
|
7
8
|
export declare const capitalizeString: (str: string) => string;
|
|
@@ -134,3 +135,19 @@ export declare const isPrimitive: (val: any) => boolean;
|
|
|
134
135
|
export declare const getFrame: () => "top" | "iframe";
|
|
135
136
|
export declare const isPromiseLike: (value: any) => value is Promise<any>;
|
|
136
137
|
export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
|
|
138
|
+
/**
|
|
139
|
+
* Partitions React children into named components and the rest of children.
|
|
140
|
+
*
|
|
141
|
+
* Returns known children as a dictionary of react children keyed by their
|
|
142
|
+
* displayName, and the rest children as an array.
|
|
143
|
+
*
|
|
144
|
+
* NOTE all named react components are included in the dictionary, irrespective
|
|
145
|
+
* of the supplied type parameter. This means you may be throwing away
|
|
146
|
+
* children that you aren't expecting, but should nonetheless be rendered.
|
|
147
|
+
* To guard against this (provided you care about the rest children at all),
|
|
148
|
+
* supply a second parameter with an object with keys of the expected children.
|
|
149
|
+
*/
|
|
150
|
+
export declare const getReactChildren: <KnownChildren extends {
|
|
151
|
+
[x: string]: React.ReactNode;
|
|
152
|
+
}>(children: React.ReactNode, expectedComponents?: Record<keyof KnownChildren, any> | undefined) => readonly [Partial<KnownChildren>, React.ReactNode[]];
|
|
153
|
+
export declare const isShallowEqual: <T extends Record<string, any>>(objA: T, objB: T) => boolean;
|