@dwelle/excalidraw 0.4.0-cfd6fb7 → 0.4.0-d8d86cf

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 (116) hide show
  1. package/CHANGELOG.md +100 -756
  2. package/README.md +85 -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 +649 -301
  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 +69 -47
  22. package/types/actions/actionClipboard.d.ts +35 -21
  23. package/types/actions/actionDeleteSelected.d.ts +28 -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 +78 -53
  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 +13 -12
  45. package/types/clients.d.ts +1 -1
  46. package/types/clipboard.d.ts +6 -1
  47. package/types/components/Actions.d.ts +13 -0
  48. package/types/components/App.d.ts +54 -2
  49. package/types/components/Avatar.d.ts +1 -1
  50. package/types/components/CollabButton.d.ts +2 -3
  51. package/types/components/DialogActionButton.d.ts +10 -0
  52. package/types/components/Footer.d.ts +10 -0
  53. package/types/components/HelpButton.d.ts +8 -0
  54. package/types/components/HintViewer.d.ts +3 -2
  55. package/types/components/HomeButton.d.ts +5 -0
  56. package/types/components/ImageExportDialog.d.ts +3 -1
  57. package/types/components/InitializeApp.d.ts +2 -0
  58. package/types/components/JSONExportDialog.d.ts +2 -2
  59. package/types/components/LayerUI.d.ts +6 -4
  60. package/types/components/LibraryButton.d.ts +1 -0
  61. package/types/components/LibraryMenu.d.ts +14 -5
  62. package/types/components/LibraryMenuBrowseButton.d.ts +7 -0
  63. package/types/components/LibraryMenuHeaderContent.d.ts +12 -0
  64. package/types/components/LibraryMenuItems.d.ts +5 -14
  65. package/types/components/LibraryUnit.d.ts +2 -3
  66. package/types/components/LoadingMessage.d.ts +2 -0
  67. package/types/components/MenuItem.d.ts +11 -0
  68. package/types/components/MenuUtils.d.ts +1 -0
  69. package/types/components/MobileMenu.d.ts +10 -9
  70. package/types/components/Sidebar/Sidebar.d.ts +73 -0
  71. package/types/components/Sidebar/SidebarHeader.d.ts +20 -0
  72. package/types/components/Sidebar/common.d.ts +16 -0
  73. package/types/components/Stats.d.ts +1 -1
  74. package/types/components/UserList.d.ts +0 -1
  75. package/types/components/WelcomeScreen.d.ts +10 -0
  76. package/types/components/WelcomeScreenDecor.d.ts +6 -0
  77. package/types/components/hoc/withUpstreamOverride.d.ts +10 -0
  78. package/types/components/icons.d.ts +81 -122
  79. package/types/constants.d.ts +15 -7
  80. package/types/data/blob.d.ts +1 -1
  81. package/types/data/restore.d.ts +1 -1
  82. package/types/data/types.d.ts +16 -1
  83. package/types/element/Hyperlink.d.ts +8 -5
  84. package/types/element/bounds.d.ts +2 -1
  85. package/types/element/image.d.ts +1 -1
  86. package/types/element/index.d.ts +1 -1
  87. package/types/element/linearElementEditor.d.ts +54 -14
  88. package/types/element/newElement.d.ts +16 -3
  89. package/types/element/resizeElements.d.ts +0 -1
  90. package/types/element/textElement.d.ts +23 -4
  91. package/types/element/transformHandles.d.ts +3 -4
  92. package/types/element/typeChecks.d.ts +1 -0
  93. package/types/element/types.d.ts +6 -3
  94. package/types/hooks/useOutsideClick.d.ts +2 -0
  95. package/types/keys.d.ts +13 -3
  96. package/types/math.d.ts +8 -1
  97. package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-52b1f3361986b6c6a4fe.d.ts → vendor-2002fe1b8862917b36c1.d.ts} +0 -0
  98. package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-c0592035c3911af79359.d.ts → vendor-e6df8519da951026ff69.d.ts} +0 -0
  99. package/types/packages/excalidraw/example/App.d.ts +2 -1
  100. package/types/packages/excalidraw/example/sidebar/{Sidebar.d.ts → ExampleSidebar.d.ts} +1 -1
  101. package/types/packages/excalidraw/index.d.ts +2 -1
  102. package/types/packages/utils.d.ts +4 -1
  103. package/types/renderer/renderElement.d.ts +4 -3
  104. package/types/renderer/renderScene.d.ts +1 -1
  105. package/types/scene/Fonts.d.ts +21 -0
  106. package/types/scene/Scene.d.ts +15 -0
  107. package/types/scene/comparisons.d.ts +1 -2
  108. package/types/scene/index.d.ts +1 -1
  109. package/types/scene/types.d.ts +1 -0
  110. package/types/shapes.d.ts +27 -3
  111. package/types/types.d.ts +32 -14
  112. package/dist/excalidraw-assets/vendor-52b1f3361986b6c6a4fe.js +0 -2
  113. package/types/components/BackgroundPickerAndDarkModeToggle.d.ts +0 -9
  114. package/types/components/Card.d.ts +0 -7
  115. package/types/components/HelpIcon.d.ts +0 -8
  116. 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;
