@zsviczian/excalidraw 0.16.1-obsidian-8 → 0.17.0-obsidian-1

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 (51) hide show
  1. package/dist/excalidraw.development.js +66 -66
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/excalidraw.production.min.js.LICENSE.txt +1 -1
  4. package/main.js +7 -1
  5. package/package.json +1 -1
  6. package/types/actions/actionAddToLibrary.d.ts +3 -0
  7. package/types/actions/actionBoundText.d.ts +2 -0
  8. package/types/actions/actionCanvas.d.ts +14 -1
  9. package/types/actions/actionClipboard.d.ts +7 -0
  10. package/types/actions/actionDeleteSelected.d.ts +3 -0
  11. package/types/actions/actionElementLock.d.ts +2 -0
  12. package/types/actions/actionExport.d.ts +10 -1
  13. package/types/actions/actionFinalize.d.ts +2 -0
  14. package/types/actions/actionFrame.d.ts +3 -0
  15. package/types/actions/actionGroup.d.ts +5 -3
  16. package/types/actions/actionLinearEditor.d.ts +1 -0
  17. package/types/actions/actionMenu.d.ts +3 -14
  18. package/types/actions/actionProperties.d.ts +13 -0
  19. package/types/actions/actionSelectAll.d.ts +1 -0
  20. package/types/actions/actionStyles.d.ts +1 -0
  21. package/types/actions/actionToggleGridMode.d.ts +1 -0
  22. package/types/actions/actionToggleObjectsSnapMode.d.ts +1 -0
  23. package/types/actions/actionToggleStats.d.ts +1 -0
  24. package/types/actions/actionToggleViewMode.d.ts +1 -0
  25. package/types/actions/actionToggleZenMode.d.ts +1 -0
  26. package/types/actions/index.d.ts +1 -1
  27. package/types/appState.d.ts +1 -1
  28. package/types/components/Actions.d.ts +3 -2
  29. package/types/components/App.d.ts +18 -9
  30. package/types/components/ImageExportDialog.d.ts +1 -1
  31. package/types/components/LayerUI.d.ts +1 -1
  32. package/types/components/MobileMenu.d.ts +4 -3
  33. package/types/constants.d.ts +6 -1
  34. package/types/data/index.d.ts +10 -2
  35. package/types/element/Hyperlink.d.ts +1 -0
  36. package/types/element/embeddable.d.ts +2 -1
  37. package/types/element/linearElementEditor.d.ts +1 -0
  38. package/types/element/typeChecks.d.ts +1 -1
  39. package/types/element/types.d.ts +1 -0
  40. package/types/errors.d.ts +5 -0
  41. package/types/frame.d.ts +11 -1
  42. package/types/packages/excalidraw/index.d.ts +3 -3
  43. package/types/packages/excalidraw/webpack.preact.config.d.ts +170 -0
  44. package/types/packages/utils.d.ts +4 -3
  45. package/types/packages/withinBounds.d.ts +2 -2
  46. package/types/renderer/renderElement.d.ts +6 -1
  47. package/types/renderer/renderScene.d.ts +10 -5
  48. package/types/scene/Scene.d.ts +7 -2
  49. package/types/scene/export.d.ts +6 -5
  50. package/types/types.d.ts +18 -15
  51. package/types/utils.d.ts +6 -1
@@ -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
  }) => import("react/jsx-runtime").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
  }) => import("react/jsx-runtime").JSX.Element;
