@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.
Files changed (41) hide show
  1. package/CHANGELOG.md +162 -1
  2. package/dist/excalidraw-assets-dev/{vendor-4d89e0ee30f240211e12.js → vendor-06d9b385f406ee409106.js} +2 -2
  3. package/dist/excalidraw-with-preact.development.js +5883 -0
  4. package/dist/excalidraw-with-preact.production.min.js +2 -0
  5. package/dist/excalidraw-with-preact.production.min.js.LICENSE.txt +21 -0
  6. package/dist/excalidraw.development.js +162 -173
  7. package/dist/excalidraw.production.min.js +1 -1
  8. package/dist/excalidraw.production.min.js.LICENSE.txt +0 -10
  9. package/main.js +7 -1
  10. package/package.json +2 -2
  11. package/types/actions/actionCanvas.d.ts +1 -1
  12. package/types/actions/actionExport.d.ts +1 -1
  13. package/types/actions/actionGroup.d.ts +3 -3
  14. package/types/actions/actionMenu.d.ts +0 -13
  15. package/types/actions/index.d.ts +1 -1
  16. package/types/appState.d.ts +1 -1
  17. package/types/components/Actions.d.ts +3 -2
  18. package/types/components/App.d.ts +18 -9
  19. package/types/components/ImageExportDialog.d.ts +1 -1
  20. package/types/components/LayerUI.d.ts +1 -1
  21. package/types/components/MobileMenu.d.ts +4 -3
  22. package/types/constants.d.ts +6 -1
  23. package/types/data/index.d.ts +10 -2
  24. package/types/element/embeddable.d.ts +1 -1
  25. package/types/element/typeChecks.d.ts +1 -1
  26. package/types/errors.d.ts +5 -0
  27. package/types/frame.d.ts +11 -1
  28. package/types/packages/excalidraw/dist/excalidraw-with-preact.development.d.ts +2 -0
  29. package/types/packages/excalidraw/dist/excalidraw-with-preact.production.min.d.ts +1 -0
  30. package/types/packages/excalidraw/dist/excalidraw.development.d.ts +2 -2
  31. package/types/packages/excalidraw/index.d.ts +3 -3
  32. package/types/packages/excalidraw/webpack.preact.config.d.ts +171 -0
  33. package/types/packages/utils.d.ts +4 -3
  34. package/types/packages/withinBounds.d.ts +2 -2
  35. package/types/renderer/renderElement.d.ts +5 -1
  36. package/types/renderer/renderScene.d.ts +5 -5
  37. package/types/scene/Scene.d.ts +7 -2
  38. package/types/scene/export.d.ts +5 -5
  39. package/types/types.d.ts +16 -15
  40. package/types/utils.d.ts +6 -1
  41. /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-4d89e0ee30f240211e12.d.ts → vendor-06d9b385f406ee409106.d.ts} +0 -0
@@ -1,15 +1,5 @@
1
1
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
2
2
 
