@zsviczian/excalidraw 0.17.0-obsidian-3 → 0.17.1-obsidian-2

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.
Files changed (45) hide show
  1. package/dist/excalidraw.development.js +90 -35
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +1 -1
  4. package/types/actions/actionAddToLibrary.d.ts +12 -9
  5. package/types/actions/actionBoundText.d.ts +8 -6
  6. package/types/actions/actionCanvas.d.ts +52 -39
  7. package/types/actions/actionClipboard.d.ts +28 -21
  8. package/types/actions/actionDeleteSelected.d.ts +12 -9
  9. package/types/actions/actionElementLock.d.ts +8 -6
  10. package/types/actions/actionExport.d.ts +32 -24
  11. package/types/actions/actionFinalize.d.ts +8 -6
  12. package/types/actions/actionFrame.d.ts +12 -9
  13. package/types/actions/actionGroup.d.ts +8 -6
  14. package/types/actions/actionLinearEditor.d.ts +4 -3
  15. package/types/actions/actionMenu.d.ts +8 -6
  16. package/types/actions/actionProperties.d.ts +52 -39
  17. package/types/actions/actionSelectAll.d.ts +4 -3
  18. package/types/actions/actionStyles.d.ts +4 -3
  19. package/types/actions/actionToggleGridMode.d.ts +4 -3
  20. package/types/actions/actionToggleObjectsSnapMode.d.ts +4 -3
  21. package/types/actions/actionToggleStats.d.ts +4 -3
  22. package/types/actions/actionToggleViewMode.d.ts +4 -3
  23. package/types/actions/actionToggleZenMode.d.ts +4 -3
  24. package/types/components/IconPicker.d.ts +3 -2
  25. package/types/components/MagicSettings.d.ts +1 -1
  26. package/types/components/TTDDialog/TTDDialog.d.ts +1 -1
  27. package/types/components/TTDDialog/TTDDialogPanel.d.ts +2 -1
  28. package/types/components/TTDDialog/TTDDialogSubmitShortcut.d.ts +1 -0
  29. package/types/components/TTDDialog/TTDDialogTabs.d.ts +8 -3
  30. package/types/components/TTDDialog/common.d.ts +3 -4
  31. package/types/components/icons.d.ts +13 -1
  32. package/types/constants.d.ts +1 -0
  33. package/types/element/Hyperlink.d.ts +4 -3
  34. package/types/element/bounds.d.ts +4 -0
  35. package/types/element/embeddable.d.ts +4 -3
  36. package/types/element/linearElementEditor.d.ts +4 -3
  37. package/types/element/types.d.ts +1 -1
  38. package/types/math.d.ts +1 -1
  39. package/types/packages/excalidraw/webpack.preact.config.d.ts +126 -22
  40. package/types/renderer/renderElement.d.ts +2 -7
  41. package/types/renderer/renderScene.d.ts +3 -14
  42. package/types/scene/Shape.d.ts +4 -1
  43. package/types/scene/ShapeCache.d.ts +5 -1
  44. package/types/scene/types.d.ts +12 -1
  45. package/types/types.d.ts +3 -2
