@dwelle/excalidraw 0.4.0-d411eb2 → 0.4.0-e7ba198

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 (107) hide show
  1. package/CHANGELOG.md +102 -754
  2. package/README.md +93 -25
  3. package/dist/excalidraw-assets/Assistant-Bold.woff2 +0 -0
  4. package/dist/excalidraw-assets/Assistant-Medium.woff2 +0 -0
  5. package/dist/excalidraw-assets/Assistant-Regular.woff2 +0 -0
  6. package/dist/excalidraw-assets/Assistant-SemiBold.woff2 +0 -0
  7. package/dist/excalidraw-assets/vendor-2002fe1b8862917b36c1.js +2 -0
  8. package/dist/excalidraw-assets/{vendor-52b1f3361986b6c6a4fe.js.LICENSE.txt → vendor-2002fe1b8862917b36c1.js.LICENSE.txt} +0 -0
  9. package/dist/excalidraw-assets-dev/Assistant-Bold.woff2 +0 -0
  10. package/dist/excalidraw-assets-dev/Assistant-Medium.woff2 +0 -0
  11. package/dist/excalidraw-assets-dev/Assistant-Regular.woff2 +0 -0
  12. package/dist/excalidraw-assets-dev/Assistant-SemiBold.woff2 +0 -0
  13. package/dist/excalidraw-assets-dev/{vendor-c0592035c3911af79359.js → vendor-e6df8519da951026ff69.js} +1 -1
  14. package/dist/excalidraw.development.js +442 -204
  15. package/dist/excalidraw.production.min.js +1 -1
  16. package/dist/excalidraw.production.min.js.LICENSE.txt +1 -8
  17. package/package.json +1 -1
  18. package/types/actions/actionAddToLibrary.d.ts +15 -12
  19. package/types/actions/actionAlign.d.ts +18 -6
  20. package/types/actions/actionBoundText.d.ts +5 -4
  21. package/types/actions/actionCanvas.d.ts +62 -40
  22. package/types/actions/actionClipboard.d.ts +26 -21
  23. package/types/actions/actionDeleteSelected.d.ts +19 -14
  24. package/types/actions/actionDistribute.d.ts +6 -2
  25. package/types/actions/actionDuplicateSelection.d.ts +3 -1
  26. package/types/actions/actionExport.d.ts +71 -46
  27. package/types/actions/actionFinalize.d.ts +13 -9
  28. package/types/actions/actionGroup.d.ts +6 -2
  29. package/types/actions/actionLinearEditor.d.ts +115 -0
  30. package/types/actions/actionMenu.d.ts +24 -15
  31. package/types/actions/actionNavigate.d.ts +3 -1
  32. package/types/actions/actionProperties.d.ts +104 -65
  33. package/types/actions/actionStyles.d.ts +5 -4
  34. package/types/actions/actionToggleGridMode.d.ts +5 -4
  35. package/types/actions/actionToggleLock.d.ts +5 -4
  36. package/types/actions/actionToggleStats.d.ts +5 -4
  37. package/types/actions/actionToggleViewMode.d.ts +5 -4
  38. package/types/actions/actionToggleZenMode.d.ts +5 -4
  39. package/types/actions/actionZindex.d.ts +12 -4
  40. package/types/actions/index.d.ts +1 -0
  41. package/types/actions/manager.d.ts +1 -1
  42. package/types/actions/shortcuts.d.ts +1 -1
  43. package/types/actions/types.d.ts +4 -2
  44. package/types/appState.d.ts +6 -5
  45. package/types/clients.d.ts +1 -1
  46. package/types/components/Actions.d.ts +14 -2
  47. package/types/components/App.d.ts +54 -3
  48. package/types/components/Avatar.d.ts +1 -1
  49. package/types/components/CollabButton.d.ts +2 -3
  50. package/types/components/DialogActionButton.d.ts +10 -0
  51. package/types/components/Footer.d.ts +10 -0
  52. package/types/components/HelpButton.d.ts +8 -0
  53. package/types/components/HintViewer.d.ts +3 -2
  54. package/types/components/HomeButton.d.ts +5 -0
  55. package/types/components/ImageExportDialog.d.ts +3 -1
  56. package/types/components/InitializeApp.d.ts +2 -0
  57. package/types/components/JSONExportDialog.d.ts +2 -2
  58. package/types/components/LayerUI.d.ts +6 -4
  59. package/types/components/LibraryButton.d.ts +1 -0
  60. package/types/components/LibraryMenu.d.ts +14 -6
  61. package/types/components/LibraryMenuBrowseButton.d.ts +7 -0
  62. package/types/components/LibraryMenuHeaderContent.d.ts +12 -0
  63. package/types/components/LibraryMenuItems.d.ts +5 -14
  64. package/types/components/LibraryUnit.d.ts +2 -3
  65. package/types/components/LoadingMessage.d.ts +2 -0
  66. package/types/components/MenuItem.d.ts +11 -0
  67. package/types/components/MenuUtils.d.ts +1 -0
  68. package/types/components/MobileMenu.d.ts +10 -9
  69. package/types/components/Sidebar/Sidebar.d.ts +73 -0
  70. package/types/components/Sidebar/SidebarHeader.d.ts +20 -0
  71. package/types/components/Sidebar/common.d.ts +16 -0
  72. package/types/components/Stats.d.ts +1 -1
  73. package/types/components/UserList.d.ts +0 -1
  74. package/types/components/WelcomeScreen.d.ts +10 -0
  75. package/types/components/WelcomeScreenDecor.d.ts +6 -0
  76. package/types/components/hoc/withUpstreamOverride.d.ts +10 -0
  77. package/types/components/icons.d.ts +81 -122
  78. package/types/constants.d.ts +15 -7
  79. package/types/data/blob.d.ts +1 -1
  80. package/types/data/restore.d.ts +1 -1
  81. package/types/data/types.d.ts +16 -1
  82. package/types/element/Hyperlink.d.ts +9 -7
  83. package/types/element/image.d.ts +1 -1
  84. package/types/element/index.d.ts +1 -1
  85. package/types/element/linearElementEditor.d.ts +24 -11
  86. package/types/element/newElement.d.ts +14 -1
  87. package/types/element/textElement.d.ts +6 -2
  88. package/types/element/transformHandles.d.ts +3 -3
  89. package/types/element/types.d.ts +3 -2
  90. package/types/hooks/useOutsideClick.d.ts +2 -0
  91. package/types/keys.d.ts +13 -3
  92. package/types/math.d.ts +8 -1
  93. package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-52b1f3361986b6c6a4fe.d.ts → vendor-2002fe1b8862917b36c1.d.ts} +0 -0
  94. package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-c0592035c3911af79359.d.ts → vendor-e6df8519da951026ff69.d.ts} +0 -0
  95. package/types/packages/excalidraw/example/App.d.ts +2 -1
  96. package/types/packages/excalidraw/example/sidebar/{Sidebar.d.ts → ExampleSidebar.d.ts} +1 -1
  97. package/types/packages/excalidraw/index.d.ts +2 -1
  98. package/types/packages/utils.d.ts +4 -1
  99. package/types/renderer/renderScene.d.ts +1 -1
  100. package/types/scene/types.d.ts +1 -0
  101. package/types/shapes.d.ts +27 -3
  102. package/types/types.d.ts +32 -15
  103. package/dist/excalidraw-assets/vendor-52b1f3361986b6c6a4fe.js +0 -2
  104. package/types/components/BackgroundPickerAndDarkModeToggle.d.ts +0 -9
  105. package/types/components/Card.d.ts +0 -7
  106. package/types/components/HelpIcon.d.ts +0 -8
  107. package/types/components/SidebarLockButton.d.ts +0 -8
