@dwelle/excalidraw 0.3.16 → 0.3.20
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 +11 -0
- package/README_NEXT.md +2 -17
- package/dist/0adeb55dfbca17fad22e.woff2 +1 -0
- package/dist/be42d56e500bdd14ae50.woff2 +1 -0
- package/dist/d9454a7bea9e32f0c282.woff2 +1 -0
- package/dist/edf7912ad1921efb0e5c.woff2 +1 -0
- package/dist/excalidraw-assets/image-0db17e06143a31f9772b.js +1 -0
- package/dist/excalidraw-assets/image-a26261fb8a718f15853e.js +1 -0
- package/dist/excalidraw-assets/vendor-405364e1fdefedf5d3d7.js +2 -0
- package/dist/excalidraw-assets/vendor-405364e1fdefedf5d3d7.js.LICENSE.txt +14 -0
- package/dist/excalidraw-assets/vendor-64ea3ed78bc76a895e61.js +2 -0
- package/dist/excalidraw-assets/vendor-64ea3ed78bc76a895e61.js.LICENSE.txt +14 -0
- package/dist/excalidraw-assets/vendor-ce466849186c701b6c48.js +2 -0
- package/dist/excalidraw-assets/vendor-ce466849186c701b6c48.js.LICENSE.txt +14 -0
- package/dist/excalidraw-assets-dev/image-469d5bd946743969995a.js +42 -0
- package/dist/excalidraw-assets-dev/image-664005f0b02c93342b89.js +42 -0
- package/dist/excalidraw-assets-dev/image-821afe7d20de2d2ca898.js +42 -0
- package/dist/excalidraw-assets-dev/vendor-7fcb99cece261da4983f.js +344 -0
- package/dist/excalidraw-assets-dev/vendor-a449655791956f151f51.js +344 -0
- package/dist/excalidraw.development.js +384 -188
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +9 -0
- package/package.json +24 -21
- package/types/appState.d.ts +6 -6
- package/types/components/CheckboxItem.d.ts +2 -1
- package/types/components/ClearCanvas.d.ts +0 -1
- package/types/components/ConfirmDialog.d.ts +11 -0
- package/types/components/Dialog.d.ts +4 -2
- package/types/components/HintViewer.d.ts +3 -2
- package/types/components/LibraryMenu.d.ts +18 -0
- package/types/components/LibraryMenuItems.d.ts +22 -0
- package/types/components/LibraryUnit.d.ts +6 -4
- package/types/components/Modal.d.ts +1 -0
- package/types/components/PasteChartDialog.d.ts +1 -1
- package/types/components/PublishLibrary.d.ts +17 -0
- package/types/components/SingleLibraryItem.d.ts +11 -0
- package/types/components/ToolButton.d.ts +5 -0
- package/types/components/Tooltip.d.ts +2 -1
- package/types/components/icons.d.ts +1 -0
- package/types/constants.d.ts +5 -0
- package/types/data/blob.d.ts +5 -1
- package/types/data/encryption.d.ts +3 -3
- package/types/data/filesystem.d.ts +2 -2
- package/types/data/json.d.ts +2 -2
- package/types/data/library.d.ts +1 -1
- package/types/data/restore.d.ts +2 -1
- package/types/data/types.d.ts +7 -4
- package/types/element/bounds.d.ts +8 -1
- package/types/element/index.d.ts +0 -3
- package/types/element/mutateElement.d.ts +1 -1
- package/types/element/newElement.d.ts +1 -1
- package/types/element/types.d.ts +2 -0
- package/types/i18n.d.ts +1 -1
- package/types/packages/excalidraw/dist/excalidraw-assets/image-0db17e06143a31f9772b.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/image-a26261fb8a718f15853e.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/vendor-405364e1fdefedf5d3d7.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/vendor-64ea3ed78bc76a895e61.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/vendor-ce466849186c701b6c48.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-469d5bd946743969995a.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-664005f0b02c93342b89.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-821afe7d20de2d2ca898.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/vendor-7fcb99cece261da4983f.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/vendor-a449655791956f151f51.d.ts +0 -0
- package/types/packages/excalidraw/env.d.ts +1 -0
- package/types/packages/excalidraw/index.d.ts +1 -1
- package/types/packages/excalidraw/webpack.dev.config.d.ts +1 -1
- package/types/packages/excalidraw/webpack.prod.config.d.ts +1 -1
- package/types/packages/utils.d.ts +5 -4
- package/types/renderer/renderElement.d.ts +4 -4
- package/types/renderer/renderScene.d.ts +4 -9
- package/types/scene/types.d.ts +15 -8
- package/types/types.d.ts +14 -1
- package/types/utils.d.ts +10 -0
|
@@ -2,12 +2,12 @@ import { ExcalidrawElement, ExcalidrawTextElement, NonDeletedExcalidrawElement,
|
|
|
2
2
|
import { RoughCanvas } from "roughjs/bin/canvas";
|
|
3
3
|
import { Drawable, Options } from "roughjs/bin/core";
|
|
4
4
|
import { RoughSVG } from "roughjs/bin/svg";
|
|
5
|
-
import {
|
|
5
|
+
import { RenderConfig } from "../scene/types";
|
|
6
6
|
import { BinaryFiles, Zoom } from "../types";
|
|
7
7
|
export interface ExcalidrawElementWithCanvas {
|
|
8
8
|
element: ExcalidrawElement | ExcalidrawTextElement;
|
|
9
9
|
canvas: HTMLCanvasElement;
|
|
10
|
-
theme:
|
|
10
|
+
theme: RenderConfig["theme"];
|
|
11
11
|
canvasZoom: Zoom["value"];
|
|
12
12
|
canvasOffsetX: number;
|
|
13
13
|
canvasOffsetY: number;
|
|
@@ -16,8 +16,8 @@ export declare const getShapeForElement: (element: ExcalidrawElement) => Drawabl
|
|
|
16
16
|
export declare const invalidateShapeForElement: (element: ExcalidrawElement) => boolean;
|
|
17
17
|
export declare const clearRenderCache: () => void;
|
|
18
18
|
export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
|
|
19
|
-
export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D,
|
|
20
|
-
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX?: number | undefined, offsetY?: number | undefined) => void;
|
|
19
|
+
export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: RenderConfig) => void;
|
|
20
|
+
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX?: number | undefined, offsetY?: number | undefined, exportWithDarkMode?: boolean | undefined) => void;
|
|
21
21
|
export declare let pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
|
|
22
22
|
export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
|
|
23
23
|
export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
|
|
@@ -2,21 +2,16 @@ import { RoughCanvas } from "roughjs/bin/canvas";
|
|
|
2
2
|
import { RoughSVG } from "roughjs/bin/svg";
|
|
3
3
|
import { AppState, BinaryFiles } from "../types";
|
|
4
4
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
5
|
-
import {
|
|
6
|
-
export declare const renderScene: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, selectionElement: NonDeletedExcalidrawElement | null, scale: number, rc: RoughCanvas, canvas: HTMLCanvasElement,
|
|
7
|
-
renderScrollbars?: boolean | undefined;
|
|
8
|
-
renderSelection?: boolean | undefined;
|
|
9
|
-
renderOptimizations?: boolean | undefined;
|
|
10
|
-
renderGrid?: boolean | undefined;
|
|
11
|
-
isExport?: boolean | undefined;
|
|
12
|
-
}) => {
|
|
5
|
+
import { RenderConfig } from "../scene/types";
|
|
6
|
+
export declare const renderScene: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, selectionElement: NonDeletedExcalidrawElement | null, scale: number, rc: RoughCanvas, canvas: HTMLCanvasElement, renderConfig: RenderConfig) => {
|
|
13
7
|
atLeastOneVisibleElement: boolean;
|
|
14
8
|
scrollBars?: undefined;
|
|
15
9
|
} | {
|
|
16
10
|
atLeastOneVisibleElement: boolean;
|
|
17
11
|
scrollBars: import("../scene/types").ScrollBars | undefined;
|
|
18
12
|
};
|
|
19
|
-
export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, }?: {
|
|
13
|
+
export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode, }?: {
|
|
20
14
|
offsetX?: number | undefined;
|
|
21
15
|
offsetY?: number | undefined;
|
|
16
|
+
exportWithDarkMode?: boolean | undefined;
|
|
22
17
|
}) => void;
|
package/types/scene/types.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ExcalidrawTextElement } from "../element/types";
|
|
2
|
-
import { AppClassProperties, AppState
|
|
3
|
-
export declare type
|
|
4
|
-
scrollX:
|
|
5
|
-
scrollY:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { AppClassProperties, AppState } from "../types";
|
|
3
|
+
export declare type RenderConfig = {
|
|
4
|
+
scrollX: AppState["scrollX"];
|
|
5
|
+
scrollY: AppState["scrollY"];
|
|
6
|
+
/** null indicates transparent bg */
|
|
7
|
+
viewBackgroundColor: AppState["viewBackgroundColor"] | null;
|
|
8
|
+
zoom: AppState["zoom"];
|
|
9
|
+
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
|
|
10
|
+
theme: AppState["theme"];
|
|
9
11
|
remotePointerViewportCoords: {
|
|
10
12
|
[id: string]: {
|
|
11
13
|
x: number;
|
|
@@ -24,8 +26,13 @@ export declare type SceneState = {
|
|
|
24
26
|
remotePointerUserStates: {
|
|
25
27
|
[id: string]: string;
|
|
26
28
|
};
|
|
27
|
-
theme: AppState["theme"];
|
|
28
29
|
imageCache: AppClassProperties["imageCache"];
|
|
30
|
+
renderScrollbars?: boolean;
|
|
31
|
+
renderSelection?: boolean;
|
|
32
|
+
renderGrid?: boolean;
|
|
33
|
+
/** when exporting the behavior is slightly different (e.g. we can't use
|
|
34
|
+
CSS filters), and we disable render optimizations for best output */
|
|
35
|
+
isExporting: boolean;
|
|
29
36
|
};
|
|
30
37
|
export declare type SceneScroll = {
|
|
31
38
|
scrollX: number;
|
package/types/types.d.ts
CHANGED
|
@@ -152,7 +152,20 @@ export declare class GestureEvent extends UIEvent {
|
|
|
152
152
|
readonly rotation: number;
|
|
153
153
|
readonly scale: number;
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
/** @deprecated legacy: do not use outside of migration paths */
|
|
156
|
+
export declare type LibraryItem_v1 = readonly NonDeleted<ExcalidrawElement>[];
|
|
157
|
+
/** @deprecated legacy: do not use outside of migration paths */
|
|
158
|
+
export declare type LibraryItems_v1 = readonly LibraryItem_v1[];
|
|
159
|
+
/** v2 library item */
|
|
160
|
+
export declare type LibraryItem = {
|
|
161
|
+
id: string;
|
|
162
|
+
status: "published" | "unpublished";
|
|
163
|
+
elements: readonly NonDeleted<ExcalidrawElement>[];
|
|
164
|
+
/** timestamp in epoch (ms) */
|
|
165
|
+
created: number;
|
|
166
|
+
name?: string;
|
|
167
|
+
error?: string;
|
|
168
|
+
};
|
|
156
169
|
export declare type LibraryItems = readonly LibraryItem[];
|
|
157
170
|
export declare type ExcalidrawAPIRefValue = ExcalidrawImperativeAPI | {
|
|
158
171
|
readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
|
package/types/utils.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeo
|
|
|
24
24
|
flush(): void;
|
|
25
25
|
cancel(): void;
|
|
26
26
|
};
|
|
27
|
+
export declare const chunk: <T extends unknown>(array: readonly T[], size: number) => T[][];
|
|
27
28
|
export declare const selectNode: (node: Element) => void;
|
|
28
29
|
export declare const removeSelection: () => void;
|
|
29
30
|
export declare const distance: (x: number, y: number) => number;
|
|
@@ -92,3 +93,12 @@ export declare const supportsEmoji: () => boolean;
|
|
|
92
93
|
export declare const getNearestScrollableContainer: (element: HTMLElement) => HTMLElement | Document;
|
|
93
94
|
export declare const focusNearestParent: (element: HTMLInputElement) => void;
|
|
94
95
|
export declare const preventUnload: (event: BeforeUnloadEvent) => void;
|
|
96
|
+
export declare const bytesToHexString: (bytes: Uint8Array) => string;
|
|
97
|
+
export declare const getUpdatedTimestamp: () => number;
|
|
98
|
+
/**
|
|
99
|
+
* Transforms array of objects containing `id` attribute,
|
|
100
|
+
* or array of ids (strings), into a Map, keyd by `id`.
|
|
101
|
+
*/
|
|
102
|
+
export declare const arrayToMap: <T extends string | {
|
|
103
|
+
id: string;
|
|
104
|
+
}>(items: readonly T[]) => Map<string, T>;
|