@zsviczian/excalidraw 0.12.0-obsidian-8 → 0.12.0-obsidian-10

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 (94) hide show
  1. package/README.md +10 -4
  2. package/dist/excalidraw.development.js +380 -488
  3. package/dist/excalidraw.production.min.js +1 -1
  4. package/dist/excalidraw.production.min.js.LICENSE.txt +0 -9
  5. package/package.json +1 -1
  6. package/types/actions/actionAddToLibrary.d.ts +3 -3
  7. package/types/actions/actionBoundText.d.ts +1 -1
  8. package/types/actions/actionCanvas.d.ts +14 -14
  9. package/types/actions/actionClipboard.d.ts +6 -6
  10. package/types/actions/actionDeleteSelected.d.ts +4 -4
  11. package/types/actions/actionExport.d.ts +10 -10
  12. package/types/actions/actionFinalize.d.ts +2 -2
  13. package/types/actions/actionLinearEditor.d.ts +121 -0
  14. package/types/actions/actionMenu.d.ts +3 -3
  15. package/types/actions/actionProperties.d.ts +13 -13
  16. package/types/actions/actionStyles.d.ts +1 -1
  17. package/types/actions/actionToggleGridMode.d.ts +1 -1
  18. package/types/actions/actionToggleLock.d.ts +1 -1
  19. package/types/actions/actionToggleStats.d.ts +1 -1
  20. package/types/actions/actionToggleViewMode.d.ts +1 -1
  21. package/types/actions/actionToggleZenMode.d.ts +1 -1
  22. package/types/actions/index.d.ts +1 -0
  23. package/types/actions/types.d.ts +1 -1
  24. package/types/appState.d.ts +1 -1
  25. package/types/components/Actions.d.ts +2 -2
  26. package/types/components/BackgroundPickerAndDarkModeToggle.d.ts +1 -6
  27. package/types/components/InitializeApp.d.ts +2 -0
  28. package/types/components/LayerUI.d.ts +1 -2
  29. package/types/components/LoadingMessage.d.ts +2 -0
  30. package/types/components/MobileMenu.d.ts +1 -2
  31. package/types/constants.d.ts +16 -1
  32. package/types/data/blob.d.ts +1 -1
  33. package/types/element/Hyperlink.d.ts +1 -1
  34. package/types/element/image.d.ts +1 -1
  35. package/types/element/linearElementEditor.d.ts +19 -8
  36. package/types/element/newElement.d.ts +6 -1
  37. package/types/element/textElement.d.ts +6 -2
  38. package/types/element/types.d.ts +2 -2
  39. package/types/math.d.ts +8 -1
  40. package/types/packages/common.webpack.dev.config.d.ts +71 -0
  41. package/types/packages/common.webpack.prod.config.d.ts +83 -0
  42. package/types/packages/excalidraw/dist/excalidraw-assets/locales/ar-SA-json-4ff31c0432fe4c84d726.d.ts +0 -0
  43. package/types/packages/excalidraw/dist/excalidraw-assets/locales/bg-BG-json-1c6eb789a5c90a61edf8.d.ts +0 -0
  44. package/types/packages/excalidraw/dist/excalidraw-assets/locales/bn-BD-json-906099d3f665de611389.d.ts +0 -0
  45. package/types/packages/excalidraw/dist/excalidraw-assets/locales/ca-ES-json-7f3f0a2c7f428fa60e01.d.ts +0 -0
  46. package/types/packages/excalidraw/dist/excalidraw-assets/locales/cs-CZ-json-304d08cac870aa0684ec.d.ts +0 -0
  47. package/types/packages/excalidraw/dist/excalidraw-assets/locales/da-DK-json-80c7153473e1427a9a3b.d.ts +0 -0
  48. package/types/packages/excalidraw/dist/excalidraw-assets/locales/de-DE-json-9b88838b2648d7d61f1b.d.ts +0 -0
  49. package/types/packages/excalidraw/dist/excalidraw-assets/locales/el-GR-json-18ce48894d32ca4895b8.d.ts +0 -0
  50. package/types/packages/excalidraw/dist/excalidraw-assets/locales/es-ES-json-69a6c81b0e5dc370ea1a.d.ts +0 -0
  51. package/types/packages/excalidraw/dist/excalidraw-assets/locales/eu-ES-json-a61838a778c9eacb61ec.d.ts +0 -0
  52. package/types/packages/excalidraw/dist/excalidraw-assets/locales/fa-IR-json-2d0cb1044744ed8e4139.d.ts +0 -0
  53. package/types/packages/excalidraw/dist/excalidraw-assets/locales/fi-FI-json-32bcb6481756ef8af590.d.ts +0 -0
  54. package/types/packages/excalidraw/dist/excalidraw-assets/locales/fr-FR-json-935424b03b86c1d82dcd.d.ts +0 -0
  55. package/types/packages/excalidraw/dist/excalidraw-assets/locales/gl-ES-json-5b417484d91976bce190.d.ts +0 -0
  56. package/types/packages/excalidraw/dist/excalidraw-assets/locales/he-IL-json-3f5bfefb1ad0baf19b6c.d.ts +0 -0
  57. package/types/packages/excalidraw/dist/excalidraw-assets/locales/hi-IN-json-71a38dbb2202baec2bad.d.ts +0 -0
  58. package/types/packages/excalidraw/dist/excalidraw-assets/locales/hu-HU-json-e1275f2b1e6ae6ef4427.d.ts +0 -0
  59. package/types/packages/excalidraw/dist/excalidraw-assets/locales/id-ID-json-da38cd847aaf195c3c20.d.ts +0 -0
  60. package/types/packages/excalidraw/dist/excalidraw-assets/locales/it-IT-json-10923c290e23bd31a5b4.d.ts +0 -0
  61. package/types/packages/excalidraw/dist/excalidraw-assets/locales/ja-JP-json-4c357f8206b88dc44840.d.ts +0 -0
  62. package/types/packages/excalidraw/dist/excalidraw-assets/locales/kab-KAB-json-8303afee283a95237f2b.d.ts +0 -0
  63. package/types/packages/excalidraw/dist/excalidraw-assets/locales/kk-KZ-json-ccf0876179807d1d685a.d.ts +0 -0
  64. package/types/packages/excalidraw/dist/excalidraw-assets/locales/ko-KR-json-8e7ae1bb19a7677a8190.d.ts +0 -0
  65. package/types/packages/excalidraw/dist/excalidraw-assets/locales/lt-LT-json-4147c3543dce75362050.d.ts +0 -0
  66. package/types/packages/excalidraw/dist/excalidraw-assets/locales/lv-LV-json-cc5e03ed2a09f8f8b60b.d.ts +0 -0
  67. package/types/packages/excalidraw/dist/excalidraw-assets/locales/mr-IN-json-cb316f30d7b40d3e6766.d.ts +0 -0
  68. package/types/packages/excalidraw/dist/excalidraw-assets/locales/my-MM-json-5dcc8e9cb97a4aa1d8bc.d.ts +0 -0
  69. package/types/packages/excalidraw/dist/excalidraw-assets/locales/nb-NO-json-61192c4af6e2231d38ae.d.ts +0 -0
  70. package/types/packages/excalidraw/dist/excalidraw-assets/locales/nl-NL-json-861ac93c048b5296b791.d.ts +0 -0
  71. package/types/packages/excalidraw/dist/excalidraw-assets/locales/nn-NO-json-808362c0cd4eccb6a885.d.ts +0 -0
  72. package/types/packages/excalidraw/dist/excalidraw-assets/locales/oc-FR-json-d5706569ab4023f94c66.d.ts +0 -0
  73. package/types/packages/excalidraw/dist/excalidraw-assets/locales/pa-IN-json-eb38ce8bfc1b974c1455.d.ts +0 -0
  74. package/types/packages/excalidraw/dist/excalidraw-assets/locales/pl-PL-json-55d8dd8a44917364ef63.d.ts +0 -0
  75. package/types/packages/excalidraw/dist/excalidraw-assets/locales/pt-BR-json-4ffa2f70c2863bca4f91.d.ts +0 -0
  76. package/types/packages/excalidraw/dist/excalidraw-assets/locales/pt-PT-json-4368eca89d2b2b3fb444.d.ts +0 -0
  77. package/types/packages/excalidraw/dist/excalidraw-assets/locales/ro-RO-json-232ea1e0c18745ec6ed9.d.ts +0 -0
  78. package/types/packages/excalidraw/dist/excalidraw-assets/locales/ru-RU-json-ce5fedd8812aa76a0b41.d.ts +0 -0
  79. package/types/packages/excalidraw/dist/excalidraw-assets/locales/si-LK-json-f48a64dfd1cb9c075d2e.d.ts +0 -0
  80. package/types/packages/excalidraw/dist/excalidraw-assets/locales/sk-SK-json-537132ec043d4db7f328.d.ts +0 -0
  81. package/types/packages/excalidraw/dist/excalidraw-assets/locales/sl-SI-json-b69c9fd9b85dac1310c6.d.ts +0 -0
  82. package/types/packages/excalidraw/dist/excalidraw-assets/locales/sv-SE-json-9a8520b202b7181625cf.d.ts +0 -0
  83. package/types/packages/excalidraw/dist/excalidraw-assets/locales/ta-IN-json-15175d03785f7a482568.d.ts +0 -0
  84. package/types/packages/excalidraw/dist/excalidraw-assets/locales/tr-TR-json-c53ae37e848043dd0b89.d.ts +0 -0
  85. package/types/packages/excalidraw/dist/excalidraw-assets/locales/uk-UA-json-15fda426e55236408ef9.d.ts +0 -0
  86. package/types/packages/excalidraw/dist/excalidraw-assets/locales/vi-VN-json-929afcbc15b2c06a64f2.d.ts +0 -0
  87. package/types/packages/excalidraw/dist/excalidraw-assets/locales/zh-CN-json-a670f2b6ddaac05b44fb.d.ts +0 -0
  88. package/types/packages/excalidraw/dist/excalidraw-assets/locales/zh-HK-json-9e8b36ecb4c8399449b1.d.ts +0 -0
  89. package/types/packages/excalidraw/dist/excalidraw-assets/locales/zh-TW-json-441a30840e0721d7f2e2.d.ts +0 -0
  90. package/types/packages/excalidraw/dist/excalidraw-assets/vendor-e516a81320b8c48e3114.d.ts +0 -0
  91. package/types/packages/excalidraw/dist/excalidraw.development.d.ts +4 -2
  92. package/types/packages/excalidraw/webpack.dev.config.d.ts +61 -82
  93. package/types/packages/excalidraw/webpack.prod.config.d.ts +70 -85
  94. package/types/types.d.ts +1 -1