3
- /**
4
- * @license React
5
- * react-jsx-runtime.production.min.js
6
- *
7
- * Copyright (c) Facebook, Inc. and its affiliates.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
-
13
3
  /**
14
4
  * @license React
15
5
  * use-sync-external-store-shim.production.min.js
package/main.js CHANGED
@@ -1,4 +1,10 @@
1
- if (process.env.NODE_ENV === "production") {
1
+ if (process.env.IS_PREACT === "true") {
2
+ if (process.env.NODE_ENV === "production") {
3
+ module.exports = require("./dist/excalidraw-with-preact.production.min.js");
4
+ } else {
5
+ module.exports = require("./dist/excalidraw-with-preact.development.js");
6
+ }
7
+ } else if (process.env.NODE_ENV === "production") {
2
8
  module.exports = require("./dist/excalidraw.production.min.js");
3
9
  } else {
4
10
  module.exports = require("./dist/excalidraw.development.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excalidraw/excalidraw",
3
- "version": "0.16.1-e8def8d",
3
+ "version": "0.17.0-7284-25ea35d",
4
4
  "main": "main.js",
5
5
  "types": "types/packages/excalidraw/index.d.ts",
6
6
  "files": [
@@ -78,7 +78,7 @@
78
78
  "homepage": "https://github.com/excalidraw/excalidraw/tree/master/src/packages/excalidraw",
79
79
  "scripts": {
80
80
  "gen:types": "tsc --project ../../../tsconfig-types.json",
81
- "build:umd": "rm -rf dist && cross-env NODE_ENV=production webpack --config webpack.prod.config.js && cross-env NODE_ENV=development webpack --config webpack.dev.config.js && yarn gen:types",
81
+ "build:umd": "rm -rf dist && cross-env NODE_ENV=production webpack --config webpack.prod.config.js && cross-env NODE_ENV=development webpack --config webpack.dev.config.js && NODE_ENV=development webpack --config webpack.preact.config.js && NODE_ENV=production webpack --config webpack.preact.config.js && yarn gen:types",
82
82
  "build:umd:withAnalyzer": "cross-env NODE_ENV=production ANALYZER=true webpack --config webpack.prod.config.js",
83
83
  "pack": "yarn build:umd && yarn pack",
84
84
  "start": "webpack serve --config webpack.dev-server.config.js",
@@ -40,7 +40,6 @@ export declare const actionClearCanvas: {
40
40
  lastActiveTool: import("../types").ActiveTool | null;
41
41
  locked: boolean;
42
42
  } & import("../types").ActiveTool;
43
- name: string;
44
43
  contextMenu: {
45
44
  items: import("../components/ContextMenu").ContextMenuItems;
46
45
  top: number;
@@ -91,6 +90,7 @@ export declare const actionClearCanvas: {
91
90
  scrollY: number;
92
91
  cursorButton: "up" | "down";
93
92
  scrolledOutside: boolean;
93
+ name: string;
94
94
  isResizing: boolean;
95
95
  isRotating: boolean;
96
96
  zoom: Readonly<{
@@ -811,7 +811,6 @@ export declare const actionLoadScene: {
811
811
  lastActiveTool: import("../types").ActiveTool | null;
812
812
  locked: boolean;
813
813
  } & import("../types").ActiveTool;
814
- name: string;
815
814
  contextMenu: {
816
815
  items: import("../components/ContextMenu").ContextMenuItems;
817
816
  top: number;
@@ -866,6 +865,7 @@ export declare const actionLoadScene: {
866
865
  scrollY: number;
867
866
  cursorButton: "up" | "down";
868
867
  scrolledOutside: boolean;
868
+ name: string;
869
869
  isResizing: boolean;
870
870
  isRotating: boolean;
871
871
  zoom: Readonly<{
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement, ExcalidrawFrameElement } from "../element/types";
1
+ import { ExcalidrawElement } from "../element/types";
2
2
  import { AppClassProperties, AppState } from "../types";
3
3
  export declare const actionGroup: {
4
4
  name: "group";
@@ -37,7 +37,7 @@ export declare const actionGroup: {
37
37
  isBindingEnabled: boolean;
38
38
  startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
39
39
  suggestedBindings: import("../element/binding").SuggestedBinding[];
40
- frameToHighlight: import("../element/types").NonDeleted<ExcalidrawFrameElement> | null;
40
+ frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameElement> | null;
41
41
  frameRendering: {
42
42
  enabled: boolean;
43
43
  name: boolean;
@@ -177,7 +177,7 @@ export declare const actionUngroup: {
177
177
  isBindingEnabled: boolean;
178
178
  startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
179
179
  suggestedBindings: import("../element/binding").SuggestedBinding[];
180
- frameToHighlight: import("../element/types").NonDeleted<ExcalidrawFrameElement> | null;
180
+ frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameElement> | null;
181
181
  frameRendering: {
182
182
  enabled: boolean;
183
183
  name: boolean;
@@ -262,19 +262,6 @@ export declare const actionToggleEditMenu: {
262
262
  } & {
263
263
  keyTest?: undefined;
264
264
  };
265
- export declare const actionFullScreen: {
266
- name: "toggleFullScreen";
267
- viewMode: true;
268
- trackEvent: {
269
- category: "canvas";
270
- predicate: (appState: Readonly<import("../types").AppState>) => boolean;
271
- };
272
- perform: () => {
273
- commitToHistory: false;
274
- };
275
- } & {
276
- keyTest?: undefined;
277
- };
278
265
  export declare const actionShortcuts: {
279
266
  name: "toggleShortcuts";
280
267
  viewMode: true;
@@ -7,7 +7,7 @@ export { actionChangeViewBackgroundColor, actionClearCanvas, actionZoomIn, actio
7
7
  export { actionFinalize } from "./actionFinalize";
8
8
  export { actionChangeProjectName, actionChangeExportBackground, actionSaveToActiveFile, actionSaveFileToDisk, actionLoadScene, } from "./actionExport";
9
9
  export { actionCopyStyles, actionPasteStyles } from "./actionStyles";
10
- export { actionToggleCanvasMenu, actionToggleEditMenu, actionFullScreen, actionShortcuts, } from "./actionMenu";
10
+ export { actionToggleCanvasMenu, actionToggleEditMenu, actionShortcuts, } from "./actionMenu";
11
11
  export { actionGroup, actionUngroup } from "./actionGroup";
12
12
  export { actionGoToCollaborator } from "./actionNavigate";
13
13
  export { actionAddToLibrary } from "./actionAddToLibrary";
@@ -5,7 +5,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
5
5
  lastActiveTool: import("./types").ActiveTool | null;
6
6
  locked: boolean;
7
7
  } & import("./types").ActiveTool) | undefined;
8
- name?: string | undefined;
9
8
  showWelcomeScreen?: boolean | undefined;
10
9
  penMode?: boolean | undefined;
11
10
  penDetected?: boolean | undefined;
@@ -31,6 +30,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
31
30
  scrollY?: number | undefined;
32
31
  cursorButton?: "up" | "down" | undefined;
33
32
  scrolledOutside?: boolean | undefined;
33
+ name?: string | undefined;
34
34
  zoom?: Readonly<{
35
35
  value: NormalizedZoomValue;
36
36
  }> | undefined;
@@ -1,16 +1,17 @@
1
1
  import { ActionManager } from "../actions/manager";
2
2
  import { ExcalidrawElement } from "../element/types";
3
- import { AppClassProperties, UIAppState, Zoom } from "../types";
3
+ import { AppClassProperties, AppProps, UIAppState, Zoom } from "../types";
4
4
  import "./Actions.scss";
5
5
  export declare const SelectedShapeActions: ({ appState, elements, renderAction, }: {
6
6
  appState: UIAppState;
7
7
  elements: readonly ExcalidrawElement[];
8
8
  renderAction: ActionManager["renderAction"];
9
9
  }) => JSX.Element;
10
- export declare const ShapesSwitcher: ({ activeTool, appState, app, }: {
10
+ export declare const ShapesSwitcher: ({ activeTool, appState, app, UIOptions, }: {
11
11
  activeTool: UIAppState["activeTool"];
12
12
  appState: UIAppState;
13
13
  app: AppClassProperties;
14
+ UIOptions: AppProps["UIOptions"];
14
15
  }) => JSX.Element;
15
16
  export declare const ZoomActions: ({ renderAction, zoom, }: {
16
17
  renderAction: ActionManager["renderAction"];
@@ -2,8 +2,9 @@ import React from "react";
2
2
  import { RoughCanvas } from "roughjs/bin/canvas";
3
3
  import { ActionManager } from "../actions/manager";
4
4
  import { EXPORT_IMAGE_TYPES } from "../constants";
5
+ import { ExportedElements } from "../data";
5
6
  import { LinearElementEditor } from "../element/linearElementEditor";
6
- import { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement } from "../element/types";
7
+ import { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameElement } from "../element/types";
7
8
  import History from "../history";
8
9
  import Scene from "../scene/Scene";
9
10
  import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType } from "../types";
@@ -18,11 +19,15 @@ export declare const ExcalidrawContainerContext: React.Context<{
18
19
  export declare const useApp: () => AppClassProperties;
19
20
  export declare const useAppProps: () => AppProps;
20
21
  export declare const useDevice: () => Readonly<{
21
- isSmScreen: boolean;
22
- isMobile: boolean;
22
+ viewport: {
23
+ isMobile: boolean;
24
+ isLandscape: boolean;
25
+ };
26
+ editor: {
27
+ isMobile: boolean;
28
+ canFitSidebar: boolean;
29
+ };
23
30
  isTouchScreen: boolean;
24
- canDeviceFitSidebar: boolean;
25
- isLandscape: boolean;
26
31
  }>;
27
32
  export declare const useExcalidrawContainer: () => {
28
33
  container: HTMLDivElement | null;
@@ -39,7 +44,6 @@ declare class App extends React.Component<AppProps, AppState> {
39
44
  unmounted: boolean;
40
45
  actionManager: ActionManager;
41
46
  device: Device;
42
- detachIsMobileMqHandler?: () => void;
43
47
  private excalidrawContainerRef;
44
48
  static defaultProps: Partial<AppProps>;
45
49
  scene: Scene;
@@ -220,7 +224,9 @@ declare class App extends React.Component<AppProps, AppState> {
220
224
  getSceneElementsIncludingDeleted: () => readonly ExcalidrawElement[];
221
225
  getSceneElements: () => readonly NonDeletedExcalidrawElement[];
222
226
  onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
223
- onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: readonly NonDeletedExcalidrawElement[]) => Promise<void>;
227
+ onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
228
+ exportingFrame: ExcalidrawFrameElement | null;
229
+ }) => Promise<void>;
224
230
  private openEyeDropper;
225
231
  private syncActionResult;
226
232
  private onBlur;
@@ -233,7 +239,9 @@ declare class App extends React.Component<AppProps, AppState> {
233
239
  */
