@dwelle/excalidraw 0.3.46 → 0.3.49

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_NEXT.md CHANGED
@@ -374,7 +374,7 @@ Most notably, you can customize the primary colors, by overriding these variable
374
374
  - `--color-primary-darker`
375
375
  - `--color-primary-darkest`
376
376
  - `--color-primary-light`
377
- - `--color-primary-chubb` — a slightly darker (in light mode), or lighter (in dark mode) `--color-primary` color to account for [Chubb illusion](https://en.wikipedia.org/wiki/Chubb_illusion).
377
+ - `--color-primary-contrast-offset` — a slightly darker (in light mode), or lighter (in dark mode) `--color-primary` color to fix contrast issues (see [Chubb illusion](https://en.wikipedia.org/wiki/Chubb_illusion)). It will fall back to `--color-primary` if not present.
378
378
 
379
379
  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.
380
380
 
@@ -399,7 +399,7 @@ For a complete list of variables, check [theme.scss](https://github.com/excalidr
399
399
  | [`theme`](#theme) | [THEME.LIGHT](#THEME-1) | [THEME.LIGHT](#THEME-1) | [THEME.LIGHT](#THEME-1) | The theme of the Excalidraw component |
400
400
  | [`name`](#name) | string | | Name of the drawing |
401
401
  | [`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) |
402
- | [`onPaste`](#onPaste) | <pre>(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L17">ClipboardData</a>, event: ClipboardEvent &#124; null) => boolean</pre> | | Callback to be triggered if passed when the something is pasted in to the scene |
402
+ | [`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 |
403
403
  | [`detectScroll`](#detectScroll) | boolean | true | Indicates whether to update the offsets when nearest ancestor is scrolled. |
404
404
  | [`handleKeyboardGlobally`](#handleKeyboardGlobally) | boolean | false | Indicates whether to bind the keyboard events to document. |
405
405
  | [`onLibraryChange`](#onLibraryChange) | <pre>(items: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L200">LibraryItems</a>) => void &#124; Promise&lt;any&gt; </pre> | | The callback if supplied is triggered when the library is updated and receives the library items. |
@@ -416,12 +416,14 @@ Excalidraw takes `100%` of `width` and `height` of the containing block so make
416
416
  Every time component updates, this callback if passed will get triggered and has the below signature.
417
417
 
418
418
  ```js
419
- (excalidrawElements, appState) => void;
419
+ (excalidrawElements, appState, files) => void;
420
420
  ```
421
421
 
422
422
  1.`excalidrawElements`: Array of [excalidrawElements](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78) in the scene.
423
423
 
424
- 2.`appState`: [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) of the scene
424
+ 2.`appState`: [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) of the scene.
425
+
426
+ 3. `files`: The [`BinaryFiles`]([BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64) which are added to the scene.
425
427
 
426
428
  Here you can try saving the data to your backend or local storage for example.
427
429
 
@@ -429,12 +431,13 @@ Here you can try saving the data to your backend or local storage for example.
429
431
 
430
432
  This helps to load Excalidraw with `initialData`. It must be an object or a [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise) which resolves to an object containing the below optional fields.
431
433
 
432
- | Name | Type | Descrption |
434
+ | Name | Type | Description |
433
435
  | --- | --- | --- |
434
436
  | `elements` | [ExcalidrawElement[]](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78) | The elements with which Excalidraw should be mounted. |
435
437
  | `appState` | [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) | The App state with which Excalidraw should be mounted. |
436
438
  | `scrollToContent` | boolean | This attribute implies whether to scroll to the nearest element to center once Excalidraw is mounted. By default, it will not scroll the nearest element to the center. Make sure you pass `initialData.appState.scrollX` and `initialData.appState.scrollY` when `scrollToContent` is false so that scroll positions are retained |
437
439
  | `libraryItems` | [LibraryItems](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L151) | This library items with which Excalidraw should be mounted. |
440
+ | `files` | [BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64) | The files added to the scene. |
438
441
 
439
442
  ```json
440
443
  {
@@ -487,6 +490,7 @@ You can pass a `ref` when you want to access some excalidraw APIs. We expose the
487
490
  | [importLibrary](#importlibrary) | `(url: string, token?: string) => void` | Imports library from given URL |
488
491
  | setToastMessage | `(message: string) => void` | This API can be used to show the toast with custom message. |
489
492
  | [id](#id) | string | Unique ID for the excalidraw component. |
493
+ | [getFiles](#getFiles) | <pre>() => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64">files</a> </pre> | This API can be used to get the files present in the scene. It may contain files that aren't referenced by any element, so if you're persisting the files to a storage, you should compare them against stored elements. |
490
494
 
491
495
  #### `readyPromise`
492
496
 
@@ -516,7 +520,7 @@ You can use this function to update the scene with the sceneData. It accepts the
516
520
 
517
521
  <pre>(files: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts">BinaryFileData</a>) => void </pre>
518
522
 
519
- Adds supplied files data to the `appState.files` cache, on top of existing files present in the cache.
523
+ Adds supplied files data to the `appState.files` cache on top of existing files present in the cache.
520
524
 
521
525
  #### `onCollabButtonClick`
522
526
 
@@ -640,7 +644,7 @@ The below attributes can be set in `UIOptions.canvasActions.export` to customize
640
644
  This callback is triggered if passed when something is pasted into the scene. You can use this callback in case you want to do something additional when the paste event occurs.
641
645
 
642
646
  <pre>
643
- (data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L17">ClipboardData</a>, event: ClipboardEvent &#124; null) => boolean
647
+ (data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L21">ClipboardData</a>, event: ClipboardEvent &#124; null) => boolean
644
648
  </pre>
645
649
 
646
650
  This callback must return a `boolean` value or a [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise) which resolves to a boolean value.
@@ -681,7 +685,7 @@ Enable this if you want Excalidraw to handle keyboard even if the component isn'
681
685
 
682
686
  #### `onLibraryChange`
683
687
 
684
- Ths callback if supplied will get triggered when the library is updated and has the below signature.
688
+ This callback if supplied will get triggered when the library is updated and has the below signature.
685
689
 
686
690
  <pre>
687
691
  (items: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L200">LibraryItems</a>) => void | Promise<any>
@@ -809,7 +813,8 @@ This function makes sure elements and state is set to appropriate values and set
809
813
  elements,
810
814
  appState
811
815
  getDimensions,
812
- }: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/packages/utils.ts#L10">ExportOpts</a>
816
+ files
817
+ }: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/packages/utils.ts#L12">ExportOpts</a>
813
818
  </pre>
814
819
 
815
820
  | Name | Type | Default | Description |
@@ -818,6 +823,7 @@ This function makes sure elements and state is set to appropriate values and set
818
823
  | appState | [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/packages/utils.ts#L12) | [defaultAppState](https://github.com/excalidraw/excalidraw/blob/master/src/appState.ts#L11) | The app state of the scene |
819
824
  | getDimensions | `(width: number, height: number) => { width: number, height: number, scale?: number }` | undefined | A function which returns the `width`, `height`, and optionally `scale` (defaults `1`), with which canvas is to be exported. |
820
825
  | maxWidthOrHeight | `number` | undefined | The maximum width or height of the exported image. If provided, `getDimensions` is ignored. |
826
+ | files | [BinaryFiles](The [`BinaryFiles`](<[BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64)>) | undefined | The files added to the scene. |
821
827
 
822
828
  **How to use**
823
829
 
@@ -863,6 +869,7 @@ exportToSvg({
863
869
  appState: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42">AppState</a>,
864
870
  exportPadding?: number,
865
871
  metadata?: string,
872
+ files?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64">BinaryFiles</a>
866
873
  })
867
874
  </pre>
868
875
 
@@ -871,6 +878,7 @@ exportToSvg({
871
878
  | elements | [Excalidraw Element []](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78) | | The elements to exported as svg |
872
879
  | appState | [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) | [defaultAppState](https://github.com/excalidraw/excalidraw/blob/master/src/appState.ts#L11) | The app state of the scene |
873
880
  | exportPadding | number | 10 | The padding to be added on canvas |
881
+ | files | [BinaryFiles](The [`BinaryFiles`](<[BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64)>) | undefined | The files added to the scene. |
874
882
 
875
883
  This function returns a promise which resolves to svg of the exported drawing.
876
884
 
@@ -1061,3 +1069,13 @@ yarn start
1061
1069
  [http://localhost:3001](http://localhost:3001) will open in your default browser.
1062
1070
 
1063
1071
  The example is same as the [codesandbox example](https://ehlz3.csb.app/)
1072
+
1073
+ #### Create a test release
1074
+
1075
+ You can create a test release by posting the below comment in your pull request
1076
+
1077
+ ```
1078
+ @excalibot release package
1079
+ ```
1080
+
1081
+ Once the version is released `@excalibot` will post a comment with the release version.