@@ -18,6 +18,7 @@ export declare const actionLink: {
18
18
  appState: {
19
19
  showHyperlinkPopup: "editor";
20
20
  openMenu: null;
21
+ showWelcomeScreen: boolean;
21
22
  isLoading: boolean;
22
23
  errorMessage: string | null;
23
24
  draggingElement: NonDeletedExcalidrawElement | null;
@@ -55,7 +56,7 @@ export declare const actionLink: {
55
56
  currentItemOpacity: number;
56
57
  currentItemFontFamily: number;
57
58
  currentItemFontSize: number;
58
- currentItemTextAlign: import("./types").TextAlign;
59
+ currentItemTextAlign: string;
59
60
  currentItemStrokeSharpness: import("./types").StrokeSharpness;
60
61
  currentItemStartArrowhead: import("./types").Arrowhead | null;
61
62
  currentItemEndArrowhead: import("./types").Arrowhead | null;
@@ -72,6 +73,9 @@ export declare const actionLink: {
72
73
  value: import("../types").NormalizedZoomValue;
73
74
  }>;
74
75
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
76
+ openSidebar: "library" | "customSidebar" | null;
77
+ openDialog: "imageExport" | "help" | null;
78
+ isSidebarDocked: boolean;
75
79
  lastPointerDownWith: import("./types").PointerType;
76
80
  selectedElementIds: {
77
81
  [id: string]: boolean;
@@ -80,7 +84,6 @@ export declare const actionLink: {
80
84
  [id: string]: boolean;
81
85
  };
82
86
  shouldCacheIgnoreZoom: boolean;
83
- showHelpDialog: boolean;
84
87
  toast: {
85
88
  message: string;
86
89
  closable?: boolean | undefined;
@@ -98,8 +101,6 @@ export declare const actionLink: {
98
101
  height: number;
99
102
  offsetTop: number;
100
103
  offsetLeft: number;
101
- isLibraryOpen: boolean;
102
- isLibraryMenuDocked: boolean;
103
104
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
104
105
  collaborators: Map<string, import("../types").Collaborator>;
105
106
  showStats: boolean;
@@ -123,7 +124,9 @@ export declare const actionLink: {
123
124
  keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
124
125
  contextItemLabel: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => "labels.link.edit" | "labels.link.create";
125
126
  contextItemPredicate: (elements: readonly import("./types").ExcalidrawElement[], appState: AppState) => boolean;
126
- 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;
127
130
  } & {
128
131
  keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
129
132
  };
@@ -1,10 +1,11 @@
1
1
  import { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, NonDeleted } from "./types";
2
2
  import { Drawable, Op } from "roughjs/bin/core";
3
3
  export declare type Bounds = readonly [number, number, number, number];
4
- export declare const getElementAbsoluteCoords: (element: ExcalidrawElement) => Bounds;
4
+ export declare const getElementAbsoluteCoords: (element: ExcalidrawElement, includeBoundText?: boolean) => [number, number, number, number, number, number];
5
5
  export declare const pointRelativeTo: (element: ExcalidrawElement, absoluteCoords: readonly [number, number]) => readonly [number, number];
6
6
  export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
7
7
  export declare const getCurvePathOps: (shape: Drawable) => Op[];
8
+ export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: ((x: number, y: number) => [number, number]) | undefined) => [number, number, number, number];
8
9
  export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
9
10
  export declare const getElementBounds: (element: ExcalidrawElement) => [number, number, number, number];
10
11
  export declare const getCommonBounds: (elements: readonly ExcalidrawElement[]) => [number, number, number, number];
@@ -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";
@@ -1,8 +1,13 @@
1
1
  /// <reference types="react" />
2
- import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement } from "./types";
3
- import { Point, AppState } from "../types";
2
+ import { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer } from "./types";
3
+ import { Point, AppState, PointerCoords } 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";
@@ -13,6 +18,15 @@ export declare class LinearElementEditor {
13
18
  prevSelectedPointsIndices: readonly number[] | null;
14
19
  /** index */
15
20
  lastClickedPoint: number;
21
+ origin: Readonly<{
22
+ x: number;
23
+ y: number;
24
+ }> | null;
25
+ segmentMidpoint: {
26
+ value: Point | null;
27
+ index: number | null;
28
+ added: boolean;
29
+ };
16
30
  }>;
17
31
  /** whether you're dragging a point */
18
32
  readonly isDragging: boolean;
@@ -24,7 +38,7 @@ export declare class LinearElementEditor {
24
38
  readonly startBindingElement: ExcalidrawBindableElement | null | "keep";
25
39
  readonly endBindingElement: ExcalidrawBindableElement | null | "keep";
26
40
  readonly hoverPointIndex: number;
27
- readonly midPointHovered: boolean;
41
+ readonly segmentMidPointHoveredCoords: Point | null;
28
42
  constructor(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene);
29
43
  static POINT_HANDLE_SIZE: number;
30
44
  /**
@@ -39,11 +53,15 @@ export declare class LinearElementEditor {
39
53
  y: number;
40
54
  }[]) => void, linearElementEditor: LinearElementEditor): boolean;
41
55
  static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState): LinearElementEditor;
42
- static isHittingMidPoint: (linearElementEditor: LinearElementEditor, scenePointer: {
56
+ static getEditorMidPoints: (element: NonDeleted<ExcalidrawLinearElement>, appState: AppState) => (typeof editorMidPointsCache)["points"];
57
+ static updateEditorMidPointsCache: (element: NonDeleted<ExcalidrawLinearElement>, appState: AppState) => void;
58
+ static getSegmentMidpointHitCoords: (linearElementEditor: LinearElementEditor, scenePointer: {
43
59
  x: number;
44
60
  y: number;
45
- }, appState: AppState) => boolean;
46
- static getMidPoint(linearElementEditor: LinearElementEditor): readonly [number, number] | null;
61
+ }, appState: AppState) => readonly [number, number] | null;
62
+ static isSegmentTooShort(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, zoom: AppState["zoom"]): boolean;
63
+ static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, startPoint: Point, endPoint: Point, endPointIndex: number): readonly [number, number];
64
+ static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: Point): number;
47
65
  static handlePointerDown(event: React.PointerEvent<HTMLCanvasElement>, appState: AppState, history: History, scenePointer: {
48
66
  x: number;
49
67
  y: number;
@@ -51,9 +69,9 @@ export declare class LinearElementEditor {
51
69
  didAddPoint: boolean;
52
70
  hitElement: NonDeleted<ExcalidrawElement> | null;
53
71
  linearElementEditor: LinearElementEditor | null;
54
- isMidPoint: boolean;
55
72
  };
56
- static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, linearElementEditor: LinearElementEditor, gridSize: number | null): LinearElementEditor;
73
+ static arePointsEqual(point1: Point | null, point2: Point | null): boolean;
74
+ static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, appState: AppState): LinearElementEditor | null;
57
75
  /** scene coords */
58
76
  static getPointGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, point: Point): readonly [number, number];
59
77
  /** scene coords */
@@ -84,6 +102,15 @@ export declare class LinearElementEditor {
84
102
  prevSelectedPointsIndices: readonly number[] | null;
85
103
  /** index */
86
104
  lastClickedPoint: number;
105
+ origin: Readonly<{
106
+ x: number;
107
+ y: number;
108
+ }> | null;
109
+ segmentMidpoint: {
110
+ value: readonly [number, number] | null;
111
+ index: number | null;
112
+ added: boolean;
113
+ };
87
114
  }>;
88
115
  isDragging: boolean;
89
116
  lastUncommittedPoint: readonly [number, number] | null;
@@ -94,8 +121,9 @@ export declare class LinearElementEditor {
94
121
  startBindingElement: ExcalidrawBindableElement | "keep" | null;
95
122
  endBindingElement: ExcalidrawBindableElement | "keep" | null;
96
123
  hoverPointIndex: number;
97
- midPointHovered: boolean;
124
+ segmentMidPointHoveredCoords: readonly [number, number] | null;
98
125
  };
126
+ showWelcomeScreen: boolean;
99
127
  isLoading: boolean;
100
128
  errorMessage: string | null;
101
129
  draggingElement: import("./types").NonDeletedExcalidrawElement | null;
@@ -132,7 +160,7 @@ export declare class LinearElementEditor {
132
160
  currentItemOpacity: number;
133
161
  currentItemFontFamily: number;
134
162
  currentItemFontSize: number;
135
- currentItemTextAlign: import("./types").TextAlign;
163
+ currentItemTextAlign: string;
136
164
  currentItemStrokeSharpness: import("./types").StrokeSharpness;
137
165
  currentItemStartArrowhead: import("./types").Arrowhead | null;
138
166
  currentItemEndArrowhead: import("./types").Arrowhead | null;
@@ -150,6 +178,9 @@ export declare class LinearElementEditor {
150
178
  }>;
151
179
  openMenu: "canvas" | "shape" | null;
152
180
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
181
+ openSidebar: "library" | "customSidebar" | null;
182
+ openDialog: "imageExport" | "help" | null;
183
+ isSidebarDocked: boolean;
153
184
  lastPointerDownWith: import("./types").PointerType;
154
185
  selectedElementIds: {
155
186
  [id: string]: boolean;
@@ -158,7 +189,6 @@ export declare class LinearElementEditor {
158
189
  [id: string]: boolean;
159
190
  };
160
191
  shouldCacheIgnoreZoom: boolean;
161
- showHelpDialog: boolean;
162
192
  toast: {
163
193
  message: string;
164
194
  closable?: boolean | undefined;
@@ -176,8 +206,6 @@ export declare class LinearElementEditor {
176
206
  height: number;
177
207
  offsetTop: number;
178
208
  offsetLeft: number;
179
- isLibraryOpen: boolean;
180
- isLibraryMenuDocked: boolean;
181
209
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
182
210
  collaborators: Map<string, import("../types").Collaborator>;
183
211
  showStats: boolean;
@@ -195,7 +223,7 @@ export declare class LinearElementEditor {
195
223
  };
196
224
  };
197
225
  static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[]): void;
198
- static addPoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
226
+ static addPoints(element: NonDeleted<ExcalidrawLinearElement>, appState: AppState, targetPoints: {
199
227
  point: Point;
200
228
  }[]): void;
201
229
  static movePoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
@@ -206,6 +234,18 @@ export declare class LinearElementEditor {
206
234
  startBinding?: PointBinding;
207
235
  endBinding?: PointBinding;
208
236
  }): void;
237
+ static shouldAddMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState): boolean;
238
+ static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState): {
239
+ pointerDownState: LinearElementEditor["pointerDownState"];
240
+ selectedPointsIndices: LinearElementEditor["selectedPointsIndices"];
241
+ } | undefined;
209
242
  private static _updatePoints;
210
243
  private static _getShiftLockedDelta;
244
+ static getBoundTextElementPosition: (element: ExcalidrawLinearElement, boundTextElement: ExcalidrawTextElementWithContainer) => {
245
+ x: number;
246
+ y: number;
247
+ };
248
+ static getMinMaxXYWithBoundText: (element: ExcalidrawLinearElement, elementBounds: [number, number, number, number], boundTextElement: ExcalidrawTextElementWithContainer) => [number, number, number, number, number, number];
249
+ static getElementAbsoluteCoords: (element: ExcalidrawLinearElement, includeBoundText?: boolean) => [number, number, number, number, number, number];
211
250
  }
251
+ export {};
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawRectangleElement } from "../element/types";
1
+ import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer } from "../element/types";
2
2
  import { AppState } from "../types";
3
3
  declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "boundElements" | "seed" | "version" | "versionNonce" | "link">;
4
4
  export declare const newElement: (opts: {
@@ -10,9 +10,19 @@ export declare const newTextElement: (opts: {
10
10
  fontFamily: FontFamilyValues;
11
11
  textAlign: TextAlign;
12
12
  verticalAlign: VerticalAlign;
13
- containerId?: ExcalidrawRectangleElement["id"];
13
+ containerId?: ExcalidrawTextContainer["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
  /**