234
240
  private resetScene;
235
241
  private initializeScene;
236
- private refreshDeviceState;
242
+ private isMobileBreakpoint;
243
+ private refreshViewportBreakpoints;
244
+ private refreshEditorBreakpoints;
237
245
  componentDidMount(): Promise<void>;
238
246
  componentWillUnmount(): void;
239
247
  private onResize;
@@ -269,7 +277,7 @@ declare class App extends React.Component<AppProps, AppState> {
269
277
  outline: boolean;
270
278
  clip: boolean;
271
279
  }> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
272
- togglePenMode: (force?: boolean) => void;
280
+ togglePenMode: (force: boolean | null) => void;
273
281
  onHandToolToggle: () => void;
274
282
  /**
275
283
  * Zooms on canvas viewport center
@@ -321,6 +329,7 @@ declare class App extends React.Component<AppProps, AppState> {
321
329
  private onKeyDown;
322
330
  private onWheel;
323
331
  private onKeyUp;
332
+ private isToolSupported;
324
333
  setActiveTool: (tool: (({
325
334
  type: Exclude<ToolType, "image">;
326
335
  } | {
@@ -10,4 +10,4 @@ export declare const ImageExportDialog: ({ elements, appState, files, actionMana
10
10
  actionManager: ActionManager;
11
11
  onExportImage: AppClassProperties["onExportImage"];
12
12
  onCloseRequest: () => void;
13
- }) => JSX.Element | null;
13
+ }) => JSX.Element;
@@ -14,7 +14,7 @@ interface LayerUIProps {
14
14
  elements: readonly NonDeletedExcalidrawElement[];
15
15
  onLockToggle: () => void;
16
16
  onHandToolToggle: () => void;
17
- onPenModeToggle: () => void;
17
+ onPenModeToggle: AppClassProperties["togglePenMode"];
18
18
  showExitZenModeBtn: boolean;
19
19
  langCode: Language["code"];
20
20
  renderTopRightUI?: ExcalidrawProps["renderTopRightUI"];
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { AppClassProperties, AppState, Device, ExcalidrawProps, UIAppState } from "../types";
2
+ import { AppClassProperties, AppProps, AppState, Device, ExcalidrawProps, UIAppState } from "../types";
3
3
  import { ActionManager } from "../actions/manager";
4
4
  import { NonDeletedExcalidrawElement } from "../element/types";
5
5
  type MobileMenuProps = {
@@ -11,13 +11,14 @@ type MobileMenuProps = {
11
11
  elements: readonly NonDeletedExcalidrawElement[];
12
12
  onLockToggle: () => void;
13
13
  onHandToolToggle: () => void;
14
- onPenModeToggle: () => void;
14
+ onPenModeToggle: AppClassProperties["togglePenMode"];
15
15
  renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
16
16
  renderCustomStats?: ExcalidrawProps["renderCustomStats"];
17
17
  renderSidebars: () => JSX.Element | null;
18
18
  device: Device;
19
19
  renderWelcomeScreen: boolean;
20
+ UIOptions: AppProps["UIOptions"];
20
21
  app: AppClassProperties;
21
22
  };
22
- export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, app, }: MobileMenuProps) => JSX.Element;
23
+ export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, UIOptions, app, }: MobileMenuProps) => JSX.Element;
23
24
  export {};
@@ -84,6 +84,7 @@ export declare const FONT_FAMILY: {
84
84
  Virgil: number;
85
85
  Helvetica: number;
86
86
  Cascadia: number;
87
+ Assistant: number;
87
88
  };
88
89
  export declare const THEME: {
89
90
  readonly LIGHT: "light";
@@ -101,6 +102,11 @@ export declare const FRAME_STYLE: {
101
102
  } | null;
102
103
  backgroundColor: string;
103
104
  radius: number;
105
+ nameOffsetY: number;
106
+ nameColorLightTheme: string;
107
+ nameColorDarkTheme: string;
108
+ nameFontSize: number;
109
+ nameLineHeight: number;
104
110
  };
105
111
  export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
106
112
  export declare const MIN_FONT_SIZE = 1;
@@ -171,7 +177,6 @@ export declare const URL_HASH_KEYS: {
171
177
  readonly addLibrary: "addLibrary";
172
178
  };
173
179
  export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
174
- export declare const MQ_SM_MAX_WIDTH = 640;
175
180
  export declare const MQ_MAX_WIDTH_PORTRAIT = 730;
176
181
  export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
177
182
  export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
@@ -1,13 +1,21 @@
1
- import { NonDeletedExcalidrawElement } from "../element/types";
1
+ import { ExcalidrawElement, ExcalidrawFrameElement, NonDeletedExcalidrawElement } from "../element/types";
2
2
  import { ExportType } from "../scene/types";
3
3
  import { AppState, BinaryFiles } from "../types";
4
4
  import { FileSystemHandle } from "./filesystem";
5
5
  export { loadFromBlob } from "./blob";
6
6
  export { loadFromJSON, saveAsJSON } from "./json";
7
- export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, }: {
7
+ export type ExportedElements = readonly NonDeletedExcalidrawElement[] & {
8
+ _brand: "exportedElements";
9
+ };
10
+ export declare const prepareElementsForExport: (elements: readonly ExcalidrawElement[], { selectedElementIds }: Pick<AppState, "selectedElementIds">, exportSelectionOnly: boolean) => {
11
+ exportingFrame: ExcalidrawFrameElement | null;
12
+ exportedElements: ExportedElements;
13
+ };
14
+ export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: ExportedElements, appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, exportingFrame, }: {
8
15
  exportBackground: boolean;
9
16
  exportPadding?: number | undefined;
10
17
  viewBackgroundColor: string;
11
18
  name: string;
12
19
  fileHandle?: FileSystemHandle | null | undefined;
20
+ exportingFrame: ExcalidrawFrameElement | null;
13
21
  }) => Promise<FileSystemHandle | null | undefined>;
@@ -14,7 +14,7 @@ type EmbeddedLink = ({
14
14
  srcdoc: (theme: Theme) => string;
15
15
  })) | null;
16
16
  export declare const getEmbedLink: (link: string | null | undefined) => EmbeddedLink;
17
- export declare const isEmbeddableOrFrameLabel: (element: NonDeletedExcalidrawElement) => Boolean;
17
+ export declare const isEmbeddableOrLabel: (element: NonDeletedExcalidrawElement) => Boolean;
18
18
  export declare const createPlaceholderEmbeddableLabel: (element: ExcalidrawEmbeddableElement) => ExcalidrawElement;
19
19
  export declare const actionSetEmbeddableAsActiveTool: {
20
20
  name: "setEmbeddableAsActiveTool";
@@ -16,7 +16,7 @@ export declare const isBindingElement: (element?: ExcalidrawElement | null, incl
16
16
  export declare const isBindingElementType: (elementType: AppState["activeTool"]["type"]) => boolean;
17
17
  export declare const isBindableElement: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawBindableElement;
18
18
  export declare const isTextBindableContainer: (element: ExcalidrawElement | null, includeLocked?: boolean) => element is ExcalidrawTextContainer;
19
- export declare const isExcalidrawElement: (element: any) => boolean;
19
+ export declare const isExcalidrawElement: (element: any) => element is ExcalidrawElement;
20
20
  export declare const hasBoundTextElement: (element: ExcalidrawElement | null) => element is MarkNonNullable<ExcalidrawBindableElement, "boundElements">;
21
21
  export declare const isBoundToContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextElementWithContainer;
22
22
  export declare const isUsingAdaptiveRadius: (type: string) => boolean;
package/types/errors.d.ts CHANGED
@@ -5,4 +5,9 @@ export declare class CanvasError extends Error {
5
5
  export declare class AbortError extends DOMException {
6
6
  constructor(message?: string);
7
7
  }
8
+ type ImageSceneDataErrorCode = "IMAGE_NOT_CONTAINS_SCENE_DATA" | "IMAGE_SCENE_DATA_ERROR";
9
+ export declare class ImageSceneDataError extends Error {
10
+ code: ImageSceneDataErrorCode;
11
+ constructor(message?: string, code?: ImageSceneDataErrorCode);
12
+ }
8
13
  export {};
package/types/frame.d.ts CHANGED
@@ -18,7 +18,17 @@ export declare const groupsAreCompletelyOutOfFrame: (elements: readonly NonDelet
18
18
  * Returns a map of frameId to frame elements. Includes empty frames.
19
19
  */