@@ -195,11 +195,12 @@ export declare class LinearElementEditor {
195
195
  openDialog: {
196
196
  name: "imageExport" | "help" | "jsonExport";
197
197
  } | {
198
- name: "magicSettings";
199
- source: "tool" | "generation" | "settings";
198
+ name: "settings";
199
+ source: "settings" | "tool" | "generation";
200
+ tab: "text-to-diagram" | "diagram-to-code";
200
201
  } | {
201
202
  name: "ttd";
202
- tab: string;
203
+ tab: "mermaid" | "text-to-diagram";
203
204
  } | null;
204
205
  defaultSidebarDockedPreference: boolean;
205
206
  lastPointerDownWith: import("./types").PointerType;
@@ -168,7 +168,7 @@ export type PointBinding = {
168
168
  focus: number;
169
169
  gap: number;
170
170
  };
171
- export type Arrowhead = "arrow" | "bar" | "dot" | "triangle";
171
+ export type Arrowhead = "arrow" | "bar" | "dot" | "circle" | "circle_outline" | "triangle" | "triangle_outline" | "diamond" | "diamond_outline";
172
172
  export type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<{
173
173
  type: "line" | "arrow";
174
174
  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,8 +1,60 @@
1
- declare const _exports: {
2
- mode: string;
1
+ export = preactWebpackConfig;
2
+ declare const preactWebpackConfig: {
3
3
  entry: {
4
- "excalidraw.development": string;
4
+ [x: string]: string;
5
+ };
6
+ externals: {
7
+ "react-dom/client": {
8
+ root: string;
9
+ commonjs2: string;
10
+ commonjs: string;
11
+ amd: string;
12
+ };
13
+ "react/jsx-runtime": {
14
+ root: string;
15
+ commonjs2: string;
16
+ commonjs: string;
17
+ amd: string;
18
+ };
19
+ react: {
20
+ root: string;
21
+ commonjs2: string;
22
+ commonjs: string;
23
+ amd: string;
24
+ };
25
+ "react-dom": {
26
+ root: string;
27
+ commonjs2: string;
28
+ commonjs: string;
29
+ amd: string;
30
+ };
31
+ } | {
32
+ "react-dom/client": {
33
+ root: string;
34
+ commonjs2: string;
35
+ commonjs: string;
36
+ amd: string;
37
+ };
38
+ "react/jsx-runtime": {
39
+ root: string;
40
+ commonjs2: string;
41
+ commonjs: string;
42
+ amd: string;
43
+ };
44
+ react: {
45
+ root: string;
46
+ commonjs2: string;
47
+ commonjs: string;
48
+ amd: string;
49
+ };
50
+ "react-dom": {
51
+ root: string;
52
+ commonjs2: string;
53
+ commonjs: string;
54
+ amd: string;
55
+ };
5
56
  };
57
+ mode: string;
6
58
  output: {
7
59
  path: string;
8
60
  library: string;
@@ -21,6 +73,7 @@ declare const _exports: {
21
73
  exclude: RegExp;
22
74
  use: (string | {
23
75
  loader: string;
76
+ options?: undefined;
24
77
  } | {
25
78
  loader: string;
26
79
  options: {
@@ -29,16 +82,22 @@ declare const _exports: {
29
82
  };
30
83
  };
31
84
  })[];
85
+ resolve?: undefined;
86
+ type?: undefined;
32
87
  } | {
33
88
  test: RegExp;
34
89
  resolve: {
35
90
  fullySpecified: boolean;
36
91
  };
92
+ exclude?: undefined;
93
+ use?: undefined;
94
+ type?: undefined;
37
95
  } | {
38
96
  test: RegExp;
39
97
  exclude: RegExp;
40
98
  use: ({
41
99
  loader: string;
100
+ options?: undefined;
42
101
  } | {
43
102
  loader: string;
44
103
  options: {
@@ -46,9 +105,14 @@ declare const _exports: {
46
105
  configFile: string;
47
106
  };
48
107
  })[];
108
+ resolve?: undefined;
109
+ type?: undefined;
49
110
  } | {
50
111
  test: RegExp;
51
112
  type: string;
113
+ exclude?: undefined;
114
+ use?: undefined;
115
+ resolve?: undefined;
52
116
  })[];
53
117
  };
54
118
  optimization: {
@@ -61,9 +125,52 @@ declare const _exports: {
61
125
  };
62
126
  };
63
127
  };
128
+ minimize?: undefined;
129
+ minimizer?: undefined;
64
130
  };
65
131
  plugins: any[];
132
+ } | {
133
+ entry: {
134
+ [x: string]: string;
135
+ };
66
136
  externals: {
137
+ "react-dom/client": {
138
+ root: string;
139
+ commonjs2: string;
140
+ commonjs: string;
141
+ amd: string;
142
+ };
143
+ "react/jsx-runtime": {
144
+ root: string;
145
+ commonjs2: string;
146
+ commonjs: string;
147
+ amd: string;
148
+ };
149
+ react: {
150
+ root: string;
151
+ commonjs2: string;
152
+ commonjs: string;
153
+ amd: string;
154
+ };
155
+ "react-dom": {
156
+ root: string;
157
+ commonjs2: string;
158
+ commonjs: string;
159
+ amd: string;
160
+ };
161
+ } | {
162
+ "react-dom/client": {
163
+ root: string;
164
+ commonjs2: string;
165
+ commonjs: string;
166
+ amd: string;
167
+ };
168
+ "react/jsx-runtime": {
169
+ root: string;
170
+ commonjs2: string;
171
+ commonjs: string;
172
+ amd: string;
173
+ };
67
174
  react: {
68
175
  root: string;
69
176
  commonjs2: string;
@@ -77,11 +184,7 @@ declare const _exports: {
77
184
  amd: string;
78
185
  };
79
186
  };
80
- } | {
81
187
  mode: string;
82
- entry: {
83
- "excalidraw.production.min": string;
84
- };
85
188
  output: {
86
189
  path: string;
87
190
  library: string;
@@ -100,6 +203,7 @@ declare const _exports: {
100
203
  exclude: RegExp;
101
204
  use: (string | {
102
205
  loader: string;
206
+ options?: undefined;
103
207
  } | {
104
208
  loader: string;
105
209
  options: {
@@ -108,21 +212,29 @@ declare const _exports: {
108
212
  };
109
213
  };
110
214
  })[];
215
+ resolve?: undefined;
216
+ type?: undefined;
111
217
  } | {
112
218
  test: RegExp;
113
219
  resolve: {
114
220
  fullySpecified: boolean;
115
221
  };
222
+ exclude?: undefined;
223
+ use?: undefined;
224
+ type?: undefined;
116
225
  } | {
117
226
  test: RegExp;
118
227
  exclude: RegExp;
119
228
  use: ({
120
229
  loader: string;
230
+ options?: undefined;
121
231
  } | {
122
232
  loader: string;
123
233
  options: {
124
234
  transpileOnly: boolean;
125
235
  configFile: string;
236
+ presets?: undefined;
237
+ plugins?: undefined;
126
238
  };
127
239
  } | {
128
240
  loader: string;
@@ -131,11 +243,18 @@ declare const _exports: {
131
243
  runtime: string;
132
244
  })[])[];
133
245
  plugins: string[];
246
+ transpileOnly?: undefined;
247
+ configFile?: undefined;
134
248
  };
135
249
  })[];
250
+ resolve?: undefined;
251
+ type?: undefined;
136
252
  } | {
137
253
  test: RegExp;
138
254
  type: string;
255
+ exclude?: undefined;
256
+ use?: undefined;
257
+ resolve?: undefined;
139
258
  })[];
