@zsviczian/excalidraw 0.10.0-obsidian-9 → 0.10.0-obsidian-13

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 (100) hide show
  1. package/README.md +2 -0
  2. package/dist/excalidraw.development.js +1118 -634
  3. package/dist/excalidraw.production.min.js +1 -1
  4. package/package.json +10 -7
  5. package/types/actions/manager.d.ts +0 -1
  6. package/types/actions/types.d.ts +0 -1
  7. package/types/appState.d.ts +5 -5
  8. package/types/clipboard.d.ts +0 -2
  9. package/types/components/Actions.d.ts +0 -1
  10. package/types/components/App.d.ts +0 -1
  11. package/types/components/Avatar.d.ts +0 -1
  12. package/types/components/ButtonIconSelect.d.ts +0 -1
  13. package/types/components/CheckboxItem.d.ts +1 -1
  14. package/types/components/ContextMenu.d.ts +0 -2
  15. package/types/components/Island.d.ts +0 -1
  16. package/types/components/JSONExportDialog.d.ts +0 -1
  17. package/types/components/LayerUI.d.ts +0 -1
  18. package/types/components/LibraryMenuItems.d.ts +1 -1
  19. package/types/components/LibraryUnit.d.ts +1 -1
  20. package/types/components/MobileMenu.d.ts +0 -1
  21. package/types/components/Popover.d.ts +0 -1
  22. package/types/components/Section.d.ts +0 -1
  23. package/types/components/Tooltip.d.ts +2 -1
  24. package/types/components/icons.d.ts +0 -1
  25. package/types/constants.d.ts +4 -0
  26. package/types/data/blob.d.ts +5 -3
  27. package/types/data/encryption.d.ts +0 -1
  28. package/types/data/filesystem.d.ts +0 -1
  29. package/types/data/types.d.ts +2 -1
  30. package/types/element/binding.d.ts +0 -2
  31. package/types/element/image.d.ts +0 -2
  32. package/types/element/index.d.ts +0 -3
  33. package/types/element/linearElementEditor.d.ts +0 -1
  34. package/types/element/mutateElement.d.ts +1 -1
  35. package/types/element/newElement.d.ts +1 -1
  36. package/types/element/textWysiwyg.d.ts +0 -2
  37. package/types/element/types.d.ts +2 -0
  38. package/types/errors.d.ts +0 -1
  39. package/types/keys.d.ts +0 -2
  40. package/types/packages/excalidraw/env.d.ts +1 -0
  41. package/types/packages/excalidraw/index.d.ts +2 -1
  42. package/types/packages/excalidraw/webpack.dev.config.d.ts +18 -11
  43. package/types/packages/utils.d.ts +3 -4
  44. package/types/renderer/renderElement.d.ts +4 -6
  45. package/types/renderer/renderScene.d.ts +4 -11
  46. package/types/renderer/roundRect.d.ts +0 -1
  47. package/types/scene/export.d.ts +0 -2
  48. package/types/scene/scroll.d.ts +0 -2
  49. package/types/scene/types.d.ts +15 -8
  50. package/types/scene/zoom.d.ts +0 -1
  51. package/types/types.d.ts +1 -1
  52. package/types/utils.d.ts +9 -3
  53. package/dist/be42d56e500bdd14ae50.woff2 +0 -1
  54. package/dist/edf7912ad1921efb0e5c.woff2 +0 -1
  55. package/dist/excalidraw-assets-dev/Cascadia.woff2 +0 -0
  56. package/dist/excalidraw-assets-dev/Virgil.woff2 +0 -0
  57. package/dist/excalidraw-assets-dev/i18n-ar-SA-json-f9621160946455b76462.js +0 -22
  58. package/dist/excalidraw-assets-dev/i18n-bg-BG-json-b32c761b9a362431e50e.js +0 -22
  59. package/dist/excalidraw-assets-dev/i18n-bn-BD-json-2a24f83ef592e6073764.js +0 -22
  60. package/dist/excalidraw-assets-dev/i18n-ca-ES-json-725c81388f2ea66dc8e1.js +0 -22
  61. package/dist/excalidraw-assets-dev/i18n-cs-CZ-json-b71ad330d7cab164891f.js +0 -22
  62. package/dist/excalidraw-assets-dev/i18n-da-DK-json-a4983751740d8265c9b3.js +0 -22
  63. package/dist/excalidraw-assets-dev/i18n-de-DE-json-4b87b0c49ae73d94c893.js +0 -22
  64. package/dist/excalidraw-assets-dev/i18n-el-GR-json-f4051582ee89b7b94567.js +0 -22
  65. package/dist/excalidraw-assets-dev/i18n-es-ES-json-5df26820f7b483a03085.js +0 -22
  66. package/dist/excalidraw-assets-dev/i18n-fa-IR-json-059e1c6403267405a2af.js +0 -22
  67. package/dist/excalidraw-assets-dev/i18n-fi-FI-json-dd991aae96ac520884d9.js +0 -22
  68. package/dist/excalidraw-assets-dev/i18n-fr-FR-json-c5c06a48e8e1a46bfc75.js +0 -22
  69. package/dist/excalidraw-assets-dev/i18n-he-IL-json-58b5a13fbbe5ef7130c8.js +0 -22
  70. package/dist/excalidraw-assets-dev/i18n-hi-IN-json-00db8d7945755fc1a042.js +0 -22
  71. package/dist/excalidraw-assets-dev/i18n-hu-HU-json-4b843703a66a790ccd51.js +0 -22
  72. package/dist/excalidraw-assets-dev/i18n-id-ID-json-593f4a01d1677bdd9914.js +0 -22
  73. package/dist/excalidraw-assets-dev/i18n-it-IT-json-bb2589d5093a440acc27.js +0 -22
  74. package/dist/excalidraw-assets-dev/i18n-ja-JP-json-0ca368b7a58f8cc96f77.js +0 -22
  75. package/dist/excalidraw-assets-dev/i18n-kab-KAB-json-b3364d3ab875a197b9fc.js +0 -22
  76. package/dist/excalidraw-assets-dev/i18n-kk-KZ-json-92fc286889aafeb15028.js +0 -22
  77. package/dist/excalidraw-assets-dev/i18n-ko-KR-json-58d8a78f6e0558f31e9d.js +0 -22
  78. package/dist/excalidraw-assets-dev/i18n-lv-LV-json-d8c07b87bdf17faeffb1.js +0 -22
  79. package/dist/excalidraw-assets-dev/i18n-my-MM-json-ffceb515ddc074c7d428.js +0 -22
  80. package/dist/excalidraw-assets-dev/i18n-nb-NO-json-cd2bc4e323e1737e1675.js +0 -22
  81. package/dist/excalidraw-assets-dev/i18n-nl-NL-json-abecfc48f3cc72659e7c.js +0 -22
  82. package/dist/excalidraw-assets-dev/i18n-nn-NO-json-69e9b034d6b20edb7022.js +0 -22
  83. package/dist/excalidraw-assets-dev/i18n-oc-FR-json-b99d37b7bfc69d6e7bfc.js +0 -22
  84. package/dist/excalidraw-assets-dev/i18n-pa-IN-json-4d08642ff4fd8368690b.js +0 -22
  85. package/dist/excalidraw-assets-dev/i18n-pl-PL-json-7569e10b0c7a31d97b5b.js +0 -22
  86. package/dist/excalidraw-assets-dev/i18n-pt-BR-json-575146bbd712bac2d9c0.js +0 -22
  87. package/dist/excalidraw-assets-dev/i18n-pt-PT-json-e300e374e83ba1221bca.js +0 -22
  88. package/dist/excalidraw-assets-dev/i18n-ro-RO-json-150126009c54589c7066.js +0 -22
  89. package/dist/excalidraw-assets-dev/i18n-ru-RU-json-67b2f448a092cb83be9a.js +0 -22
  90. package/dist/excalidraw-assets-dev/i18n-si-LK-json-51bf4181409d07f46335.js +0 -22
  91. package/dist/excalidraw-assets-dev/i18n-sk-SK-json-869b94d41c4b845f30aa.js +0 -22
  92. package/dist/excalidraw-assets-dev/i18n-sv-SE-json-65efb104752478d24a35.js +0 -22
  93. package/dist/excalidraw-assets-dev/i18n-ta-IN-json-cbb8fa76d764d56c278d.js +0 -22
  94. package/dist/excalidraw-assets-dev/i18n-tr-TR-json-7938ac27407bec8f0309.js +0 -22
  95. package/dist/excalidraw-assets-dev/i18n-uk-UA-json-63042833340affcdc97c.js +0 -22
  96. package/dist/excalidraw-assets-dev/i18n-zh-CN-json-d0ac48294062972815bd.js +0 -22
  97. package/dist/excalidraw-assets-dev/i18n-zh-HK-json-20c86a43a3497131abc2.js +0 -22
  98. package/dist/excalidraw-assets-dev/i18n-zh-TW-json-11e2cb1fa396ab4d1b06.js +0 -22
  99. package/dist/excalidraw-assets-dev/image-821afe7d20de2d2ca898.js +0 -42
  100. package/dist/excalidraw-assets-dev/vendor-a449655791956f151f51.js +0 -344
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zsviczian/excalidraw",
3
- "version": "0.10.0-obsidian-9",
3
+ "version": "0.10.0-obsidian-13",
4
4
  "main": "main.js",
