@dwelle/excalidraw 0.4.0-7125553 → 0.4.0-73860
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.
- package/CHANGELOG.md +205 -2
- package/README.md +94 -22
- package/dist/excalidraw-assets/Assistant-Bold.woff2 +0 -0
- package/dist/excalidraw-assets/Assistant-Medium.woff2 +0 -0
- package/dist/excalidraw-assets/Assistant-Regular.woff2 +0 -0
- package/dist/excalidraw-assets/Assistant-SemiBold.woff2 +0 -0
- package/dist/excalidraw-assets/{vendor-cb04f63875674d708080.js → vendor-2002fe1b8862917b36c1.js} +2 -2
- package/dist/excalidraw-assets/{vendor-cb04f63875674d708080.js.LICENSE.txt → vendor-2002fe1b8862917b36c1.js.LICENSE.txt} +0 -0
- package/dist/excalidraw-assets-dev/Assistant-Bold.woff2 +0 -0
- package/dist/excalidraw-assets-dev/Assistant-Medium.woff2 +0 -0
- package/dist/excalidraw-assets-dev/Assistant-Regular.woff2 +0 -0
- package/dist/excalidraw-assets-dev/Assistant-SemiBold.woff2 +0 -0
- package/dist/excalidraw.development.js +658 -288
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +2 -0
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +33 -18
- package/types/actions/actionAlign.d.ts +18 -6
- package/types/actions/actionBoundText.d.ts +11 -6
- package/types/actions/actionCanvas.d.ts +122 -63
- package/types/actions/actionClipboard.d.ts +82 -30
- package/types/actions/actionDeleteSelected.d.ts +45 -19
- package/types/actions/actionDistribute.d.ts +6 -2
- package/types/actions/actionDuplicateSelection.d.ts +3 -1
- package/types/actions/actionExport.d.ts +133 -71
- package/types/actions/actionFinalize.d.ts +25 -13
- package/types/actions/actionGroup.d.ts +6 -2
- package/types/actions/actionLinearEditor.d.ts +119 -0
- package/types/actions/actionMenu.d.ts +44 -21
- package/types/actions/actionNavigate.d.ts +4 -1
- package/types/actions/actionProperties.d.ts +184 -93
- package/types/actions/actionStyles.d.ts +11 -6
- package/types/actions/actionToggleGridMode.d.ts +13 -6
- package/types/actions/actionToggleLock.d.ts +11 -6
- package/types/actions/actionToggleStats.d.ts +12 -6
- package/types/actions/actionToggleViewMode.d.ts +13 -6
- package/types/actions/actionToggleZenMode.d.ts +13 -6
- package/types/actions/actionZindex.d.ts +12 -4
- package/types/actions/index.d.ts +1 -0
- package/types/actions/manager.d.ts +1 -1
- package/types/actions/shortcuts.d.ts +1 -1
- package/types/actions/types.d.ts +8 -3
- package/types/appState.d.ts +14 -14
- package/types/clients.d.ts +1 -1
- package/types/clipboard.d.ts +6 -1
- package/types/components/Actions.d.ts +1 -0
- package/types/components/App.d.ts +56 -6
- package/types/components/Avatar.d.ts +1 -1
- package/types/components/CollabButton.d.ts +2 -3
- package/types/components/ContextMenu.d.ts +8 -21
- package/types/components/DialogActionButton.d.ts +10 -0
- package/types/components/HelpButton.d.ts +8 -0
- package/types/components/HintViewer.d.ts +3 -2
- package/types/components/HomeButton.d.ts +5 -0
- package/types/components/ImageExportDialog.d.ts +3 -1
- package/types/components/InitializeApp.d.ts +2 -0
- package/types/components/JSONExportDialog.d.ts +2 -2
- package/types/components/LayerUI.d.ts +7 -5
- package/types/components/LibraryButton.d.ts +1 -0
- package/types/components/LibraryMenu.d.ts +14 -5
- package/types/components/LibraryMenuBrowseButton.d.ts +7 -0
- package/types/components/LibraryMenuHeaderContent.d.ts +12 -0
- package/types/components/LibraryMenuItems.d.ts +5 -14
- package/types/components/LibraryUnit.d.ts +2 -3
- package/types/components/LoadingMessage.d.ts +2 -0
- package/types/components/MenuItem.d.ts +11 -0
- package/types/components/MenuUtils.d.ts +1 -0
- package/types/components/MobileMenu.d.ts +9 -9
- package/types/components/Sidebar/Sidebar.d.ts +73 -0
- package/types/components/Sidebar/SidebarHeader.d.ts +20 -0
- package/types/components/Sidebar/common.d.ts +16 -0
- package/types/components/UserList.d.ts +0 -1
- package/types/components/WelcomeScreen.d.ts +10 -0
- package/types/components/WelcomeScreenDecor.d.ts +6 -0
- package/types/components/footer/Footer.d.ts +13 -0
- package/types/components/footer/FooterCenter.d.ts +7 -0
- package/types/components/hoc/withUpstreamOverride.d.ts +10 -0
- package/types/components/icons.d.ts +81 -122
- package/types/constants.d.ts +23 -12
- package/types/data/restore.d.ts +1 -1
- package/types/data/types.d.ts +16 -1
- package/types/element/Hyperlink.d.ts +14 -7
- package/types/element/bounds.d.ts +3 -2
- package/types/element/image.d.ts +1 -1
- package/types/element/index.d.ts +1 -1
- package/types/element/linearElementEditor.d.ts +43 -10
- package/types/element/newElement.d.ts +16 -3
- package/types/element/resizeElements.d.ts +0 -1
- package/types/element/textElement.d.ts +23 -4
- package/types/element/textWysiwyg.d.ts +6 -1
- package/types/element/transformHandles.d.ts +3 -4
- package/types/element/typeChecks.d.ts +10 -1
- package/types/element/types.d.ts +12 -5
- package/types/hooks/useOutsideClick.d.ts +2 -0
- package/types/keys.d.ts +13 -3
- package/types/math.d.ts +2 -1
- package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-cb04f63875674d708080.d.ts → vendor-2002fe1b8862917b36c1.d.ts} +0 -0
- package/types/packages/excalidraw/example/App.d.ts +2 -1
- package/types/packages/excalidraw/example/sidebar/{Sidebar.d.ts → ExampleSidebar.d.ts} +1 -1
- package/types/packages/excalidraw/index.d.ts +4 -1
- package/types/renderer/renderElement.d.ts +4 -3
- package/types/renderer/renderScene.d.ts +1 -1
- package/types/scene/Fonts.d.ts +21 -0
- package/types/scene/Scene.d.ts +15 -0
- package/types/scene/comparisons.d.ts +2 -3
- package/types/scene/index.d.ts +1 -1
- package/types/scene/types.d.ts +1 -0
- package/types/shapes.d.ts +27 -3
- package/types/types.d.ts +44 -17
- package/types/utils.d.ts +4 -0
- package/types/components/BackgroundPickerAndDarkModeToggle.d.ts +0 -9
- package/types/components/Card.d.ts +0 -7
- package/types/components/Footer.d.ts +0 -9
- package/types/components/HelpIcon.d.ts +0 -8
- package/types/components/SidebarLockButton.d.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -13,17 +13,220 @@ Please add the latest change on the top under the correct section.
|
|
|
13
13
|
|
|
14
14
|
## Unreleased
|
|
15
15
|
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- Render Footer as a component instead of render prop [#5970](https://github.com/excalidraw/excalidraw/pull/5970). You can read more about its usage [here](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#Footer)
|
|
19
|
+
|
|
20
|
+
#### BREAKING CHANGE
|
|
21
|
+
|
|
22
|
+
- With this change, the prop `renderFooter` is now removed.
|
|
23
|
+
|
|
24
|
+
### Excalidraw schema
|
|
25
|
+
|
|
26
|
+
- Merged `appState.currentItemStrokeSharpness` and `appState.currentItemLinearStrokeSharpness` into `appState.currentItemRoundness`. Renamed `changeSharpness` action to `changeRoundness`. Excalidraw element's `strokeSharpness` was changed to `roundness`. Check the PR for types and more details [#5553](https://github.com/excalidraw/excalidraw/pull/5553).
|
|
27
|
+
|
|
28
|
+
## 0.13.0 (2022-10-27)
|
|
29
|
+
|
|
16
30
|
### Excalidraw API
|
|
17
31
|
|
|
18
32
|
#### Features
|
|
19
33
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
34
|
+
- `restoreElements()` now takes an optional parameter to indicate whether we should also recalculate text element dimensions. Defaults to `true`, but since this is a potentially costly operation, you may want to disable it if you restore elements in tight loops, such as during collaboration [#5432](https://github.com/excalidraw/excalidraw/pull/5432).
|
|
35
|
+
- Support rendering custom sidebar using [`renderSidebar`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#renderSidebar) prop ([#5663](https://github.com/excalidraw/excalidraw/pull/5663)).
|
|
36
|
+
- Add [`toggleMenu`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#toggleMenu) prop to toggle specific menu open/close state ([#5663](https://github.com/excalidraw/excalidraw/pull/5663)).
|
|
37
|
+
- Support [theme](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#theme) to be semi-controlled [#5660](https://github.com/excalidraw/excalidraw/pull/5660).
|
|
38
|
+
- Added support for storing [`customData`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#storing-custom-data-on-excalidraw-elements) on Excalidraw elements [#5592].
|
|
39
|
+
- Added `exportPadding?: number;` to [exportToCanvas](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#exporttocanvas) and [exportToBlob](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#exporttoblob). The default value of the padding is `10`.
|
|
22
40
|
|
|
23
41
|
#### Breaking Changes
|
|
24
42
|
|
|
43
|
+
- `props.UIOptions.canvasActions.theme` is now renamed to `props.UIOptions.canvasActions.toggleTheme` [#5660](https://github.com/excalidraw/excalidraw/pull/5660).
|
|
25
44
|
- `setToastMessage` API is now renamed to `setToast` API and the function signature is also updated [#5427](https://github.com/excalidraw/excalidraw/pull/5427). You can also pass `duration` and `closable` attributes along with `message`.
|
|
26
45
|
|
|
46
|
+
## Excalidraw Library
|
|
47
|
+
|
|
48
|
+
**_This section lists the updates made to the excalidraw library and will not affect the integration._**
|
|
49
|
+
|
|
50
|
+
### Features
|
|
51
|
+
|
|
52
|
+
- Render library into `Sidebar` on mobile [#5774](https://github.com/excalidraw/excalidraw/pull/5774)
|
|
53
|
+
|
|
54
|
+
- Additional drag and drop image format support (webp, bmp, ico) [#5749](https://github.com/excalidraw/excalidraw/pull/5749)
|
|
55
|
+
|
|
56
|
+
- Enter and Exit line editor via context menu [#5719](https://github.com/excalidraw/excalidraw/pull/5719)
|
|
57
|
+
|
|
58
|
+
- Further reduce darkmode init flash [#5701](https://github.com/excalidraw/excalidraw/pull/5701)
|
|
59
|
+
|
|
60
|
+
- Support segment midpoints in line editor [#5641](https://github.com/excalidraw/excalidraw/pull/5641)
|
|
61
|
+
|
|
62
|
+
- Added exportPadding to PNG (blob) export in @excalidraw/utils [#5626](https://github.com/excalidraw/excalidraw/pull/5626)
|
|
63
|
+
|
|
64
|
+
- Introduce ExcalidrawElements and ExcalidrawAppState provider [#5463](https://github.com/excalidraw/excalidraw/pull/5463)
|
|
65
|
+
|
|
66
|
+
- Enable midpoint inside linear element editor [#5564](https://github.com/excalidraw/excalidraw/pull/5564)
|
|
67
|
+
|
|
68
|
+
- Show a mid point for linear elements [#5534](https://github.com/excalidraw/excalidraw/pull/5534)
|
|
69
|
+
|
|
70
|
+
- Lock angle when editing linear elements with shift pressed [#5527](https://github.com/excalidraw/excalidraw/pull/5527)
|
|
71
|
+
|
|
72
|
+
- Redesign linear elements 🎉 [#5501](https://github.com/excalidraw/excalidraw/pull/5501)
|
|
73
|
+
|
|
74
|
+
- Cursor alignment when creating linear elements with shift pressed [#5518](https://github.com/excalidraw/excalidraw/pull/5518)
|
|
75
|
+
|
|
76
|
+
- Shift-clamp when creating multi-point lines/arrows [#5500](https://github.com/excalidraw/excalidraw/pull/5500)
|
|
77
|
+
|
|
78
|
+
- Cursor alignment when creating generic elements [#5516](https://github.com/excalidraw/excalidraw/pull/5516)
|
|
79
|
+
|
|
80
|
+
- Make context menu scrollable [#4030](https://github.com/excalidraw/excalidraw/pull/4030)
|
|
81
|
+
|
|
82
|
+
### Fixes
|
|
83
|
+
|
|
84
|
+
- Ungroup short cut key [#5779](https://github.com/excalidraw/excalidraw/pull/5779)
|
|
85
|
+
|
|
86
|
+
- Replaced KeyboardEvent.code with KeyboardEvent.key for all letters [#5523](https://github.com/excalidraw/excalidraw/pull/5523)
|
|
87
|
+
|
|
88
|
+
- Free draw flip not scaling correctly [#5752](https://github.com/excalidraw/excalidraw/pull/5752)
|
|
89
|
+
|
|
90
|
+
- Wait for window focus until prompting for library install [#5751](https://github.com/excalidraw/excalidraw/pull/5751)
|
|
91
|
+
|
|
92
|
+
- Update perfect freehand library to fix extra dot [#5727](https://github.com/excalidraw/excalidraw/pull/5727)
|
|
93
|
+
|
|
94
|
+
- RestoreElementWithProperties drops "parent" property [#5742](https://github.com/excalidraw/excalidraw/pull/5742)
|
|
95
|
+
|
|
96
|
+
- Horizontal text alignment for bound text when resizing [#5721](https://github.com/excalidraw/excalidraw/pull/5721)
|
|
97
|
+
|
|
98
|
+
- Set the dimensions of bound text correctly [#5710](https://github.com/excalidraw/excalidraw/pull/5710)
|
|
99
|
+
|
|
100
|
+
- Image-mirroring in export preview and in exported svg [#5700](https://github.com/excalidraw/excalidraw/pull/5700)
|
|
101
|
+
|
|
102
|
+
- Double state update incorrectly resetting state [#5704](https://github.com/excalidraw/excalidraw/pull/5704)
|
|
103
|
+
|
|
104
|
+
- Remove no longer used code related to collab room loading [#5699](https://github.com/excalidraw/excalidraw/pull/5699)
|
|
105
|
+
|
|
106
|
+
- Revert webpack deduping to fix `@next` runtime [#5695](https://github.com/excalidraw/excalidraw/pull/5695)
|
|
107
|
+
|
|
108
|
+
- Move to release notes for v0.9.0 and after [#5686](https://github.com/excalidraw/excalidraw/pull/5686)
|
|
109
|
+
|
|
110
|
+
- Zen-mode exit button not working [#5682](https://github.com/excalidraw/excalidraw/pull/5682)
|
|
111
|
+
|
|
112
|
+
- Buttons jump around on the mobile menu [#5658](https://github.com/excalidraw/excalidraw/pull/5658)
|
|
113
|
+
|
|
114
|
+
- #5622 - prevent session theme reset during collaboration [#5640](https://github.com/excalidraw/excalidraw/pull/5640)
|
|
115
|
+
|
|
116
|
+
- Library actions inside the sidebar [#5638](https://github.com/excalidraw/excalidraw/pull/5638)
|
|
117
|
+
|
|
118
|
+
- Don't render library menu twice for mobile [#5636](https://github.com/excalidraw/excalidraw/pull/5636)
|
|
119
|
+
|
|
120
|
+
- Reintroduce help dialog button [#5631](https://github.com/excalidraw/excalidraw/pull/5631)
|
|
121
|
+
|
|
122
|
+
- Add display name to components so it doesn't show as anonymous [#5616](https://github.com/excalidraw/excalidraw/pull/5616)
|
|
123
|
+
|
|
124
|
+
- Improve solveQuadratic when a = 0 [#5618](https://github.com/excalidraw/excalidraw/pull/5618)
|
|
125
|
+
|
|
126
|
+
- Add random tiny offsets to avoid linear elements from being clipped [#5615](https://github.com/excalidraw/excalidraw/pull/5615)
|
|
127
|
+
|
|
128
|
+
- Crash when adding a new point in the line editor #5602 [#5606](https://github.com/excalidraw/excalidraw/pull/5606)
|
|
129
|
+
|
|
130
|
+
- Allow box selection of points when inside editor [#5594](https://github.com/excalidraw/excalidraw/pull/5594)
|
|
131
|
+
|
|
132
|
+
- Remove unnecessary conditions in pointerup for linear elements [#5575](https://github.com/excalidraw/excalidraw/pull/5575)
|
|
133
|
+
|
|
134
|
+
- Check if hitting link in handleSelectionOnPointerDown [#5589](https://github.com/excalidraw/excalidraw/pull/5589)
|
|
135
|
+
|
|
136
|
+
- Points not being normalized on single-elem resize [#5581](https://github.com/excalidraw/excalidraw/pull/5581)
|
|
137
|
+
|
|
138
|
+
- Deselect linear element when clicked inside bounding box outside editor [#5579](https://github.com/excalidraw/excalidraw/pull/5579)
|
|
139
|
+
|
|
140
|
+
- Resize multiple elements from center [#5560](https://github.com/excalidraw/excalidraw/pull/5560)
|
|
141
|
+
|
|
142
|
+
- Call static methods via class instead of instance in linearElementEditor [#5561](https://github.com/excalidraw/excalidraw/pull/5561)
|
|
143
|
+
|
|
144
|
+
- Show bounding box for 3 or more linear point elements [#5554](https://github.com/excalidraw/excalidraw/pull/5554)
|
|
145
|
+
|
|
146
|
+
- Cleanup the condition for dragging elements [#5555](https://github.com/excalidraw/excalidraw/pull/5555)
|
|
147
|
+
|
|
148
|
+
- Shareable links being merged with current scene data [#5547](https://github.com/excalidraw/excalidraw/pull/5547)
|
|
149
|
+
|
|
150
|
+
- Scene lookup failing when looking up by id [#5542](https://github.com/excalidraw/excalidraw/pull/5542)
|
|
151
|
+
|
|
152
|
+
- Remove rounding to fix jitter when shift-editing [#5543](https://github.com/excalidraw/excalidraw/pull/5543)
|
|
153
|
+
|
|
154
|
+
- Line deselected when shift-dragging point outside editor [#5540](https://github.com/excalidraw/excalidraw/pull/5540)
|
|
155
|
+
|
|
156
|
+
- Flip linear elements after redesign [#5538](https://github.com/excalidraw/excalidraw/pull/5538)
|
|
157
|
+
|
|
158
|
+
- Disable locking aspect ratio for box-selection [#5525](https://github.com/excalidraw/excalidraw/pull/5525)
|
|
159
|
+
|
|
160
|
+
- Add `title` attribute to the modal close button [#5521](https://github.com/excalidraw/excalidraw/pull/5521)
|
|
161
|
+
|
|
162
|
+
- Context menu positioning when component has offsets [#5520](https://github.com/excalidraw/excalidraw/pull/5520)
|
|
163
|
+
|
|
164
|
+
- Resolve paths in prebuild.js script [#5498](https://github.com/excalidraw/excalidraw/pull/5498)
|
|
165
|
+
|
|
166
|
+
- Use flushSync when moving line editor since we need to read previous value after setting state [#5508](https://github.com/excalidraw/excalidraw/pull/5508)
|
|
167
|
+
|
|
168
|
+
- UseLayout effect cleanup in dev mode for charts [#5505](https://github.com/excalidraw/excalidraw/pull/5505)
|
|
169
|
+
|
|
170
|
+
- Revert browser toast for high/low zoom [#5495](https://github.com/excalidraw/excalidraw/pull/5495)
|
|
171
|
+
|
|
172
|
+
- Fixing push to DockerHub [#5468](https://github.com/excalidraw/excalidraw/pull/5468)
|
|
173
|
+
|
|
174
|
+
- Incorrectly rendering freedraw elements [#5481](https://github.com/excalidraw/excalidraw/pull/5481)
|
|
175
|
+
|
|
176
|
+
- Generate types when building example [#5480](https://github.com/excalidraw/excalidraw/pull/5480)
|
|
177
|
+
|
|
178
|
+
- Use React.FC as react-dom is not able to infer types of Modal [#5479](https://github.com/excalidraw/excalidraw/pull/5479)
|
|
179
|
+
|
|
180
|
+
- Missing translation for "Scale" to Export Dialog [#5456](https://github.com/excalidraw/excalidraw/pull/5456)
|
|
181
|
+
|
|
182
|
+
- Add display name for Excalidraw component so it doesn't show as anonymous [#5464](https://github.com/excalidraw/excalidraw/pull/5464)
|
|
183
|
+
|
|
184
|
+
- Account for safe area for floating buttons on mobile [#5420](https://github.com/excalidraw/excalidraw/pull/5420)
|
|
185
|
+
|
|
186
|
+
- Attribute warnings in comment svg example [#5465](https://github.com/excalidraw/excalidraw/pull/5465)
|
|
187
|
+
|
|
188
|
+
- Check for ctrl key when wheel event triggered to only disable zooming [#5459](https://github.com/excalidraw/excalidraw/pull/5459)
|
|
189
|
+
|
|
190
|
+
- Disable render throttling by default & during resize [#5451](https://github.com/excalidraw/excalidraw/pull/5451)
|
|
191
|
+
|
|
192
|
+
- Attach wheel event to exscalidraw container only [#5443](https://github.com/excalidraw/excalidraw/pull/5443)
|
|
193
|
+
|
|
194
|
+
- Show toast when browser zoom is not 100% [#5304](https://github.com/excalidraw/excalidraw/pull/5304)
|
|
195
|
+
|
|
196
|
+
- Prevent browser zoom inside Excalidraw [#5426](https://github.com/excalidraw/excalidraw/pull/5426)
|
|
197
|
+
|
|
198
|
+
- Typo in changelog [#5425](https://github.com/excalidraw/excalidraw/pull/5425)
|
|
199
|
+
|
|
200
|
+
### Refactor
|
|
201
|
+
|
|
202
|
+
- Create a util to compute container dimensions for bound text container [#5708](https://github.com/excalidraw/excalidraw/pull/5708)
|
|
203
|
+
|
|
204
|
+
- Reuse common ui dialogs and message for mobile and LayerUI [#5611](https://github.com/excalidraw/excalidraw/pull/5611)
|
|
205
|
+
|
|
206
|
+
- Stats component [#5610](https://github.com/excalidraw/excalidraw/pull/5610)
|
|
207
|
+
|
|
208
|
+
- Move footer to its own component [#5609](https://github.com/excalidraw/excalidraw/pull/5609)
|
|
209
|
+
|
|
210
|
+
- Remove unused attribute hasHitElementInside from pointerDownState [#5591](https://github.com/excalidraw/excalidraw/pull/5591)
|
|
211
|
+
|
|
212
|
+
- Cleanup renderScene [#5573](https://github.com/excalidraw/excalidraw/pull/5573)
|
|
213
|
+
|
|
214
|
+
- Rename docs to dev-docs [#5487](https://github.com/excalidraw/excalidraw/pull/5487)
|
|
215
|
+
|
|
216
|
+
- Remove unnecessary if condition for linear element onKeyDown [#5486](https://github.com/excalidraw/excalidraw/pull/5486)
|
|
217
|
+
|
|
218
|
+
- Improve typing & check [#5415](https://github.com/excalidraw/excalidraw/pull/5415)
|
|
219
|
+
|
|
220
|
+
- Don't pass zenModeEnable, viewModeEnabled and toggleZenMode props to LayerUI [#5444](https://github.com/excalidraw/excalidraw/pull/5444)
|
|
221
|
+
|
|
222
|
+
### Build
|
|
223
|
+
|
|
224
|
+
- Add missing dependencies: pica, lodash [#5656](https://github.com/excalidraw/excalidraw/pull/5656)
|
|
225
|
+
|
|
226
|
+
- Move dotenv to dev deps [#5472](https://github.com/excalidraw/excalidraw/pull/5472)
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
27
230
|
## 0.12.0 (2022-07-07)
|
|
28
231
|
|
|
29
232
|
Check out the [release notes](https://github.com/excalidraw/excalidraw/releases/tag/v0.12.0) )
|
package/README.md
CHANGED
|
@@ -376,36 +376,65 @@ Most notably, you can customize the primary colors, by overriding these variable
|
|
|
376
376
|
|
|
377
377
|
For a complete list of variables, check [theme.scss](https://github.com/excalidraw/excalidraw/blob/master/src/css/theme.scss), though most of them will not make sense to override.
|
|
378
378
|
|
|
379
|
+
### Does this package support collaboration ?
|
|
380
|
+
|
|
381
|
+
No, Excalidraw package doesn't come with collaboration built in, since the implementation is specific to each host app. We expose APIs which you can use to communicate with Excalidraw which you can use to implement it. You can check our own implementation [here](https://github.com/excalidraw/excalidraw/blob/master/src/excalidraw-app/index.tsx).
|
|
382
|
+
|
|
383
|
+
### Component API
|
|
384
|
+
|
|
385
|
+
#### Footer
|
|
386
|
+
|
|
387
|
+
Earlier we were using `renderFooter` prop to render custom footer which was removed in [#5970](https://github.com/excalidraw/excalidraw/pull/5970). Now you can pass a `Footer` component instead to render the custom UI for footer.
|
|
388
|
+
|
|
389
|
+
You will need to import the `Footer` component from the package and wrap your component with the Footer component. The `Footer` should a valid React Node.
|
|
390
|
+
|
|
391
|
+
**Usage**
|
|
392
|
+
|
|
393
|
+
```js
|
|
394
|
+
import { Footer } from "@excalidraw/excalidraw";
|
|
395
|
+
|
|
396
|
+
const CustomFooter = () => <button> custom button</button>;
|
|
397
|
+
const App = () => {
|
|
398
|
+
return (
|
|
399
|
+
<Excalidraw>
|
|
400
|
+
<Footer>
|
|
401
|
+
<CustomFooter />
|
|
402
|
+
</Footer>
|
|
403
|
+
</Excalidraw>
|
|
404
|
+
);
|
|
405
|
+
};
|
|
406
|
+
```
|
|
407
|
+
|
|
379
408
|
### Props
|
|
380
409
|
|
|
381
410
|
| Name | Type | Default | Description |
|
|
382
411
|
| --- | --- | --- | --- |
|
|
383
412
|
| [`onChange`](#onChange) | Function | | This callback is triggered whenever the component updates due to any change. This callback will receive the excalidraw elements and the current app state. |
|
|
384
|
-
| [`initialData`](#initialData) | <
|
|
385
|
-
| [`ref`](#ref) | [`createRef`](https://reactjs.org/docs/refs-and-the-dom.html#creating-refs) | [`useRef`](https://reactjs.org/docs/hooks-reference.html#useref) | [`callbackRef`](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) | <
|
|
413
|
+
| [`initialData`](#initialData) | <code>{elements?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L106">ExcalidrawElement[]</a>, appState?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L79">AppState<a> } </code> | null | The initial data with which app loads. |
|
|
414
|
+
| [`ref`](#ref) | [`createRef`](https://reactjs.org/docs/refs-and-the-dom.html#creating-refs) | [`useRef`](https://reactjs.org/docs/hooks-reference.html#useref) | [`callbackRef`](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) | <code>{ current: { readyPromise: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/utils.ts#L317">resolvablePromise</a> } }</code> | | Ref to be passed to Excalidraw |
|
|
386
415
|
| [`onCollabButtonClick`](#onCollabButtonClick) | Function | | Callback to be triggered when the collab button is clicked |
|
|
387
416
|
| [`isCollaborating`](#isCollaborating) | `boolean` | | This implies if the app is in collaboration mode |
|
|
388
417
|
| [`onPointerUpdate`](#onPointerUpdate) | Function | | Callback triggered when mouse pointer is updated. |
|
|
389
418
|
| [`langCode`](#langCode) | string | `en` | Language code string |
|
|
390
419
|
| [`renderTopRightUI`](#renderTopRightUI) | Function | | Function that renders custom UI in top right corner |
|
|
391
|
-
| [`renderFooter `](#renderFooter) | Function | | Function that renders custom UI footer |
|
|
392
420
|
| [`renderCustomStats`](#renderCustomStats) | Function | | Function that can be used to render custom stats on the stats dialog. |
|
|
421
|
+
| [`renderSIdebar`](#renderSIdebar) | Function | | Render function that renders custom sidebar. |
|
|
393
422
|
| [`viewModeEnabled`](#viewModeEnabled) | boolean | | This implies if the app is in view mode. |
|
|
394
423
|
| [`zenModeEnabled`](#zenModeEnabled) | boolean | | This implies if the zen mode is enabled |
|
|
395
424
|
| [`gridModeEnabled`](#gridModeEnabled) | boolean | | This implies if the grid mode is enabled |
|
|
396
425
|
| [`libraryReturnUrl`](#libraryReturnUrl) | string | | What URL should [libraries.excalidraw.com](https://libraries.excalidraw.com) be installed to |
|
|
397
426
|
| [`theme`](#theme) | [THEME.LIGHT](#THEME-1) | [THEME.DARK](#THEME-1) | [THEME.LIGHT](#THEME-1) | The theme of the Excalidraw component |
|
|
398
427
|
| [`name`](#name) | string | | Name of the drawing |
|
|
399
|
-
| [`UIOptions`](#UIOptions) | <
|
|
400
|
-
| [`onPaste`](#onPaste) | <
|
|
428
|
+
| [`UIOptions`](#UIOptions) | <code>{ canvasActions: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L208"> CanvasActions<a/> }</code> | [DEFAULT UI OPTIONS](https://github.com/excalidraw/excalidraw/blob/master/src/constants.ts#L129) | To customise UI options. Currently we support customising [`canvas actions`](#canvasActions) |
|
|
429
|
+
| [`onPaste`](#onPaste) | <code>(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L21">ClipboardData</a>, event: ClipboardEvent | null) => boolean</code> | | Callback to be triggered if passed when the something is pasted in to the scene |
|
|
401
430
|
| [`detectScroll`](#detectScroll) | boolean | true | Indicates whether to update the offsets when nearest ancestor is scrolled. |
|
|
402
431
|
| [`handleKeyboardGlobally`](#handleKeyboardGlobally) | boolean | false | Indicates whether to bind the keyboard events to document. |
|
|
403
|
-
| [`onLibraryChange`](#onLibraryChange) | <
|
|
432
|
+
| [`onLibraryChange`](#onLibraryChange) | <code>(items: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L200">LibraryItems</a>) => void | Promise<any> </code> | | The callback if supplied is triggered when the library is updated and receives the library items. |
|
|
404
433
|
| [`autoFocus`](#autoFocus) | boolean | false | Implies whether to focus the Excalidraw component on page load |
|
|
405
434
|
| [`generateIdForFile`](#generateIdForFile) | `(file: File) => string | Promise<string>` | Allows you to override `id` generation for files added on canvas |
|
|
406
|
-
| [`onLinkOpen`](#onLinkOpen) | <
|
|
407
|
-
| [`onPointerDown`](#onPointerDown) | <
|
|
408
|
-
| [`onScrollChange`](#onScrollChange) | (scrollX: number, scrollY: number) | | This prop if passed gets triggered when scrolling the canvas. |
|
|
435
|
+
| [`onLinkOpen`](#onLinkOpen) | <code>(element: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L106">NonDeletedExcalidrawElement</a>, event: CustomEvent) </code> | | This prop if passed will be triggered when link of an element is clicked. |
|
|
436
|
+
| [`onPointerDown`](#onPointerDown) | <code>(activeTool: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L93"> AppState["activeTool"]</a>, pointerDownState: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L365">PointerDownState</a>) => void</code> | | This prop if passed gets triggered on pointer down evenets |
|
|
437
|
+
| [`onScrollChange`](#onScrollChange) | <code>(scrollX: number, scrollY: number)</code> | | This prop if passed gets triggered when scrolling the canvas. |
|
|
409
438
|
|
|
410
439
|
### Dimensions of Excalidraw
|
|
411
440
|
|
|
@@ -503,6 +532,7 @@ You can pass a `ref` when you want to access some excalidraw APIs. We expose the
|
|
|
503
532
|
| [setActiveTool](#setActiveTool) | <code>(tool: { type: typeof <a href="https://github.com/excalidraw/excalidraw/blob/master/src/shapes.tsx#L4">SHAPES</a> [number]["value"]| "eraser" } | { type: "custom"; customType: string }) => void</code> | This API can be used to set the active tool |
|
|
504
533
|
| [setCursor](#setCursor) | <code>(cursor: string) => void </code> | This API can be used to set customise the mouse cursor on the canvas |
|
|
505
534
|
| [resetCursor](#resetCursor) | <code>() => void </code> | This API can be used to reset to default mouse cursor on the canvas |
|
|
535
|
+
| [toggleMenu](#toggleMenu) | <code>(type: string, force?: boolean) => boolean</code> | Toggles specific menus on/off |
|
|
506
536
|
|
|
507
537
|
#### `readyPromise`
|
|
508
538
|
|
|
@@ -607,17 +637,41 @@ import { defaultLang, languages } from "@excalidraw/excalidraw";
|
|
|
607
637
|
|
|
608
638
|
A function returning JSX to render custom UI in the top right corner of the app.
|
|
609
639
|
|
|
610
|
-
#### `
|
|
640
|
+
#### `renderCustomStats`
|
|
641
|
+
|
|
642
|
+
A function that can be used to render custom stats (returns JSX) in the nerd stats dialog. For example you can use this prop to render the size of the elements in the storage.
|
|
643
|
+
|
|
644
|
+
#### `renderSidebar`
|
|
611
645
|
|
|
612
646
|
<pre>
|
|
613
|
-
(
|
|
647
|
+
() => JSX | null
|
|
614
648
|
</pre>
|
|
615
649
|
|
|
616
|
-
|
|
650
|
+
Optional function that can render custom sidebar. This sidebar is the same that the library menu sidebar is using, and can be used for any purposes your app needs. The render function should return a `<Sidebar>` instance — a component that is exported from the Excalidraw package. It accepts `children` which can be any content you like to render inside.
|
|
617
651
|
|
|
618
|
-
|
|
652
|
+
The `<Sidebar>` component takes these props (all are optional except `children`):
|
|
619
653
|
|
|
620
|
-
|
|
654
|
+
| name | type | description |
|
|
655
|
+
| --- | --- | --- |
|
|
656
|
+
| className | string |
|
|
657
|
+
| children | <pre>React.ReactNode</pre> | Content you want to render inside the sidebar. |
|
|
658
|
+
| onClose | <pre>() => void</pre> | Invoked when the component is closed (by user, or the editor). No need to act on this event, as the editor manages the sidebar open state on its own. |
|
|
659
|
+
| onDock | <pre>(isDocked: boolean) => void</pre> | Invoked when the user toggles the dock button. |
|
|
660
|
+
| docked | boolean | Indicates whether the sidebar is docked. By default, the sidebar is undocked. If passed, the docking becomes controlled, and you are responsible for updating the `docked` state by listening on `onDock` callback. See [here](#dockedSidebarBreakpoint) for more info docking. |
|
|
661
|
+
| dockable | boolean | Indicates whether the sidebar can be docked by user (=the dock button is shown). If `false`, you can still dock programmatically by passing `docked=true` |
|
|
662
|
+
|
|
663
|
+
The sidebar will always include a header with close/dock buttons (when applicable).
|
|
664
|
+
|
|
665
|
+
You can also add custom content to the header, by rendering `<Sidebar.Header>` as a child of the `<Sidebar>` component. Note that the custom header will still include the default buttons.
|
|
666
|
+
|
|
667
|
+
The `<Sidebar.Header>` component takes these props children (all are optional):
|
|
668
|
+
|
|
669
|
+
| name | type | description |
|
|
670
|
+
| --- | --- | --- |
|
|
671
|
+
| className | string |
|
|
672
|
+
| children | <pre>React.ReactNode</pre> | Content you want to render inside the sidebar header, sibling of the header buttons. |
|
|
673
|
+
|
|
674
|
+
For example code, see the example [`App.tsx`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/example/App.tsx#L524) file.
|
|
621
675
|
|
|
622
676
|
#### `viewModeEnabled`
|
|
623
677
|
|
|
@@ -637,7 +691,9 @@ If supplied, this URL will be used when user tries to install a library from [li
|
|
|
637
691
|
|
|
638
692
|
#### `theme`
|
|
639
693
|
|
|
640
|
-
This prop controls Excalidraw's theme. When supplied, the value takes precedence over `intialData.appState.theme`, the theme will be fully controlled by the host app, and users won't be able to toggle it from within the app.
|
|
694
|
+
This prop controls Excalidraw's theme. When supplied, the value takes precedence over `intialData.appState.theme`, the theme will be fully controlled by the host app, and users won't be able to toggle it from within the app unless `UIOptions.canvasActions.toggleTheme` is set to `true`, in which case the `theme` prop will control Excalidraw's default theme with ability to allow theme switching (you must take care of updating the `theme` prop when you detect a change to `appState.theme` from the [onChange](#onChange) callback).
|
|
695
|
+
|
|
696
|
+
You can use [`THEME`](#THEME-1) to specify the theme.
|
|
641
697
|
|
|
642
698
|
#### `name`
|
|
643
699
|
|
|
@@ -660,7 +716,7 @@ This prop can be used to customise UI of Excalidraw. Currently we support custom
|
|
|
660
716
|
| `export` | false | [exportOpts](#exportOpts) | <pre>{ saveFileToDisk: true }</pre> | This prop allows to customize the UI inside the export dialog. By default it shows the "saveFileToDisk". If this prop is `false` the export button will not be rendered. For more details visit [`exportOpts`](#exportOpts). |
|
|
661
717
|
| `loadScene` | boolean | true | Implies whether to show `Load button` |
|
|
662
718
|
| `saveToActiveFile` | boolean | true | Implies whether to show `Save button` to save to current file |
|
|
663
|
-
| `
|
|
719
|
+
| `toggleTheme` | boolean | null | null | Implies whether to show `Theme toggle`. When defined as `boolean`, takes precedence over [`props.theme`](#theme) to show `Theme toggle` |
|
|
664
720
|
| `saveAsImage` | boolean | true | Implies whether to show `Save as image button` |
|
|
665
721
|
|
|
666
722
|
##### `dockedSidebarBreakpoint`
|
|
@@ -751,6 +807,16 @@ This API can be used to customise the mouse cursor on the canvas and has the bel
|
|
|
751
807
|
(cursor: string) => void
|
|
752
808
|
</pre>
|
|
753
809
|
|
|
810
|
+
#### `toggleMenu`
|
|
811
|
+
|
|
812
|
+
<pre>
|
|
813
|
+
(type: "library" | "customSidebar", force?: boolean) => boolean
|
|
814
|
+
</pre>
|
|
815
|
+
|
|
816
|
+
This API can be used to toggle a specific menu (currently only the sidebars), and returns whether the menu was toggled on or off. If the `force` flag passed, it will force the menu to be toggled either on/off based on the boolean passed.
|
|
817
|
+
|
|
818
|
+
This API is especially useful when you render a custom sidebar using [`renderSidebar`](#renderSidebar) prop, and you want to toggle it from your app based on a user action.
|
|
819
|
+
|
|
754
820
|
#### `resetCursor`
|
|
755
821
|
|
|
756
822
|
This API can be used to reset to default mouse cursor.
|
|
@@ -840,10 +906,6 @@ This prop if passed will be triggered when canvas is scrolled and has the below
|
|
|
840
906
|
(scrollX: number, scrollY: number) => void
|
|
841
907
|
```
|
|
842
908
|
|
|
843
|
-
### Does it support collaboration ?
|
|
844
|
-
|
|
845
|
-
No, Excalidraw package doesn't come with collaboration built in, since the implementation is specific to each host app. We expose APIs which you can use to communicate with Excalidraw which you can use to implement it. You can check our own implementation [here](https://github.com/excalidraw/excalidraw/blob/master/src/excalidraw-app/index.tsx).
|
|
846
|
-
|
|
847
909
|
### Restore utilities
|
|
848
910
|
|
|
849
911
|
#### `restoreAppState`
|
|
@@ -869,7 +931,11 @@ When `localAppState` is supplied, it's used in place of values that are missing
|
|
|
869
931
|
**_Signature_**
|
|
870
932
|
|
|
871
933
|
<pre>
|
|
872
|
-
restoreElements(
|
|
934
|
+
restoreElements(
|
|
935
|
+
elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L16">ImportedDataState["elements"]</a>,
|
|
936
|
+
localElements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L16">ExcalidrawElement[]</a> | null | undefined): <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L106">ExcalidrawElement[]</a>,
|
|
937
|
+
refreshDimensions: boolean
|
|
938
|
+
)
|
|
873
939
|
</pre>
|
|
874
940
|
|
|
875
941
|
**_How to use_**
|
|
@@ -882,12 +948,18 @@ This function will make sure all properties of element is correctly set and if a
|
|
|
882
948
|
|
|
883
949
|
When `localElements` are supplied, they are used to ensure that existing restored elements reuse `version` (and increment it), and regenerate `versionNonce`. Use this when you import elements which may already be present in the scene to ensure that you do not disregard the newly imported elements if you're using element version to detect the updates.
|
|
884
950
|
|
|
951
|
+
Parameter `refreshDimensions` indicates whether we should also recalculate text element dimensions. Defaults to `false`. Since this is a potentially costly operation, you may want to disable it if you restore elements in tight loops, such as during collaboration.
|
|
952
|
+
|
|
885
953
|
#### `restore`
|
|
886
954
|
|
|
887
955
|
**_Signature_**
|
|
888
956
|
|
|
889
957
|
<pre>
|
|
890
|
-
restoreElements(
|
|
958
|
+
restoreElements(
|
|
959
|
+
data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L12">ImportedDataState</a>,
|
|
960
|
+
localAppState: Partial<<a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L79">AppState</a>> | null | undefined,
|
|
961
|
+
localElements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L16">ExcalidrawElement[]</a> | null | undefined): <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L4">DataState</a>
|
|
962
|
+
)
|
|
891
963
|
</pre>
|
|
892
964
|
|
|
893
965
|
See [`restoreAppState()`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#restoreAppState) about `localAppState`, and [`restoreElements()`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#restoreElements) about `localElements`.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|