@zsviczian/excalidraw 0.15.2-obsidian-1 → 0.15.2-obsidian-2
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/excalidraw.development.js +462 -198
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +15 -6
- package/types/actions/actionBoundText.d.ts +10 -4
- package/types/actions/actionCanvas.d.ts +50 -20
- package/types/actions/actionClipboard.d.ts +25 -10
- package/types/actions/actionDeleteSelected.d.ts +15 -6
- package/types/actions/actionExport.d.ts +45 -18
- package/types/actions/actionFinalize.d.ts +10 -4
- package/types/actions/actionLinearEditor.d.ts +5 -2
- package/types/actions/actionMenu.d.ts +15 -6
- package/types/actions/actionProperties.d.ts +65 -26
- package/types/actions/actionStyles.d.ts +5 -2
- package/types/actions/actionToggleGridMode.d.ts +5 -2
- package/types/actions/actionToggleLock.d.ts +5 -2
- package/types/actions/actionToggleStats.d.ts +5 -2
- package/types/actions/actionToggleViewMode.d.ts +5 -2
- package/types/actions/actionToggleZenMode.d.ts +5 -2
- package/types/appState.d.ts +5 -2
- package/types/clipboard.d.ts +2 -2
- package/types/components/Actions.d.ts +5 -5
- package/types/components/App.d.ts +10 -3
- package/types/components/Button.d.ts +3 -1
- package/types/components/DefaultSidebar.d.ts +30 -0
- package/types/components/HintViewer.d.ts +2 -2
- package/types/components/ImageExportDialog.d.ts +4 -4
- package/types/components/JSONExportDialog.d.ts +3 -3
- package/types/components/LayerUI.d.ts +3 -10
- package/types/components/LibraryMenu.d.ts +32 -13
- package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
- package/types/components/LibraryMenuControlButtons.d.ts +9 -0
- package/types/components/LibraryMenuHeaderContent.d.ts +9 -28
- package/types/components/LibraryMenuItems.d.ts +2 -2
- package/types/components/MobileMenu.d.ts +3 -3
- package/types/components/PasteChartDialog.d.ts +4 -5
- package/types/components/PublishLibrary.d.ts +2 -2
- package/types/components/Sidebar/Sidebar.d.ts +68 -45
- package/types/components/Sidebar/SidebarHeader.d.ts +6 -19
- package/types/components/Sidebar/SidebarTab.d.ts +9 -0
- package/types/components/Sidebar/SidebarTabTrigger.d.ts +10 -0
- package/types/components/Sidebar/SidebarTabTriggers.d.ts +7 -0
- package/types/components/Sidebar/SidebarTabs.d.ts +7 -0
- package/types/components/Sidebar/SidebarTrigger.d.ts +6 -0
- package/types/components/Sidebar/common.d.ts +23 -6
- package/types/components/Stats.d.ts +3 -3
- package/types/components/Trans.d.ts +8 -0
- package/types/components/footer/Footer.d.ts +2 -2
- package/types/constants.d.ts +5 -0
- package/types/context/tunnels.d.ts +18 -0
- package/types/context/ui-appState.d.ts +4 -0
- package/types/data/types.d.ts +2 -4
- package/types/element/Hyperlink.d.ts +7 -4
- package/types/element/linearElementEditor.d.ts +5 -2
- package/types/element/newElement.d.ts +6 -1
- package/types/element/showSelectedShapeActions.d.ts +2 -2
- package/types/element/textElement.d.ts +2 -2
- package/types/hooks/useOutsideClick.d.ts +1 -1
- package/types/packages/excalidraw/index.d.ts +2 -1
- package/types/packages/utils.d.ts +1 -1
- package/types/scene/selection.d.ts +4 -4
- package/types/types.d.ts +23 -12
- package/types/utils.d.ts +2 -2
package/types/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme, StrokeRoundness } from "./element/types";
|
|
2
3
|
import { SHAPES } from "./shapes";
|
|
3
4
|
import { Point as RoughPoint } from "roughjs/bin/geometry";
|
|
@@ -16,7 +17,6 @@ import type { FileSystemHandle } from "./data/filesystem";
|
|
|
16
17
|
import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
|
|
17
18
|
import { ContextMenuItems } from "./components/ContextMenu";
|
|
18
19
|
import { Merge, ForwardRef, ValueOf } from "./utility-types";
|
|
19
|
-
import React from "react";
|
|
20
20
|
export declare type Point = Readonly<RoughPoint>;
|
|
21
21
|
export declare type Collaborator = {
|
|
22
22
|
pointer?: {
|
|
@@ -63,6 +63,8 @@ export declare type LastActiveTool = {
|
|
|
63
63
|
type: "custom";
|
|
64
64
|
customType: string;
|
|
65
65
|
} | null;
|
|
66
|
+
export declare type SidebarName = string;
|
|
67
|
+
export declare type SidebarTabName = string;
|
|
66
68
|
export declare type AppState = {
|
|
67
69
|
contextMenu: {
|
|
68
70
|
items: ContextMenuItems;
|
|
@@ -125,9 +127,19 @@ export declare type AppState = {
|
|
|
125
127
|
zoom: Zoom;
|
|
126
128
|
openMenu: "canvas" | "shape" | null;
|
|
127
129
|
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
128
|
-
openSidebar:
|
|
130
|
+
openSidebar: {
|
|
131
|
+
name: SidebarName;
|
|
132
|
+
tab?: SidebarTabName;
|
|
133
|
+
} | null;
|
|
129
134
|
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
130
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Reflects user preference for whether the default sidebar should be docked.
|
|
137
|
+
*
|
|
138
|
+
* NOTE this is only a user preference and does not reflect the actual docked
|
|
139
|
+
* state of the sidebar, because the host apps can override this through
|
|
140
|
+
* a DefaultSidebar prop, which is not reflected back to the appState.
|
|
141
|
+
*/
|
|
142
|
+
defaultSidebarDockedPreference: boolean;
|
|
131
143
|
lastPointerDownWith: PointerType;
|
|
132
144
|
selectedElementIds: {
|
|
133
145
|
[id: string]: boolean;
|
|
@@ -189,6 +201,7 @@ export declare type AppState = {
|
|
|
189
201
|
invertBindingBehaviour: boolean;
|
|
190
202
|
selectedLinearElement: LinearElementEditor | null;
|
|
191
203
|
};
|
|
204
|
+
export declare type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
|
|
192
205
|
export declare type NormalizedZoomValue = number & {
|
|
193
206
|
_brand: "normalizedZoom";
|
|
194
207
|
};
|
|
@@ -251,7 +264,7 @@ export interface ExcalidrawProps {
|
|
|
251
264
|
}) => void;
|
|
252
265
|
onPaste?: (data: ClipboardData, event: ClipboardEvent | null) => Promise<boolean> | boolean;
|
|
253
266
|
onDrop?: (event: React.DragEvent<HTMLDivElement>) => Promise<boolean> | boolean;
|
|
254
|
-
renderTopRightUI?: (isMobile: boolean, appState:
|
|
267
|
+
renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
|
|
255
268
|
langCode?: Language["code"];
|
|
256
269
|
viewModeEnabled?: boolean;
|
|
257
270
|
zenModeEnabled?: boolean;
|
|
@@ -260,7 +273,7 @@ export interface ExcalidrawProps {
|
|
|
260
273
|
initState?: AppState;
|
|
261
274
|
theme?: Theme;
|
|
262
275
|
name?: string;
|
|
263
|
-
renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState:
|
|
276
|
+
renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => JSX.Element;
|
|
264
277
|
UIOptions?: Partial<UIOptions>;
|
|
265
278
|
detectScroll?: boolean;
|
|
266
279
|
handleKeyboardGlobally?: boolean;
|
|
@@ -277,10 +290,6 @@ export interface ExcalidrawProps {
|
|
|
277
290
|
onLinkHover?: (element: NonDeletedExcalidrawElement, event: React.PointerEvent<HTMLCanvasElement>) => void;
|
|
278
291
|
onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
|
|
279
292
|
onScrollChange?: (scrollX: number, scrollY: number) => void;
|
|
280
|
-
/**
|
|
281
|
-
* Render function that renders custom <Sidebar /> component.
|
|
282
|
-
*/
|
|
283
|
-
renderSidebar?: () => JSX.Element | null;
|
|
284
293
|
children?: React.ReactNode;
|
|
285
294
|
}
|
|
286
295
|
export declare type SceneData = {
|
|
@@ -296,8 +305,8 @@ export declare enum UserIdleState {
|
|
|
296
305
|
}
|
|
297
306
|
export declare type ExportOpts = {
|
|
298
307
|
saveFileToDisk?: boolean;
|
|
299
|
-
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState:
|
|
300
|
-
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState:
|
|
308
|
+
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => void;
|
|
309
|
+
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => JSX.Element;
|
|
301
310
|
};
|
|
302
311
|
declare type CanvasActions = Partial<{
|
|
303
312
|
changeViewBackgroundColor: boolean;
|
|
@@ -340,6 +349,8 @@ export declare type AppClassProperties = {
|
|
|
340
349
|
device: App["device"];
|
|
341
350
|
scene: App["scene"];
|
|
342
351
|
pasteFromClipboard: App["pasteFromClipboard"];
|
|
352
|
+
id: App["id"];
|
|
353
|
+
onInsertElements: App["onInsertElements"];
|
|
343
354
|
};
|
|
344
355
|
export declare type PointerDownState = Readonly<{
|
|
345
356
|
origin: Readonly<{
|
|
@@ -432,7 +443,7 @@ export declare type ExcalidrawImperativeAPI = {
|
|
|
432
443
|
setActiveTool: InstanceType<typeof App>["setActiveTool"];
|
|
433
444
|
setCursor: InstanceType<typeof App>["setCursor"];
|
|
434
445
|
resetCursor: InstanceType<typeof App>["resetCursor"];
|
|
435
|
-
|
|
446
|
+
toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
|
|
436
447
|
};
|
|
437
448
|
export declare type Device = Readonly<{
|
|
438
449
|
isSmScreen: boolean;
|
package/types/utils.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">,
|
|
|
63
63
|
export declare const resetCursor: (canvas: HTMLCanvasElement | null) => void;
|
|
64
64
|
export declare const setCursor: (canvas: HTMLCanvasElement | null, cursor: string) => void;
|
|
65
65
|
export declare const setEraserCursor: (canvas: HTMLCanvasElement | null, theme: AppState["theme"]) => void;
|
|
66
|
-
export declare const setCursorForShape: (canvas: HTMLCanvasElement | null, appState: AppState) => void;
|
|
66
|
+
export declare const setCursorForShape: (canvas: HTMLCanvasElement | null, appState: Pick<AppState, "activeTool" | "theme">) => void;
|
|
67
67
|
export declare const isFullScreen: () => boolean;
|
|
68
68
|
export declare const allowFullScreen: () => Promise<void>;
|
|
69
69
|
export declare const exitFullScreen: () => Promise<void>;
|
|
@@ -156,7 +156,7 @@ export declare const isPrimitive: (val: any) => boolean;
|
|
|
156
156
|
export declare const getFrame: () => "top" | "iframe";
|
|
157
157
|
export declare const isPromiseLike: (value: any) => value is Promise<any>;
|
|
158
158
|
export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
|
|
159
|
-
export declare const isShallowEqual: <T extends Record<string, any
|
|
159
|
+
export declare const isShallowEqual: <T extends Record<string, any>, I extends keyof T>(objA: T, objB: T, comparators?: Record<I, (a: T[I], b: T[I]) => boolean> | undefined, debug?: boolean) => boolean;
|
|
160
160
|
export declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E) => void) | undefined, ourEventHandler?: ((event: E) => void) | undefined, { checkForDefaultPrevented }?: {
|
|
161
161
|
checkForDefaultPrevented?: boolean | undefined;
|
|
162
162
|
}) => (event: E) => void;
|