20
20
  export declare const groupByFrames: (elements: readonly ExcalidrawElement[]) => Map<string, ExcalidrawElement[]>;
21
- export declare const getFrameElements: (allElements: ExcalidrawElementsIncludingDeleted, frameId: string) => ExcalidrawElement[];
21
+ export declare const getFrameChildren: (allElements: ExcalidrawElementsIncludingDeleted, frameId: string) => ExcalidrawElement[];
22
+ export declare const getFrameElements: (allElements: ExcalidrawElementsIncludingDeleted) => ExcalidrawFrameElement[];
23
+ /**
24
+ * Returns ExcalidrawFrameElements and non-frame-children elements.
25
+ *
26
+ * Considers children as root elements if they point to a frame parent
27
+ * non-existing in the elements set.
28
+ *
29
+ * Considers non-frame bound elements (container or arrow labels) as root.
30
+ */
31
+ export declare const getRootElements: (allElements: ExcalidrawElementsIncludingDeleted) => ExcalidrawElement[];
22
32
  export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
23
33
  export declare const getElementsInNewFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement) => ExcalidrawElement[];
24
34
  export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap?: Map<string, ExcalidrawElement>) => ExcalidrawFrameElement | null;
@@ -0,0 +1,2 @@
1
+ export = __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__;
2
+ export = __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__;
@@ -0,0 +1 @@
1
+ export const ExcalidrawLib: {};
@@ -1,2 +1,2 @@
1
- export = __WEBPACK_EXTERNAL_MODULE_react_dom__;
2
- export = __WEBPACK_EXTERNAL_MODULE_react_dom__;
1
+ export = __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__;
2
+ export = __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__;
@@ -1,13 +1,12 @@
1
1
  import React from "react";