5
5
  "types": "types/packages/excalidraw/index.d.ts",
6
6
  "files": [
@@ -47,9 +47,9 @@
47
47
  "@babel/core": "7.16.0",
48
48
  "@babel/plugin-transform-arrow-functions": "7.16.0",
49
49
  "@babel/plugin-transform-async-to-generator": "7.16.0",
50
- "@babel/plugin-transform-runtime": "7.16.0",
50
+ "@babel/plugin-transform-runtime": "7.16.4",
51
51
  "@babel/plugin-transform-typescript": "7.16.1",
52
- "@babel/preset-env": "7.16.0",
52
+ "@babel/preset-env": "7.16.4",
53
53
  "@babel/preset-react": "7.16.0",
54
54
  "@babel/preset-typescript": "7.16.0",
55
55
  "autoprefixer": "10.4.0",
@@ -58,13 +58,13 @@
58
58
  "cross-env": "7.0.3",
59
59
  "css-loader": "6.5.1",
60
60
  "file-loader": "6.2.0",
61
- "mini-css-extract-plugin": "2.4.4",
62
- "postcss-loader": "6.2.0",
61
+ "mini-css-extract-plugin": "2.4.5",
62
+ "postcss-loader": "6.2.1",
63
63
  "sass-loader": "12.3.0",
64
64
  "terser-webpack-plugin": "5.2.5",
65
65
  "ts-loader": "9.2.6",
66
- "typescript": "4.4.4",
67
- "webpack": "5.64.0",
66
+ "typescript": "4.5.2",
67
+ "webpack": "5.64.4",
68
68
  "webpack-bundle-analyzer": "4.5.0",
69
69
  "webpack-cli": "4.9.1"
70
70
  },