@@ -6,68 +6,77 @@ declare type Opts = {
6
6
  mirror?: true;
7
7
  } & React.SVGProps<SVGSVGElement>;
8
8
  export declare const createIcon: (d: string | React.ReactNode, opts?: number | Opts) => JSX.Element;
9
+ export declare const HomeIcon: JSX.Element;
10
+ export declare const LibraryIcon: JSX.Element;
11
+ export declare const PlusIcon: JSX.Element;
12
+ export declare const DotsIcon: JSX.Element;
13
+ export declare const PinIcon: JSX.Element;
14
+ export declare const UnlockedIcon: JSX.Element;
15
+ export declare const LockedIcon: JSX.Element;
16
+ export declare const WelcomeScreenMenuArrow: JSX.Element;
17
+ export declare const WelcomeScreenHelpArrow: JSX.Element;
18
+ export declare const WelcomeScreenTopToolbarArrow: JSX.Element;
19
+ export declare const ExcalLogo: JSX.Element;
20
+ export declare const SelectionIcon: JSX.Element;
21
+ export declare const RectangleIcon: JSX.Element;
22
+ export declare const DiamondIcon: JSX.Element;
23
+ export declare const EllipseIcon: JSX.Element;
24
+ export declare const ArrowIcon: JSX.Element;
25
+ export declare const LineIcon: JSX.Element;
26
+ export declare const PenModeIcon: JSX.Element;
27
+ export declare const FreedrawIcon: JSX.Element;
28
+ export declare const TextIcon: JSX.Element;
29
+ export declare const ImageIcon: JSX.Element;
30
+ export declare const EraserIcon: JSX.Element;
31
+ export declare const ZoomInIcon: JSX.Element;
32
+ export declare const ZoomOutIcon: JSX.Element;
33
+ export declare const TrashIcon: JSX.Element;
34
+ export declare const DuplicateIcon: JSX.Element;
35
+ export declare const MoonIcon: JSX.Element;
36
+ export declare const SunIcon: JSX.Element;
37
+ export declare const HamburgerMenuIcon: JSX.Element;
38
+ export declare const ExportIcon: JSX.Element;
39
+ export declare const HelpIcon: JSX.Element;
40
+ export declare const ExternalLinkIcon: JSX.Element;
41
+ export declare const GithubIcon: JSX.Element;
42
+ export declare const DiscordIcon: JSX.Element;
43
+ export declare const TwitterIcon: JSX.Element;
9
44
  export declare const checkIcon: JSX.Element;