2
2
  import "../../css/app.scss";
3
3
  import "../../css/styles.scss";
4
- import { ExcalidrawAPIRefValue, ExcalidrawProps } from "../../types";
4
+ import { ExcalidrawProps } from "../../types";
5
5
  import Footer from "../../components/footer/FooterCenter";
6
6
  import MainMenu from "../../components/main-menu/MainMenu";
7
7
  import WelcomeScreen from "../../components/welcome-screen/WelcomeScreen";
8
8
  import LiveCollaborationTrigger from "../../components/live-collaboration/LiveCollaborationTrigger";
9
- type PublicExcalidrawProps = Omit<ExcalidrawProps, "forwardedRef">;
10
- export declare const Excalidraw: React.MemoExoticComponent<React.ForwardRefExoticComponent<PublicExcalidrawProps & React.RefAttributes<ExcalidrawAPIRefValue>>>;
9
+ export declare const Excalidraw: React.MemoExoticComponent<(props: ExcalidrawProps) => JSX.Element>;
11
10
  export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
12
11
  export { defaultLang, useI18n, languages } from "../../i18n";
13
12
  export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "../../data/restore";
@@ -27,4 +26,5 @@ export { LiveCollaborationTrigger };
27
26
  export { DefaultSidebar } from "../../components/DefaultSidebar";
