@excalidraw/excalidraw 0.16.1-e8def8d → 0.17.0-7284-25ea35d
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 +162 -1
- package/dist/excalidraw-assets-dev/{vendor-4d89e0ee30f240211e12.js → vendor-06d9b385f406ee409106.js} +2 -2
- package/dist/excalidraw-with-preact.development.js +5883 -0
- package/dist/excalidraw-with-preact.production.min.js +2 -0
- package/dist/excalidraw-with-preact.production.min.js.LICENSE.txt +21 -0
- package/dist/excalidraw.development.js +162 -173
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +0 -10
- package/main.js +7 -1
- package/package.json +2 -2
- package/types/actions/actionCanvas.d.ts +1 -1
- package/types/actions/actionExport.d.ts +1 -1
- package/types/actions/actionGroup.d.ts +3 -3
- package/types/actions/actionMenu.d.ts +0 -13
- package/types/actions/index.d.ts +1 -1
- package/types/appState.d.ts +1 -1
- package/types/components/Actions.d.ts +3 -2
- package/types/components/App.d.ts +18 -9
- package/types/components/ImageExportDialog.d.ts +1 -1
- package/types/components/LayerUI.d.ts +1 -1
- package/types/components/MobileMenu.d.ts +4 -3
- package/types/constants.d.ts +6 -1
- package/types/data/index.d.ts +10 -2
- package/types/element/embeddable.d.ts +1 -1
- package/types/element/typeChecks.d.ts +1 -1
- package/types/errors.d.ts +5 -0
- package/types/frame.d.ts +11 -1
- package/types/packages/excalidraw/dist/excalidraw-with-preact.development.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-with-preact.production.min.d.ts +1 -0
- package/types/packages/excalidraw/dist/excalidraw.development.d.ts +2 -2
- package/types/packages/excalidraw/index.d.ts +3 -3
- package/types/packages/excalidraw/webpack.preact.config.d.ts +171 -0
- package/types/packages/utils.d.ts +4 -3
- package/types/packages/withinBounds.d.ts +2 -2
- package/types/renderer/renderElement.d.ts +5 -1
- package/types/renderer/renderScene.d.ts +5 -5
- package/types/scene/Scene.d.ts +7 -2
- package/types/scene/export.d.ts +5 -5
- package/types/types.d.ts +16 -15
- package/types/utils.d.ts +6 -1
- /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-4d89e0ee30f240211e12.d.ts → vendor-06d9b385f406ee409106.d.ts} +0 -0
|
@@ -18,7 +18,11 @@ export declare const DEFAULT_LINK_SIZE = 14;
|
|
|
18
18
|
export declare const elementWithCanvasCache: WeakMap<ExcalidrawElement, ExcalidrawElementWithCanvas>;
|
|
19
19
|
export declare const renderSelectionElement: (element: NonDeletedExcalidrawElement, context: CanvasRenderingContext2D, appState: InteractiveCanvasAppState) => void;
|
|
20
20
|
export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState) => void;
|
|
21
|
-
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number,
|
|
21
|
+
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number, renderConfig: {
|
|
22
|
+
exportWithDarkMode: boolean;
|
|
23
|
+
renderEmbeddables: boolean;
|
|
24
|
+
frameRendering: AppState["frameRendering"];
|
|
25
|
+
}) => void;
|
|
22
26
|
export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
|
|
23
27
|
export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
|
|
24
28
|
export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RoughSVG } from "roughjs/bin/svg";
|
|
2
|
-
import { BinaryFiles } from "../types";
|
|
2
|
+
import { BinaryFiles, AppState } from "../types";
|
|
3
3
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
4
4
|
import { InteractiveSceneRenderConfig, StaticSceneRenderConfig } from "../scene/types";
|
|
5
5
|
import "canvas-roundrect-polyfill";
|
|
@@ -22,10 +22,10 @@ export declare const renderInteractiveScene: <U extends ({ canvas, elements, vis
|
|
|
22
22
|
*/
|
|
23
23
|
export declare const renderStaticScene: (renderConfig: StaticSceneRenderConfig, throttle?: boolean) => void;
|
|
24
24
|
export declare const cancelRender: () => void;
|
|
25
|
-
export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode,
|
|
25
|
+
export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode, renderEmbeddables, frameRendering, }: {
|
|
26
26
|
offsetX?: number | undefined;
|
|
27
27
|
offsetY?: number | undefined;
|
|
28
|
-
exportWithDarkMode
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
exportWithDarkMode: boolean;
|
|
29
|
+
renderEmbeddables: boolean;
|
|
30
|
+
frameRendering: AppState["frameRendering"];
|
|
31
31
|
}) => void;
|
package/types/scene/Scene.d.ts
CHANGED
|
@@ -9,7 +9,12 @@ export type ExcalidrawElementsIncludingDeleted = readonly ExcalidrawElement[];
|
|
|
9
9
|
declare class Scene {
|
|
10
10
|
private static sceneMapByElement;
|
|
11
11
|
private static sceneMapById;
|
|
12
|
-
static mapElementToScene(elementKey: ElementKey, scene: Scene
|
|
12
|
+
static mapElementToScene(elementKey: ElementKey, scene: Scene,
|
|
13
|
+
/**
|
|
14
|
+
* needed because of frame exporting hack.
|
|
15
|
+
* elementId:Scene mapping will be removed completely, soon.
|
|
16
|
+
*/
|
|
17
|
+
mapElementIds?: boolean): void;
|
|
13
18
|
static getScene(elementKey: ElementKey): Scene | null;
|
|
14
19
|
private callbacks;
|
|
15
20
|
private nonDeletedElements;
|
|
@@ -50,7 +55,7 @@ declare class Scene {
|
|
|
50
55
|
* @returns whether a change was made
|
|
51
56
|
*/
|
|
52
57
|
mapElements(iteratee: (element: ExcalidrawElement) => ExcalidrawElement): boolean;
|
|
53
|
-
replaceAllElements(nextElements: readonly ExcalidrawElement[]): void;
|
|
58
|
+
replaceAllElements(nextElements: readonly ExcalidrawElement[], mapElementIds?: boolean): void;
|
|
54
59
|
informMutation(): void;
|
|
55
60
|
addCallback(cb: SceneStateCallback): SceneStateCallbackRemover;
|
|
56
61
|
destroy(): void;
|
package/types/scene/export.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
1
|
+
import { ExcalidrawFrameElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
import { AppState, BinaryFiles } from "../types";
|
|
3
|
-
|
|
4
|
-
export declare const exportToCanvas: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, }: {
|
|
3
|
+
export declare const exportToCanvas: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, exportingFrame, }: {
|
|
5
4
|
exportBackground: boolean;
|
|
6
5
|
exportPadding?: number | undefined;
|
|
7
6
|
viewBackgroundColor: string;
|
|
7
|
+
exportingFrame?: ExcalidrawFrameElement | null | undefined;
|
|
8
8
|
}, createCanvas?: (width: number, height: number) => {
|
|
9
9
|
canvas: HTMLCanvasElement;
|
|
10
10
|
scale: number;
|
|
@@ -16,9 +16,9 @@ export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElemen
|
|
|
16
16
|
viewBackgroundColor: string;
|
|
17
17
|
exportWithDarkMode?: boolean;
|
|
18
18
|
exportEmbedScene?: boolean;
|
|
19
|
-
|
|
19
|
+
frameRendering?: AppState["frameRendering"];
|
|
20
20
|
}, files: BinaryFiles | null, opts?: {
|
|
21
|
-
serializeAsJSON?: () => string;
|
|
22
21
|
renderEmbeddables?: boolean;
|
|
22
|
+
exportingFrame?: ExcalidrawFrameElement | null;
|
|
23
23
|
}) => Promise<SVGSVGElement>;
|
|
24
24
|
export declare const getExportSize: (elements: readonly NonDeletedExcalidrawElement[], exportPadding: number, scale: number) => [number, number];
|
package/types/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { LinearElementEditor } from "./element/linearElementEditor";
|
|
|
5
5
|
import { SuggestedBinding } from "./element/binding";
|
|
6
6
|
import { ImportedDataState } from "./data/types";
|
|
7
7
|
import type App from "./components/App";
|
|
8
|
-
import type {
|
|
8
|
+
import type { throttleRAF } from "./utils";
|
|
9
9
|
import { Spreadsheet } from "./charts";
|
|
10
10
|
import { Language } from "./i18n";
|
|
11
11
|
import { ClipboardData } from "./clipboard";
|
|
@@ -16,7 +16,7 @@ import type { FileSystemHandle } from "./data/filesystem";
|
|
|
16
16
|
import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
|
|
17
17
|
import { ContextMenuItems } from "./components/ContextMenu";
|
|
18
18
|
import { SnapLine } from "./snapping";
|
|
19
|
-
import { Merge,
|
|
19
|
+
import { Merge, ValueOf } from "./utility-types";
|
|
20
20
|
export type Point = Readonly<RoughPoint>;
|
|
21
21
|
export type Collaborator = {
|
|
22
22
|
pointer?: CollaboratorPointer;
|
|
@@ -283,17 +283,13 @@ export type LibraryItem = {
|
|
|
283
283
|
export type LibraryItems = readonly LibraryItem[];
|
|
284
284
|
export type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1;
|
|
285
285
|
export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>) | Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>;
|
|
286
|
-
export type ExcalidrawAPIRefValue = ExcalidrawImperativeAPI | {
|
|
287
|
-
readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
288
|
-
ready?: false;
|
|
289
|
-
};
|
|
290
286
|
export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
|
|
291
287
|
libraryItems?: Required<ImportedDataState>["libraryItems"] | Promise<Required<ImportedDataState>["libraryItems"]>;
|
|
292
288
|
}>;
|
|
293
289
|
export interface ExcalidrawProps {
|
|
294
290
|
onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
295
291
|
initialData?: ExcalidrawInitialDataState | null | Promise<ExcalidrawInitialDataState | null>;
|
|
296
|
-
|
|
292
|
+
excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
|
|
297
293
|
isCollaborating?: boolean;
|
|
298
294
|
onPointerUpdate?: (payload: {
|
|
299
295
|
pointer: {
|
|
@@ -346,7 +342,7 @@ export type ExportOpts = {
|
|
|
346
342
|
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => void;
|
|
347
343
|
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => JSX.Element;
|
|
348
344
|
};
|
|
349
|
-
type CanvasActions = Partial<{
|
|
345
|
+
export type CanvasActions = Partial<{
|
|
350
346
|
changeViewBackgroundColor: boolean;
|
|
351
347
|
clearCanvas: boolean;
|
|
352
348
|
export: false | ExportOpts;
|
|
@@ -355,9 +351,12 @@ type CanvasActions = Partial<{
|
|
|
355
351
|
toggleTheme: boolean | null;
|
|
356
352
|
saveAsImage: boolean;
|
|
357
353
|
}>;
|
|
358
|
-
type UIOptions = Partial<{
|
|
354
|
+
export type UIOptions = Partial<{
|
|
359
355
|
dockedSidebarBreakpoint: number;
|
|
360
356
|
canvasActions: CanvasActions;
|
|
357
|
+
tools: {
|
|
358
|
+
image: boolean;
|
|
359
|
+
};
|
|
361
360
|
/** @deprecated does nothing. Will be removed in 0.15 */
|
|
362
361
|
welcomeScreen?: boolean;
|
|
363
362
|
}>;
|
|
@@ -475,8 +474,6 @@ export type ExcalidrawImperativeAPI = {
|
|
|
475
474
|
refresh: InstanceType<typeof App>["refresh"];
|
|
476
475
|
setToast: InstanceType<typeof App>["setToast"];
|
|
477
476
|
addFiles: (data: BinaryFileData[]) => void;
|
|
478
|
-
readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
479
|
-
ready: true;
|
|
480
477
|
id: string;
|
|
481
478
|
setActiveTool: InstanceType<typeof App>["setActiveTool"];
|
|
482
479
|
setCursor: InstanceType<typeof App>["setCursor"];
|
|
@@ -493,11 +490,15 @@ export type ExcalidrawImperativeAPI = {
|
|
|
493
490
|
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
494
491
|
};
|
|
495
492
|
export type Device = Readonly<{
|
|
496
|
-
|
|
497
|
-
|
|
493
|
+
viewport: {
|
|
494
|
+
isMobile: boolean;
|
|
495
|
+
isLandscape: boolean;
|
|
496
|
+
};
|
|
497
|
+
editor: {
|
|
498
|
+
isMobile: boolean;
|
|
499
|
+
canFitSidebar: boolean;
|
|
500
|
+
};
|
|
498
501
|
isTouchScreen: boolean;
|
|
499
|
-
canDeviceFitSidebar: boolean;
|
|
500
|
-
isLandscape: boolean;
|
|
501
502
|
}>;
|
|
502
503
|
type FrameNameBounds = {
|
|
503
504
|
x: number;
|
package/types/utils.d.ts
CHANGED
|
@@ -187,7 +187,11 @@ export declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E
|
|
|
187
187
|
checkForDefaultPrevented?: boolean | undefined;
|
|
188
188
|
}) => (event: E) => void;
|
|
189
189
|
export declare const isOnlyExportingSingleFrame: (elements: readonly NonDeletedExcalidrawElement[]) => boolean;
|
|
190
|
-
|
|
190
|
+
/**
|
|
191
|
+
* supply `null` as message if non-never value is valid, you just need to
|
|
192
|
+
* typecheck against it
|
|
193
|
+
*/
|
|
194
|
+
export declare const assertNever: (value: never, message: string | null, softAssert?: boolean) => never;
|
|
191
195
|
/**
|
|
192
196
|
* Memoizes on values of `opts` object (strict equality).
|
|
193
197
|
*/
|
|
@@ -197,3 +201,4 @@ export declare const memoize: <T extends Record<string, any>, R extends unknown>
|
|
|
197
201
|
export declare const isRenderThrottlingEnabled: () => boolean;
|
|
198
202
|
/** Checks if value is inside given collection. Useful for type-safety. */
|
|
199
203
|
export declare const isMemberOf: <T extends string>(collection: Set<T> | Record<T, any> | Map<T, any> | readonly T[], value: string) => value is T;
|
|
204
|
+
export declare const cloneJSON: <T>(obj: T) => T;
|