10
- export declare const link: JSX.Element;
45
+ export declare const LinkIcon: JSX.Element;
11
46
  export declare const save: JSX.Element;
12
47
  export declare const saveAs: JSX.Element;
13
- export declare const load: JSX.Element;
48
+ export declare const LoadIcon: JSX.Element;
14
49
  export declare const clipboard: JSX.Element;
15
- export declare const trash: JSX.Element;
16
50
  export declare const palette: JSX.Element;
17
- export declare const exportFile: JSX.Element;
18
- export declare const exportImage: JSX.Element;
51
+ export declare const ExportImageIcon: JSX.Element;
19
52
  export declare const exportToFileIcon: JSX.Element;
20
53
  export declare const zoomIn: JSX.Element;
21
54
  export declare const zoomOut: JSX.Element;
22
55
  export declare const done: JSX.Element;
23
56
  export declare const menu: JSX.Element;
24
- export declare const undo: JSX.Element;
25
- export declare const redo: JSX.Element;
57
+ export declare const UndoIcon: JSX.Element;
58
+ export declare const RedoIcon: JSX.Element;
26
59
  export declare const questionCircle: JSX.Element;
27
60
  export declare const share: JSX.Element;
28
61
  export declare const shareIOS: JSX.Element;
29
62
  export declare const shareWindows: JSX.Element;
30
63
  export declare const resetZoom: JSX.Element;
31
- export declare const BringForwardIcon: React.MemoExoticComponent<({ theme }: {
32
- theme: Theme;
33
- }) => JSX.Element>;
34
- export declare const SendBackwardIcon: React.MemoExoticComponent<({ theme }: {
35
- theme: Theme;
36
- }) => JSX.Element>;
37
- export declare const BringToFrontIcon: React.MemoExoticComponent<({ theme }: {
38
- theme: Theme;
39
- }) => JSX.Element>;
40
- export declare const SendToBackIcon: React.MemoExoticComponent<({ theme }: {
41
- theme: Theme;
42
- }) => JSX.Element>;
43
- export declare const AlignTopIcon: React.MemoExoticComponent<({ theme }: {
44
- theme: Theme;
45
- }) => JSX.Element>;
46
- export declare const AlignBottomIcon: React.MemoExoticComponent<({ theme }: {
47
- theme: Theme;
48
- }) => JSX.Element>;
49
- export declare const AlignLeftIcon: React.MemoExoticComponent<({ theme }: {
50
- theme: Theme;
51
- }) => JSX.Element>;
52
- export declare const AlignRightIcon: React.MemoExoticComponent<({ theme }: {
53
- theme: Theme;
54
- }) => JSX.Element>;
55
- export declare const DistributeHorizontallyIcon: React.MemoExoticComponent<({ theme }: {
56
- theme: Theme;
57
- }) => JSX.Element>;
58
- export declare const DistributeVerticallyIcon: React.MemoExoticComponent<({ theme }: {
59
- theme: Theme;
60
- }) => JSX.Element>;
61
- export declare const CenterVerticallyIcon: React.MemoExoticComponent<({ theme }: {
62
- theme: Theme;
63
- }) => JSX.Element>;
64
- export declare const CenterHorizontallyIcon: React.MemoExoticComponent<({ theme }: {
65
- theme: Theme;
66
- }) => JSX.Element>;
67
- export declare const users: JSX.Element;
64
+ export declare const BringForwardIcon: JSX.Element;
65
+ export declare const SendBackwardIcon: JSX.Element;
66
+ export declare const BringToFrontIcon: JSX.Element;
67
+ export declare const SendToBackIcon: JSX.Element;
68
+ export declare const AlignTopIcon: JSX.Element;
69
+ export declare const AlignBottomIcon: JSX.Element;
70
+ export declare const AlignLeftIcon: JSX.Element;
71
+ export declare const AlignRightIcon: JSX.Element;
72
+ export declare const DistributeHorizontallyIcon: JSX.Element;
73
+ export declare const DistributeVerticallyIcon: JSX.Element;
74
+ export declare const CenterVerticallyIcon: JSX.Element;
75
+ export declare const CenterHorizontallyIcon: JSX.Element;
76
+ export declare const UsersIcon: JSX.Element;
68
77
  export declare const start: JSX.Element;
