mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Move all remaining files in src
This commit is contained in:
parent
e75a7b45d6
commit
c48d847f62
524 changed files with 538 additions and 547 deletions
|
@ -5,7 +5,7 @@
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { FONT_FAMILY } from "@excalidraw/excalidraw";
|
||||
import { FONT_FAMILY } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
`FONT_FAMILY` contains all the font families used in `Excalidraw`. The default families are the following:
|
||||
|
@ -23,7 +23,7 @@ Pre-selected family is `FONT_FAMILY.Excalifont`, unless it's overriden with `ini
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { THEME } from "@excalidraw/excalidraw";
|
||||
import { THEME } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
`THEME` contains all the themes supported by `Excalidraw` as explained below
|
||||
|
@ -42,5 +42,5 @@ Defaults to `THEME.LIGHT` unless passed in `initialData.appState.theme`
|
|||
**How to use **
|
||||
|
||||
```js
|
||||
import { MIME_TYPES } from "@excalidraw/excalidraw";
|
||||
import { MIME_TYPES } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
|
|
@ -25,7 +25,7 @@ convertToExcalidrawElements(
|
|||
**_How to use_**
|
||||
|
||||
```js
|
||||
import { convertToExcalidrawElements } from "@excalidraw/excalidraw";
|
||||
import { convertToExcalidrawElements } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
This function converts the Excalidraw Element Skeleton to excalidraw elements which could be then rendered on the canvas. Hence calling this function is necessary before passing it to APIs like [`initialData`](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/api/props/initialdata), [`updateScene`](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/api/props/excalidraw-api#updatescene) if you are using the Skeleton API
|
||||
|
|
|
@ -193,7 +193,7 @@ const onLinkOpen: ExcalidrawProps["onLinkOpen"] = useCallback(
|
|||
Determines the `language` of the UI. It should be one of the [available language codes](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/i18n.ts#L14). Defaults to `en` (English). We also export default language and supported languages which you can import as shown below.
|
||||
|
||||
```js
|
||||
import { defaultLang, languages } from "@excalidraw/excalidraw";
|
||||
import { defaultLang, languages } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
| name | type |
|
||||
|
|
|
@ -47,7 +47,7 @@ A function which returns the `width`, `height`, and optionally `scale` (defaults
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { exportToCanvas } from "@excalidraw/excalidraw";
|
||||
import { exportToCanvas } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
This function returns the canvas with the exported elements, appState and dimensions.
|
||||
|
@ -122,7 +122,7 @@ exportToBlob(<br/>
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { exportToBlob } from "@excalidraw/excalidraw";
|
||||
import { exportToBlob } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
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).
|
||||
|
@ -181,7 +181,7 @@ exportToClipboard(<br/>
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { exportToClipboard } from "@excalidraw/excalidraw";
|
||||
import { exportToClipboard } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
Copies the scene data in the specified format (determined by `type`) to clipboard.
|
||||
|
|
|
@ -14,7 +14,7 @@ restoreAppState(appState: <a href="https://github.com/excalidraw/excalidraw/blob
|
|||
**_How to use_**
|
||||
|
||||
```js
|
||||
import { restoreAppState } from "@excalidraw/excalidraw";
|
||||
import { restoreAppState } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
This function will make sure all the `keys` have appropriate `values` in [appState](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/types.ts#L95) and if any key is missing, it will be set to its `default` value.
|
||||
|
@ -58,7 +58,7 @@ The extra optional parameter to configure restored elements. It has the followin
|
|||
**_How to use_**
|
||||
|
||||
```js
|
||||
import { restoreElements } from "@excalidraw/excalidraw";
|
||||
import { restoreElements } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
This function will make sure all properties of element is correctly set and if any attribute is missing, it will be set to its default value.
|
||||
|
@ -84,7 +84,7 @@ See [`restoreAppState()`](https://github.com/excalidraw/excalidraw/blob/master/p
|
|||
**_How to use_**
|
||||
|
||||
```js
|
||||
import { restore } from "@excalidraw/excalidraw";
|
||||
import { restore } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
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).
|
||||
|
@ -101,7 +101,7 @@ defaultStatus: "published" | "unpublished")
|
|||
**_How to use_**
|
||||
|
||||
```js
|
||||
import { restoreLibraryItems } from "@excalidraw/excalidraw";
|
||||
import { restoreLibraryItems } from "@excalidraw/excalidraw/src";
|
||||
|
||||
restoreLibraryItems(libraryItems, "unpublished");
|
||||
```
|
||||
|
|
|
@ -24,7 +24,7 @@ serializeAsJSON({<br/>
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { serializeAsJSON } from "@excalidraw/excalidraw";
|
||||
import { serializeAsJSON } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
### serializeLibraryAsJSON
|
||||
|
@ -43,7 +43,7 @@ serializeLibraryAsJSON(
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { serializeLibraryAsJSON } from "@excalidraw/excalidraw";
|
||||
import { serializeLibraryAsJSON } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
#### isInvisiblySmallElement
|
||||
|
@ -59,7 +59,7 @@ isInvisiblySmallElement(element: <a href="https://github.com/excalidraw/excalid
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { isInvisiblySmallElement } from "@excalidraw/excalidraw";
|
||||
import { isInvisiblySmallElement } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
### loadFromBlob
|
||||
|
@ -69,7 +69,7 @@ This function loads the scene data from the blob (or file). If you pass `localAp
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { loadFromBlob } from "@excalidraw/excalidraw";
|
||||
import { loadFromBlob } from "@excalidraw/excalidraw/src";
|
||||
|
||||
const scene = await loadFromBlob(file, null, null);
|
||||
excalidrawAPI.updateScene(scene);
|
||||
|
@ -93,7 +93,7 @@ This function loads the library from the blob. Additonally takes `defaultStatus`
|
|||
**How to use **
|
||||
|
||||
```js
|
||||
import { loadLibraryFromBlob } from "@excalidraw/excalidraw";
|
||||
import { loadLibraryFromBlob } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
**_Signature_**
|
||||
|
@ -115,7 +115,7 @@ Throws if blob doesn't contain valid `scene` data or `library` data.
|
|||
**How to use**
|
||||
|
||||
```js showLineNumbers
|
||||
import { loadSceneOrLibraryFromBlob, MIME_TYPES } from "@excalidraw/excalidraw";
|
||||
import { loadSceneOrLibraryFromBlob, MIME_TYPES } from "@excalidraw/excalidraw/src";
|
||||
|
||||
const contents = await loadSceneOrLibraryFromBlob(file, null, null);
|
||||
if (contents.type === MIME_TYPES.excalidraw) {
|
||||
|
@ -143,7 +143,7 @@ This function returns the `free draw` svg path for the element.
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { getFreeDrawSvgPath } from "@excalidraw/excalidraw";
|
||||
import { getFreeDrawSvgPath } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
**Signature**
|
||||
|
@ -159,7 +159,7 @@ This function returns true if the element is `linear` type (`arrow` |`line`) els
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { isLinearElement } from "@excalidraw/excalidraw";
|
||||
import { isLinearElement } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
**Signature**
|
||||
|
@ -175,7 +175,7 @@ This function returns an array of `deleted` elements.
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { getNonDeletedElements } from "@excalidraw/excalidraw";
|
||||
import { getNonDeletedElements } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
**Signature**
|
||||
|
@ -189,7 +189,7 @@ getNonDeletedElements(elements:<a href="https://github.com/excalidraw/excalidraw
|
|||
This function merges two `LibraryItems` arrays, where unique items from `otherItems` are sorted first in the returned array.
|
||||
|
||||
```js
|
||||
import { mergeLibraryItems } from "@excalidraw/excalidraw";
|
||||
import { mergeLibraryItems } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
**_Signature_**
|
||||
|
@ -208,7 +208,7 @@ Parses library parameters from URL if present (expects the `#addLibrary` hash ke
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { parseLibraryTokensFromUrl } from "@excalidraw/excalidraw";
|
||||
import { parseLibraryTokensFromUrl } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
**Signature**
|
||||
|
@ -227,7 +227,7 @@ A hook that automatically imports library from url if `#addLibrary` hash key exi
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { useHandleLibrary } from "@excalidraw/excalidraw";
|
||||
import { useHandleLibrary } from "@excalidraw/excalidraw/src";
|
||||
|
||||
export const App = () => {
|
||||
// ...
|
||||
|
@ -259,7 +259,7 @@ getSceneVersion(elements: <a href="https://github.com/excalidraw/excalidraw/blo
|
|||
**How to use**
|
||||
|
||||
```js
|
||||
import { getSceneVersion } from "@excalidraw/excalidraw";
|
||||
import { getSceneVersion } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
### sceneCoordsToViewportCoords
|
||||
|
@ -267,7 +267,7 @@ import { getSceneVersion } from "@excalidraw/excalidraw";
|
|||
This function returns equivalent `viewport` coords for the provided `scene` coords in params.
|
||||
|
||||
```js
|
||||
import { sceneCoordsToViewportCoords } from "@excalidraw/excalidraw";
|
||||
import { sceneCoordsToViewportCoords } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
**_Signature_**
|
||||
|
@ -282,7 +282,7 @@ sceneCoordsToViewportCoords({ sceneX: number, sceneY: number },<br/>
|
|||
This function returns equivalent `scene` coords for the provided `viewport` coords in params.
|
||||
|
||||
```js
|
||||
import { viewportCoordsToSceneCoords } from "@excalidraw/excalidraw";
|
||||
import { viewportCoordsToSceneCoords } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
**_Signature_**
|
||||
|
@ -354,7 +354,7 @@ To help with localization, we export the following.
|
|||
| `useI18n` | [`() => { langCode, t }`](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/i18n.ts#L15) |
|
||||
|
||||
```js
|
||||
import { defaultLang, languages, useI18n } from "@excalidraw/excalidraw";
|
||||
import { defaultLang, languages, useI18n } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
#### defaultLang
|
||||
|
@ -407,7 +407,7 @@ getCommonBounds(
|
|||
**_How to use_**
|
||||
|
||||
```js
|
||||
import { getCommonBounds } from "@excalidraw/excalidraw";
|
||||
import { getCommonBounds } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
### elementsOverlappingBBox
|
||||
|
@ -436,7 +436,7 @@ elementsOverlappingBBox(<br/>
|
|||
**_How to use_**
|
||||
|
||||
```js
|
||||
import { elementsOverlappingBBox } from "@excalidraw/excalidraw";
|
||||
import { elementsOverlappingBBox } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
### isElementInsideBBox
|
||||
|
@ -456,7 +456,7 @@ isElementInsideBBox(<br/>
|
|||
**_How to use_**
|
||||
|
||||
```js
|
||||
import { isElementInsideBBox } from "@excalidraw/excalidraw";
|
||||
import { isElementInsideBBox } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
||||
### elementPartiallyOverlapsWithOrContainsBBox
|
||||
|
@ -475,5 +475,5 @@ elementPartiallyOverlapsWithOrContainsBBox(<br/>
|
|||
**_How to use_**
|
||||
|
||||
```js
|
||||
import { elementPartiallyOverlapsWithOrContainsBBox } from "@excalidraw/excalidraw";
|
||||
import { elementPartiallyOverlapsWithOrContainsBBox } from "@excalidraw/excalidraw/src";
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue