@excalidraw/excalidraw 0.17.1-4bdeaf9 → 0.17.1-7391-e65bf53
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/dist/excalidraw-assets-dev/{vendor-4b7e1a9df5f218d0a300.js → vendor-c09b2c6a1f68505f7149.js} +2 -2
- package/dist/excalidraw-with-preact.development.js +12 -12
- package/dist/excalidraw-with-preact.production.min.js +1 -1
- package/dist/excalidraw.development.js +12 -12
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/element/bounds.d.ts +4 -0
- package/types/element/types.d.ts +2 -1
- package/types/math.d.ts +1 -1
- package/types/renderer/renderElement.d.ts +2 -6
- package/types/renderer/renderScene.d.ts +3 -9
- package/types/scene/Shape.d.ts +4 -1
- package/types/scene/ShapeCache.d.ts +5 -1
- package/types/scene/types.d.ts +11 -1
- /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-4b7e1a9df5f218d0a300.d.ts → vendor-c09b2c6a1f68505f7149.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -32,6 +32,10 @@ export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
|
|
|
32
32
|
export declare const getCurvePathOps: (shape: Drawable) => Op[];
|
|
33
33
|
export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: ((x: number, y: number) => [number, number]) | undefined) => Bounds;
|
|
34
34
|
export declare const getBoundsFromPoints: (points: ExcalidrawFreeDrawElement["points"]) => Bounds;
|
|
35
|
+
/** @returns number in pixels */
|
|
36
|
+
export declare const getArrowheadSize: (arrowhead: Arrowhead) => number;
|
|
37
|
+
/** @returns number in degrees */
|
|
38
|
+
export declare const getArrowheadAngle: (arrowhead: Arrowhead) => number;
|
|
35
39
|
export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
|
|
36
40
|
export declare const getElementBounds: (element: ExcalidrawElement) => Bounds;
|
|
37
41
|
export declare const getCommonBounds: (elements: readonly ExcalidrawElement[]) => Bounds;
|
package/types/element/types.d.ts
CHANGED
|
@@ -165,7 +165,8 @@ export type PointBinding = {
|
|
|
165
165
|
focus: number;
|
|
166
166
|
gap: number;
|
|
167
167
|
};
|
|
168
|
-
export type
|
|
168
|
+
export type DiagramArrowhead = "d_arrow" | "d_triangle" | "d_triangle_filled" | "d_diamond" | "d_diamond_filled";
|
|
169
|
+
export type Arrowhead = "arrow" | "bar" | "dot" | "triangle" | DiagramArrowhead;
|
|
169
170
|
export type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<{
|
|
170
171
|
type: "line" | "arrow";
|
|
171
172
|
points: readonly Point[];
|
package/types/math.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point, Zoom } from "./types";
|
|
2
2
|
import { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted } from "./element/types";
|
|
3
|
-
export declare const rotate: (
|
|
3
|
+
export declare const rotate: (x: number, y: number, cx: number, cy: number, angle: number) => [number, number];
|
|
4
4
|
export declare const rotatePoint: (point: readonly [number, number], center: readonly [number, number], angle: number) => [number, number];
|
|
5
5
|
export declare const adjustXYWithRotation: (sides: {
|
|
6
6
|
n?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExcalidrawElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, ExcalidrawFreeDrawElement } from "../element/types";
|
|
2
2
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
3
3
|
import type { RoughSVG } from "roughjs/bin/svg";
|
|
4
|
-
import { StaticCanvasRenderConfig } from "../scene/types";
|
|
4
|
+
import { SVGRenderConfig, StaticCanvasRenderConfig } from "../scene/types";
|
|
5
5
|
import { AppState, StaticCanvasAppState, BinaryFiles, InteractiveCanvasAppState } from "../types";
|
|
6
6
|
export interface ExcalidrawElementWithCanvas {
|
|
7
7
|
element: ExcalidrawElement | ExcalidrawTextElement;
|
|
@@ -18,11 +18,7 @@ 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, renderConfig:
|
|
22
|
-
exportWithDarkMode: boolean;
|
|
23
|
-
renderEmbeddables: boolean;
|
|
24
|
-
frameRendering: AppState["frameRendering"];
|
|
25
|
-
}) => void;
|
|
21
|
+
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number, renderConfig: SVGRenderConfig) => void;
|
|
26
22
|
export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
|
|
27
23
|
export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
|
|
28
24
|
export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RoughSVG } from "roughjs/bin/svg";
|
|
2
|
-
import { BinaryFiles
|
|
2
|
+
import { BinaryFiles } from "../types";
|
|
3
3
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
4
|
-
import { InteractiveSceneRenderConfig, StaticSceneRenderConfig } from "../scene/types";
|
|
4
|
+
import { InteractiveSceneRenderConfig, SVGRenderConfig, StaticSceneRenderConfig } from "../scene/types";
|
|
5
5
|
import "canvas-roundrect-polyfill";
|
|
6
6
|
export declare const DEFAULT_SPACING = 2;
|
|
7
7
|
/**
|
|
@@ -22,10 +22,4 @@ 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,
|
|
26
|
-
offsetX?: number | undefined;
|
|
27
|
-
offsetY?: number | undefined;
|
|
28
|
-
exportWithDarkMode: boolean;
|
|
29
|
-
renderEmbeddables: boolean;
|
|
30
|
-
frameRendering: AppState["frameRendering"];
|
|
31
|
-
}) => void;
|
|
25
|
+
export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, renderConfig: SVGRenderConfig) => void;
|
package/types/scene/Shape.d.ts
CHANGED
|
@@ -9,4 +9,7 @@ export declare const generateRoughOptions: (element: ExcalidrawElement, continuo
|
|
|
9
9
|
*
|
|
10
10
|
* @private
|
|
11
11
|
*/
|
|
12
|
-
export declare const _generateElementShape: (element: Exclude<NonDeletedExcalidrawElement, ExcalidrawSelectionElement>, generator: RoughGenerator, isExporting
|
|
12
|
+
export declare const _generateElementShape: (element: Exclude<NonDeletedExcalidrawElement, ExcalidrawSelectionElement>, generator: RoughGenerator, { isExporting, canvasBackgroundColor, }: {
|
|
13
|
+
isExporting: boolean;
|
|
14
|
+
canvasBackgroundColor: string;
|
|
15
|
+
}) => Drawable | Drawable[] | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Drawable } from "roughjs/bin/core";
|
|
2
2
|
import { ExcalidrawElement } from "../element/types";
|
|
3
3
|
import { ElementShape, ElementShapes } from "./types";
|
|
4
|
+
import { AppState } from "../types";
|
|
4
5
|
export declare class ShapeCache {
|
|
5
6
|
private static rg;
|
|
6
7
|
private static cache;
|
|
@@ -16,5 +17,8 @@ export declare class ShapeCache {
|
|
|
16
17
|
* Generates & caches shape for element if not already cached, otherwise
|
|
17
18
|
* returns cached shape.
|
|
18
19
|
*/
|
|
19
|
-
static generateElementShape: <T extends import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawEmbeddableElement | import("../element/types").ExcalidrawIframeElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawFrameElement | import("../element/types").ExcalidrawMagicFrameElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawFreeDrawElement>(element: T,
|
|
20
|
+
static generateElementShape: <T extends import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawEmbeddableElement | import("../element/types").ExcalidrawIframeElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawFrameElement | import("../element/types").ExcalidrawMagicFrameElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawFreeDrawElement>(element: T, renderConfig: {
|
|
21
|
+
isExporting: boolean;
|
|
22
|
+
canvasBackgroundColor: AppState["viewBackgroundColor"];
|
|
23
|
+
} | null) => ((T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined) & ({} | null)) | (T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable | null);
|
|
20
24
|
}
|
package/types/scene/types.d.ts
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
2
2
|
import { Drawable } from "roughjs/bin/core";
|
|
3
3
|
import { ExcalidrawTextElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
4
|
-
import { AppClassProperties, InteractiveCanvasAppState, StaticCanvasAppState } from "../types";
|
|
4
|
+
import { AppClassProperties, AppState, InteractiveCanvasAppState, StaticCanvasAppState } from "../types";
|
|
5
5
|
export type StaticCanvasRenderConfig = {
|
|
6
|
+
canvasBackgroundColor: AppState["viewBackgroundColor"];
|
|
6
7
|
imageCache: AppClassProperties["imageCache"];
|
|
7
8
|
renderGrid: boolean;
|
|
8
9
|
/** when exporting the behavior is slightly different (e.g. we can't use
|
|
9
10
|
CSS filters), and we disable render optimizations for best output */
|
|
10
11
|
isExporting: boolean;
|
|
11
12
|
};
|
|
13
|
+
export type SVGRenderConfig = {
|
|
14
|
+
offsetX: number;
|
|
15
|
+
offsetY: number;
|
|
16
|
+
isExporting: boolean;
|
|
17
|
+
exportWithDarkMode: boolean;
|
|
18
|
+
renderEmbeddables: boolean;
|
|
19
|
+
frameRendering: AppState["frameRendering"];
|
|
20
|
+
canvasBackgroundColor: AppState["viewBackgroundColor"];
|
|
21
|
+
};
|
|
12
22
|
export type InteractiveCanvasRenderConfig = {
|
|
13
23
|
remoteSelectedElementIds: {
|
|
14
24
|
[elementId: string]: string[];
|