69
78
  export declare const stop: JSX.Element;
70
- export declare const close: JSX.Element;
79
+ export declare const CloseIcon: JSX.Element;
71
80
  export declare const back: JSX.Element;
72
81
  export declare const clone: JSX.Element;
73
82
  export declare const shield: JSX.Element;
@@ -78,92 +87,44 @@ export declare const GroupIcon: React.MemoExoticComponent<({ theme }: {
78
87
  export declare const UngroupIcon: React.MemoExoticComponent<({ theme }: {
79
88
  theme: Theme;
80
89
  }) => JSX.Element>;
81
- export declare const FillHachureIcon: React.MemoExoticComponent<({ theme }: {
82
- theme: Theme;
83
- }) => JSX.Element>;
84
- export declare const FillCrossHatchIcon: React.MemoExoticComponent<({ theme }: {
85
- theme: Theme;
86
- }) => JSX.Element>;
87
- export declare const FillSolidIcon: React.MemoExoticComponent<({ theme }: {
88
- theme: Theme;
89
- }) => JSX.Element>;
90
- export declare const StrokeWidthIcon: React.MemoExoticComponent<({ theme, strokeWidth }: {
91
- theme: Theme;
92
- strokeWidth: number;
93
- }) => JSX.Element>;
90
+ export declare const FillHachureIcon: JSX.Element;
91
+ export declare const FillCrossHatchIcon: JSX.Element;
92
+ export declare const FillSolidIcon: JSX.Element;
93
+ export declare const StrokeWidthBaseIcon: JSX.Element;
94
+ export declare const StrokeWidthBoldIcon: JSX.Element;
95
+ export declare const StrokeWidthExtraBoldIcon: JSX.Element;
94
96
  export declare const StrokeStyleSolidIcon: React.MemoExoticComponent<({ theme }: {
95
97
  theme: Theme;
96
98
  }) => JSX.Element>;
97
- export declare const StrokeStyleDashedIcon: React.MemoExoticComponent<({ theme }: {
98
- theme: Theme;
99
- }) => JSX.Element>;
100
- export declare const StrokeStyleDottedIcon: React.MemoExoticComponent<({ theme }: {
101
- theme: Theme;
102
- }) => JSX.Element>;
103
- export declare const SloppinessArchitectIcon: React.MemoExoticComponent<({ theme }: {
104
- theme: Theme;
105
- }) => JSX.Element>;
106
- export declare const SloppinessArtistIcon: React.MemoExoticComponent<({ theme }: {
107
- theme: Theme;
108
- }) => JSX.Element>;
109
- export declare const SloppinessCartoonistIcon: React.MemoExoticComponent<({ theme }: {
110
- theme: Theme;
111
- }) => JSX.Element>;
112
- export declare const EdgeSharpIcon: React.MemoExoticComponent<({ theme }: {
113
- theme: Theme;
114
- }) => JSX.Element>;
115
- export declare const EdgeRoundIcon: React.MemoExoticComponent<({ theme }: {
116
- theme: Theme;
117
- }) => JSX.Element>;
118
- export declare const ArrowheadNoneIcon: React.MemoExoticComponent<({ theme }: {
119
- theme: Theme;
120
- }) => JSX.Element>;
121
- export declare const ArrowheadArrowIcon: React.MemoExoticComponent<({ theme, flip }: {
122
- theme: Theme;
99
+ export declare const StrokeStyleDashedIcon: JSX.Element;
100
+ export declare const StrokeStyleDottedIcon: JSX.Element;
101
+ export declare const SloppinessArchitectIcon: JSX.Element;
102
+ export declare const SloppinessArtistIcon: JSX.Element;
103
+ export declare const SloppinessCartoonistIcon: JSX.Element;
104
+ export declare const EdgeSharpIcon: JSX.Element;
105
+ export declare const EdgeRoundIcon: JSX.Element;
106
+ export declare const ArrowheadNoneIcon: JSX.Element;
107
+ export declare const ArrowheadArrowIcon: React.MemoExoticComponent<({ flip }: {
123
108
  flip?: boolean | undefined;
124
109
  }) => JSX.Element>;
125
- export declare const ArrowheadDotIcon: React.MemoExoticComponent<({ theme, flip }: {
126
- theme: Theme;
110
+ export declare const ArrowheadDotIcon: React.MemoExoticComponent<({ flip }: {
127
111
  flip?: boolean | undefined;
128
112
  }) => JSX.Element>;
129
- export declare const ArrowheadBarIcon: React.MemoExoticComponent<({ theme, flip }: {
130
- theme: Theme;
113
+ export declare const ArrowheadBarIcon: React.MemoExoticComponent<({ flip }: {
131
114
  flip?: boolean | undefined;
132
115
  }) => JSX.Element>;
133
- export declare const ArrowheadTriangleIcon: React.MemoExoticComponent<({ theme, flip }: {
134
- theme: Theme;
116
+ export declare const ArrowheadTriangleIcon: React.MemoExoticComponent<({ flip }: {
135
117
  flip?: boolean | undefined;
136
118
  }) => JSX.Element>;
137
- export declare const FontSizeSmallIcon: React.MemoExoticComponent<({ theme }: {
138
- theme: Theme;
139
- }) => JSX.Element>;
140
- export declare const FontSizeMediumIcon: React.MemoExoticComponent<({ theme }: {
141
- theme: Theme;
142
- }) => JSX.Element>;
143
- export declare const FontSizeLargeIcon: React.MemoExoticComponent<({ theme }: {
144
- theme: Theme;
145
- }) => JSX.Element>;
146
- export declare const FontSizeExtraLargeIcon: React.MemoExoticComponent<({ theme }: {
147
- theme: Theme;
148
- }) => JSX.Element>;
149
- export declare const FontFamilyHandDrawnIcon: React.MemoExoticComponent<({ theme }: {
150
- theme: Theme;
151
- }) => JSX.Element>;
152
- export declare const FontFamilyNormalIcon: React.MemoExoticComponent<({ theme }: {
153
- theme: Theme;
154
- }) => JSX.Element>;
155
- export declare const FontFamilyCodeIcon: React.MemoExoticComponent<({ theme }: {
156
- theme: Theme;
157
- }) => JSX.Element>;
158
- export declare const TextAlignLeftIcon: React.MemoExoticComponent<({ theme }: {
159
- theme: Theme;
160
- }) => JSX.Element>;
161
- export declare const TextAlignCenterIcon: React.MemoExoticComponent<({ theme }: {
162
- theme: Theme;
163
- }) => JSX.Element>;
164
- export declare const TextAlignRightIcon: React.MemoExoticComponent<({ theme }: {
165
- theme: Theme;
166
- }) => JSX.Element>;
119
+ export declare const FontSizeSmallIcon: JSX.Element;
120
+ export declare const FontSizeMediumIcon: JSX.Element;
121
+ export declare const FontSizeLargeIcon: JSX.Element;
122
+ export declare const FontSizeExtraLargeIcon: JSX.Element;
123
+ export declare const FontFamilyNormalIcon: JSX.Element;
124
+ export declare const FontFamilyCodeIcon: JSX.Element;
125
+ export declare const TextAlignLeftIcon: JSX.Element;
126
+ export declare const TextAlignCenterIcon: JSX.Element;
127
+ export declare const TextAlignRightIcon: JSX.Element;
167
128
  export declare const TextAlignTopIcon: React.MemoExoticComponent<({ theme }: {
168
129
  theme: Theme;
169
130
  }) => JSX.Element>;
@@ -174,7 +135,5 @@ export declare const TextAlignMiddleIcon: React.MemoExoticComponent<({ theme }:
174
135
  theme: Theme;
175
136
  }) => JSX.Element>;
176
137
  export declare const publishIcon: JSX.Element;
177
- export declare const editIcon: JSX.Element;
178
138
  export declare const eraser: JSX.Element;
179
- export declare const home: JSX.Element;
180
139
  export {};
@@ -1,4 +1,4 @@
1
- import { AppProps, CanvasActions, ExportOpts } from "./types";
1
+ import { AppProps } from "./types";
2
2
  import { FontFamilyValues } from "./element/types";
3
3
  export declare const APP_NAME = "Excalidraw";
4
4
  export declare const DRAGGING_THRESHOLD = 10;
@@ -84,6 +84,9 @@ export declare const MIME_TYPES: {
84
84
  readonly "excalidraw.png": "image/png";
85
85
  readonly jpg: "image/jpeg";
86
86
  readonly gif: "image/gif";
87
+ readonly webp: "image/webp";
88
+ readonly bmp: "image/bmp";
89
+ readonly ico: "image/x-icon";
87
90
  readonly binary: "application/octet-stream";
88
91
  };
89
92
  export declare const EXPORT_DATA_TYPES: {
@@ -99,6 +102,7 @@ export declare const TITLE_TIMEOUT = 10000;
99
102
  export declare const VERSION_TIMEOUT = 30000;
100
103
  export declare const SCROLL_TIMEOUT = 100;
101
104
  export declare const ZOOM_STEP = 0.1;
105
+ export declare const MIN_ZOOM = 0.1;
102
106
  export declare const HYPERLINK_TOOLTIP_DELAY = 300;
103
107
  export declare const IDLE_THRESHOLD = 60000;
104
108
  export declare const ACTIVE_THRESHOLD = 3000;
@@ -114,11 +118,7 @@ export declare const URL_QUERY_KEYS: {
114
118
  export declare const URL_HASH_KEYS: {
115
119
  readonly addLibrary: "addLibrary";
116
120
  };
117
- export declare const DEFAULT_UI_OPTIONS: Merge<AppProps["UIOptions"], {
118
- canvasActions: Merge<Required<CanvasActions>, {
119
- export: ExportOpts;
120
- }>;
121
- }>;
121
+ export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
122
122
  export declare const MQ_SM_MAX_WIDTH = 640;
123
123
  export declare const MQ_MAX_WIDTH_PORTRAIT = 800;
124
124
  export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
@@ -129,7 +129,7 @@ export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
129
129
  export declare const EXPORT_SCALES: number[];
130
130
  export declare const DEFAULT_EXPORT_PADDING = 10;
131
131
  export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
132
- export declare const ALLOWED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml", "image/gif"];
132
+ export declare const ALLOWED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml", "image/gif", "image/webp", "image/bmp", "image/x-icon"];
133
133
  export declare const MAX_ALLOWED_FILE_BYTES: number;
134
134
  export declare const SVG_NS = "http://www.w3.org/2000/svg";
135
135
  export declare const ENCRYPTION_KEY_BITS = 128;
@@ -143,7 +143,15 @@ export declare const VERTICAL_ALIGN: {
143
143
  MIDDLE: string;
144
144
  BOTTOM: string;
145
145
  };
146
+ export declare const TEXT_ALIGN: {
147
+ LEFT: string;
148
+ CENTER: string;
149
+ RIGHT: string;
150
+ };
146
151
  export declare const ELEMENT_READY_TO_ERASE_OPACITY = 20;
147
152
  export declare const COOKIES: {
148
153
  readonly AUTH_STATE_COOKIE: "excplus-auth";
149
154
  };
155
+ /** key containt id of precedeing elemnt id we use in reconciliation during
156
+ * collaboration */
157
+ 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>;
@@ -8,7 +8,7 @@ export declare type RestoredDataState = {
8
8
  appState: RestoredAppState;
9
9
  files: BinaryFiles;
10
10
  };
11
- export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined) => ExcalidrawElement[];
11
+ export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined, refreshDimensions?: boolean) => ExcalidrawElement[];
12
12
  export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
13
13
  export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined) => RestoredDataState;
14
14
  export declare const restoreLibraryItems: (libraryItems: ImportedDataState["libraryItems"], defaultStatus: LibraryItem["status"]) => LibraryItem[];
@@ -10,12 +10,27 @@ export interface ExportedDataState {
10
10
  appState: ReturnType<typeof cleanAppStateForExport>;
11
11
  files: BinaryFiles | undefined;
12
12
  }
13
+ /**
14
+ * Map of legacy AppState keys, with values of:
15
+ * [<legacy type>, <new AppState proeprty>]
16
+ *
17
+ * This is a helper type used in downstream abstractions.
18
+ * Don't consume on its own.
19
+ */
20
+ export declare type LegacyAppState = {
21
+ /** @deprecated #5663 TODO remove 22-12-15 */
22
+ isLibraryOpen: [boolean, "openSidebar"];
23
+ /** @deprecated #5663 TODO remove 22-12-15 */
24
+ isLibraryMenuDocked: [boolean, "isSidebarDocked"];
25
+ };
13
26
  export interface ImportedDataState {
14
27
  type?: string;
15
28
  version?: number;
16
29
  source?: string;
17
30
  elements?: readonly ExcalidrawElement[] | null;
18
- appState?: Readonly<Partial<AppState>> | null;
31
+ appState?: Readonly<Partial<AppState & {
32
+ [T in keyof LegacyAppState]: LegacyAppState[T][0];
33
+ }>> | null;
19
34
  scrollToContent?: boolean;
20
35
  libraryItems?: LibraryItems_anyVersion;
21
36
  files?: BinaryFiles;
@@ -4,9 +4,8 @@ import { NonDeletedExcalidrawElement } from "./types";
4
4
  import { Bounds } from "./bounds";
5
5
  import "./Hyperlink.scss";
6
6
  export declare const EXTERNAL_LINK_IMG: HTMLImageElement;
7
- export declare const Hyperlink: ({ element, appState, setAppState, onLinkOpen, }: {
7
+ export declare const Hyperlink: ({ element, setAppState, onLinkOpen, }: {
8
8
  element: NonDeletedExcalidrawElement;
9
- appState: AppState;
10
9
  setAppState: React.Component<any, AppState>["setState"];
11
10
  onLinkOpen: ExcalidrawProps["onLinkOpen"];
12
11
  }) => JSX.Element | null;
@@ -19,6 +18,7 @@ export declare const actionLink: {
19
18
  appState: {
20
19
  showHyperlinkPopup: "editor";
21
20
  openMenu: null;
21
+ showWelcomeScreen: boolean;
22
22
  isLoading: boolean;
23
23
  errorMessage: string | null;
24
24
  draggingElement: NonDeletedExcalidrawElement | null;
@@ -56,7 +56,7 @@ export declare const actionLink: {
56
56
  currentItemOpacity: number;
57
57
  currentItemFontFamily: number;
58
58
  currentItemFontSize: number;
59
- currentItemTextAlign: import("./types").TextAlign;
59
+ currentItemTextAlign: string;
60
60
  currentItemStrokeSharpness: import("./types").StrokeSharpness;
61
61
  currentItemStartArrowhead: import("./types").Arrowhead | null;
62
62
  currentItemEndArrowhead: import("./types").Arrowhead | null;
@@ -73,6 +73,9 @@ export declare const actionLink: {
73
73
  value: import("../types").NormalizedZoomValue;
74
74
  }>;
75
75
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
76
+ openSidebar: "library" | "customSidebar" | null;
77
+ openDialog: "imageExport" | "help" | null;
78
+ isSidebarDocked: boolean;
76
79
  lastPointerDownWith: import("./types").PointerType;
77
80
  selectedElementIds: {
78
81
  [id: string]: boolean;
@@ -81,7 +84,6 @@ export declare const actionLink: {
81
84
  [id: string]: boolean;
82
85
  };
83
86
  shouldCacheIgnoreZoom: boolean;
84
- showHelpDialog: boolean;
85
87
  toast: {
86
88
  message: string;
87
89
  closable?: boolean | undefined;
@@ -99,8 +101,6 @@ export declare const actionLink: {
99
101
  height: number;
100
102
  offsetTop: number;
101
103
  offsetLeft: number;
102
- isLibraryOpen: boolean;
103
- isLibraryMenuDocked: boolean;
104
104
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
105
105
  collaborators: Map<string, import("../types").Collaborator>;
106
106
  showStats: boolean;
@@ -124,7 +124,9 @@ export declare const actionLink: {
124
124
  keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
125
125
  contextItemLabel: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => "labels.link.edit" | "labels.link.create";
126
126
  contextItemPredicate: (elements: readonly import("./types").ExcalidrawElement[], appState: AppState) => boolean;
127
- PanelComponent: ({ elements, appState, updateData }: import("../actions/types").PanelComponentProps) => JSX.Element;
127
+ PanelComponent: ({ elements, appState, updateData }: import("../actions/types").PanelComponentProps & {
128
+ isInHamburgerMenu: boolean;
129
+ }) => JSX.Element;
128
130
  } & {
129
131
  keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
130
132
  };
@@ -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";
14
14
  }>;
15
15
  /** includes errored files because they cache was updated nonetheless */
16
16
  updatedFiles: Map<FileId, true>;
@@ -1,5 +1,5 @@
1
1
  import { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted } from "./types";
2
- export { newElement, newTextElement, updateTextElement, newLinearElement, newImageElement, duplicateElement, } from "./newElement";
2
+ export { newElement, newTextElement, updateTextElement, refreshTextDimensions, newLinearElement, newImageElement, duplicateElement, } from "./newElement";
3
3
  export { getElementAbsoluteCoords, getElementBounds, getCommonBounds, getDiamondPoints, getArrowheadPoints, getClosestElementBounds, } from "./bounds";
4
4
  export { OMIT_SIDES_FOR_MULTIPLE_ELEMENTS, getTransformHandlesFromCoords, getTransformHandles, } from "./transformHandles";
5
5
  export { hitTest, isHittingElementBoundingBoxWithoutHittingElement, } from "./collision";
@@ -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,8 +104,9 @@ 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
  };
109
+ showWelcomeScreen: boolean;
99
110
  isLoading: boolean;
100
111
  errorMessage: string | null;
101
112
  draggingElement: import("./types").NonDeletedExcalidrawElement | null;
@@ -132,7 +143,7 @@ export declare class LinearElementEditor {
132
143
  currentItemOpacity: number;
133
144
  currentItemFontFamily: number;
134
145
  currentItemFontSize: number;
135
- currentItemTextAlign: import("./types").TextAlign;
146
+ currentItemTextAlign: string;
136
147
  currentItemStrokeSharpness: import("./types").StrokeSharpness;
137
148
  currentItemStartArrowhead: import("./types").Arrowhead | null;
138
149
  currentItemEndArrowhead: import("./types").Arrowhead | null;
@@ -149,7 +160,11 @@ export declare class LinearElementEditor {
149
160
  value: import("../types").NormalizedZoomValue;
150
161
  }>;
151
162
  openMenu: "canvas" | "shape" | null;
163
+ /** @returns whether point was dragged */
152
164
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
165
+ openSidebar: "library" | "customSidebar" | null;
166
+ openDialog: "imageExport" | "help" | null;
167
+ isSidebarDocked: boolean;
153
168
  lastPointerDownWith: import("./types").PointerType;
154
169
  selectedElementIds: {
155
170
  [id: string]: boolean;
@@ -158,7 +173,6 @@ export declare class LinearElementEditor {
158
173
  [id: string]: boolean;
159
174
  };
160
175
  shouldCacheIgnoreZoom: boolean;
161
- showHelpDialog: boolean;
162
176
  toast: {
163
177
  message: string;
164
178
  closable?: boolean | undefined;
@@ -176,8 +190,6 @@ export declare class LinearElementEditor {
176
190
  height: number;
177
191
  offsetTop: number;
178
192
  offsetLeft: number;
179
- isLibraryOpen: boolean;
180
- isLibraryMenuDocked: boolean;
181
193
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
182
194
  collaborators: Map<string, import("../types").Collaborator>;
183
195
  showStats: boolean;
@@ -195,7 +207,7 @@ export declare class LinearElementEditor {
195
207
  };
196
208
  };
197
209
  static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[]): void;
198
- static addPoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
210
+ static addPoints(element: NonDeleted<ExcalidrawLinearElement>, appState: AppState, targetPoints: {
199
211
  point: Point;
200
212
  }[]): void;
201
213
  static movePoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
@@ -209,3 +221,4 @@ export declare class LinearElementEditor {
209
221
  private static _updatePoints;
210
222
  private static _getShiftLockedDelta;
211
223
  }
224
+ export {};
@@ -12,7 +12,17 @@ export declare const newTextElement: (opts: {
12
12
  verticalAlign: VerticalAlign;
13
13
  containerId?: ExcalidrawRectangleElement["id"];
14
14
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
15
- export declare const updateTextElement: (element: ExcalidrawTextElement, { text, isDeleted, originalText, }: {
15
+ export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, text?: string) => {
16
+ x: number;
17
+ y: number;
18
+ width: number;
19
+ height: number;
20
+ baseline: number;
21
+ text: string;
22
+ };
23
+ export declare const getMaxContainerWidth: (container: ExcalidrawElement) => number;
24
+ export declare const getMaxContainerHeight: (container: ExcalidrawElement) => number;
25
+ export declare const updateTextElement: (textElement: ExcalidrawTextElement, { text, isDeleted, originalText, }: {
16
26
  text: string;
17
27
  isDeleted?: boolean | undefined;
18
28
  originalText: string;
@@ -30,6 +40,9 @@ export declare const newLinearElement: (opts: {
30
40
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawLinearElement>;
31
41
  export declare const newImageElement: (opts: {
32
42
  type: ExcalidrawImageElement["type"];
43
+ status?: ExcalidrawImageElement["status"];
44
+ fileId?: ExcalidrawImageElement["fileId"];
45
+ scale?: ExcalidrawImageElement["scale"];
33
46
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawImageElement>;
34
47
  export declare const deepCopyElement: (val: any, depth?: number) => any;
35
48
  /**
@@ -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,6 +1,6 @@
1
1
  import { ExcalidrawElement, NonDeletedExcalidrawElement, PointerType } from "./types";
2
2
  import { Bounds } from "./bounds";
3
- import { Zoom } from "../types";
3
+ import { AppState, Zoom } from "../types";
4
4
  export declare type TransformHandleDirection = "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se";
5
5
  export declare type TransformHandleType = TransformHandleDirection | "rotation";
6
6
  export declare type TransformHandle = [number, number, number, number];
@@ -15,8 +15,8 @@ export declare const OMIT_SIDES_FOR_MULTIPLE_ELEMENTS: {
15
15
  w: boolean;
16
16
  };
17
17
  export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, zoom: Zoom, pointerType: PointerType, omitSides?: {
18
- e?: boolean | undefined;
19
18
  s?: boolean | undefined;
19
+ e?: boolean | undefined;
20
20
  w?: boolean | undefined;
21
21
  n?: boolean | undefined;
22
22
  nw?: boolean | undefined;
@@ -26,4 +26,4 @@ export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2]: Bounds, a
26
26
  rotation?: boolean | undefined;
27
27
  }, margin?: number) => TransformHandles;
28
28
  export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, pointerType?: PointerType) => TransformHandles;
29
- export declare const shouldShowBoundingBox: (elements: NonDeletedExcalidrawElement[]) => boolean;
29
+ export declare const shouldShowBoundingBox: (elements: NonDeletedExcalidrawElement[], appState: AppState) => boolean;