15
16
  export declare const ZoomActions: ({ renderAction, zoom, trayMode, }: {
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, ExcalidrawLinearElement, NonDeleted, NonDeletedExcalidrawElement } from "../element/types";
7
+ import { ExcalidrawElement, ExcalidrawLinearElement, 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";
@@ -19,11 +20,15 @@ export declare const ExcalidrawContainerContext: React.Context<{
19
20
  export declare const useApp: () => AppClassProperties;
20
21
  export declare const useAppProps: () => AppProps;
21
22
  export declare const useDevice: () => Readonly<{
22
- isSmScreen: boolean;
23
- isMobile: boolean;
23
+ viewport: {
24
+ isMobile: boolean;
25
+ isLandscape: boolean;
26
+ };
27
+ editor: {
28
+ isMobile: boolean;
29
+ canFitSidebar: boolean;
30
+ };
24
31
  isTouchScreen: boolean;
25
- canDeviceFitSidebar: boolean;
26
- isLandscape: boolean;
27
32
  }>;
28
33
  export declare const useExcalidrawContainer: () => {
29
34
  container: HTMLDivElement | null;
@@ -40,7 +45,6 @@ declare class App extends React.Component<AppProps, AppState> {
40
45
  unmounted: boolean;
41
46
  actionManager: ActionManager;
42
47
  device: Device;
43
- detachIsMobileMqHandler?: () => void;
44
48
  private excalidrawContainerRef;
45
49
  static defaultProps: Partial<AppProps>;
46
50
  scene: Scene;
@@ -222,7 +226,9 @@ declare class App extends React.Component<AppProps, AppState> {
222
226
  getSceneElementsIncludingDeleted: () => readonly ExcalidrawElement[];
223
227
  getSceneElements: () => readonly NonDeletedExcalidrawElement[];
224
228
  onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
225
- onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: readonly NonDeletedExcalidrawElement[]) => Promise<void>;
229
+ onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
230
+ exportingFrame: ExcalidrawFrameElement | null;
231
+ }) => Promise<void>;
226
232
  private openEyeDropper;
227
233
  private syncActionResult;
228
234
  private onBlur;
@@ -235,7 +241,9 @@ declare class App extends React.Component<AppProps, AppState> {
235
241
  */
236
242
  private resetScene;
237
243
  private initializeScene;
238
- private refreshDeviceState;
244
+ private isMobileBreakpoint;
245
+ private refreshViewportBreakpoints;
246
+ private refreshEditorBreakpoints;
239
247
  componentDidMount(): Promise<void>;
240
248
  componentWillUnmount(): void;
241
249
  private onResize;
@@ -271,7 +279,7 @@ declare class App extends React.Component<AppProps, AppState> {
271
279
  outline: boolean;
272
280
  clip: boolean;
273
281
  }> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
274
- togglePenMode: (force?: boolean) => void;
282
+ togglePenMode: (force: boolean | null) => void;
275
283
  onHandToolToggle: () => void;
276
284
  /**
277
285
  * Zooms on canvas viewport center
@@ -333,6 +341,7 @@ declare class App extends React.Component<AppProps, AppState> {
333
341
  private onKeyDown;
334
342
  private onWheel;
335
343
  private onKeyUp;
344
+ private isToolSupported;
336
345
  setActiveTool: (tool: (({
337
346
  type: Exclude<ToolType, "image">;
338
347
  } | {
@@ -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
- }) => import("react/jsx-runtime").JSX.Element | null;
13
+ }) => import("react/jsx-runtime").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) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onHandToolToggle, onPenModeToggle, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, UIOptions, app, }: MobileMenuProps) => import("react/jsx-runtime").JSX.Element;
23
24
  export {};
@@ -87,6 +87,7 @@ export declare const FONT_FAMILY: {
87
87
  Helvetica: number;
88
88
  Cascadia: number;
89
89
  LocalFont: number;
90
+ Assistant: number;
90
91
  };
91
92
  export declare const THEME: {
92
93
  readonly LIGHT: "light";
@@ -104,6 +105,11 @@ export declare const FRAME_STYLE: {
104
105
  } | null;
105
106
  backgroundColor: string;
106
107
  radius: number;
108
+ nameOffsetY: number;
109
+ nameColorLightTheme: string;
110
+ nameColorDarkTheme: string;
111
+ nameFontSize: number;
112
+ nameLineHeight: number;
107
113
  };
108
114
  export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
109
115
  export declare const MIN_FONT_SIZE = 1;
@@ -174,7 +180,6 @@ export declare const URL_HASH_KEYS: {
174
180
  readonly addLibrary: "addLibrary";
175
181
  };
176
182
  export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
177
- export declare const MQ_SM_MAX_WIDTH = 640;
178
183
  export declare const MQ_MAX_WIDTH_PORTRAIT = 730;
179
184
  export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
180
185
  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>;
@@ -159,6 +159,7 @@ export declare const actionLink: {
159
159
  frameColor: {
160
160
  stroke: string;
161
161
  fill: string;
162
+ nameColor: string;
162
163
  };
163
164
  invertBindingBehaviour: boolean;
164
165
  selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
@@ -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";
@@ -165,6 +165,7 @@ export declare const actionSetEmbeddableAsActiveTool: {
165
165
  frameColor: {
166
166
  stroke: string;
167
167
  fill: string;
168
+ nameColor: string;
168
169
  };
169
170
  invertBindingBehaviour: boolean;
170
171
  selectedLinearElement: import("./linearElementEditor").LinearElementEditor | null;
@@ -263,6 +263,7 @@ export declare class LinearElementEditor {
263
263
  frameColor: {
264
264
  stroke: string;
265
265
  fill: string;
266
+ nameColor: string;
266
267
  };
267
268
  invertBindingBehaviour: boolean;
268
269
  selectedLinearElement: LinearElementEditor | null;
@@ -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;
@@ -83,6 +83,7 @@ export type ExcalidrawEmbeddableElement = _ExcalidrawElementBase & Readonly<{
83
83
  * may not have access to host-app supplied url validator during restore.
84
84
  */
85
85
  validated: boolean | null;
86
+ scale: [number, number];
86
87
  }>;
87
88
  export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
88
89
  type: "image";
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;
@@ -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) => import("react/jsx-runtime").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";
@@ -37,4 +36,5 @@ export { LiveCollaborationTrigger };
37
36
  export { DefaultSidebar } from "../../components/DefaultSidebar";
38
37
  export { normalizeLink } from "../../data/url";
39
38
  export { convertToExcalidrawElements } from "../../data/transform";
39
+ export { getCommonBounds } from "../../element/bounds";
40
40
  export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "../withinBounds";
@@ -0,0 +1,170 @@
1
+ declare const _exports: {
2
+ mode: string;
3
+ entry: {
4
+ "excalidraw.development": string;
5
+ };
6
+ output: {
7
+ path: string;
8
+ library: string;
9
+ libraryTarget: string;
10
+ filename: string;
11
+ chunkFilename: string;
12
+ assetModuleFilename: string;
13
+ publicPath: string;
14
+ };
15
+ resolve: {
16
+ extensions: string[];
17
+ };
18
+ module: {
19
+ rules: ({
20
+ test: RegExp;
21
+ exclude: RegExp;
22
+ use: (string | {
23
+ loader: string;
24
+ } | {
25
+ loader: string;
26
+ options: {
27
+ postcssOptions: {
28
+ plugins: (import("postcss").Plugin & import("autoprefixer").ExportedAPI)[];
29
+ };
30
+ };
31
+ })[];
32
+ } | {
33
+ test: RegExp;
34
+ resolve: {
35
+ fullySpecified: boolean;
36
+ };
37
+ } | {
38
+ test: RegExp;
39
+ exclude: RegExp;
40
+ use: ({
41
+ loader: string;
42
+ } | {
43
+ loader: string;
44
+ options: {
45
+ transpileOnly: boolean;
46
+ configFile: string;
47
+ };
48
+ })[];
49
+ } | {
50
+ test: RegExp;
51
+ type: string;
52
+ })[];
53
+ };
54
+ optimization: {
55
+ splitChunks: {
56
+ chunks: string;
57
+ cacheGroups: {
58
+ vendors: {
59
+ test: RegExp;
60
+ name: string;
61
+ };
62
+ };
63
+ };
64
+ };
65
+ plugins: any[];
66
+ externals: {
67
+ react: {
68
+ root: string;
69
+ commonjs2: string;
70
+ commonjs: string;
71
+ amd: string;
72
+ };
73
+ "react-dom": {
74
+ root: string;
75
+ commonjs2: string;
76
+ commonjs: string;
77
+ amd: string;
78
+ };
79
+ };
80
+ } | {
81
+ mode: string;
82
+ entry: {
83
+ "excalidraw.production.min": string;
84
+ };
85
+ output: {
86
+ path: string;
87
+ library: string;
88
+ libraryTarget: string;
89
+ filename: string;
90
+ chunkFilename: string;
91
+ assetModuleFilename: string;
92
+ publicPath: string;
93
+ };
94
+ resolve: {
95
+ extensions: string[];
96
+ };
97
+ module: {
98
+ rules: ({
99
+ test: RegExp;
100
+ exclude: RegExp;
101
+ use: (string | {
102
+ loader: string;
103
+ } | {
104
+ loader: string;
105
+ options: {
106
+ postcssOptions: {
107
+ plugins: (import("postcss").Plugin & import("autoprefixer").ExportedAPI)[];
108
+ };
109
+ };
110
+ })[];
111
+ } | {
112
+ test: RegExp;
113
+ resolve: {
114
+ fullySpecified: boolean;
115
+ };
116
+ } | {
117
+ test: RegExp;
118
+ exclude: RegExp;
119
+ use: ({
120
+ loader: string;
121
+ } | {
122
+ loader: string;
123
+ options: {
124
+ transpileOnly: boolean;
125
+ configFile: string;
126
+ };
127
+ } | {
128
+ loader: string;
129
+ options: {
130
+ presets: (string | (string | {
131
+ runtime: string;
132
+ })[])[];
133
+ plugins: string[];
134
+ };
135
+ })[];
136
+ } | {
137
+ test: RegExp;
138
+ type: string;
139
+ })[];
140
+ };
141
+ optimization: {
142
+ minimize: boolean;
143
+ minimizer: import("terser-webpack-plugin")<import("terser").MinifyOptions>[];
144
+ splitChunks: {
145
+ chunks: string;
146
+ cacheGroups: {
147
+ vendors: {
148
+ test: RegExp;
149
+ name: string;
150
+ };
151
+ };
152
+ };
153
+ };
154
+ 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
+ };
170
+ 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
  /**
@@ -18,7 +18,12 @@ 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, exportWithDarkMode?: boolean, exportingFrameId?: string | null, renderEmbeddables?: boolean) => 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;
22
27
  export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
23
28
  export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
24
29
  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,15 @@ 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, exportingFrameId, renderEmbeddables, }?: {
25
+ export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode, renderEmbeddables, frameRendering, frameColor, }: {
26
26
  offsetX?: number | undefined;
27
27
  offsetY?: number | undefined;
28
- exportWithDarkMode?: boolean | undefined;
29
- exportingFrameId?: string | null | undefined;
30
- renderEmbeddables?: boolean | undefined;
28
+ exportWithDarkMode: boolean;
29
+ renderEmbeddables: boolean;
30
+ frameRendering: AppState["frameRendering"];
31
+ frameColor?: {
32
+ stroke: string;
33
+ fill: string;
34
+ nameColor: string;
35
+ } | undefined;
31
36
  }) => void;
@@ -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): void;
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;
@@ -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
- import { serializeAsJSON } from "../data/json";
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,10 @@ export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElemen
16
16
  viewBackgroundColor: string;
17
17
  exportWithDarkMode?: boolean;
18
18
  exportEmbedScene?: boolean;
19
- renderFrame?: boolean;
19
+ frameRendering?: AppState["frameRendering"];
20
+ frameColor?: AppState["frameColor"];
20
21
  }, files: BinaryFiles | null, opts?: {
21
- serializeAsJSON?: () => string;
22
22
  renderEmbeddables?: boolean;
23
+ exportingFrame?: ExcalidrawFrameElement | null;
23
24
  }) => Promise<SVGSVGElement>;
24
25
  export declare const getExportSize: (elements: readonly NonDeletedExcalidrawElement[], exportPadding: number, scale: number) => [number, number];