28
27
  export { normalizeLink } from "../../data/url";
29
28
  export { convertToExcalidrawElements } from "../../data/transform";
29
+ export { getCommonBounds } from "../../element/bounds";
30
30
  export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "../withinBounds";
@@ -0,0 +1,171 @@
1
+ declare const _exports: {
2
+ mode: string;
3
+ devtool: boolean;
4
+ entry: {
5
+ "excalidraw.development": string;
6
+ };
7
+ output: {
8
+ path: string;
9
+ library: string;
10
+ libraryTarget: string;
11
+ filename: string;
12
+ chunkFilename: string;
13
+ assetModuleFilename: string;
14
+ publicPath: string;
15
+ };
16
+ resolve: {
17
+ extensions: string[];
18
+ };
19
+ module: {
20
+ rules: ({
21
+ test: RegExp;
22
+ exclude: RegExp;
23
+ use: (string | {
24
+ loader: string;
25
+ } | {
26
+ loader: string;
27
+ options: {
28
+ postcssOptions: {
29
+ plugins: (import("postcss").Plugin & import("autoprefixer").ExportedAPI)[];
30
+ };
31
+ };
32
+ })[];
33
+ } | {
34
+ test: RegExp;
35
+ resolve: {
36
+ fullySpecified: boolean;
37
+ };
38
+ } | {
39
+ test: RegExp;
40
+ exclude: RegExp;
41
+ use: ({
42
+ loader: string;
43
+ } | {
44
+ loader: string;
45
+ options: {
46
+ transpileOnly: boolean;
47
+ configFile: string;
48
+ };
49
+ })[];
50
+ } | {
51
+ test: RegExp;
52
+ type: string;
53
+ })[];
54
+ };
55
+ optimization: {
56
+ splitChunks: {
57
+ chunks: string;
58
+ cacheGroups: {
59
+ vendors: {
60
+ test: RegExp;
61
+ name: string;
62
+ };
63
+ };
64
+ };
65
+ };
66
+ plugins: (import("webpack").EvalSourceMapDevToolPlugin | import("webpack").DefinePlugin)[];
67
+ externals: {
68
+ react: {
69
+ root: string;
70
+ commonjs2: string;
71
+ commonjs: string;
72
+ amd: string;
73
+ };
74
+ "react-dom": {
75
+ root: string;
76
+ commonjs2: string;
77
+ commonjs: string;
78
+ amd: string;
79
+ };
80
+ };
81
+ } | {
82
+ mode: string;
83
+ entry: {
84
+ "excalidraw.production.min": string;
85
+ };
86
+ output: {
87
+ path: string;
88
+ library: string;
89
+ libraryTarget: string;
90
+ filename: string;
91
+ chunkFilename: string;
92
+ assetModuleFilename: string;
93
+ publicPath: string;
94
+ };
95
+ resolve: {
96
+ extensions: string[];
97
+ };
98
+ module: {
99
+ rules: ({
100
+ test: RegExp;
101
+ exclude: RegExp;
102
+ use: (string | {
103
+ loader: string;
104
+ } | {
105
+ loader: string;
106
+ options: {
107
+ postcssOptions: {
108
+ plugins: (import("postcss").Plugin & import("autoprefixer").ExportedAPI)[];
109
+ };
110
+ };
111
+ })[];
112
+ } | {
113
+ test: RegExp;
114
+ resolve: {
115
+ fullySpecified: boolean;
116
+ };
117
+ } | {
118
+ test: RegExp;
119
+ exclude: RegExp;
120
+ use: ({
121
+ loader: string;
122
+ } | {
123
+ loader: string;
124
+ options: {
125
+ transpileOnly: boolean;
126
+ configFile: string;
127
+ };
128
+ } | {
129
+ loader: string;
130
+ options: {
131
+ presets: (string | (string | {
132
+ runtime: string;
133
+ })[])[];
134
+ plugins: string[];
135
+ };
136
+ })[];
137
+ } | {
138
+ test: RegExp;
139
+ type: string;
140
+ })[];
141
+ };
142
+ optimization: {
143
+ minimize: boolean;
144
+ minimizer: import("terser-webpack-plugin")<import("terser").MinifyOptions>[];
145
+ splitChunks: {
146
+ chunks: string;
147
+ cacheGroups: {
148
+ vendors: {
149
+ test: RegExp;
150
+ name: string;
151
+ };
152
+ };
153
+ };
154
+ };
155
+ plugins: any[];
156
+ externals: {
157
+ react: {
158
+ root: string;
159
+ commonjs2: string;
160
+ commonjs: string;
161
+ amd: string;
162
+ };
163
+ "react-dom": {
164
+ root: string;
165
+ commonjs2: string;
166
+ commonjs: string;
167
+ amd: string;
168
+ };
169
+ };
170
+ };
171
+ export = _exports;
@@ -1,5 +1,5 @@
1
1
  import { AppState, BinaryFiles } from "../types";
