@zsviczian/excalidraw 0.15.2-obsidian-4 → 0.15.2-obsidian-5
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 +4 -0
- package/dist/excalidraw.development.js +249 -141
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +2 -0
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +30 -3
- package/types/actions/actionAlign.d.ts +12 -6
- package/types/actions/actionBoundText.d.ts +21 -3
- package/types/actions/actionCanvas.d.ts +94 -10
- package/types/actions/actionClipboard.d.ts +47 -5
- package/types/actions/actionDeleteSelected.d.ts +27 -3
- package/types/actions/actionDistribute.d.ts +2 -2
- package/types/actions/actionElementLock.d.ts +21 -2
- package/types/actions/actionExport.d.ts +90 -9
- package/types/actions/actionFinalize.d.ts +20 -2
- package/types/actions/actionFlip.d.ts +2 -2
- package/types/actions/actionFrame.d.ts +475 -0
- package/types/actions/actionGroup.d.ts +2 -2
- package/types/actions/actionLinearEditor.d.ts +10 -1
- package/types/actions/actionMenu.d.ts +30 -3
- package/types/actions/actionNavigate.d.ts +1 -1
- package/types/actions/actionProperties.d.ts +130 -13
- package/types/actions/actionStyles.d.ts +10 -1
- package/types/actions/actionToggleGridMode.d.ts +10 -1
- package/types/actions/actionToggleStats.d.ts +10 -1
- package/types/actions/actionToggleViewMode.d.ts +10 -1
- package/types/actions/actionToggleZenMode.d.ts +10 -1
- package/types/actions/actionZindex.d.ts +4 -4
- package/types/actions/types.d.ts +1 -1
- package/types/appState.d.ts +1 -1
- package/types/clients.d.ts +1 -5
- package/types/components/App.d.ts +17 -2
- package/types/components/Avatar.d.ts +0 -1
- package/types/components/Dialog.d.ts +2 -1
- package/types/components/FilledButton.d.ts +2 -1
- package/types/components/OverwriteConfirm/OverwriteConfirm.d.ts +17 -0
- package/types/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +17 -0
- package/types/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -0
- package/types/components/ToolButton.d.ts +2 -1
- package/types/components/dropdownMenu/DropdownMenu.d.ts +3 -2
- package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +4 -2
- package/types/components/icons.d.ts +4 -0
- package/types/components/main-menu/MainMenu.d.ts +3 -2
- package/types/constants.d.ts +23 -1
- package/types/context/tunnels.d.ts +1 -0
- package/types/element/Hyperlink.d.ts +21 -6
- package/types/element/binding.d.ts +1 -1
- package/types/element/bounds.d.ts +31 -6
- package/types/element/collision.d.ts +7 -7
- package/types/element/dragElements.d.ts +2 -1
- package/types/element/iframe.d.ts +173 -0
- package/types/element/index.d.ts +3 -2
- package/types/element/linearElementEditor.d.ts +11 -2
- package/types/element/newElement.d.ts +8 -2
- package/types/element/transformHandles.d.ts +8 -1
- package/types/element/typeChecks.d.ts +5 -3
- package/types/element/types.d.ts +13 -4
- package/types/frame.d.ts +40 -0
- package/types/groups.d.ts +4 -0
- package/types/keys.d.ts +2 -0
- package/types/math.d.ts +1 -0
- package/types/packages/excalidraw/example/initialData.d.ts +6 -0
- package/types/renderer/renderElement.d.ts +3 -2
- package/types/renderer/renderScene.d.ts +12 -3
- package/types/renderer/roundRect.d.ts +1 -1
- package/types/scene/Scene.d.ts +8 -1
- package/types/scene/export.d.ts +1 -0
- package/types/scene/selection.d.ts +13 -3
- package/types/types.d.ts +34 -3
- package/types/utils.d.ts +5 -2
- package/types/zindex.d.ts +4 -4
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, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme, StrokeRoundness } from "./element/types";
|
|
2
|
+
import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawFrameElement } 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";
|
|
@@ -58,7 +58,7 @@ export type BinaryFileData = {
|
|
|
58
58
|
export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
|
|
59
59
|
export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
|
|
60
60
|
export type LastActiveTool = {
|
|
61
|
-
type: typeof SHAPES[number]["value"] | "eraser" | "hand";
|
|
61
|
+
type: typeof SHAPES[number]["value"] | "eraser" | "hand" | "frame" | "iframe";
|
|
62
62
|
customType: null;
|
|
63
63
|
} | {
|
|
64
64
|
type: "custom";
|
|
@@ -75,6 +75,10 @@ export type AppState = {
|
|
|
75
75
|
showWelcomeScreen: boolean;
|
|
76
76
|
isLoading: boolean;
|
|
77
77
|
errorMessage: React.ReactNode;
|
|
78
|
+
activeIFrame: {
|
|
79
|
+
element: NonDeletedExcalidrawElement;
|
|
80
|
+
state: "hover" | "active";
|
|
81
|
+
} | null;
|
|
78
82
|
draggingElement: NonDeletedExcalidrawElement | null;
|
|
79
83
|
resizingElement: NonDeletedExcalidrawElement | null;
|
|
80
84
|
multiElement: NonDeleted<ExcalidrawLinearElement> | null;
|
|
@@ -82,6 +86,10 @@ export type AppState = {
|
|
|
82
86
|
isBindingEnabled: boolean;
|
|
83
87
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
84
88
|
suggestedBindings: SuggestedBinding[];
|
|
89
|
+
frameToHighlight: NonDeleted<ExcalidrawFrameElement> | null;
|
|
90
|
+
shouldRenderFrames: boolean;
|
|
91
|
+
editingFrame: string | null;
|
|
92
|
+
elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
|
|
85
93
|
editingElement: NonDeletedExcalidrawElement | null;
|
|
86
94
|
editingLinearElement: LinearElementEditor | null;
|
|
87
95
|
activeTool: {
|
|
@@ -92,7 +100,7 @@ export type AppState = {
|
|
|
92
100
|
lastActiveTool: LastActiveTool;
|
|
93
101
|
locked: boolean;
|
|
94
102
|
} & ({
|
|
95
|
-
type: typeof SHAPES[number]["value"] | "eraser" | "hand";
|
|
103
|
+
type: typeof SHAPES[number]["value"] | "eraser" | "hand" | "frame" | "iframe";
|
|
96
104
|
customType: null;
|
|
97
105
|
} | {
|
|
98
106
|
type: "custom";
|
|
@@ -148,6 +156,7 @@ export type AppState = {
|
|
|
148
156
|
previousSelectedElementIds: {
|
|
149
157
|
[id: string]: boolean;
|
|
150
158
|
};
|
|
159
|
+
selectedElementsAreBeingDragged: boolean;
|
|
151
160
|
shouldCacheIgnoreZoom: boolean;
|
|
152
161
|
toast: {
|
|
153
162
|
message: string;
|
|
@@ -297,6 +306,8 @@ export interface ExcalidrawProps {
|
|
|
297
306
|
onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
|
|
298
307
|
onScrollChange?: (scrollX: number, scrollY: number) => void;
|
|
299
308
|
children?: React.ReactNode;
|
|
309
|
+
iframeURLWhitelist?: RegExp[];
|
|
310
|
+
renderCustomIFrame?: (element: NonDeletedExcalidrawElement, radius: number, appState: UIAppState) => JSX.Element | null;
|
|
300
311
|
}
|
|
301
312
|
export type SceneData = {
|
|
302
313
|
elements?: ImportedDataState["elements"];
|
|
@@ -452,6 +463,12 @@ export type ExcalidrawImperativeAPI = {
|
|
|
452
463
|
setCursor: InstanceType<typeof App>["setCursor"];
|
|
453
464
|
resetCursor: InstanceType<typeof App>["resetCursor"];
|
|
454
465
|
toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
|
|
466
|
+
/**
|
|
467
|
+
* Disables rendering of frames (including element clipping), but currently
|
|
468
|
+
* the frames are still interactive in edit mode. As such, this API should be
|
|
469
|
+
* used in conjunction with view mode (props.viewModeEnabled).
|
|
470
|
+
*/
|
|
471
|
+
toggleFrameRendering: InstanceType<typeof App>["toggleFrameRendering"];
|
|
455
472
|
};
|
|
456
473
|
export type Device = Readonly<{
|
|
457
474
|
isSmScreen: boolean;
|
|
@@ -460,4 +477,18 @@ export type Device = Readonly<{
|
|
|
460
477
|
canDeviceFitSidebar: boolean;
|
|
461
478
|
isLandscape: boolean;
|
|
462
479
|
}>;
|
|
480
|
+
type FrameNameBounds = {
|
|
481
|
+
x: number;
|
|
482
|
+
y: number;
|
|
483
|
+
width: number;
|
|
484
|
+
height: number;
|
|
485
|
+
angle: number;
|
|
486
|
+
};
|
|
487
|
+
export type FrameNameBoundsCache = {
|
|
488
|
+
get: (frameElement: ExcalidrawFrameElement) => FrameNameBounds | null;
|
|
489
|
+
_cache: Map<string, FrameNameBounds & {
|
|
490
|
+
zoom: AppState["zoom"]["value"];
|
|
491
|
+
versionNonce: ExcalidrawFrameElement["versionNonce"];
|
|
492
|
+
}>;
|
|
493
|
+
};
|
|
463
494
|
export {};
|
package/types/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EVENT } from "./constants";
|
|
2
|
-
import { FontFamilyValues, FontString } from "./element/types";
|
|
2
|
+
import { FontFamilyValues, FontString, NonDeletedExcalidrawElement } from "./element/types";
|
|
3
3
|
import { AppState, LastActiveTool, Zoom } from "./types";
|
|
4
4
|
import { SHAPES } from "./shapes";
|
|
5
5
|
export declare const setDateTimeForTests: (dateTime: string) => void;
|
|
@@ -7,6 +7,7 @@ export declare const getDateTime: () => string;
|
|
|
7
7
|
export declare const capitalizeString: (str: string) => string;
|
|
8
8
|
export declare const isToolIcon: (target: Element | EventTarget | null) => target is HTMLElement;
|
|
9
9
|
export declare const isInputLike: (target: Element | EventTarget | null) => target is HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLBRElement | HTMLDivElement;
|
|
10
|
+
export declare const isInteractive: (target: Element | EventTarget | null) => boolean;
|
|
10
11
|
export declare const isWritableElement: (target: Element | EventTarget | null) => target is HTMLInputElement | HTMLTextAreaElement | HTMLBRElement | HTMLDivElement;
|
|
11
12
|
export declare const getFontFamilyString: ({ fontFamily, }: {
|
|
12
13
|
fontFamily: FontFamilyValues;
|
|
@@ -53,7 +54,7 @@ export declare const selectNode: (node: Element) => void;
|
|
|
53
54
|
export declare const removeSelection: () => void;
|
|
54
55
|
export declare const distance: (x: number, y: number) => number;
|
|
55
56
|
export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">, data: ({
|
|
56
|
-
type: (typeof SHAPES)[number]["value"] | "eraser" | "hand";
|
|
57
|
+
type: (typeof SHAPES)[number]["value"] | "eraser" | "hand" | "frame" | "iframe";
|
|
57
58
|
} | {
|
|
58
59
|
type: "custom";
|
|
59
60
|
customType: string;
|
|
@@ -154,9 +155,11 @@ export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) =
|
|
|
154
155
|
export declare const updateObject: <T extends Record<string, any>>(obj: T, updates: Partial<T>) => T;
|
|
155
156
|
export declare const isPrimitive: (val: any) => boolean;
|
|
156
157
|
export declare const getFrame: () => "top" | "iframe";
|
|
158
|
+
export declare const isRunningInIframe: () => boolean;
|
|
157
159
|
export declare const isPromiseLike: (value: any) => value is Promise<any>;
|
|
158
160
|
export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
|
|
159
161
|
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
162
|
export declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E) => void) | undefined, ourEventHandler?: ((event: E) => void) | undefined, { checkForDefaultPrevented }?: {
|
|
161
163
|
checkForDefaultPrevented?: boolean | undefined;
|
|
162
164
|
}) => (event: E) => void;
|
|
165
|
+
export declare const isOnlyExportingSingleFrame: (elements: readonly NonDeletedExcalidrawElement[]) => boolean;
|
package/types/zindex.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "./element/types";
|
|
2
2
|
import { AppState } from "./types";
|
|
3
|
-
export declare const moveOneLeft: (elements: readonly ExcalidrawElement[], appState: AppState
|
|
4
|
-
export declare const moveOneRight: (elements: readonly ExcalidrawElement[], appState: AppState
|
|
5
|
-
export declare const moveAllLeft: (elements: readonly ExcalidrawElement[], appState: AppState
|
|
6
|
-
export declare const moveAllRight: (elements: readonly ExcalidrawElement[], appState: AppState
|
|
3
|
+
export declare const moveOneLeft: (elements: readonly ExcalidrawElement[], appState: AppState, elementsToBeMoved?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
4
|
+
export declare const moveOneRight: (elements: readonly ExcalidrawElement[], appState: AppState, elementsToBeMoved?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
5
|
+
export declare const moveAllLeft: (elements: readonly ExcalidrawElement[], appState: AppState, elementsToBeMoved?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
6
|
+
export declare const moveAllRight: (elements: readonly ExcalidrawElement[], appState: AppState, elementsToBeMoved?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|