@@ -75,5 +75,8 @@
75
75
  "build:umd": "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",
76
76
  "build:umd:withAnalyzer": "cross-env NODE_ENV=production ANALYZER=true webpack --config webpack.prod.config.js",
77
77
  "pack": "yarn build:umd && yarn pack"
78
+ },
79
+ "dependencies": {
80
+ "dotenv": "10.0.0"
78
81
  }
79
82
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  import React from "react";
3
2
  import { Action, ActionsManagerInterface, UpdaterFn, ActionName, ActionResult, PanelComponentProps } from "./types";
4
3
  import { ExcalidrawElement } from "../element/types";
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  import React from "react";
3
2
  import { ExcalidrawElement } from "../element/types";
4
3
  import { AppClassProperties, AppState, ExcalidrawProps, BinaryFiles } from "../types";
@@ -1,7 +1,9 @@
1
1
  import { AppState, NormalizedZoomValue } from "./types";
2
2
  export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
3
3
  export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
4
- theme?: string | undefined;
4
+ scrollX?: number | undefined;
5
+ scrollY?: number | undefined;
6
+ viewBackgroundColor?: string | undefined;
5
7
  zoom?: Readonly<{
6
8
  value: NormalizedZoomValue;
7
9
  translation: Readonly<{
@@ -9,8 +11,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
9
11
  y: number;
10
12
  }>;
11
13
  }> | undefined;
12
- scrollX?: number | undefined;
13
- scrollY?: number | undefined;
14
+ shouldCacheIgnoreZoom?: boolean | undefined;
15
+ theme?: string | undefined;
14
16
  name?: string | undefined;
15
17
  elementType?: "line" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "text" | "arrow" | "freedraw" | undefined;
16
18
  elementLocked?: boolean | undefined;
@@ -32,7 +34,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
32
34
  currentItemStartArrowhead?: import("./element/types").Arrowhead | null | undefined;
33
35
  currentItemEndArrowhead?: import("./element/types").Arrowhead | null | undefined;
34
36
  currentItemLinearStrokeSharpness?: import("./element/types").StrokeSharpness | undefined;
