@excalidraw/excalidraw 0.11.0-5346-59101a1 → 0.11.0-5346-d3655cd
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/README.md +43 -41
- package/dist/excalidraw.development.js +5 -5
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/README_NEXT.md +0 -1345
package/README.md
CHANGED
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
#### Note
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**This is an unstable release and not recommended for production. If you don't want to wait for the stable release and try out the unreleased changes you can use this.**
|
|
6
|
-
|
|
7
|
-
For stable release please use [@excalidraw/excalidraw](https://www.npmjs.com/package/@excalidraw/excalidraw).
|
|
8
|
-
|
|
9
|
-
<!-- unstable-readme-end-->
|
|
3
|
+
⚠️ ⚠️ ⚠️ You are viewing the docs for the **next** release, in case you want to check the docs for the stable release, you can view it [here](https://www.npmjs.com/package/@excalidraw/excalidraw).
|
|
10
4
|
|
|
11
5
|
### Excalidraw
|
|
12
6
|
|
|
13
7
|
Excalidraw exported as a component to directly embed in your projects.
|
|
14
8
|
|
|
9
|
+
#### Note
|
|
10
|
+
|
|
11
|
+
⚠️ ⚠️ ⚠️ You are viewing the docs for the **next** release, in case you want to check the docs for the stable release, you can view it [here](https://www.npmjs.com/package/@excalidraw/excalidraw).
|
|
12
|
+
|
|
15
13
|
### Installation
|
|
16
14
|
|
|
17
15
|
You can use npm
|
|
18
16
|
|
|
19
17
|
```
|
|
20
|
-
npm install react react-dom @excalidraw/excalidraw
|
|
18
|
+
npm install react react-dom @excalidraw/excalidraw
|
|
21
19
|
```
|
|
22
20
|
|
|
23
21
|
or via yarn
|
|
24
22
|
|
|
25
23
|
```
|
|
26
|
-
yarn add react react-dom @excalidraw/excalidraw
|
|
24
|
+
yarn add react react-dom @excalidraw/excalidraw
|
|
27
25
|
```
|
|
28
26
|
|
|
29
27
|
After installation you will see a folder `excalidraw-assets` and `excalidraw-assets-dev` in `dist` directory which contains the assets needed for this app in prod and dev mode respectively.
|
|
30
28
|
|
|
31
29
|
Move the folder `excalidraw-assets` and `excalidraw-assets-dev` to the path where your assets are served.
|
|
32
30
|
|
|
33
|
-
By default it will try to load the files from `https://unpkg.com/@excalidraw/excalidraw
|
|
31
|
+
By default it will try to load the files from `https://unpkg.com/@excalidraw/excalidraw/dist/`
|
|
34
32
|
|
|
35
33
|
If you want to load assets from a different path you can set a variable `window.EXCALIDRAW_ASSET_PATH` depending on environment (for example if you have different URL's for dev and prod) to the url from where you want to load the assets.
|
|
36
34
|
|
|
35
|
+
#### Note
|
|
36
|
+
|
|
37
|
+
**If you don't want to wait for the next stable release and try out the unreleased changes you can use `@excalidraw/excalidraw@next`.**
|
|
38
|
+
|
|
37
39
|
### Demo
|
|
38
40
|
|
|
39
41
|
[Try here](https://codesandbox.io/s/excalidraw-ehlz3).
|
|
@@ -48,7 +50,7 @@ If you are using a Web bundler (for instance, Webpack), you can import it as an
|
|
|
48
50
|
|
|
49
51
|
```js
|
|
50
52
|
import React, { useEffect, useState, useRef } from "react";
|
|
51
|
-
import { Excalidraw } from "@excalidraw/excalidraw
|
|
53
|
+
import { Excalidraw } from "@excalidraw/excalidraw";
|
|
52
54
|
import InitialData from "./initialData";
|
|
53
55
|
|
|
54
56
|
import "./styles.scss";
|
|
@@ -166,13 +168,13 @@ import { useState, useEffect } from "react";
|
|
|
166
168
|
export default function IndexPage() {
|
|
167
169
|
const [Comp, setComp] = useState(null);
|
|
168
170
|
useEffect(() => {
|
|
169
|
-
import("@excalidraw/excalidraw
|
|
171
|
+
import("@excalidraw/excalidraw").then((comp) => setComp(comp.default));
|
|
170
172
|
}, []);
|
|
171
173
|
return <>{Comp && <Comp />}</>;
|
|
172
174
|
}
|
|
173
175
|
```
|
|
174
176
|
|
|
175
|
-
The `types` are available at `@excalidraw/excalidraw
|
|
177
|
+
The `types` are available at `@excalidraw/excalidraw/types`, you can view [example for typescript](https://codesandbox.io/s/excalidraw-types-9h2dm)
|
|
176
178
|
|
|
177
179
|
#### In Browser
|
|
178
180
|
|
|
@@ -183,7 +185,7 @@ For development use :point_down:
|
|
|
183
185
|
```js
|
|
184
186
|
<script
|
|
185
187
|
type="text/javascript"
|
|
186
|
-
src="https://unpkg.com/@excalidraw/excalidraw
|
|
188
|
+
src="https://unpkg.com/@excalidraw/excalidraw/dist/excalidraw.development.js"
|
|
187
189
|
></script>
|
|
188
190
|
```
|
|
189
191
|
|
|
@@ -192,7 +194,7 @@ For production use :point_down:
|
|
|
192
194
|
```js
|
|
193
195
|
<script
|
|
194
196
|
type="text/javascript"
|
|
195
|
-
src="https://unpkg.com/@excalidraw/excalidraw
|
|
197
|
+
src="https://unpkg.com/@excalidraw/excalidraw/dist/excalidraw.production.min.js"
|
|
196
198
|
></script>
|
|
197
199
|
```
|
|
198
200
|
|
|
@@ -211,7 +213,7 @@ You will need to make sure `react`, `react-dom` is available as shown in the bel
|
|
|
211
213
|
|
|
212
214
|
<script
|
|
213
215
|
type="text/javascript"
|
|
214
|
-
src="https://unpkg.com/@excalidraw/excalidraw
|
|
216
|
+
src="https://unpkg.com/@excalidraw/excalidraw/dist/excalidraw.development.js"
|
|
215
217
|
></script>
|
|
216
218
|
</head>
|
|
217
219
|
|
|
@@ -585,7 +587,7 @@ This callback is triggered when mouse pointer is updated.
|
|
|
585
587
|
Determines the language of the UI. It should be one of the [available language codes](https://github.com/excalidraw/excalidraw/blob/master/src/i18n.ts#L14). Defaults to `en` (English). We also export default language and supported languages which you can import as shown below.
|
|
586
588
|
|
|
587
589
|
```js
|
|
588
|
-
import { defaultLang, languages } from "@excalidraw/excalidraw
|
|
590
|
+
import { defaultLang, languages } from "@excalidraw/excalidraw";
|
|
589
591
|
```
|
|
590
592
|
|
|
591
593
|
| name | type |
|
|
@@ -829,7 +831,7 @@ restoreAppState(appState: <a href="https://github.com/excalidraw/excalidraw/blob
|
|
|
829
831
|
**_How to use_**
|
|
830
832
|
|
|
831
833
|
```js
|
|
832
|
-
import { restoreAppState } from "@excalidraw/excalidraw
|
|
834
|
+
import { restoreAppState } from "@excalidraw/excalidraw";
|
|
833
835
|
```
|
|
834
836
|
|
|
835
837
|
This function will make sure all the keys have appropriate values in [appState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L79) and if any key is missing, it will be set to default value.
|
|
@@ -847,7 +849,7 @@ restoreElements(elements: <a href="https://github.com/excalidraw/excalidraw/blob
|
|
|
847
849
|
**_How to use_**
|
|
848
850
|
|
|
849
851
|
```js
|
|
850
|
-
import { restoreElements } from "@excalidraw/excalidraw
|
|
852
|
+
import { restoreElements } from "@excalidraw/excalidraw";
|
|
851
853
|
```
|
|
852
854
|
|
|
853
855
|
This function will make sure all properties of element is correctly set and if any attribute is missing, it will be set to default value.
|
|
@@ -867,7 +869,7 @@ See [`restoreAppState()`](https://github.com/excalidraw/excalidraw/blob/master/s
|
|
|
867
869
|
**_How to use_**
|
|
868
870
|
|
|
869
871
|
```js
|
|
870
|
-
import { restore } from "@excalidraw/excalidraw
|
|
872
|
+
import { restore } from "@excalidraw/excalidraw";
|
|
871
873
|
```
|
|
872
874
|
|
|
873
875
|
This function makes sure elements and state is set to appropriate values and set to default value if not present. It is a combination of [restoreElements](#restoreElements) and [restoreAppState](#restoreAppState).
|
|
@@ -883,7 +885,7 @@ restoreLibraryItems(libraryItems: <a href="https://github.com/excalidraw/excalid
|
|
|
883
885
|
**_How to use_**
|
|
884
886
|
|
|
885
887
|
```js
|
|
886
|
-
import { restoreLibraryItems } from "@excalidraw/excalidraw
|
|
888
|
+
import { restoreLibraryItems } from "@excalidraw/excalidraw";
|
|
887
889
|
|
|
888
890
|
restoreLibraryItems(libraryItems, "unpublished");
|
|
889
891
|
```
|
|
@@ -916,7 +918,7 @@ This function normalizes library items elements, adding missing values when need
|
|
|
916
918
|
**How to use**
|
|
917
919
|
|
|
918
920
|
```js
|
|
919
|
-
import { exportToCanvas } from "@excalidraw/excalidraw
|
|
921
|
+
import { exportToCanvas } from "@excalidraw/excalidraw";
|
|
920
922
|
```
|
|
921
923
|
|
|
922
924
|
This function returns the canvas with the exported elements, appState and dimensions.
|
|
@@ -942,7 +944,7 @@ exportToBlob(
|
|
|
942
944
|
**How to use**
|
|
943
945
|
|
|
944
946
|
```js
|
|
945
|
-
import { exportToBlob } from "@excalidraw/excalidraw
|
|
947
|
+
import { exportToBlob } from "@excalidraw/excalidraw";
|
|
946
948
|
```
|
|
947
949
|
|
|
948
950
|
Returns a promise which resolves with a [blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob). It internally uses [canvas.ToBlob](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob).
|
|
@@ -993,7 +995,7 @@ exportToClipboard(
|
|
|
993
995
|
**How to use**
|
|
994
996
|
|
|
995
997
|
```js
|
|
996
|
-
import { exportToClipboard } from "@excalidraw/excalidraw
|
|
998
|
+
import { exportToClipboard } from "@excalidraw/excalidraw";
|
|
997
999
|
```
|
|
998
1000
|
|
|
999
1001
|
Copies the scene data in the specified format (determined by `type`) to clipboard.
|
|
@@ -1042,7 +1044,7 @@ If you want to overwrite the source field in the JSON string, you can set `windo
|
|
|
1042
1044
|
**How to use**
|
|
1043
1045
|
|
|
1044
1046
|
<pre>
|
|
1045
|
-
import { getSceneVersion } from "@excalidraw/excalidraw
|
|
1047
|
+
import { getSceneVersion } from "@excalidraw/excalidraw";
|
|
1046
1048
|
getSceneVersion(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L106">ExcalidrawElement[]</a>)
|
|
1047
1049
|
</pre>
|
|
1048
1050
|
|
|
@@ -1059,7 +1061,7 @@ isInvisiblySmallElement(element: <a href="https://github.com/excalidraw/excalid
|
|
|
1059
1061
|
**How to use**
|
|
1060
1062
|
|
|
1061
1063
|
```js
|
|
1062
|
-
import { isInvisiblySmallElement } from "@excalidraw/excalidraw
|
|
1064
|
+
import { isInvisiblySmallElement } from "@excalidraw/excalidraw";
|
|
1063
1065
|
```
|
|
1064
1066
|
|
|
1065
1067
|
Returns `true` if element is invisibly small (e.g. width & height are zero).
|
|
@@ -1067,7 +1069,7 @@ Returns `true` if element is invisibly small (e.g. width & height are zero).
|
|
|
1067
1069
|
#### `loadLibraryFromBlob`
|
|
1068
1070
|
|
|
1069
1071
|
```js
|
|
1070
|
-
import { loadLibraryFromBlob } from "@excalidraw/excalidraw
|
|
1072
|
+
import { loadLibraryFromBlob } from "@excalidraw/excalidraw";
|
|
1071
1073
|
```
|
|
1072
1074
|
|
|
1073
1075
|
**_Signature_**
|
|
@@ -1083,7 +1085,7 @@ This function loads the library from the blob.
|
|
|
1083
1085
|
**How to use**
|
|
1084
1086
|
|
|
1085
1087
|
```js
|
|
1086
|
-
import { loadFromBlob } from "@excalidraw/excalidraw
|
|
1088
|
+
import { loadFromBlob } from "@excalidraw/excalidraw";
|
|
1087
1089
|
|
|
1088
1090
|
const scene = await loadFromBlob(file, null, null);
|
|
1089
1091
|
excalidrawAPI.updateScene(scene);
|
|
@@ -1135,7 +1137,7 @@ This function loads either scene or library data from the supplied blob. If the
|
|
|
1135
1137
|
**How to use**
|
|
1136
1138
|
|
|
1137
1139
|
```js
|
|
1138
|
-
import { getFreeDrawSvgPath } from "@excalidraw/excalidraw
|
|
1140
|
+
import { getFreeDrawSvgPath } from "@excalidraw/excalidraw";
|
|
1139
1141
|
```
|
|
1140
1142
|
|
|
1141
1143
|
**Signature**
|
|
@@ -1151,7 +1153,7 @@ This function returns the free draw svg path for the element.
|
|
|
1151
1153
|
**How to use**
|
|
1152
1154
|
|
|
1153
1155
|
```js
|
|
1154
|
-
import { isLinearElement } from "@excalidraw/excalidraw
|
|
1156
|
+
import { isLinearElement } from "@excalidraw/excalidraw";
|
|
1155
1157
|
```
|
|
1156
1158
|
|
|
1157
1159
|
**Signature**
|
|
@@ -1167,7 +1169,7 @@ This function returns true if the element is linear type (`arrow` |`line`) else
|
|
|
1167
1169
|
**How to use**
|
|
1168
1170
|
|
|
1169
1171
|
```js
|
|
1170
|
-
import { getNonDeletedElements } from "@excalidraw/excalidraw
|
|
1172
|
+
import { getNonDeletedElements } from "@excalidraw/excalidraw";
|
|
1171
1173
|
```
|
|
1172
1174
|
|
|
1173
1175
|
**Signature**
|
|
@@ -1181,7 +1183,7 @@ This function returns an array of deleted elements.
|
|
|
1181
1183
|
#### `mergeLibraryItems`
|
|
1182
1184
|
|
|
1183
1185
|
```js
|
|
1184
|
-
import { mergeLibraryItems } from "@excalidraw/excalidraw
|
|
1186
|
+
import { mergeLibraryItems } from "@excalidraw/excalidraw";
|
|
1185
1187
|
```
|
|
1186
1188
|
|
|
1187
1189
|
**_Signature_**
|
|
@@ -1197,7 +1199,7 @@ This function merges two `LibraryItems` arrays, where unique items from `otherIt
|
|
|
1197
1199
|
**How to use**
|
|
1198
1200
|
|
|
1199
1201
|
```js
|
|
1200
|
-
import { parseLibraryTokensFromUrl } from "@excalidraw/excalidraw
|
|
1202
|
+
import { parseLibraryTokensFromUrl } from "@excalidraw/excalidraw";
|
|
1201
1203
|
```
|
|
1202
1204
|
|
|
1203
1205
|
**Signature**
|
|
@@ -1216,7 +1218,7 @@ Parses library parameters from URL if present (expects the `#addLibrary` hash ke
|
|
|
1216
1218
|
**How to use**
|
|
1217
1219
|
|
|
1218
1220
|
```js
|
|
1219
|
-
import { useHandleLibrary } from "@excalidraw/excalidraw
|
|
1221
|
+
import { useHandleLibrary } from "@excalidraw/excalidraw";
|
|
1220
1222
|
|
|
1221
1223
|
export const App = () => {
|
|
1222
1224
|
// ...
|
|
@@ -1240,7 +1242,7 @@ In the future, we will be adding support for handling library persistence to bro
|
|
|
1240
1242
|
#### `sceneCoordsToViewportCoords`
|
|
1241
1243
|
|
|
1242
1244
|
```js
|
|
1243
|
-
import { sceneCoordsToViewportCoords } from "@excalidraw/excalidraw
|
|
1245
|
+
import { sceneCoordsToViewportCoords } from "@excalidraw/excalidraw";
|
|
1244
1246
|
```
|
|
1245
1247
|
|
|
1246
1248
|
**_Signature_**
|
|
@@ -1254,7 +1256,7 @@ This function returns equivalent viewport coords for the provided scene coords i
|
|
|
1254
1256
|
#### `viewportCoordsToSceneCoords`
|
|
1255
1257
|
|
|
1256
1258
|
```js
|
|
1257
|
-
import { viewportCoordsToSceneCoords } from "@excalidraw/excalidraw
|
|
1259
|
+
import { viewportCoordsToSceneCoords } from "@excalidraw/excalidraw";
|
|
1258
1260
|
```
|
|
1259
1261
|
|
|
1260
1262
|
**_Signature_**
|
|
@@ -1272,7 +1274,7 @@ This function returns equivalent scene coords for the provided viewport coords i
|
|
|
1272
1274
|
**How to use**
|
|
1273
1275
|
|
|
1274
1276
|
```js
|
|
1275
|
-
import { FONT_FAMILY } from "@excalidraw/excalidraw
|
|
1277
|
+
import { FONT_FAMILY } from "@excalidraw/excalidraw";
|
|
1276
1278
|
```
|
|
1277
1279
|
|
|
1278
1280
|
`FONT_FAMILY` contains all the font families used in `Excalidraw` as explained below
|
|
@@ -1290,7 +1292,7 @@ Defaults to `FONT_FAMILY.Virgil` unless passed in `initialData.appState.currentI
|
|
|
1290
1292
|
**How to use**
|
|
1291
1293
|
|
|
1292
1294
|
```js
|
|
1293
|
-
import { THEME } from "@excalidraw/excalidraw
|
|
1295
|
+
import { THEME } from "@excalidraw/excalidraw";
|
|
1294
1296
|
```
|
|
1295
1297
|
|
|
1296
1298
|
`THEME` contains all the themes supported by `Excalidraw` as explained below
|
|
@@ -1307,7 +1309,7 @@ Defaults to `THEME.LIGHT` unless passed in `initialData.appState.theme`
|
|
|
1307
1309
|
**How to use **
|
|
1308
1310
|
|
|
1309
1311
|
```js
|
|
1310
|
-
import { MIME_TYPES } from "@excalidraw/excalidraw
|
|
1312
|
+
import { MIME_TYPES } from "@excalidraw/excalidraw";
|
|
1311
1313
|
```
|
|
1312
1314
|
|
|
1313
1315
|
[`MIME_TYPES`](https://github.com/excalidraw/excalidraw/blob/master/src/constants.ts#L92) contains all the mime types supported by `Excalidraw`.
|
|
@@ -1342,4 +1344,4 @@ You can create a test release by posting the below comment in your pull request
|
|
|
1342
1344
|
@excalibot release package
|
|
1343
1345
|
```
|
|
1344
1346
|
|
|
1345
|
-
Once the version is released `@excalibot` will post a comment with the release version.
|
|
1347
|
+
Once the version is released `@excalibot` will post a comment with the release version.
|