@zsviczian/excalidraw 0.15.2-obsidian-4 → 0.15.2-obsidian-6
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 +273 -143
- 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 +397 -17
- 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 +29 -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/data/url.d.ts +2 -0
- package/types/element/Hyperlink.d.ts +20 -7
- 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 +167 -0
- package/types/element/index.d.ts +3 -2
- package/types/element/linearElementEditor.d.ts +11 -2
- package/types/element/newElement.d.ts +7 -2
- package/types/element/transformHandles.d.ts +8 -1
- package/types/element/typeChecks.d.ts +5 -3
- package/types/element/types.d.ts +20 -4
- package/types/frame.d.ts +40 -0
- package/types/groups.d.ts +4 -0
- package/types/keys.d.ts +3 -0
- package/types/math.d.ts +1 -0
- package/types/packages/excalidraw/example/initialData.d.ts +6 -0
- package/types/packages/excalidraw/index.d.ts +1 -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 +38 -3
- package/types/utils.d.ts +46 -16
- 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,11 @@ 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
|
+
validateIFrame?: boolean | RegExp | RegExp[] | ((link: string) => boolean | undefined);
|
|
310
|
+
renderCustomIFrame?: (element: NonDeletedExcalidrawElement, radius: number, appState: UIAppState) => JSX.Element | null;
|
|
311
|
+
renderWebview?: boolean;
|
|
312
|
+
renderIFrameMenu?: (//zsivzian
|
|
313
|
+
appState: AppState) => JSX.Element | null;
|
|
300
314
|
}
|
|
301
315
|
export type SceneData = {
|
|
302
316
|
elements?: ImportedDataState["elements"];
|
|
@@ -452,6 +466,13 @@ export type ExcalidrawImperativeAPI = {
|
|
|
452
466
|
setCursor: InstanceType<typeof App>["setCursor"];
|
|
453
467
|
resetCursor: InstanceType<typeof App>["resetCursor"];
|
|
454
468
|
toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
|
|
469
|
+
getIFrameElementById: InstanceType<typeof App>["getIFrameElementById"];
|
|
470
|
+
/**
|
|
471
|
+
* Disables rendering of frames (including element clipping), but currently
|
|
472
|
+
* the frames are still interactive in edit mode. As such, this API should be
|
|
473
|
+
* used in conjunction with view mode (props.viewModeEnabled).
|
|
474
|
+
*/
|
|
475
|
+
toggleFrameRendering: InstanceType<typeof App>["toggleFrameRendering"];
|
|
455
476
|
};
|
|
456
477
|
export type Device = Readonly<{
|
|
457
478
|
isSmScreen: boolean;
|
|
@@ -460,4 +481,18 @@ export type Device = Readonly<{
|
|
|
460
481
|
canDeviceFitSidebar: boolean;
|
|
461
482
|
isLandscape: boolean;
|
|
462
483
|
}>;
|
|
484
|
+
type FrameNameBounds = {
|
|
485
|
+
x: number;
|
|
486
|
+
y: number;
|
|
487
|
+
width: number;
|
|
488
|
+
height: number;
|
|
489
|
+
angle: number;
|
|
490
|
+
};
|
|
491
|
+
export type FrameNameBoundsCache = {
|
|
492
|
+
get: (frameElement: ExcalidrawFrameElement) => FrameNameBounds | null;
|
|
493
|
+
_cache: Map<string, FrameNameBounds & {
|
|
494
|
+
zoom: AppState["zoom"]["value"];
|
|
495
|
+
versionNonce: ExcalidrawFrameElement["versionNonce"];
|
|
496
|
+
}>;
|
|
497
|
+
};
|
|
463
498
|
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;
|
|
@@ -29,31 +30,58 @@ export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void, op
|
|
|
29
30
|
cancel(): void;
|
|
30
31
|
};
|
|
31
32
|
/**
|
|
32
|
-
*
|
|
33
|
-
* callback through a requestAnimationFrame call
|
|
33
|
+
* Exponential ease-out method
|
|
34
34
|
*
|
|
35
|
-
*
|
|
35
|
+
* @param {number} k - The value to be tweened.
|
|
36
|
+
* @returns {number} The tweened value.
|
|
37
|
+
*/
|
|
38
|
+
export declare const easeOut: (k: number) => number;
|
|
39
|
+
/**
|
|
40
|
+
* Animates values from `fromValues` to `toValues` using the requestAnimationFrame API.
|
|
41
|
+
* Executes the `onStep` callback on each step with the interpolated values.
|
|
42
|
+
* Returns a function that can be called to cancel the animation.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Example usage:
|
|
46
|
+
* const fromValues = { x: 0, y: 0 };
|
|
47
|
+
* const toValues = { x: 100, y: 200 };
|
|
48
|
+
* const onStep = ({x, y}) => {
|
|
49
|
+
* setState(x, y)
|
|
50
|
+
* };
|
|
51
|
+
* const onCancel = () => {
|
|
52
|
+
* console.log("Animation canceled");
|
|
53
|
+
* };
|
|
36
54
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
55
|
+
* const cancelAnimation = easeToValuesRAF({
|
|
56
|
+
* fromValues,
|
|
57
|
+
* toValues,
|
|
58
|
+
* onStep,
|
|
59
|
+
* onCancel,
|
|
60
|
+
* });
|
|
41
61
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* @param callback The callback receiving the values
|
|
45
|
-
* @param opts default to 250ms duration and the easeOut function
|
|
62
|
+
* // To cancel the animation:
|
|
63
|
+
* cancelAnimation();
|
|
46
64
|
*/
|
|
47
|
-
export declare const easeToValuesRAF: (fromValues
|
|
65
|
+
export declare const easeToValuesRAF: <T extends Record<keyof T, number>, K extends keyof T>({ fromValues, toValues, onStep, duration, interpolateValue, onStart, onEnd, onCancel, }: {
|
|
66
|
+
fromValues: T;
|
|
67
|
+
toValues: T;
|
|
68
|
+
/**
|
|
69
|
+
* Interpolate a single value.
|
|
70
|
+
* Return undefined to be handled by the default interpolator.
|
|
71
|
+
*/
|
|
72
|
+
interpolateValue?: ((fromValue: number, toValue: number, progress: number, key: K) => number | undefined) | undefined;
|
|
73
|
+
onStep: (values: T) => void;
|
|
48
74
|
duration?: number | undefined;
|
|
49
|
-
|
|
50
|
-
|
|
75
|
+
onStart?: (() => void) | undefined;
|
|
76
|
+
onEnd?: (() => void) | undefined;
|
|
77
|
+
onCancel?: (() => void) | undefined;
|
|
78
|
+
}) => () => void;
|
|
51
79
|
export declare const chunk: <T extends unknown>(array: readonly T[], size: number) => T[][];
|
|
52
80
|
export declare const selectNode: (node: Element) => void;
|
|
53
81
|
export declare const removeSelection: () => void;
|
|
54
82
|
export declare const distance: (x: number, y: number) => number;
|
|
55
83
|
export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">, data: ({
|
|
56
|
-
type: (typeof SHAPES)[number]["value"] | "eraser" | "hand";
|
|
84
|
+
type: (typeof SHAPES)[number]["value"] | "eraser" | "hand" | "frame" | "iframe";
|
|
57
85
|
} | {
|
|
58
86
|
type: "custom";
|
|
59
87
|
customType: string;
|
|
@@ -154,9 +182,11 @@ export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) =
|
|
|
154
182
|
export declare const updateObject: <T extends Record<string, any>>(obj: T, updates: Partial<T>) => T;
|
|
155
183
|
export declare const isPrimitive: (val: any) => boolean;
|
|
156
184
|
export declare const getFrame: () => "top" | "iframe";
|
|
185
|
+
export declare const isRunningInIframe: () => boolean;
|
|
157
186
|
export declare const isPromiseLike: (value: any) => value is Promise<any>;
|
|
158
187
|
export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
|
|
159
188
|
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
189
|
export declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E) => void) | undefined, ourEventHandler?: ((event: E) => void) | undefined, { checkForDefaultPrevented }?: {
|
|
161
190
|
checkForDefaultPrevented?: boolean | undefined;
|
|
162
191
|
}) => (event: E) => void;
|
|
192
|
+
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[];
|