@dwelle/excalidraw 0.3.72 → 0.3.73-raf-fix
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/CHANGELOG.md +246 -4
- package/README.md +352 -42
- package/dist/excalidraw.development.js +22 -33
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +3 -3
- package/types/actions/actionAddToLibrary.d.ts +13 -3
- package/types/actions/actionBoundText.d.ts +5 -1
- package/types/actions/actionCanvas.d.ts +40 -8
- package/types/actions/actionClipboard.d.ts +25 -5
- package/types/actions/actionDeleteSelected.d.ts +15 -3
- package/types/actions/actionExport.d.ts +43 -9
- package/types/actions/actionFinalize.d.ts +10 -2
- package/types/actions/actionMenu.d.ts +15 -3
- package/types/actions/actionProperties.d.ts +65 -13
- package/types/actions/actionStyles.d.ts +3 -1
- package/types/actions/actionToggleGridMode.d.ts +5 -1
- package/types/actions/actionToggleStats.d.ts +5 -1
- package/types/actions/actionToggleViewMode.d.ts +5 -1
- package/types/actions/actionToggleZenMode.d.ts +5 -1
- package/types/components/App.d.ts +7 -2
- package/types/components/Toast.d.ts +4 -2
- package/types/constants.d.ts +0 -1
- package/types/data/filesystem.d.ts +2 -2
- package/types/element/Hyperlink.d.ts +5 -1
- package/types/element/linearElementEditor.d.ts +5 -1
- package/types/jotai.d.ts +5 -3
- package/types/renderer/renderScene.d.ts +2 -0
- package/types/types.d.ts +6 -2
- package/types/utils.d.ts +3 -1
- package/README_NEXT.md +0 -1345
|
@@ -72,7 +72,11 @@ export declare const actionToggleZenMode: {
|
|
|
72
72
|
};
|
|
73
73
|
shouldCacheIgnoreZoom: boolean;
|
|
74
74
|
showHelpDialog: boolean;
|
|
75
|
-
|
|
75
|
+
toast: {
|
|
76
|
+
message: string;
|
|
77
|
+
closable?: boolean | undefined;
|
|
78
|
+
duration?: number | undefined;
|
|
79
|
+
} | null;
|
|
76
80
|
theme: string;
|
|
77
81
|
gridSize: number | null;
|
|
78
82
|
viewModeEnabled: boolean;
|
|
@@ -64,6 +64,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
64
64
|
private refreshDeviceState;
|
|
65
65
|
componentDidMount(): Promise<void>;
|
|
66
66
|
componentWillUnmount(): void;
|
|
67
|
+
private checkIfBrowserZoomed;
|
|
67
68
|
private onResize;
|
|
68
69
|
private removeEventListeners;
|
|
69
70
|
private addEventListeners;
|
|
@@ -85,8 +86,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
85
86
|
togglePenMode: () => void;
|
|
86
87
|
toggleZenMode: () => void;
|
|
87
88
|
scrollToContent: (target?: ExcalidrawElement | readonly ExcalidrawElement[]) => void;
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
setToast: (toast: {
|
|
90
|
+
message: string;
|
|
91
|
+
closable?: boolean;
|
|
92
|
+
duration?: number;
|
|
93
|
+
} | null) => void;
|
|
90
94
|
restoreFileFromShare: () => Promise<void>;
|
|
91
95
|
/** adds supplied files to existing files in the appState */
|
|
92
96
|
addFiles: ExcalidrawImperativeAPI["addFiles"];
|
|
@@ -99,6 +103,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
99
103
|
private onSceneUpdated;
|
|
100
104
|
private updateCurrentCursorPosition;
|
|
101
105
|
private onKeyDown;
|
|
106
|
+
private onWheel;
|
|
102
107
|
private onKeyUp;
|
|
103
108
|
private setActiveTool;
|
|
104
109
|
private setCursor;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./Toast.scss";
|
|
3
|
-
export declare const Toast: ({ message,
|
|
3
|
+
export declare const Toast: ({ message, onClose, closable, duration, }: {
|
|
4
4
|
message: string;
|
|
5
|
-
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
closable?: boolean | undefined;
|
|
7
|
+
duration?: number | undefined;
|
|
6
8
|
}) => JSX.Element;
|
package/types/constants.d.ts
CHANGED
|
@@ -96,7 +96,6 @@ export declare const IMAGE_RENDER_TIMEOUT = 500;
|
|
|
96
96
|
export declare const TAP_TWICE_TIMEOUT = 300;
|
|
97
97
|
export declare const TOUCH_CTX_MENU_TIMEOUT = 500;
|
|
98
98
|
export declare const TITLE_TIMEOUT = 10000;
|
|
99
|
-
export declare const TOAST_TIMEOUT = 5000;
|
|
100
99
|
export declare const VERSION_TIMEOUT = 30000;
|
|
101
100
|
export declare const SCROLL_TIMEOUT = 100;
|
|
102
101
|
export declare const ZOOM_STEP = 0.1;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FileSystemHandle, supported as nativeFileSystemSupported } from "browser-fs-access";
|
|
2
2
|
declare type FILE_EXTENSION = "gif" | "jpg" | "png" | "excalidraw.png" | "svg" | "excalidraw.svg" | "json" | "excalidraw" | "excalidrawlib";
|
|
3
3
|
export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
|
|
4
4
|
extensions?: FILE_EXTENSION[] | undefined;
|
|
5
5
|
description: string;
|
|
6
6
|
multiple?: M | undefined;
|
|
7
|
-
}) => Promise<M extends false | undefined ?
|
|
7
|
+
}) => Promise<M extends false | undefined ? File : File[]>;
|
|
8
8
|
export declare const fileSave: (blob: Blob, opts: {
|
|
9
9
|
/** supply without the extension */
|
|
10
10
|
name: string;
|
|
@@ -82,7 +82,11 @@ export declare const actionLink: {
|
|
|
82
82
|
};
|
|
83
83
|
shouldCacheIgnoreZoom: boolean;
|
|
84
84
|
showHelpDialog: boolean;
|
|
85
|
-
|
|
85
|
+
toast: {
|
|
86
|
+
message: string;
|
|
87
|
+
closable?: boolean | undefined;
|
|
88
|
+
duration?: number | undefined;
|
|
89
|
+
} | null;
|
|
86
90
|
zenModeEnabled: boolean;
|
|
87
91
|
theme: string;
|
|
88
92
|
gridSize: number | null;
|
|
@@ -149,7 +149,11 @@ export declare class LinearElementEditor {
|
|
|
149
149
|
};
|
|
150
150
|
shouldCacheIgnoreZoom: boolean;
|
|
151
151
|
showHelpDialog: boolean;
|
|
152
|
-
|
|
152
|
+
toast: {
|
|
153
|
+
message: string;
|
|
154
|
+
closable?: boolean | undefined;
|
|
155
|
+
duration?: number | undefined;
|
|
156
|
+
} | null;
|
|
153
157
|
zenModeEnabled: boolean;
|
|
154
158
|
theme: string;
|
|
155
159
|
gridSize: number | null;
|
package/types/jotai.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { WritableAtom } from "jotai";
|
|
1
2
|
export declare const jotaiScope: unique symbol;
|
|
2
3
|
export declare const jotaiStore: {
|
|
3
4
|
get: <Value>(atom: import("jotai").Atom<Value>) => (Value extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value) | undefined;
|
|
4
5
|
asyncGet: <Value_1>(atom: import("jotai").Atom<Value_1>) => Promise<Value_1 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_1>;
|
|
5
|
-
set: <Value_2, Update, Result extends void | Promise<void>>(atom:
|
|
6
|
+
set: <Value_2, Update, Result extends void | Promise<void>>(atom: WritableAtom<Value_2, Update, Result>, update: Update) => Result;
|
|
6
7
|
sub: (atom: {
|
|
7
8
|
toString: () => string;
|
|
8
9
|
debugLabel?: string | undefined;
|
|
@@ -14,7 +15,7 @@ export declare const jotaiStore: {
|
|
|
14
15
|
}, callback: () => void) => () => void;
|
|
15
16
|
SECRET_INTERNAL_store: {
|
|
16
17
|
r: <Value_6>(readingAtom: import("jotai").Atom<Value_6>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_6>;
|
|
17
|
-
w: <Value_1_1, Update_1, Result_1 extends void | Promise<void>>(writingAtom:
|
|
18
|
+
w: <Value_1_1, Update_1, Result_1 extends void | Promise<void>>(writingAtom: WritableAtom<Value_1_1, Update_1, Result_1>, update: Update_1, version?: import("jotai/core/store").VersionObject | undefined) => Result_1;
|
|
18
19
|
c: (_atom: {
|
|
19
20
|
toString: () => string;
|
|
20
21
|
debugLabel?: string | undefined;
|
|
@@ -84,7 +85,7 @@ export declare const jotaiStore: {
|
|
|
84
85
|
} | undefined;
|
|
85
86
|
} | {
|
|
86
87
|
r: <Value_7>(readingAtom: import("jotai").Atom<Value_7>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_7>;
|
|
87
|
-
w: <Value_1_2, Update_2, Result_2 extends void | Promise<void>>(writingAtom:
|
|
88
|
+
w: <Value_1_2, Update_2, Result_2 extends void | Promise<void>>(writingAtom: WritableAtom<Value_1_2, Update_2, Result_2>, update: Update_2, version?: import("jotai/core/store").VersionObject | undefined) => Result_2;
|
|
88
89
|
c: (_atom: {
|
|
89
90
|
toString: () => string;
|
|
90
91
|
debugLabel?: string | undefined;
|
|
@@ -118,3 +119,4 @@ export declare const jotaiStore: {
|
|
|
118
119
|
m?: undefined;
|
|
119
120
|
};
|
|
120
121
|
};
|
|
122
|
+
export declare const useAtomWithInitialValue: <T extends unknown, A extends WritableAtom<T, T, void>>(atom: A, initialValue: T | (() => T)) => readonly [T extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : T, import("jotai/core/atom").SetAtom<T, void>];
|
|
@@ -10,6 +10,8 @@ export declare const renderScene: (elements: readonly NonDeletedExcalidrawElemen
|
|
|
10
10
|
atLeastOneVisibleElement: boolean;
|
|
11
11
|
scrollBars: import("../scene/types").ScrollBars | undefined;
|
|
12
12
|
};
|
|
13
|
+
/** renderScene throttled to animation framerate */
|
|
14
|
+
export declare const renderSceneThrottled: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, selectionElement: NonDeletedExcalidrawElement | null, scale: number, rc: RoughCanvas, canvas: HTMLCanvasElement, renderConfig: RenderConfig, callback?: ((data: ReturnType<typeof renderScene>) => void) | undefined, throttle?: boolean) => void;
|
|
13
15
|
export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode, }?: {
|
|
14
16
|
offsetX?: number | undefined;
|
|
15
17
|
offsetY?: number | undefined;
|
package/types/types.d.ts
CHANGED
|
@@ -113,7 +113,11 @@ export declare type AppState = {
|
|
|
113
113
|
};
|
|
114
114
|
shouldCacheIgnoreZoom: boolean;
|
|
115
115
|
showHelpDialog: boolean;
|
|
116
|
-
|
|
116
|
+
toast: {
|
|
117
|
+
message: string;
|
|
118
|
+
closable?: boolean;
|
|
119
|
+
duration?: number;
|
|
120
|
+
} | null;
|
|
117
121
|
zenModeEnabled: boolean;
|
|
118
122
|
theme: Theme;
|
|
119
123
|
gridSize: number | null;
|
|
@@ -365,7 +369,7 @@ export declare type ExcalidrawImperativeAPI = {
|
|
|
365
369
|
getAppState: () => InstanceType<typeof App>["state"];
|
|
366
370
|
getFiles: () => InstanceType<typeof App>["files"];
|
|
367
371
|
refresh: InstanceType<typeof App>["refresh"];
|
|
368
|
-
|
|
372
|
+
setToast: InstanceType<typeof App>["setToast"];
|
|
369
373
|
addFiles: (data: BinaryFileData[]) => void;
|
|
370
374
|
readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
371
375
|
ready: true;
|
package/types/utils.d.ts
CHANGED
|
@@ -21,7 +21,9 @@ export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeo
|
|
|
21
21
|
flush(): void;
|
|
22
22
|
cancel(): void;
|
|
23
23
|
};
|
|
24
|
-
export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void
|
|
24
|
+
export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void, opts?: {
|
|
25
|
+
trailing?: boolean | undefined;
|
|
26
|
+
} | undefined) => {
|
|
25
27
|
(...args: T): void;
|
|
26
28
|
flush(): void;
|
|
27
29
|
cancel(): void;
|