2
- import { ExcalidrawElement, NonDeleted } from "../element/types";
2
+ import { ExcalidrawElement, ExcalidrawFrameElement, NonDeleted } from "../element/types";
3
3
  import { MIME_TYPES } from "../constants";
4
4
  export { MIME_TYPES };
5
5
  type ExportOpts = {
@@ -7,13 +7,14 @@ type ExportOpts = {
7
7
  appState?: Partial<Omit<AppState, "offsetTop" | "offsetLeft">>;
8
8
  files: BinaryFiles | null;
9
9
  maxWidthOrHeight?: number;
10
+ exportingFrame?: ExcalidrawFrameElement | null;
10
11
  getDimensions?: (width: number, height: number) => {
11
12
  width: number;
12
13
  height: number;
13
14
  scale?: number;
14
15
  };
15
16
  };
16
- export declare const exportToCanvas: ({ elements, appState, files, maxWidthOrHeight, getDimensions, exportPadding, }: ExportOpts & {
17
+ export declare const exportToCanvas: ({ elements, appState, files, maxWidthOrHeight, getDimensions, exportPadding, exportingFrame, }: ExportOpts & {
17
18
  exportPadding?: number | undefined;
18
19
  }) => Promise<HTMLCanvasElement>;
19
20
  export declare const exportToBlob: (opts: ExportOpts & {
@@ -21,7 +22,7 @@ export declare const exportToBlob: (opts: ExportOpts & {
21
22
  quality?: number;
22
23
  exportPadding?: number;
23
24
  }) => Promise<Blob>;
24
- export declare const exportToSvg: ({ elements, appState, files, exportPadding, renderEmbeddables, }: Omit<ExportOpts, "getDimensions"> & {
25
+ export declare const exportToSvg: ({ elements, appState, files, exportPadding, renderEmbeddables, exportingFrame, }: Omit<ExportOpts, "getDimensions"> & {
25
26
  exportPadding?: number | undefined;
26
27
  renderEmbeddables?: boolean | undefined;
27
28
  }) => Promise<SVGSVGElement>;
@@ -1,4 +1,4 @@
1
- import type { NonDeletedExcalidrawElement } from "../element/types";
1
+ import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
2
2
  import { Bounds } from "../element/bounds";
3
3
  type Element = NonDeletedExcalidrawElement;
4
4
  type Elements = readonly NonDeletedExcalidrawElement[];
@@ -6,7 +6,7 @@ export declare const isElementInsideBBox: (element: Element, bbox: Bounds, eithe
6
6
  export declare const elementPartiallyOverlapsWithOrContainsBBox: (element: Element, bbox: Bounds) => boolean;
7
7
  export declare const elementsOverlappingBBox: ({ elements, bounds, type, errorMargin, }: {
8
8
  elements: Elements;
9
- bounds: Bounds;
9
+ bounds: Bounds | ExcalidrawElement;
10
10
  /** safety offset. Defaults to 0. */
11
11
  errorMargin?: number | undefined;
12
12
  /**