@dwelle/excalidraw 0.3.58 → 0.3.59-restoreLibraryItems

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,6 +15,14 @@ Please add the latest change on the top under the correct section.
15
15
 
16
16
  ### Excalidraw API
17
17
 
18
+ #### Features
19
+
20
+ - Exported [`restoreLibraryItems`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#restoreLibraryItems) API useful when dealing with libraries [#4995](https://github.com/excalidraw/excalidraw/pull/4995).
21
+
22
+ #### Fixes
23
+
24
+ - Library menu now properly rerenders if open when library is updated using `updateScene({ libraryItems })` [#4995](https://github.com/excalidraw/excalidraw/pull/4995).
25
+
18
26
  #### Refactor
19
27
 
20
28
  - Rename `appState.elementLocked` to `appState.activeTool.locked` [#4983](https://github.com/excalidraw/excalidraw/pull/4983).
package/README_NEXT.md CHANGED
@@ -802,6 +802,24 @@ import { restore } from "@excalidraw/excalidraw-next";
802
802
 
803
803
  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).
804
804
 
805
+ #### `restoreLibraryItems`
806
+
807
+ **_Signature_**
808
+
809
+ <pre>
810
+ restoreLibraryItems(libraryItems: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L22">ImportedDataState["libraryItems"]</a>, defaultStatus: "published" | "unpublished")
811
+ </pre>
812
+
813
+ **_How to use_**
814
+
815
+ ```js
816
+ import { restoreLibraryItems } from "@excalidraw/excalidraw-next";
817
+
818
+ restoreLibraryItems(libraryItems, "unpublished");
819
+ ```
820
+
821
+ This function normalizes library items elements, adding missing values when needed.
822
+
805
823
  ### Export utilities
806
824
 
807
825
  #### `exportToCanvas`