@dwelle/excalidraw 0.5.0-3afd1ef → 0.5.0-3c6f672cd
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 +111 -14
- package/dist/dev/{chunk-FAO4JKOU.js → chunk-E46ST234.js} +3646 -1969
- package/dist/dev/chunk-E46ST234.js.map +7 -0
- package/dist/dev/{chunk-V5BIR3MG.js → chunk-L5TK3F2L.js} +22 -3
- package/dist/dev/chunk-L5TK3F2L.js.map +7 -0
- package/dist/dev/{chunk-W6ICSA4S.js → chunk-MFBHCRUO.js} +2 -2
- package/dist/dev/{chunk-W6ICSA4S.js.map → chunk-MFBHCRUO.js.map} +1 -1
- package/dist/dev/components/TTDDialog/{CodeMirrorEditor-BEEYVGBY.js → CodeMirrorEditor-F7FAZ7VK.js} +2 -2
- package/dist/dev/data/{image-UAMHR4NR.js → image-H6YUB767.js} +3 -3
- package/dist/dev/index.css +133 -67
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +5237 -3539
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/locales/{en-2JUZQ4KZ.js → en-7NUPYLED.js} +4 -2
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/chunk-65OI4N5K.js +34 -0
- package/dist/prod/{chunk-ALEVGRNC.js → chunk-S3EMY4QR.js} +1 -1
- package/dist/prod/{chunk-DDHTQBPG.js → chunk-YI6WNTBI.js} +5 -5
- package/dist/prod/components/TTDDialog/{CodeMirrorEditor-OIYENWM6.js → CodeMirrorEditor-PSYIQ7NH.js} +1 -1
- package/dist/prod/data/image-CNYDX3MX.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +31 -29
- package/dist/prod/locales/en-WABAEZHC.js +1 -0
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/common/src/appEventBus.d.ts +27 -0
- package/dist/types/common/src/colors.d.ts +1 -1
- package/dist/types/common/src/constants.d.ts +9 -7
- package/dist/types/common/src/index.d.ts +2 -0
- package/dist/types/common/src/utils.d.ts +1 -45
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +5 -3
- package/dist/types/element/src/arrowheads.d.ts +3 -0
- package/dist/types/element/src/bounds.d.ts +22 -7
- package/dist/types/element/src/comparisons.d.ts +1 -0
- package/dist/types/element/src/duplicate.d.ts +1 -0
- package/dist/types/element/src/frame.d.ts +7 -6
- package/dist/types/element/src/groups.d.ts +3 -3
- package/dist/types/element/src/index.d.ts +1 -0
- package/dist/types/element/src/linearElementEditor.d.ts +2 -2
- package/dist/types/element/src/newElement.d.ts +1 -0
- package/dist/types/element/src/renderElement.d.ts +7 -4
- package/dist/types/element/src/selection.d.ts +8 -4
- package/dist/types/element/src/shape.d.ts +1 -1
- package/dist/types/element/src/textElement.d.ts +1 -1
- package/dist/types/element/src/textWrapping.d.ts +26 -0
- package/dist/types/element/src/typeChecks.d.ts +1 -0
- package/dist/types/element/src/types.d.ts +10 -1
- package/dist/types/element/src/utils.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +20 -17
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +15 -13
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +458 -480
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +14 -12
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +7 -6
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +22 -19
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +161 -0
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +7 -6
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +15 -13
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +7 -6
- package/dist/types/excalidraw/actions/actionExport.d.ts +119 -390
- package/dist/types/excalidraw/actions/actionFrame.d.ts +41 -36
- package/dist/types/excalidraw/actions/actionGroup.d.ts +30 -28
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +10 -8
- package/dist/types/excalidraw/actions/actionLink.d.ts +8 -7
- package/dist/types/excalidraw/actions/actionMenu.d.ts +7 -6
- package/dist/types/excalidraw/actions/actionProperties.d.ts +26 -15
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +8 -7
- package/dist/types/excalidraw/actions/actionStyles.d.ts +7 -5
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +8 -7
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +11 -11
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +8 -7
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +8 -7
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +11 -11
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +8 -7
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +8 -7
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +8 -7
- package/dist/types/excalidraw/actions/index.d.ts +2 -1
- package/dist/types/excalidraw/actions/types.d.ts +4 -4
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +25 -23
- package/dist/types/excalidraw/clipboard.d.ts +2 -3
- package/dist/types/excalidraw/components/Actions.d.ts +2 -3
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.d.ts +105 -49
- package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +2 -2
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +1 -1
- package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
- package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
- package/dist/types/excalidraw/components/Island.d.ts +7 -0
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- package/dist/types/excalidraw/components/Range.d.ts +10 -4
- package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
- package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +1 -1
- package/dist/types/excalidraw/components/Toast.d.ts +8 -4
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -1
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +1 -0
- package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -2
- package/dist/types/excalidraw/components/icons.d.ts +19 -8
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +7 -3
- package/dist/types/excalidraw/components/shapes.d.ts +7 -0
- package/dist/types/excalidraw/data/blob.d.ts +153 -150
- package/dist/types/excalidraw/data/filesystem.d.ts +3 -5
- package/dist/types/excalidraw/data/index.d.ts +2 -3
- package/dist/types/excalidraw/data/json.d.ts +87 -77
- package/dist/types/excalidraw/data/library.d.ts +1 -1
- package/dist/types/excalidraw/data/resave.d.ts +7 -2
- package/dist/types/excalidraw/data/restore.d.ts +1 -1
- package/dist/types/excalidraw/elementAnimator.d.ts +52 -0
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/types/excalidraw/index.d.ts +27 -5
- package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
- package/dist/types/excalidraw/lasso/index.d.ts +2 -3
- package/dist/types/excalidraw/renderer/animation.d.ts +5 -1
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -3
- package/dist/types/excalidraw/scene/Renderer.d.ts +426 -19
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/types.d.ts +8 -4
- package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
- package/dist/types/excalidraw/types.d.ts +294 -44
- package/dist/types/excalidraw/viewport.d.ts +316 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +5 -1
- package/dist/types/fractional-indexing/src/index.d.ts +29 -0
- package/dist/types/laser-pointer/src/index.d.ts +2 -0
- package/dist/types/laser-pointer/src/math.d.ts +16 -0
- package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
- package/dist/types/laser-pointer/src/state.d.ts +35 -0
- package/dist/types/math/src/constants.d.ts +0 -1
- package/dist/types/math/src/curve.d.ts +4 -1
- package/dist/types/math/src/point.d.ts +2 -1
- package/package.json +5 -6
- package/CHANGELOG.md +0 -2385
- package/dist/dev/chunk-FAO4JKOU.js.map +0 -7
- package/dist/dev/chunk-V5BIR3MG.js.map +0 -7
- package/dist/prod/chunk-RS54KZXC.js +0 -33
- package/dist/prod/data/image-QN4A65R4.js +0 -1
- package/dist/prod/locales/en-IVA5PAN7.js +0 -1
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
- package/dist/types/excalidraw/scene/scrollConstraints.d.ts +0 -46
- package/dist/types/utils/src/bbox.d.ts +0 -9
- package/dist/types/utils/src/index.d.ts +0 -4
- package/dist/types/utils/src/withinBounds.d.ts +0 -19
- package/history.ts +0 -249
- /package/dist/dev/components/TTDDialog/{CodeMirrorEditor-BEEYVGBY.js.map → CodeMirrorEditor-F7FAZ7VK.js.map} +0 -0
- /package/dist/dev/data/{image-UAMHR4NR.js.map → image-H6YUB767.js.map} +0 -0
- /package/dist/dev/locales/{en-2JUZQ4KZ.js.map → en-7NUPYLED.js.map} +0 -0
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Excalidraw
|
|
2
2
|
|
|
3
|
-
**Excalidraw** is exported as a component
|
|
3
|
+
**Excalidraw** is exported as a React component that you can embed directly in your app.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Install the package together with its React peer dependencies.
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npm install react react-dom @excalidraw/excalidraw
|
|
@@ -12,34 +12,131 @@ npm install react react-dom @excalidraw/excalidraw
|
|
|
12
12
|
yarn add react react-dom @excalidraw/excalidraw
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
> **Note**: If you
|
|
15
|
+
> **Note**: If you want to try unreleased changes, use `@excalidraw/excalidraw@next`.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Quick start
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
The minimum working setup has two easy-to-miss requirements:
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
1. Import the package CSS:
|
|
22
22
|
|
|
23
|
-
```
|
|
24
|
-
|
|
23
|
+
```ts
|
|
24
|
+
import "@excalidraw/excalidraw/index.css";
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
2. Render Excalidraw inside a container with a non-zero height.
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
```tsx
|
|
30
|
+
import { Excalidraw } from "@excalidraw/excalidraw";
|
|
31
|
+
import "@excalidraw/excalidraw/index.css";
|
|
32
|
+
|
|
33
|
+
export default function App() {
|
|
34
|
+
return (
|
|
35
|
+
<div style={{ height: "100vh" }}>
|
|
36
|
+
<Excalidraw />
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Excalidraw fills `100%` of the width and height of its parent. If the parent has no height, the canvas will not be visible.
|
|
43
|
+
|
|
44
|
+
## Next.js / SSR frameworks
|
|
45
|
+
|
|
46
|
+
Excalidraw should be rendered on the client. In SSR frameworks such as Next.js, use a client component and load it dynamically with SSR disabled.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
// app/components/ExcalidrawClient.tsx
|
|
50
|
+
"use client";
|
|
51
|
+
|
|
52
|
+
import { Excalidraw } from "@excalidraw/excalidraw";
|
|
53
|
+
import "@excalidraw/excalidraw/index.css";
|
|
54
|
+
|
|
55
|
+
export default function ExcalidrawClient() {
|
|
56
|
+
return (
|
|
57
|
+
<div style={{ height: "100vh" }}>
|
|
58
|
+
<Excalidraw />
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
// app/page.tsx
|
|
66
|
+
import dynamic from "next/dynamic";
|
|
67
|
+
|
|
68
|
+
const ExcalidrawClient = dynamic(
|
|
69
|
+
() => import("./components/ExcalidrawClient"),
|
|
70
|
+
{ ssr: false },
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
export default function Page() {
|
|
74
|
+
return <ExcalidrawClient />;
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
See the local examples for complete setups:
|
|
79
|
+
|
|
80
|
+
- [examples/with-nextjs](https://github.com/excalidraw/excalidraw/tree/master/examples/with-nextjs)
|
|
81
|
+
- [examples/with-script-in-browser](https://github.com/excalidraw/excalidraw/tree/master/examples/with-script-in-browser)
|
|
82
|
+
|
|
83
|
+
## LLM / agent tips
|
|
84
|
+
|
|
85
|
+
If an LLM or coding agent is setting up Excalidraw, these shortcuts usually save more time than re-prompting:
|
|
86
|
+
|
|
87
|
+
- Start with a plain `<Excalidraw />` in a `100vh` container. Add refs, `initialData`, persistence, or custom UI only after the base embed works.
|
|
88
|
+
- If the canvas is blank, check the CSS import and parent height first. Those are the two most common integration failures.
|
|
89
|
+
- In Next.js or other SSR frameworks, assume client-only rendering first. Use `"use client"` and `dynamic(..., { ssr: false })` before debugging hydration or `window is not defined` errors.
|
|
90
|
+
- If imports or entrypoints are unclear, inspect `node_modules/@excalidraw/excalidraw/package.json`. The installed package exports are the source of truth.
|
|
91
|
+
- Do not set `window.EXCALIDRAW_ASSET_PATH` unless you are intentionally self-hosting fonts/assets.
|
|
92
|
+
- When docs and generated code drift, copy the nearest working example from this repo, especially `examples/with-nextjs` or `examples/with-script-in-browser`.
|
|
93
|
+
|
|
94
|
+
## Migrating to `@excalidraw/excalidraw@0.18.x`
|
|
95
|
+
|
|
96
|
+
Version `0.18.x` removes the old `types/`-prefixed deep import paths. If you were importing types from `@excalidraw/excalidraw/types/...`, switch to the new type-only subpaths below.
|
|
97
|
+
|
|
98
|
+
| Old path | New path |
|
|
99
|
+
| --- | --- |
|
|
100
|
+
| `@excalidraw/excalidraw/types/data/transform.js` | `@excalidraw/excalidraw/element/transform` |
|
|
101
|
+
| `@excalidraw/excalidraw/types/data/types.js` | `@excalidraw/excalidraw/data/types` |
|
|
102
|
+
| `@excalidraw/excalidraw/types/element/types.js` | `@excalidraw/excalidraw/element/types` |
|
|
103
|
+
| `@excalidraw/excalidraw/types/utility-types.js` | `@excalidraw/excalidraw/common/utility-types` |
|
|
104
|
+
| `@excalidraw/excalidraw/types/types.js` | `@excalidraw/excalidraw/types` |
|
|
105
|
+
|
|
106
|
+
Drop the `.js` extension. The new package `exports` map resolves these paths without it.
|
|
107
|
+
|
|
108
|
+
These deep subpaths are for `import type` only. Runtime imports should come from the package root, plus `@excalidraw/excalidraw/index.css` for styles.
|
|
109
|
+
|
|
110
|
+
For example:
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import { exportToSvg } from "@excalidraw/excalidraw";
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Self-hosting fonts
|
|
117
|
+
|
|
118
|
+
By default, Excalidraw downloads the fonts it needs from the [CDN](https://esm.run/@excalidraw/excalidraw/dist/prod).
|
|
119
|
+
|
|
120
|
+
For self-hosting, copy the contents of `node_modules/@excalidraw/excalidraw/dist/prod/fonts` into the path where your app serves static assets, for example `public/`. Then set `window.EXCALIDRAW_ASSET_PATH` to that same path:
|
|
121
|
+
|
|
122
|
+
```html
|
|
123
|
+
<script>
|
|
124
|
+
window.EXCALIDRAW_ASSET_PATH = "/";
|
|
125
|
+
</script>
|
|
126
|
+
```
|
|
30
127
|
|
|
31
128
|
## Demo
|
|
32
129
|
|
|
33
|
-
|
|
130
|
+
Try the [CodeSandbox example](https://codesandbox.io/p/sandbox/github/excalidraw/excalidraw/tree/master/examples/with-script-in-browser).
|
|
34
131
|
|
|
35
132
|
## Integration
|
|
36
133
|
|
|
37
|
-
|
|
134
|
+
Read the [integration docs](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/integration).
|
|
38
135
|
|
|
39
136
|
## API
|
|
40
137
|
|
|
41
|
-
|
|
138
|
+
Read the [API docs](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/api).
|
|
42
139
|
|
|
43
140
|
## Contributing
|
|
44
141
|
|
|
45
|
-
|
|
142
|
+
Read the [contributing docs](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/contributing).
|