@@ -46,7 +46,7 @@ export declare const actionToggleLock: {
46
46
  currentItemOpacity: number;
47
47
  currentItemFontFamily: number;
48
48
  currentItemFontSize: number;
49
- currentItemTextAlign: import("../element/types").TextAlign;
49
+ currentItemTextAlign: string;
50
50
  currentItemStrokeSharpness: import("../element/types").StrokeSharpness;
51
51
  currentItemStartArrowhead: import("../element/types").Arrowhead | null;
52
52
  currentItemEndArrowhead: import("../element/types").Arrowhead | null;
@@ -44,7 +44,7 @@ export declare const actionToggleStats: {
44
44
  currentItemOpacity: number;
45
45
  currentItemFontFamily: number;
46
46
  currentItemFontSize: number;
47
- currentItemTextAlign: import("../element/types").TextAlign;
47
+ currentItemTextAlign: string;
48
48
  currentItemStrokeSharpness: import("../element/types").StrokeSharpness;
49
49
  currentItemStartArrowhead: import("../element/types").Arrowhead | null;
50
50
  currentItemEndArrowhead: import("../element/types").Arrowhead | null;
@@ -45,7 +45,7 @@ export declare const actionToggleViewMode: {
45
45
  currentItemOpacity: number;
46
46
  currentItemFontFamily: number;
47
47
  currentItemFontSize: number;
48
- currentItemTextAlign: import("../element/types").TextAlign;
48
+ currentItemTextAlign: string;
49
49
  currentItemStrokeSharpness: import("../element/types").StrokeSharpness;
50
50
  currentItemStartArrowhead: import("../element/types").Arrowhead | null;
51
51
  currentItemEndArrowhead: import("../element/types").Arrowhead | null;
@@ -45,7 +45,7 @@ export declare const actionToggleZenMode: {
45
45
  currentItemOpacity: number;
46
46
  currentItemFontFamily: number;
47
47
  currentItemFontSize: number;
48
- currentItemTextAlign: import("../element/types").TextAlign;
48
+ currentItemTextAlign: string;
49
49
  currentItemStrokeSharpness: import("../element/types").StrokeSharpness;
50
50
  currentItemStartArrowhead: import("../element/types").Arrowhead | null;
51
51
  currentItemEndArrowhead: import("../element/types").Arrowhead | null;
@@ -21,3 +21,4 @@ export { actionToggleStats } from "./actionToggleStats";
21
21
  export { actionUnbindText, actionBindText } from "./actionBoundText";
22
22
  export { actionLink } from "../element/Hyperlink";
23
23
  export { actionToggleLock } from "./actionToggleLock";
24
+ export { actionToggleLinearEditor } from "./actionLinearEditor";
@@ -14,7 +14,7 @@ export declare type ActionResult = {
14
14
  declare type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
15
15
  export declare type UpdaterFn = (res: ActionResult) => void;
16
16
  export declare type ActionFilterFn = (action: Action) => void;
17
- export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToSelection" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "eraser" | "bindText" | "toggleLock";
17
+ export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToSelection" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "eraser" | "bindText" | "toggleLock" | "toggleLinearEditor";
18
18
  export declare type PanelComponentProps = {
19
19
  elements: readonly ExcalidrawElement[];
20
20
  appState: AppState;
@@ -35,7 +35,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
35
35
  currentItemOpacity?: number | undefined;
36
36
  currentItemFontFamily?: number | undefined;
37
37
  currentItemFontSize?: number | undefined;
38
- currentItemTextAlign?: import("./element/types").TextAlign | undefined;
38
+ currentItemTextAlign?: string | undefined;
39
39
  currentItemStrokeSharpness?: import("./element/types").StrokeSharpness | undefined;
40
40
  currentItemStartArrowhead?: import("./element/types").Arrowhead | null | undefined;
41
41
  currentItemEndArrowhead?: import("./element/types").Arrowhead | null | undefined;
@@ -25,8 +25,8 @@ export declare const UndoRedoActions: ({ renderAction, className, }: {
25
25
  renderAction: ActionManager["renderAction"];
26
26
  className?: string | undefined;
27
27
  }) => JSX.Element;
28
- export declare const ExitZenModeAction: ({ executeAction, showExitZenModeBtn, }: {
29
- executeAction: ActionManager["executeAction"];
28
+ export declare const ExitZenModeAction: ({ actionManager, showExitZenModeBtn, }: {
29
+ actionManager: ActionManager;
30
30
  showExitZenModeBtn: boolean;
31
31
  }) => JSX.Element;
32
32
  export declare const FinalizeAction: ({ renderAction, className, }: {
@@ -1,9 +1,4 @@
1
- import React from "react";
2
1
  import { ActionManager } from "../actions/manager";
3
- import { AppState } from "../types";
4
- export declare const BackgroundPickerAndDarkModeToggle: ({ appState, setAppState, actionManager, showThemeBtn, }: {
2
+ export declare const BackgroundPickerAndDarkModeToggle: ({ actionManager, }: {
5
3
  actionManager: ActionManager;
6
- appState: AppState;
7
- setAppState: React.Component<any, AppState>["setState"];
8
- showThemeBtn: boolean;
9
4
  }) => JSX.Element;
@@ -1,8 +1,10 @@
1
1
  import React from "react";
2
2
  import { Language } from "../i18n";
3
+ import { Theme } from "../element/types";
3
4
  interface Props {
4
5
  langCode: Language["code"];
5
6
  children: React.ReactElement;
7
+ theme?: Theme;
6
8
  }
7
9
  export declare const InitializeApp: (props: Props) => JSX.Element;
8
10
  export {};
@@ -18,7 +18,6 @@ interface LayerUIProps {
18
18
  onPenModeToggle: () => void;
19
19
  onInsertElements: (elements: readonly NonDeletedExcalidrawElement[]) => void;
20
20
  showExitZenModeBtn: boolean;
21
- showThemeBtn: boolean;
22
21
  langCode: Language["code"];
23
22
  isCollaborating: boolean;
24
23
  renderTopRightUI?: ExcalidrawProps["renderTopRightUI"];
@@ -33,5 +32,5 @@ interface LayerUIProps {
33
32
  insertOnCanvasDirectly: boolean;
34
33
  }) => void;
35
34
  }
36
- declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onCollabButtonClick, onLockToggle, onPenModeToggle, onInsertElements, showExitZenModeBtn, showThemeBtn, isCollaborating, renderTopRightUI, renderCustomFooter, renderCustomStats, libraryReturnUrl, UIOptions, focusContainer, library, id, onImageAction, }: LayerUIProps) => JSX.Element>;
35
+ declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onCollabButtonClick, onLockToggle, onPenModeToggle, onInsertElements, showExitZenModeBtn, isCollaborating, renderTopRightUI, renderCustomFooter, renderCustomStats, libraryReturnUrl, UIOptions, focusContainer, library, id, onImageAction, }: LayerUIProps) => JSX.Element>;
37
36
  export default _default;
@@ -1,4 +1,6 @@
1
1
  /// <reference types="react" />
2
+ import { Theme } from "../element/types";
2
3
  export declare const LoadingMessage: React.FC<{
3
4
  delay?: number;
5
+ theme?: Theme;
4
6
  }>;
@@ -16,12 +16,11 @@ declare type MobileMenuProps = {
16
16
  canvas: HTMLCanvasElement | null;
17
17
  isCollaborating: boolean;
18
18
  renderCustomFooter?: (isMobile: boolean, appState: AppState) => JSX.Element | null;
19
- showThemeBtn: boolean;
20
19
  onImageAction: (data: {
21
20
  insertOnCanvasDirectly: boolean;
22
21
  }) => void;
23
22
  renderTopRightUI?: (isMobile: boolean, appState: AppState) => JSX.Element | null;
24
23
  renderCustomStats?: ExcalidrawProps["renderCustomStats"];
25
24
  };
26
- export declare const MobileMenu: ({ appState, elements, libraryMenu, actionManager, renderJSONExportDialog, renderImageExportDialog, setAppState, onCollabButtonClick, onLockToggle, onPenModeToggle, canvas, isCollaborating, renderCustomFooter, showThemeBtn, onImageAction, renderTopRightUI, renderCustomStats, }: MobileMenuProps) => JSX.Element;
25
+ export declare const MobileMenu: ({ appState, elements, libraryMenu, actionManager, renderJSONExportDialog, renderImageExportDialog, setAppState, onCollabButtonClick, onLockToggle, onPenModeToggle, canvas, isCollaborating, renderCustomFooter, onImageAction, renderTopRightUI, renderCustomStats, }: MobileMenuProps) => JSX.Element;
27
26
  export {};
@@ -87,6 +87,13 @@ export declare const MIME_TYPES: {
87
87
  readonly "excalidraw.png": "image/png";
88
88
  readonly jpg: "image/jpeg";
89
89
  readonly gif: "image/gif";
90
+ readonly webp: "image/webp";
91
+ readonly bmp: "image/bmp";
92
+ readonly ico: "image/x-icon";
93
+ readonly heic: "image/heic";
94
+ readonly heif: "image/heif";
95
+ readonly tif: "image/tif";
96
+ readonly tiff: "image/tiff";
90
97
  readonly binary: "application/octet-stream";
91
98
  };
92
99
  export declare const EXPORT_DATA_TYPES: {
@@ -128,7 +135,7 @@ export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
128
135
  export declare const EXPORT_SCALES: number[];
129
136
  export declare const DEFAULT_EXPORT_PADDING = 10;
130
137
  export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
131
- export declare const ALLOWED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml", "image/gif"];
138
+ export declare const ALLOWED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml", "image/gif", "image/webp", "image/bmp", "image/x-icon", "image/heic", "image/heif", "image/tif", "image/tiff"];
132
139
  export declare const MAX_ALLOWED_FILE_BYTES: number;
133
140
  export declare const SVG_NS = "http://www.w3.org/2000/svg";
134
141
  export declare const ENCRYPTION_KEY_BITS = 128;
@@ -142,7 +149,15 @@ export declare const VERTICAL_ALIGN: {
142
149
  MIDDLE: string;
143
150
  BOTTOM: string;
144
151
  };
152
+ export declare const TEXT_ALIGN: {
153
+ LEFT: string;
154
+ CENTER: string;
155
+ RIGHT: string;
156
+ };
145
157
  export declare const ELEMENT_READY_TO_ERASE_OPACITY = 20;
146
158
  export declare const COOKIES: {
147
159
  readonly AUTH_STATE_COOKIE: "excplus-auth";
148
160
  };
161
+ /** key containt id of precedeing elemnt id we use in reconciliation during
162
+ * collaboration */
163
+ export declare const PRECEDING_ELEMENT_KEY = "__precedingElement__";
@@ -40,7 +40,7 @@ export declare const getFileFromEvent: (event: React.DragEvent<HTMLDivElement>)
40
40
  }>;
41
41
  export declare const getFileHandle: (event: React.DragEvent<HTMLDivElement>) => Promise<FileSystemHandle | null>;
42
42
  export declare const createFile: (blob: File | Blob | ArrayBuffer, mimeType: ValueOf<typeof MIME_TYPES>, name: string | undefined) => File;
43
- /** attemps to detect correct mimeType if none is set, or if an image
43
+ /** attempts to detect correct mimeType if none is set, or if an image
44
44
  * has an incorrect extension.
45
45
  * Note: doesn't handle missing .excalidraw/.excalidrawlib extension */
46
46
  export declare const normalizeFile: (file: File) => Promise<File>;
@@ -55,7 +55,7 @@ export declare const actionLink: {
55
55
  currentItemOpacity: number;
56
56
  currentItemFontFamily: number;
57
57
  currentItemFontSize: number;
58
- currentItemTextAlign: import("./types").TextAlign;
58
+ currentItemTextAlign: string;
59
59
  currentItemStrokeSharpness: import("./types").StrokeSharpness;
60
60
  currentItemStartArrowhead: import("./types").Arrowhead | null;
61
61
  currentItemEndArrowhead: import("./types").Arrowhead | null;
@@ -10,7 +10,7 @@ export declare const updateImageCache: ({ fileIds, files, imageCache, }: {
10
10
  }) => Promise<{
11
11
  imageCache: Map<FileId, {
12
12
  image: HTMLImageElement | Promise<HTMLImageElement>;
13
- mimeType: "image/svg+xml" | "image/png" | "image/jpeg" | "image/gif";
13
+ mimeType: "image/svg+xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/x-icon" | "image/heic" | "image/heif" | "image/tif" | "image/tiff";
14
14
  }>;
15
15
  /** includes errored files because they cache was updated nonetheless */
16
16
  updatedFiles: Map<FileId, true>;
@@ -3,6 +3,11 @@ import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, E
3
3
  import { Point, AppState } from "../types";
4
4
  import History from "../history";
5
5
  import Scene from "../scene/Scene";
6
+ declare const editorMidPointsCache: {
7
+ version: number | null;
8
+ points: (Point | null)[];
9
+ zoom: number | null;
10
+ };
6
11
  export declare class LinearElementEditor {
7
12
  readonly elementId: ExcalidrawElement["id"] & {
8
13
  _brand: "excalidrawLinearElementId";
@@ -24,7 +29,7 @@ export declare class LinearElementEditor {
24
29
  readonly startBindingElement: ExcalidrawBindableElement | null | "keep";
25
30
  readonly endBindingElement: ExcalidrawBindableElement | null | "keep";
26
31
  readonly hoverPointIndex: number;
27
- readonly midPointHovered: boolean;
32
+ readonly segmentMidPointHoveredCoords: Point | null;
28
33
  constructor(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene);
29
34
  static POINT_HANDLE_SIZE: number;
30
35
  /**
@@ -39,11 +44,15 @@ export declare class LinearElementEditor {
39
44
  y: number;
40
45
  }[]) => void, linearElementEditor: LinearElementEditor): boolean;
41
46
  static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState): LinearElementEditor;
42
- static isHittingMidPoint: (linearElementEditor: LinearElementEditor, scenePointer: {
47
+ static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, appState: AppState) => (typeof editorMidPointsCache)["points"];
48
+ static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, appState: AppState) => void;
49
+ static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
43
50
  x: number;
44
51
  y: number;
45
- }, appState: AppState) => boolean;
46
- static getMidPoint(linearElementEditor: LinearElementEditor): readonly [number, number] | null;
52
+ }, appState: AppState) => readonly [number, number] | null;
53
+ static isSegmentTooShort(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, zoom: AppState["zoom"]): boolean;
54
+ static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, endPointIndex: number): readonly [number, number];
55
+ static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: Point): number;
47
56
  static handlePointerDown(event: React.PointerEvent<HTMLCanvasElement>, appState: AppState, history: History, scenePointer: {
48
57
  x: number;
49
58
  y: number;
@@ -53,7 +62,8 @@ export declare class LinearElementEditor {
53
62
  linearElementEditor: LinearElementEditor | null;
54
63
  isMidPoint: boolean;
55
64
  };
56
- static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, linearElementEditor: LinearElementEditor, gridSize: number | null): LinearElementEditor;
65
+ static arePointsEqual(point1: Point | null, point2: Point | null): boolean;
66
+ static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, appState: AppState): LinearElementEditor | null;
57
67
  /** scene coords */
58
68
  static getPointGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, point: Point): readonly [number, number];
59
69
  /** scene coords */
@@ -94,7 +104,7 @@ export declare class LinearElementEditor {
94
104
  startBindingElement: ExcalidrawBindableElement | "keep" | null;
95
105
  endBindingElement: ExcalidrawBindableElement | "keep" | null;
96
106
  hoverPointIndex: number;
97
- midPointHovered: boolean;
107
+ segmentMidPointHoveredCoords: readonly [number, number] | null;
98
108
  };
99
109
  isLoading: boolean;
100
110
  errorMessage: string | null;
@@ -132,7 +142,7 @@ export declare class LinearElementEditor {
132
142
  currentItemOpacity: number;
133
143
  currentItemFontFamily: number;
134
144
  currentItemFontSize: number;
135
- currentItemTextAlign: import("./types").TextAlign;
145
+ currentItemTextAlign: string;
136
146
  currentItemStrokeSharpness: import("./types").StrokeSharpness;
137
147
  currentItemStartArrowhead: import("./types").Arrowhead | null;
138
148
  currentItemEndArrowhead: import("./types").Arrowhead | null;
@@ -202,7 +212,7 @@ export declare class LinearElementEditor {
202
212
  };
203
213
  };
204
214
  static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[]): void;
205
- static addPoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
215
+ static addPoints(element: NonDeleted<ExcalidrawLinearElement>, appState: AppState, targetPoints: {
206
216
  point: Point;
207
217
  }[]): void;
208
218
  static movePoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
@@ -216,3 +226,4 @@ export declare class LinearElementEditor {
216
226
  private static _updatePoints;
217
227
  private static _getShiftLockedDelta;
218
228
  }
229
+ export {};
@@ -13,7 +13,9 @@ export declare const newTextElement: (opts: {
13
13
  verticalAlign: VerticalAlign;
14
14
  containerId?: ExcalidrawRectangleElement["id"];
15
15
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
16
- export declare const updateTextElement: (element: ExcalidrawTextElement, { text, isDeleted, originalText, rawText, link, }: {
16
+ export declare const getMaxContainerWidth: (container: ExcalidrawElement) => number;
17
+ export declare const getMaxContainerHeight: (container: ExcalidrawElement) => number;
18
+ export declare const updateTextElement: (textElement: ExcalidrawTextElement, { text, isDeleted, originalText, rawText, link, }: {
17
19
  text: string;
18
20
  isDeleted?: boolean | undefined;
19
21
  originalText: string;
@@ -33,6 +35,9 @@ export declare const newLinearElement: (opts: {
33
35
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawLinearElement>;
34
36
  export declare const newImageElement: (opts: {
35
37
  type: ExcalidrawImageElement["type"];
38
+ status?: ExcalidrawImageElement["status"];
39
+ fileId?: ExcalidrawImageElement["fileId"];
40
+ scale?: ExcalidrawImageElement["scale"];
36
41
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawImageElement>;
37
42
  export declare const deepCopyElement: (val: any, depth?: number) => any;
38
43
  /**
@@ -1,6 +1,6 @@
1
1
  import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontString, NonDeletedExcalidrawElement } from "./types";
2
2
  import { MaybeTransformHandleType } from "./transformHandles";
3
- export declare const redrawTextBoundingBox: (element: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
3
+ export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null) => void;
4
4
  export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
5
5
  export declare const handleBindTextResize: (element: NonDeletedExcalidrawElement, transformHandleType: MaybeTransformHandleType) => void;
6
6
  export declare const measureText: (text: string, font: FontString, maxWidth?: number | null) => {
@@ -9,7 +9,7 @@ export declare const measureText: (text: string, font: FontString, maxWidth?: nu
9
9
  baseline: number;
10
10
  };
11
11
  export declare const getApproxLineHeight: (font: FontString) => number;
12
- export declare const wrapText: (text: string, font: FontString, containerWidth: number) => string;
12
+ export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
13
13
  export declare const charWidth: {
14
14
  calculate: (char: string, font: FontString) => number;
15
15
  getCache: (font: FontString) => number[];
@@ -24,3 +24,7 @@ export declare const getBoundTextElement: (element: ExcalidrawElement | null) =>
24
24
  export declare const getContainerElement: (element: (ExcalidrawElement & {
25
25
  containerId: ExcalidrawElement["id"] | null;
26
26
  }) | null) => ExcalidrawElement | null;
27
+ export declare const getContainerDims: (element: ExcalidrawElement) => {
28
+ width: number;
29
+ height: number;
30
+ };
@@ -1,5 +1,5 @@
1
1
  import { Point } from "../types";
2
- import { FONT_FAMILY, THEME, VERTICAL_ALIGN } from "../constants";
2
+ import { FONT_FAMILY, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "../constants";
3
3
  export declare type ChartType = "bar" | "line";
4
4
  export declare type FillStyle = "hachure" | "cross-hatch" | "solid";
5
5
  export declare type FontFamilyKeys = keyof typeof FONT_FAMILY;
@@ -12,7 +12,7 @@ export declare type GroupId = string;
12
12
  export declare type PointerType = "mouse" | "pen" | "touch";
13
13
  export declare type StrokeSharpness = "round" | "sharp";
14
14
  export declare type StrokeStyle = "solid" | "dashed" | "dotted";
15
- export declare type TextAlign = "left" | "center" | "right";
15
+ export declare type TextAlign = typeof TEXT_ALIGN[keyof typeof TEXT_ALIGN];
16
16
  declare type VerticalAlignKeys = keyof typeof VERTICAL_ALIGN;
17
17
  export declare type VerticalAlign = typeof VERTICAL_ALIGN[VerticalAlignKeys];
18
18
  declare type _ExcalidrawElementBase = Readonly<{
package/types/math.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Point, Zoom } from "./types";
2
- import { ExcalidrawLinearElement } from "./element/types";
2
+ import { ExcalidrawLinearElement, NonDeleted } from "./element/types";
3
3
  export declare const rotate: (x1: number, y1: number, x2: number, y2: number, angle: number) => [number, number];
4
4
  export declare const rotatePoint: (point: readonly [number, number], center: readonly [number, number], angle: number) => [number, number];
5
5
  export declare const adjustXYWithRotation: (sides: {
@@ -18,3 +18,10 @@ export declare const centerPoint: (a: readonly [number, number], b: readonly [nu
18
18
  export declare const isPathALoop: (points: ExcalidrawLinearElement["points"], zoomValue?: Zoom["value"]) => boolean;
19
19
  export declare const isPointInPolygon: (points: Point[], x: number, y: number) => boolean;
20
20
  export declare const getGridPoint: (x: number, y: number, gridSize: number | null) => [number, number];
21
+ export declare const getControlPointsForBezierCurve: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => [number, number][] | null;
22
+ export declare const getBezierXY: (p0: readonly [number, number], p1: readonly [number, number], p2: readonly [number, number], p3: readonly [number, number], t: number) => number[];
23
+ export declare const getPointsInBezierCurve: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => [number, number][];
24
+ export declare const getBezierCurveArcLengths: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => number[];
25
+ export declare const getBezierCurveLength: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => number;
26
+ export declare const mapIntervalToBezierT: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number], interval: number) => number;
27
+ export declare const arePointsEqual: (p1: readonly [number, number], p2: readonly [number, number]) => boolean;
@@ -0,0 +1,71 @@
1
+ import webpack = require("webpack");
2
+ export const mode: string;
3
+ export const devtool: boolean;
4
+ export namespace output {
5
+ const libraryTarget: string;
6
+ const filename: string;
7
+ const publicPath: string;
8
+ }
9
+ export namespace resolve {
10
+ const extensions: string[];
11
+ }
12
+ export namespace module {
13
+ const rules: ({
14
+ test: RegExp;
15
+ exclude: RegExp;
16
+ use: (string | {
17
+ loader: string;
18
+ options?: undefined;
19
+ } | {
20
+ loader: string;
21
+ options: {
22
+ postcssOptions: {
23
+ plugins: any[];
24
+ };
25
+ };
26
+ })[];
27
+ type?: undefined;
28
+ } | {
29
+ test: RegExp;
30
+ exclude: RegExp;
31
+ use: {
32
+ loader: string;
33
+ options: {
34
+ transpileOnly: boolean;
35
+ configFile: string;
36
+ };
37
+ }[];
38
+ type?: undefined;
39
+ } | {
40
+ test: RegExp;
41
+ type: string;
42
+ exclude?: undefined;
43
+ use?: undefined;
44
+ })[];
45
+ }
46
+ export namespace optimization {
47
+ namespace splitChunks {
48
+ const chunks: string;
49
+ namespace cacheGroups {
50
+ namespace vendors {
51
+ const test: RegExp;
52
+ const name: string;
53
+ }
54
+ }
55
+ }
56
+ }
57
+ export const plugins: (webpack.EvalSourceMapDevToolPlugin | webpack.DefinePlugin)[];
58
+ export const externals: {
59
+ react: {
60
+ root: string;
61
+ commonjs2: string;
62
+ commonjs: string;
63
+ amd: string;
64
+ };
65
+ "react-dom": {
66
+ root: string;
67
+ commonjs2: string;
68
+ commonjs: string;
69
+ amd: string;
70
+ };
71
+ };
@@ -0,0 +1,83 @@
1
+ export const mode: string;
2
+ export namespace output {
3
+ const libraryTarget: string;
4
+ const filename: string;
5
+ const publicPath: string;
6
+ }
7
+ export namespace resolve {
8
+ const extensions: string[];
9
+ }
10
+ export namespace module {
11
+ const rules: ({
12
+ test: RegExp;
13
+ exclude: RegExp;
14
+ use: (string | {
15
+ loader: string;
16
+ options?: undefined;
17
+ } | {
18
+ loader: string;
19
+ options: {
20
+ postcssOptions: {
21
+ plugins: any[];
22
+ };
23
+ };
24
+ })[];
25
+ type?: undefined;
26
+ } | {
27
+ test: RegExp;
28
+ exclude: RegExp;
29
+ use: ({
30
+ loader: string;
31
+ options: {
32
+ transpileOnly: boolean;
33
+ configFile: string;
34
+ presets?: undefined;
35
+ plugins?: undefined;
36
+ };
37
+ } | {
38
+ loader: string;
39
+ options: {
40
+ presets: (string | (string | {
41
+ runtime: string;
42
+ })[])[];
43
+ plugins: string[];
44
+ transpileOnly?: undefined;
45
+ configFile?: undefined;
46
+ };
47
+ })[];
48
+ type?: undefined;
49
+ } | {
50
+ test: RegExp;
51
+ type: string;
52
+ exclude?: undefined;
53
+ use?: undefined;
54
+ })[];
55
+ }
56
+ export namespace optimization {
57
+ const minimize: boolean;
58
+ const minimizer: any[];
59
+ namespace splitChunks {
60
+ const chunks: string;
61
+ namespace cacheGroups {
62
+ namespace vendors {
63
+ const test: RegExp;
64
+ const name: string;
65
+ }
66
+ }
67
+ }
68
+ }
69
+ export const plugins: any[];
70
+ export const externals: {
71
+ react: {
72
+ root: string;
73
+ commonjs2: string;
74
+ commonjs: string;
75
+ amd: string;
76
+ };
77
+ "react-dom": {
78
+ root: string;
79
+ commonjs2: string;
80
+ commonjs: string;
81
+ amd: string;
82
+ };
83
+ };