140
259
  };
141
260
  optimization: {
@@ -152,19 +271,4 @@ declare const _exports: {
152
271
  };
153
272
  };
154
273
  plugins: any[];
155
- externals: {
156
- react: {
157
- root: string;
158
- commonjs2: string;
159
- commonjs: string;
160
- amd: string;
161
- };
162
- "react-dom": {
163
- root: string;
164
- commonjs2: string;
165
- commonjs: string;
166
- amd: string;
167
- };
168
- };
169
274
  };
170
- export = _exports;
@@ -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,12 +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
- frameColor?: AppState["frameColor"];
26
- }) => void;
21
+ export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number, renderConfig: SVGRenderConfig) => void;
27
22
  export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
28
23
  export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
29
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,15 +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, frameColor, }: {
26
- offsetX?: number | undefined;
27
- offsetY?: number | undefined;
28
- exportWithDarkMode: boolean;
29
- renderEmbeddables: boolean;
30
- frameRendering: AppState["frameRendering"];
31
- frameColor?: {
32
- stroke: string;
33
- fill: string;
34
- nameColor: string;
35
- } | undefined;
36
- }) => 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,25 @@
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
+ frameColor?: AppState["frameColor"];
22
+ };
12
23
  export type InteractiveCanvasRenderConfig = {
13
24
  remoteSelectedElementIds: {
14
25
  [elementId: string]: string[];
package/types/types.d.ts CHANGED
@@ -189,11 +189,12 @@ export interface AppState {
189
189
  openDialog: null | {
190
190
  name: "imageExport" | "help" | "jsonExport";
191
191
  } | {
192
- name: "magicSettings";
192
+ name: "settings";
193
193
  source: "tool" | "generation" | "settings";
194
+ tab: "text-to-diagram" | "diagram-to-code";
194
195
  } | {
195
196
  name: "ttd";
196
- tab: string;
197
+ tab: "text-to-diagram" | "mermaid";
197
198
  };
198
199
  /**
199
200
  * Reflects user preference for whether the default sidebar should be docked.