35
- viewBackgroundColor?: string | undefined;
36
37
  cursorButton?: "up" | "down" | undefined;
37
38
  scrolledOutside?: boolean | undefined;
38
39
  openMenu?: "canvas" | "shape" | null | undefined;
@@ -43,7 +44,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
43
44
  previousSelectedElementIds?: {
44
45
  [id: string]: boolean;
45
46
  } | undefined;
46
- shouldCacheIgnoreZoom?: boolean | undefined;
47
47
  zenModeEnabled?: boolean | undefined;
48
48
  gridSize?: number | null | undefined;
49
49
  selectedGroupIds?: {
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- /// <reference types="web" />
3
1
  import { ExcalidrawElement, NonDeletedExcalidrawElement } from "./element/types";
4
2
  import { AppState, BinaryFiles } from "./types";
5
3
  import { Spreadsheet } from "./charts";
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  import React from "react";
3
2
  import { ActionManager } from "../actions/manager";
4
3
  import { ExcalidrawElement, PointerType } from "../element/types";
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  import React from "react";
3
2
  import { RoughCanvas } from "roughjs/bin/canvas";
4
3
  import { ActionManager } from "../actions/manager";
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  import "./Avatar.scss";
3
2
  import React from "react";
4
3
  declare type AvatarProps = {
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="web" />
3
2
  export declare const ButtonIconSelect: <T extends Object>({ options, value, onChange, group, }: {
4
3
  options: {
5
4
  value: T;
@@ -2,6 +2,6 @@ import React from "react";
2
2
  import "./CheckboxItem.scss";
3
3
  export declare const CheckboxItem: React.FC<{
4
4
  checked: boolean;
5
- onChange: (checked: boolean) => void;
5
+ onChange: (checked: boolean, event: React.MouseEvent) => void;
6
6
  className?: string;
7
7
  }>;
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- /// <reference types="web" />
3
1
  import "./ContextMenu.scss";
4
2
  import { Action } from "../actions/types";
5
3
  import { ActionManager } from "../actions/manager";
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  import "./Island.scss";
3
2
  import React from "react";
4
3
  declare type IslandProps = {
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="web" />
3
2
  import { ActionsManagerInterface } from "../actions/types";
4
3
  import { NonDeletedExcalidrawElement } from "../element/types";
5
4
  import { AppState, ExportOpts, BinaryFiles } from "../types";
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  import React from "react";
3
2
  import { ActionManager } from "../actions/manager";
4
3
  import { NonDeletedExcalidrawElement } from "../element/types";
@@ -15,7 +15,7 @@ declare const LibraryMenuItems: ({ libraryItems, onRemoveFromLibrary, onAddToLib
15
15
  library: Library;
16
16
  id: string;
17
17
  selectedItems: LibraryItem["id"][];
18
- onToggle: (id: LibraryItem["id"]) => void;
18
+ onToggle: (id: LibraryItem["id"], event: React.MouseEvent) => void;
19
19
  onPublish: () => void;
20
20
  resetLibrary: () => void;
21
21
  }) => JSX.Element;
@@ -8,5 +8,5 @@ export declare const LibraryUnit: ({ id, elements, files, isPending, onClick, se
8
8
  isPending?: boolean | undefined;
9
9
  onClick: () => void;
10
10
  selected: boolean;
11
- onToggle: (id: string) => void;
11
+ onToggle: (id: string, event: React.MouseEvent) => void;
12
12
  }) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  import React from "react";
3
2
  import { AppState } from "../types";
4
3
  import { ActionManager } from "../actions/manager";
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  import React from "react";
3
2
  import "./Popover.scss";
4
3
  declare type Props = {
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  import React from "react";
3
2
  interface SectionProps extends React.HTMLProps<HTMLElement> {
4
3
  heading: string;
@@ -4,6 +4,7 @@ declare type TooltipProps = {
4
4
  children: React.ReactNode;
5
5
  label: string;
6
6
  long?: boolean;
7
+ style?: React.CSSProperties;
7
8
  };
8
- export declare const Tooltip: ({ children, label, long }: TooltipProps) => JSX.Element;
9
+ export declare const Tooltip: ({ children, label, long, style, }: TooltipProps) => JSX.Element;
9
10
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  import React from "react";
3
2
  import { Theme } from "../element/types";
4
3
  declare type Opts = {
@@ -126,3 +126,7 @@ export declare const ALLOWED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpe
126
126
  export declare const MAX_ALLOWED_FILE_BYTES: number;
127
127
  export declare const SVG_NS = "http://www.w3.org/2000/svg";
128
128
  export declare const ENCRYPTION_KEY_BITS = 128;
129
+ export declare const VERSIONS: {
130
+ readonly excalidraw: 2;
131
+ readonly excalidrawLibrary: 2;
132
+ };
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- /// <reference types="web" />
3
1
  import { ALLOWED_IMAGE_MIME_TYPES, MIME_TYPES } from "../constants";
4
2
  import { ExcalidrawElement, FileId } from "../element/types";
5
3
  import { AppState, DataURL } from "../types";
@@ -20,7 +18,11 @@ export declare const canvasToBlob: (canvas: HTMLCanvasElement) => Promise<Blob>;
20
18
  export declare const generateIdFromFile: (file: File) => Promise<FileId>;
21
19
  export declare const getDataURL: (file: Blob | File) => Promise<DataURL>;
22
20
  export declare const dataURLToFile: (dataURL: DataURL, filename?: string) => File;
23
- export declare const resizeImageFile: (file: File, maxWidthOrHeight: number) => Promise<File>;
21
+ export declare const resizeImageFile: (file: File, opts: {
22
+ /** undefined indicates auto */
23
+ outputType?: typeof MIME_TYPES["jpg"];
24
+ maxWidthOrHeight: number;
25
+ }) => Promise<File>;
24
26
  export declare const SVGStringToFile: (SVGString: string, filename?: string) => File & {
25
27
  type: typeof MIME_TYPES.svg;
26
28
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  export declare const IV_LENGTH_BYTES = 12;
3
2
  export declare const createIV: () => Uint8Array;
4
3
  export declare const generateEncryptionKey: <T extends "string" | "cryptoKey" = "string">(returnAs?: T | undefined) => Promise<T extends "cryptoKey" ? CryptoKey : string>;
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  import { FileWithHandle, FileSystemHandle, supported as nativeFileSystemSupported } from "browser-fs-access";
3
2
  declare type FILE_EXTENSION = "gif" | "jpg" | "png" | "svg" | "json" | "excalidraw" | "excalidrawlib";
4
3
  export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
@@ -1,6 +1,7 @@
1
1
  import { ExcalidrawElement } from "../element/types";
2
2
  import { AppState, BinaryFiles, LibraryItems, LibraryItems_v1 } from "../types";
3
3
  import type { cleanAppStateForExport } from "../appState";
4
+ import { VERSIONS } from "../constants";
4
5
  export interface ExportedDataState {
5
6
  type: string;
6
7
  version: number;
@@ -21,7 +22,7 @@ export interface ImportedDataState {
21
22
  }
22
23
  export interface ExportedLibraryData {
23
24
  type: string;
24
- version: 2;
25
+ version: typeof VERSIONS.excalidrawLibrary;
25
26
  source: string;
26
27
  libraryItems: LibraryItems;
27
28
  }
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- /// <reference types="web" />
3
1
  import { ExcalidrawLinearElement, ExcalidrawBindableElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawElement } from "./types";
4
2
  import { AppState } from "../types";
5
3
  import Scene from "../scene/Scene";
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- /// <reference types="web" />
3
1
  import { AppClassProperties, DataURL, BinaryFiles } from "../types";
4
2
  import { ExcalidrawElement, FileId, InitializedExcalidrawImageElement } from "./types";
5
3
  export declare const loadHTMLImageElement: (dataURL: DataURL) => Promise<HTMLImageElement>;
@@ -11,9 +11,6 @@ export { textWysiwyg } from "./textWysiwyg";
11
11
  export { redrawTextBoundingBox } from "./textElement";
12
12
  export { getPerfectElementSize, isInvisiblySmallElement, resizePerfectLineForNWHandler, getNormalizedDimensions, } from "./sizeHelpers";
13
13
  export { showSelectedShapeActions } from "./showSelectedShapeActions";
14
- export declare const getElementMap: (elements: readonly ExcalidrawElement[]) => {
15
- [key: string]: ExcalidrawElement;
16
- };
17
14
  export declare const getSceneVersion: (elements: readonly ExcalidrawElement[]) => number;
18
15
  export declare const getVisibleElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
19
16
  export declare const getNonDeletedElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="web" />
3
2
  import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement } from "./types";
4
3
  import { Point, AppState } from "../types";
5
4
  import History from "../history";
@@ -3,7 +3,7 @@ declare type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TE
3
3
  export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
4
4
  export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>) => TElement;
5
5
  /**
6
- * Mutates element and updates `version` & `versionNonce`.
6
+ * Mutates element, bumping `version`, `versionNonce`, and `updated`.
7
7
  *
8
8
  * NOTE: does not trigger re-render.
9
9
  */
@@ -1,6 +1,6 @@
1
1
  import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues } from "../element/types";
2
2
  import { AppState } from "../types";
3
- declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted">, "width" | "height" | "angle" | "groupIds" | "boundElementIds" | "seed" | "version" | "versionNonce">;
3
+ declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "boundElementIds" | "seed" | "version" | "versionNonce">;
4
4
  export declare const newElement: (opts: {
5
5
  type: ExcalidrawGenericElement["type"];
6
6
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- /// <reference types="web" />
3
1
  import { ExcalidrawElement } from "./types";
4
2
  import { AppState } from "../types";
5
3
  export declare const textWysiwyg: ({ id, appState, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, }: {
@@ -45,6 +45,8 @@ declare type _ExcalidrawElementBase = Readonly<{
45
45
  groupIds: readonly GroupId[];
46
46
  /** Ids of (linear) elements that are bound to this element. */
47
47
  boundElementIds: readonly ExcalidrawLinearElement["id"][] | null;
48
+ /** epoch (ms) timestamp of last element update */
49
+ updated: number;
48
50
  }>;
49
51
  export declare type ExcalidrawSelectionElement = _ExcalidrawElementBase & {
50
52
  type: "selection";
package/types/errors.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  declare type CANVAS_ERROR_NAMES = "CANVAS_ERROR" | "CANVAS_POSSIBLY_TOO_BIG";
3
2
  export declare class CanvasError extends Error {
4
3
  constructor(message?: string, name?: CANVAS_ERROR_NAMES);
package/types/keys.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- /// <reference types="web" />
3
1
  export declare const isDarwin: boolean;
4
2
  export declare const isWindows: boolean;
5
3
  export declare const CODES: {
@@ -0,0 +1 @@
1
+ export function parseEnvVariables(filepath: any): {};
@@ -6,10 +6,11 @@ import { ExcalidrawAPIRefValue, ExcalidrawProps } from "../../types";
6
6
  declare type PublicExcalidrawProps = Omit<ExcalidrawProps, "forwardedRef">;
7
7
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<PublicExcalidrawProps & React.RefAttributes<ExcalidrawAPIRefValue>>>;
8
8
  export default _default;
9
- export { getSceneVersion, getElementMap, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
9
+ export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
10
10
  export { defaultLang, languages } from "../../i18n";
11
11
  export { restore, restoreAppState, restoreElements } from "../../data/restore";
12
12
  export { exportToCanvas, exportToBlob, exportToSvg, serializeAsJSON, loadLibraryFromBlob, loadFromBlob, getFreeDrawSvgPath, } from "../../packages/utils";
13
13
  export { isLinearElement } from "../../element/typeChecks";
14
+ export { getCommonBoundingBox } from "../../element/bounds";
14
15
  export { FONT_FAMILY, THEME } from "../../constants";
15
16
  export { mutateElement, newElementWith, bumpVersion, } from "../../element/mutateElement";
@@ -1,7 +1,5 @@
1
1
  import autoprefixer = require("autoprefixer");
2
- import webpack = require("webpack");
3
2
  export const mode: string;
4
- export const devtool: boolean;
5
3
  export const entry: {
6
4
  "excalidraw.development": string;
7
5
  };
@@ -31,26 +29,35 @@ export namespace module {
31
29
  };
32
30
  };
33
31
  })[];
32
+ type?: undefined;
34
33
  } | {
35
34
  test: RegExp;
36
35
  exclude: RegExp;
37
- use: {
36
+ use: ({
38
37
  loader: string;
39
38
  options: {
40
39
  transpileOnly: boolean;
41
40
  configFile: string;
41
+ presets?: undefined;
42
+ plugins?: undefined;
42
43
  };
43
- }[];
44
- } | {
45
- test: RegExp;
46
- use: {
44
+ } | {
47
45
  loader: string;
48
46
  options: {
49
- name: string;
50
- outputPath: string;
47
+ presets: (string | (string | {
48
+ runtime: string;
49
+ })[])[];
50
+ plugins: string[];
51
+ transpileOnly?: undefined;
52
+ configFile?: undefined;
51
53
  };
52
- }[];
54
+ })[];
55
+ type?: undefined;
56
+ } | {
57
+ test: RegExp;
58
+ type: string;
53
59
  exclude?: undefined;
60
+ use?: undefined;
54
61
  })[];
55
62
  }
56
63
  export namespace optimization {
@@ -64,7 +71,7 @@ export namespace optimization {
64
71
  }
65
72
  }
66
73
  }
67
- export const plugins: webpack.EvalSourceMapDevToolPlugin[];
74
+ export const plugins: any[];
68
75
  export const externals: {
69
76
  react: {
70
77
  root: string;
@@ -1,18 +1,17 @@
1
- /// <reference types="react" />
2
- /// <reference types="web" />
3
1
  import { AppState, BinaryFiles } from "../types";
4
2
  import { ExcalidrawElement, NonDeleted } from "../element/types";
5
3
  declare type ExportOpts = {
6
4
  elements: readonly NonDeleted<ExcalidrawElement>[];
7
5
  appState?: Partial<Omit<AppState, "offsetTop" | "offsetLeft">>;
8
6
  files: BinaryFiles | null;
7
+ maxWidthOrHeight?: number;
9
8
  getDimensions?: (width: number, height: number) => {
10
9
  width: number;
11
10
  height: number;
12
- scale: number;
11
+ scale?: number;
13
12
  };
14
13
  };
15
- export declare const exportToCanvas: ({ elements, appState, files, getDimensions, }: ExportOpts) => Promise<HTMLCanvasElement>;
14
+ export declare const exportToCanvas: ({ elements, appState, files, maxWidthOrHeight, getDimensions, }: ExportOpts) => Promise<HTMLCanvasElement>;
16
15
  export declare const exportToBlob: (opts: ExportOpts & {
17
16
  mimeType?: string;
18
17
  quality?: number;
@@ -1,15 +1,13 @@
1
- /// <reference types="react" />
2
- /// <reference types="web" />
3
1
  import { ExcalidrawElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, ExcalidrawFreeDrawElement } from "../element/types";
4
2
  import { RoughCanvas } from "roughjs/bin/canvas";
5
3
  import { Drawable, Options } from "roughjs/bin/core";
6
4
  import { RoughSVG } from "roughjs/bin/svg";
7
- import { SceneState } from "../scene/types";
5
+ import { RenderConfig } from "../scene/types";
8
6
  import { BinaryFiles, Zoom } from "../types";
9
7
  export interface ExcalidrawElementWithCanvas {
10
8
  element: ExcalidrawElement | ExcalidrawTextElement;
11
9
  canvas: HTMLCanvasElement;
12
- theme: SceneState["theme"];
10
+ theme: RenderConfig["theme"];
13
11
  canvasZoom: Zoom["value"];
14
12
  canvasOffsetX: number;
15
13
  canvasOffsetY: number;
@@ -17,8 +15,8 @@ export interface ExcalidrawElementWithCanvas {
17
15
  export declare const getShapeForElement: (element: ExcalidrawElement) => Drawable | Drawable[] | null | undefined;
18
16
  export declare const invalidateShapeForElement: (element: ExcalidrawElement) => boolean;
19
17
  export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
20
- export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderOptimizations: boolean, sceneState: SceneState) => void;
21
- export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX?: number | undefined, offsetY?: number | undefined) => void;
18
+ export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: RenderConfig) => void;
19
+ export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX?: number | undefined, offsetY?: number | undefined, exportWithDarkMode?: boolean | undefined) => void;
22
20
  export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
23
21
  export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
24
22
  export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
@@ -1,24 +1,17 @@
1
- /// <reference types="react" />
2
- /// <reference types="web" />
3
1
  import { RoughCanvas } from "roughjs/bin/canvas";
4
2
  import { RoughSVG } from "roughjs/bin/svg";
5
3
  import { AppState, BinaryFiles } from "../types";
6
4
  import { NonDeletedExcalidrawElement } from "../element/types";
7
- import { SceneState } from "../scene/types";
8
- export declare const renderScene: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, selectionElement: NonDeletedExcalidrawElement | null, scale: number, rc: RoughCanvas, canvas: HTMLCanvasElement, sceneState: SceneState, { renderScrollbars, renderSelection, renderOptimizations, renderGrid, isExport, }?: {
9
- renderScrollbars?: boolean | undefined;
10
- renderSelection?: boolean | undefined;
11
- renderOptimizations?: boolean | undefined;
12
- renderGrid?: boolean | undefined;
13
- isExport?: boolean | undefined;
14
- }) => {
5
+ import { RenderConfig } from "../scene/types";
6
+ export declare const renderScene: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, selectionElement: NonDeletedExcalidrawElement | null, scale: number, rc: RoughCanvas, canvas: HTMLCanvasElement, renderConfig: RenderConfig) => {
15
7
  atLeastOneVisibleElement: boolean;
16
8
  scrollBars?: undefined;
17
9
  } | {
18
10
  atLeastOneVisibleElement: boolean;
19
11
  scrollBars: import("../scene/types").ScrollBars | undefined;
20
12
  };
21
- export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, }?: {
13
+ export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode, }?: {
22
14
  offsetX?: number | undefined;
23
15
  offsetY?: number | undefined;
16
+ exportWithDarkMode?: boolean | undefined;
24
17
  }) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  /**
3
2
  * https://stackoverflow.com/a/3368118
4
3
  * Draws a rounded rectangle using the current state of the canvas.
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- /// <reference types="web" />
3
1
  import { NonDeletedExcalidrawElement } from "../element/types";
4
2
  import { AppState, BinaryFiles } from "../types";
5
3
  export declare const SVG_EXPORT_TAG = "<!-- svg-source:excalidraw -->";
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- /// <reference types="web" />
3
1
  import { AppState, PointerCoords, Zoom } from "../types";
4
2
  import { ExcalidrawElement } from "../element/types";
5
3
  export declare const centerScrollOn: ({ scenePoint, viewportDimensions, zoom, }: {
@@ -1,11 +1,13 @@
1
1
  import { ExcalidrawTextElement } from "../element/types";
2
- import { AppClassProperties, AppState, Zoom } from "../types";
3
- export declare type SceneState = {
4
- scrollX: number;
5
- scrollY: number;
6
- viewBackgroundColor: string | null;
7
- zoom: Zoom;
8
- shouldCacheIgnoreZoom: boolean;
2
+ import { AppClassProperties, AppState } from "../types";
3
+ export declare type RenderConfig = {
4
+ scrollX: AppState["scrollX"];
5
+ scrollY: AppState["scrollY"];
6
+ /** null indicates transparent bg */
7
+ viewBackgroundColor: AppState["viewBackgroundColor"] | null;
8
+ zoom: AppState["zoom"];
9
+ shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
10
+ theme: AppState["theme"];
9
11
  remotePointerViewportCoords: {
10
12
  [id: string]: {
11
13
  x: number;
@@ -24,8 +26,13 @@ export declare type SceneState = {
24
26
  remotePointerUserStates: {
25
27
  [id: string]: string;
26
28
  };
27
- theme: AppState["theme"];
28
29
  imageCache: AppClassProperties["imageCache"];
30
+ renderScrollbars?: boolean;
31
+ renderSelection?: boolean;
32
+ renderGrid?: boolean;
33
+ /** when exporting the behavior is slightly different (e.g. we can't use
34
+ CSS filters), and we disable render optimizations for best output */
35
+ isExporting: boolean;
29
36
  };
30
37
  export declare type SceneScroll = {
31
38
  scrollX: number;
@@ -1,4 +1,3 @@
1
- /// <reference types="web" />
2
1
  import { NormalizedZoomValue, PointerCoords, Zoom } from "../types";
3
2
  export declare const getNewZoom: (newZoomValue: NormalizedZoomValue, prevZoom: Zoom, canvasOffset: {
4
3
  left: number;
package/types/types.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="web" />
3
2
  import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme } from "./element/types";
4
3
  import { SHAPES } from "./shapes";
5
4
  import { Point as RoughPoint } from "roughjs/bin/geometry";
@@ -205,6 +204,7 @@ export interface ExcalidrawProps {
205
204
  onBeforeTextEdit?: (textElement: ExcalidrawTextElement) => string;
206
205
  onBeforeTextSubmit?: (textElement: ExcalidrawTextElement, textToSubmit: string, isDeleted: boolean) => string;
207
206
  generateIdForFile?: (file: File) => string | Promise<string>;
207
+ onThemeChange?: (newTheme: string) => void;
208
208
  }
209
209
  export declare type SceneData = {
210
210
  elements?: ImportedDataState["elements"];