@excalidraw/excalidraw 0.12.0-b818df1 → 0.12.0-b914ad4

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 CHANGED
@@ -15,9 +15,11 @@ Please add the latest change on the top under the correct section.
15
15
 
16
16
  ### Excalidraw API
17
17
 
18
+ - Added support for storing [`customData`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#storing-custom-data-to-excalidraw-elements) on Excalidraw elements [#5592].
19
+
18
20
  #### Breaking Changes
19
21
 
20
- - `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`.
22
+ - `setToastMessage` API is now renamed to `setToas○t` 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`.
21
23
 
22
24
  ## 0.12.0 (2022-07-07)
23
25
 
package/README.md CHANGED
@@ -394,7 +394,7 @@ For a complete list of variables, check [theme.scss](https://github.com/excalidr
394
394
  | [`zenModeEnabled`](#zenModeEnabled) | boolean | | This implies if the zen mode is enabled |
395
395
  | [`gridModeEnabled`](#gridModeEnabled) | boolean | | This implies if the grid mode is enabled |
396
396
  | [`libraryReturnUrl`](#libraryReturnUrl) | string | | What URL should [libraries.excalidraw.com](https://libraries.excalidraw.com) be installed to |
397
- | [`theme`](#theme) | [THEME.LIGHT](#THEME-1) | [THEME.LIGHT](#THEME-1) | [THEME.LIGHT](#THEME-1) | The theme of the Excalidraw component |
397
+ | [`theme`](#theme) | [THEME.LIGHT](#THEME-1) | [THEME.DARK](#THEME-1) | [THEME.LIGHT](#THEME-1) | The theme of the Excalidraw component |
398
398
  | [`name`](#name) | string | | Name of the drawing |
399
399
  | [`UIOptions`](#UIOptions) | <pre>{ canvasActions: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L208"> CanvasActions<a/> }</pre> | [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) |
400
400
  | [`onPaste`](#onPaste) | <pre>(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L21">ClipboardData</a>, event: ClipboardEvent &#124; null) => boolean</pre> | | Callback to be triggered if passed when the something is pasted in to the scene |
@@ -470,6 +470,14 @@ This helps to load Excalidraw with `initialData`. It must be an object or a [pro
470
470
 
471
471
  You might want to use this when you want to load excalidraw with some initial elements and app state.
472
472
 
473
+ #### Storing custom data on Excalidraw elements
474
+
475
+ Beyond attributes that Excalidraw elements already support, you can store custom data on each element in a `customData` object. The type of the attribute is [`Record<string, any>`](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L59) and is optional.
476
+
477
+ You can use this to add any extra information you need to keep track of.
478
+
479
+ You can add `customData` to elements when passing them as `initialData`, or using [`updateScene`](#updateScene)/[`updateLibrary`](#updateLibrary) afterwards.
480
+
473
481
  #### `ref`
474
482
 
475
483
  You can pass a `ref` when you want to access some excalidraw APIs. We expose the below APIs: