@excalidraw/excalidraw 0.17.1-4bdeaf9 → 0.17.1-7381-cdf6d3e

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excalidraw/excalidraw",
3
- "version": "0.17.1-4bdeaf9",
3
+ "version": "0.17.1-7381-cdf6d3e",
4
4
  "main": "main.js",
5
5
  "types": "types/packages/excalidraw/index.d.ts",
6
6
  "files": [
@@ -2,11 +2,12 @@ import "./IconPicker.scss";
2
2
  export declare function IconPicker<T>({ value, label, options, onChange, group, }: {
3
3
  label: string;
4
4
  value: T;
5
- options: {
5
+ options: readonly {
6
6
  value: T;
7
7
  text: string;
8
8
  icon: JSX.Element;
9
- keyBinding: string;
9
+ keyBinding: string | null;
10
+ showInPicker?: boolean;
10
11
  }[];
11
12
  onChange: (value: T) => void;
12
13
  group?: string;
@@ -110,7 +110,10 @@ export declare const ArrowheadNoneIcon: JSX.Element;
110
110
  export declare const ArrowheadArrowIcon: React.MemoExoticComponent<({ flip }: {
111
111
  flip?: boolean | undefined;
112
112
  }) => JSX.Element>;
113
- export declare const ArrowheadDotIcon: React.MemoExoticComponent<({ flip }: {
113
+ export declare const ArrowheadCircleIcon: React.MemoExoticComponent<({ flip }: {
114
+ flip?: boolean | undefined;
115
+ }) => JSX.Element>;
116
+ export declare const ArrowheadCircleOutlineIcon: React.MemoExoticComponent<({ flip }: {
114
117
  flip?: boolean | undefined;
115
118
  }) => JSX.Element>;
116
119
  export declare const ArrowheadBarIcon: React.MemoExoticComponent<({ flip }: {
@@ -119,6 +122,15 @@ export declare const ArrowheadBarIcon: React.MemoExoticComponent<({ flip }: {
119
122
  export declare const ArrowheadTriangleIcon: React.MemoExoticComponent<({ flip }: {
120
123
  flip?: boolean | undefined;
121
124
  }) => JSX.Element>;
125
+ export declare const ArrowheadTriangleOutlineIcon: React.MemoExoticComponent<({ flip }: {
126
+ flip?: boolean | undefined;
127
+ }) => JSX.Element>;
128
+ export declare const ArrowheadDiamondIcon: React.MemoExoticComponent<({ flip }: {
129
+ flip?: boolean | undefined;
130
+ }) => JSX.Element>;
131
+ export declare const ArrowheadDiamondOutlineIcon: React.MemoExoticComponent<({ flip }: {
132
+ flip?: boolean | undefined;
133
+ }) => JSX.Element>;
122
134
  export declare const FontSizeSmallIcon: JSX.Element;
123
135
  export declare const FontSizeMediumIcon: JSX.Element;
124
136
  export declare const FontSizeLargeIcon: JSX.Element;
@@ -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;
@@ -165,7 +165,7 @@ export type PointBinding = {
165
165
  focus: number;
166
166
  gap: number;
167
167
  };
168
- export type Arrowhead = "arrow" | "bar" | "dot" | "triangle";
168
+ export type Arrowhead = "arrow" | "bar" | "dot" | "circle" | "circle_outline" | "triangle" | "triangle_outline" | "diamond" | "diamond_outline";
169
169
  export type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<{
170
170
  type: "line" | "arrow";
171
171
  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: (x1: number, y1: number, x2: number, y2: number, angle: number) => [number, number];
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, AppState } from "../types";
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, { offsetX, offsetY, exportWithDarkMode, renderEmbeddables, frameRendering, }: {
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;
@@ -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?: boolean) => Drawable | Drawable[] | null;
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, isExporting?: boolean) => ((T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined) & ({} | null)) | (T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable | null);
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
  }
@@ -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[];