Commit Graph
602 Commits
Author SHA1 Message Date
David Luzar b03c3bb2c6 chore(packages/excalidraw): vendor roughjs as @excalidraw/sloppy (#12832)
* chore(packages/sloppy): vendor roughjs as @excalidraw/sloppy

- port roughjs 4.6.4 with hachure-fill, path-data-parser and points-on-path into packages/sloppy
- move points-on-curve and roughjs's Random into @excalidraw/math
- output is identical to roughjs 4.6.4 (tests/parity.test.ts)

* fix(packages/sloppy): don't change the caller's points in polygon pattern fills

The fillers rotate a polygon's points in place and back, which left float
drift in an element's points every time a sharp, pattern-filled line's
shape was regenerated.
2026-12-03 23:03:24 +01:00
Márk Tolmácsanddwelle 30a4c631a5 chore(repo): Move to pnpm (#12655)
* fix: Undeclared dependencies

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Rationalize package versions

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Remove old react app remnants

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Conversion to pnpm

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Circular deps #0

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: common package circular dependencies

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Move history and undo/redo to excalidraw/excalidraw

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: AppState broken up across package boundaries

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: renderElement and binding type racionalization

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Refactor linearElementEditor to not use types outside the package

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* chore: Do not import self barrel file

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: All circular dependencies except core

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: Bump pnpm to 11

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: SASS deprecation warnings

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Polynomial regular expression used on uncontrolled data

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Vercel deploy

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat: excalidraw/history package

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Polynomial regex in SVG payload decoding

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: emit the internal packages' types from the editor again

The editor advertises ./common/*, ./element/*, ./history/*, ./math/* and
./utils/* type subpaths, but without the path aliases tsc treats those
packages as external libraries and no longer emits them. Include their
sources in the editor's type build, and drop the relative cross-package
import that made element/ come out half-emitted.

* feat: export the history classes of the editor's API from the entry

onIncrement hands out StoreIncrement subclasses and applyDeltas takes
StoreDelta, so export them next to CaptureUpdateAction. Hosts then need no
dependency of their own on @excalidraw/history.

* chore: refuse to publish packages with npm or yarn

Only pnpm publish rewrites workspace:* dependencies and applies
publishConfig.exports, so a package published with another client can't be
installed.

---------

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
2026-12-01 22:17:47 +01:00
ea74995af2 feat(packages/excalidraw): Extended fonts support (#11601)
* feat: Extended fonts support

* Refactor fonts + improve picker

* Move font logic into AppFonts

* Consolidate the font metrics fallback

* chore: refresh history snapshot after rebase onto master

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* feat(editor): font provider search and hover-preview revert in the font picker

- optional `FontProvider.search` hook: matches and suggestions shared fairly
  across providers, "+N more" footer, "Did you mean" suggestions
- font preview text helpers
- revert a hover preview when the picker closes from outside (canvas click,
  compact mode); restore by cached id rather than selection

* fix(editor): font picker scene groups, search announcements and preview revert

- keep a hover preview out of the "In this scene" group while fonts register
- announce a searched family only from the search rows, not when it's listed
  already
- leave elements deleted meanwhile deleted when reverting a hover preview
- keep the focus in the picker after a selection that keeps it open while
  editing text
- skip the scene font reflow once the editor unmounted
- memoize the top picks, so hovering doesn't re-run their effects

* fix(editor): load fonts even when `document.fonts.check()` passes

Chrome's `check()` reports any family whose name matches an installed
system font as loaded, even while its web faces are unloaded (e.g. anyone
with Excalifont installed). Scene fonts then never got loaded explicitly,
so the first paint used the fallback font, and a font change measured text
with the fallback and never repaired it once the faces arrived (a wrong
bbox for good).

- scene font loading always calls `load()`, which settles right away
  (~0.1ms) when the faces are loaded already
- font family changes still redraw synchronously when `check()` passes,
  but load the faces regardless and re-measure when the load brought in
  faces that weren't loaded at measure time

Claude Opus 5.5 (xhigh)

* feat(fonts): custom fonts rework after the design review

Format and loading:

- a custom font id is `<provider>:<family>`. The provider key is `google`
  or a reverse-DNS name (`isValidFontProviderKey`,
  `GOOGLE_FONT_PROVIDER_KEY`)
- a custom font is registered under a generated CSS name
  (`xf-<slug>-<hash>`), so its id never reaches CSS
- restore keeps font families it doesn't know, instead of resetting them
- loading a font no longer rewrites elements. It invalidates caches, and
  only text measured before the font's metrics arrived gets repaired
- under collab, a scene with custom fonts no longer runs a font pass every
  second: only a family nothing of which has arrived yet schedules one
- a StrictMode remount no longer leaves the editor on a `Fonts` instance
  without its undo-safety hooks

Exports:

- `registerFontResolvers(resolvers)` registers resolvers for every image
  export of a page or worker, also exported from `@excalidraw/utils`. A
  per-call `config.fontResolvers` wins for the providers it names
- an export warns once per family it has no resolver for

Google Fonts, as a new entry `@excalidraw/excalidraw/fonts/google`:

- a catalog of the families with their vertical metrics, generated by
  `yarn gen:google-fonts` and append-only
- `createGoogleFontResolver()`: resolves a family through `css2`, retries
  transient failures, shares in-flight requests, and takes a `fetch` for
  servers
- `searchGoogleFonts`, `getGoogleFontPreviewText` and a list of default
  picks

Font picker and provider API:

- `availableFonts` and `search()` take `{ id, label }` entries besides
  plain names (`ProvidedFont`); search results are `{ kind, fonts }`
- typing a name no longer resolves it as a font id: the picker only offers
  what a provider lists or finds
- `fontPickerTip` replaces the picker's tip, i.e. to point at where a host
  manages its fonts
- `onNewFontUsed` is gone from `FontProvider`

Claude Opus 5.5 and Claude Fable 5.2 (effort 40 to 80)

* feat(fonts): Google catalog of text fonts only, with a browse list

- catalog: 1,895 families. Out are the 33 non-text families (symbols,
  emoji, knitting charts, SignWriting), Libertinus Math, which draws
  relation signs over the preceding letter, and the 28 families which
  take over 10 ms to draw a line of text in Chromium (median: 1.5 ms).
  Added since the first run: Agrave Pro, Firjar; kept: STIX Two Math and
  Noto Sans Math
- generator: the exclusion rules above, by classification and by name
  with the reason; a family new to Google's list whose font file looks
  slow to draw (huge outlines, colour layers) is held back until it's
  measured, `--allow` lets it in; output in prettier's format
- `loadMoreGoogleFonts` pages through the `GOOGLE_FONT_BROWSE_LIMIT` (100)
  most popular families, for a provider's `loadMore`; search still covers
  the whole catalog
- default picks are provisional, to be hand-picked before release

Claude Fable 5.2 (effort 30 to 80)

* feat(editor): font picker favorites, "Browse more fonts", faster list

- `fontFavorites={{ fonts, onChange }}`: the user's favorite fonts, kept
  by the host. A font is dragged onto a zone over the search to add it,
  and a favorite onto the same zone to remove it. Without the prop the
  picker has no favorites
- list order: fonts in the scene, favorites, then the available ones with
  the editor's own fonts first. A font only counts as in the scene once an
  element uses it
- `FontProvider.loadMore({ offset, limit, signal })`: a "Browse more
  fonts" row which pages through the provider's further fonts, and loads
  on by itself once clicked. What it loaded stays for when the picker
  reopens, and a font picked from it keeps its place. At the end, a
  provider with `search` gets a "Use search for more" note
- rows are memoized and skip rendering while off screen
  (`content-visibility`), so a list of a few hundred fonts stays
  responsive

Claude Fable 5.2 (effort 30 to 80)

* feat(app): resolve Google fonts on excalidraw.com, without the picker

What the app ships of the custom fonts: the package's Google Fonts
resolver alone. Nothing changes in the font picker, but a text in a Google
font - from a file, a shared link or a paste from another app such as
Excalidraw+ - renders in that font, and is listed among the scene's fonts.

- `fontProviders` with the resolver and no fonts on offer, no search
- the resolver is registered for image exports made outside of the editor
  (the frame snapshot for diagram-to-code), which otherwise draw such text
  in the fallback font

Claude Fable 5.2 (effort 30)

* fix(fonts): font repairs and retries found in review

- A font repair no longer lands during a text edit, where it took what
  had been typed out of undo's reach. It waits for the edit to be
  submitted, as it does for a drag.
- One loaded face no longer counts as the font being in for text which
  needs another `unicode-range` subset: such text is measured again once
  its subset arrives.
- A font file which failed to download is retried when the family is
  asked for again, i.e. by picking the font.
- New provider callbacks under the same key are used without rebuilding
  the `Fonts` instance.
- SVG export keeps a face whose `unicodeRange` is lowercase or uses
  wildcards.

Claude Fable 5.2, effort 80

* feat(fonts): drop 43 Google families the editor can't lay out reliably

The catalog goes from 1,895 to 1,852 families. Nothing has shipped, so
the entries are removed rather than kept.

- 12 whose text jumps when the text editor opens, as browsers don't
  agree on their vertical metrics, or whose line height is unusable.
- 29 whose lines the canvas and the text editor lay out at different
  widths in Chrome or Safari, with no setting to bring them together.
- 2 which don't draw as text fonts (Vibur, Libertinus Keyboard).

The generator names each with what was measured, and holds back a new
family whose font file shows the first kind. Provisional: the catalog
gets another pass before release.

Claude Fable 5.2, effort 80

* fix(editor): kern text the same on canvas, in the text editor and in SVG

Left on the default (`font-kerning: auto`), browsers skip the kerning
between a letter and a space in places: Chrome on canvas but not in the
DOM, Firefox everywhere. So a line was measured and drawn wider on canvas
than Chrome's text editor laid it out (6 px for "A V A T A R" in
Liberation Sans at 20 px), and wider in Firefox than in Chrome's editor.

Kerning is now `normal` wherever text is measured or drawn: the measuring
canvas, the element canvas, the text editor and exported SVG.

Claude Fable 5.2, effort 30

* fix(editor): wrap text and place the caret by the same kerning

Review follow-ups to the kerning change:

- Wrapping added up the widths of single-character tokens (and of the
  characters of a word too long for a line) one by one, which leaves out
  the kerning between them. "A V A T A R A V A T A R" in a 105 px box
  wrapped to three lines where the text editor shows two. Before a line
  breaks on such a sum, it's now measured as a whole.
- The hidden element which finds the caret for a click was still kerned
  with `auto`, so in Firefox the caret could land a character early.

Claude Fable 5.2, effort 80

* fix(editor): shape canvas text as a whole line, as the text editor does

Chrome's canvas shapes a line word by word by default. A font which picks
a letter's shape by what's around it, across spaces too (Caveat, Itim,
Sriracha), then measures and draws several px a line wider or narrower on
canvas than in the text editor, which the DOM lays out as a whole.

`textRendering = "optimizeLegibility"` has the canvas shape the whole
line. It changes nothing for a font without such rules, the built-in ones
included, and is set on the canvas only: the DOM, Firefox's canvas and
skia-canvas shape whole lines as it is.

Claude Fable 5.2, effort 80

* fix(editor): leave font-kerning on the browser's default

Kerning was set to `normal` wherever text is measured or drawn, so that
Firefox would kern a letter against a space as Chrome does. Set on the text,
it also has Firefox close up Japanese and Chinese: full-width punctuation
and kana lose their side space, by 7 to 22% on a line, in 17 Google
families and in system fonts such as Yu Gothic and Hiragino.

`font-kerning` is no longer set on the canvas, in the text editor or in
exported SVG. `textRendering = "optimizeLegibility"` stays on the canvas,
which is what brings Chrome's canvas to its text editor, the kerning next to
a space included.

The price: Firefox doesn't kern a letter against a space, so a line with
such pairs is a little wider there than in Chrome ("A V A T A R To WA" in
Liberation Sans at 20 px: 285 px against 273).

Claude Fable 5.2, effort 30

* feat(fonts): offer 9 Google families, not Google's whole list

The catalog held every family that passed the generator's checks (1,852).
It now holds the ones we offer: 9, picked by hand, each looked at on the
canvas and in the text editor at 16 to 36 px in Chrome and Firefox, on a
low and a high pixel density display. Safari 15.5 has seen all but Open
Sans and Bevan.

- handwriting: Kalam, Patrick Hand, Pacifico
- sans: Open Sans
- serif: Literata
- monospace: Fira Mono
- display: Bevan
- Japanese: Zen Maru Gothic
- Korean: Gowun Dodum

No Chinese family yet: none of Google's fits Simplified Chinese (LXGW
WenKai TC has the characters, in older forms than mainland's and with
Taiwan's punctuation), and a Traditional one alone would leave the larger
group out. Zen Maru Gothic has every kana and JIS X 0208 kanji, Gowun
Dodum every Hangul syllable, read from the font files.

All are under the SIL Open Font License with no reserved font name. All
but Zen Maru Gothic have the letters of Czech, Slovak, Polish, Hungarian,
Turkish and Romanian, also read from the font files: Google's "latin-ext"
label doesn't tell.

The generator works from that list (`OFFERED_FAMILIES`) and writes the
catalog in its order, so the order no longer follows Google's popularity
figures. A catalog can grow later; it can't shrink once a release has had
a name. `GOOGLE_FONT_DEFAULT_PICKS` is the same list.

Claude Fable 5.2, effort 30

* feat(fonts): list a family by a glyph of its own script

A Japanese or Korean family has a Latin name, and its row in the font
list looked like any other of its provider: the provider's icon, then the
name. Nothing said which script it writes.

The row now takes the family's preview text for its icon, written in the
family ("あ", "한"), where the provider's `getPreviewText` gives one. It
is the sample the top picks already show for a pinned family. A family
without one keeps the provider's icon.

`getPreviewText` is asked for every listed family, not only the pinned
ones; the answer is still kept for the session.

Claude Fable 5.2, effort 30

* feat(fonts): a provider's families get the icons our own fonts have

In the font list every family of a provider had the provider's icon. The
icon column said where a font comes from, the same on every row, and
nothing about the font. Our own fonts say what they're for there:
handwriting, text, code, headings.

A provider can now tell a family's kind: `getKind`, answering one of
`FontKind` ("hand-drawn", "normal", "code", "heading"). The row gets the
icon our own fonts of that kind have, so a host imports no icon of ours.
A row's icon is, in this order: the family's preview text (a glyph of its
script), the icon of its kind, the provider's `icon`, a normal font's.

`FontProvider.icon` is optional with that: it's what a family gets which
its provider says nothing about.

The Google catalog has a kind per family (`getGoogleFontKind`), set by
hand next to the name in the generator's `OFFERED_FAMILIES`: Google's own
categories file Bevan, a display face, as a serif. An entry is now
[name, unitsPerEm, ascender, descender, lineGap, kind, script?].

excalidraw.com's provider drops Google's icon, and passes the kind and
the preview text for the fonts it lists (the ones a scene uses).

fontPreviewText.ts is fontProviderInfo.ts now: one cache for what a
provider says about a family, the preview text and the kind.

Claude Fable 5.2, effort 30

* feat(fonts): offer "Browse more fonts" only when there are more

A provider able to page (`loadMore`) turned "Browse more fonts" on,
whether or not it had a font beyond the ones listed. One offering all of
its fonts up front, as the Google catalog's 9 are, got a button which
brought nothing and then went away.

The picker now asks for the first page as it opens, once per editor and
set of providers, and offers the button only if that brings a font it
doesn't list yet. Those fonts are what the first click lists; later pages
load as before.

Claude Fable 5.2, effort 30

* fix(fonts): findings of Astra's review

- Closing the font picker restored every selected element from the copy
  taken when it opened, as a newer version: whatever a collaborator had
  changed meanwhile was lost for everyone, and opening and closing the
  picker alone gave each element a new version. Now only a live preview
  is taken back, to the scene as it was when that preview started, and
  only what a preview changes: the font of a text and the layout that
  follows (its wrapping, size and position, on a sticky note its fitted
  font size; its container's size). A text edited during the preview
  gets its font back and is laid out anew. Whatever else is selected
  along with a text is never touched. A hover resets a container's size
  the same way, not the whole element.
- A headless export (no `document.fonts`, no `FontFace`) threw: on plain
  Helvetica text, on a font of a provider nobody configured, and on any
  custom font once a resolver was configured. A font face built its
  `FontFace` as it was created, and so did the registry for every
  built-in font. It's built when first asked for now, which such an
  export never does: nothing is installed or retried without a font set.
  Telling that a font is local, or registered, doesn't build the registry
  either (the font metadata, as on master; `hasCustomFamily`).
- Beyond what master could do: an SVG export embeds its fonts where
  there is no `window`, `document` or `FontFace` at all (i.e. Node, given
  a document to build in). A font face read `window.EXCALIDRAW_ASSET_PATH`
  unguarded, and asked its `FontFace` for the unicode range it covers
  when its descriptors named none; it covers everything then, as in CSS.
- `Fonts.loadElementsFonts(elements, ownerDocument)`, master's signature,
  threw: the second argument had become a `Fonts`. It takes either.
- The font picker called React 18's `useSyncExternalStore`, with React 17
  among the peer dependencies. `hooks/useSyncExternalStore` falls back to
  a subscription in an effect there, like `hooks/useTransition`.
- An export resolved the fonts of deleted elements, before it dropped
  them.
- An export loaded its fonts into the global document, whatever document
  it was given to draw in (`environment.document`): an editor in a popout
  window got them in its opener's, where its canvas can't use them. As on
  master, where it's an omission too. They go into the given document if
  it has a font set.
- "Browse more fonts" went missing with its group: when the scene uses
  every available font, the group is empty and wasn't rendered. A group
  with a footer is.

Left as they are, as rare: a collaborator moving or resizing a text or
its container within the seconds of someone's hover preview of it, a family picked in
a popout which another document registered, a provider added in the
middle of a gesture, a failing resolver asked three times by one export,
a slow pinned font overtaking a later pick, and the look-ahead's five
page limit.

Claude Fable 5.2, effort 30

* feat(fonts): favorites are pinned fonts

The font picker's "Favorites" are "Pinned" now, and so is everything
that names them:

- the prop: `fontFavorites` -> `pinnedFonts` (same shape, `fonts` and
  `onChange`)
- the list's section "Pinned", the drop zone's "Pin" and "Unpin"
- the locale keys `fontList.pinnedFonts`, `pinFont`, `unpinFont`

The tip at the bottom of the picker reads "Drag a font to pin". It spoke
of the top picks alone, while a drag also offers the pin zone, which only
shows up once the drag starts.

Claude Fable 5.2, effort 30

* feat(fonts): createGoogleFontProvider

A host had to put the Google provider together from the parts: the
resolver, the offered families, the search, the paging, the preview text
and, since this week, the kind. Each new part meant a change in every
host.

`createGoogleFontProvider()` in `fonts/google` returns the whole
`FontProvider`. `offerInPicker: false` leaves the fonts out of the font
picker (none listed, found by search or browsed to), while a scene's
Google fonts still render: what excalidraw.com ships, in one call now.
`resolve` takes a resolver of the host's own.

Claude Fable 5.2, effort 30

* feat(fonts): Escape closes the font picker; "Drop to pin" and a hint icon

- Escape closes the font picker, from its search too. It never did: the
  key took a hover preview back and left the popup open, as a focus
  moving out does. A live preview is still taken back, and the focus goes
  to the canvas, or back to the text being edited.
- The pin drop zone reads "Drop to pin" and "Drop to unpin".
- The hint "Drag a font to pin" has a drag-and-drop icon. A host's own
  `fontPickerTip` is shown as given.

Claude Fable 5.2, effort 30

* feat(app): keep Google's font stylesheets for offline use

Resolving a `google:` font asks Google for the family's stylesheet, which
lists its files. The service worker kept the files (the `.woff2` rule)
and not the stylesheet, so offline such a font resolved only for as long
as the browser's HTTP cache held it: a day, by Google's headers. After
that the text fell back to another font, its files in the cache or not.

A runtime caching rule for `fonts.googleapis.com/css2` keeps it for 90
days, served from the cache and refreshed in the background. Nothing is
fetched ahead: a stylesheet is stored when its family is first resolved.

Tried in a production build with the network cut for everything but
localhost: with the HTTP cache cleared, a text in Kalam is drawn in Kalam
with the rule and in the fallback font without it.

Claude Fable 5.2, effort 30

* docs: changelog for custom fonts

Claude Fable 5.2, effort 30

* fix(fonts): a font picked after its hover preview settled can be undone

Hovering a font in the picker previews it on the selected text without
capturing it. A font repair landing meanwhile (the hovered font itself
finishing to load, or any other) was committed as never-to-be-captured,
which took the previewed font into the store's snapshot along with it.
Picking that font then changed nothing against the snapshot: no undo
entry, and undo left the new font in place.

A live hover preview now counts among the changes yet to be captured, as
a drag and a text edit do, so repairs wait for it to end. The preview's
own redraw, once its font has loaded, runs as part of the preview.

Found by mtolmacs in review.

Claude Fable 5.2, effort 30

* fix(editor): load the custom fonts of a dropped scene

Dropping an `.excalidraw` file applied its scene without asking for its
fonts, and nothing else resolves a scene's custom fonts on that path, so
its text stayed in a fallback font until a reload. The "Open" action
asked already.

Found by mtolmacs in review.

Claude Fable 5.2, effort 30

* fix(build): keep the Google font catalog out of the package's fonts folder

The package build names a code-split chunk by its source folder, so the
catalog, imported from `fonts/google/`, was emitted as
`dist/prod/fonts/google/catalog-<hash>.js`: a script inside the folder of
font files which hosts copy over to serve them themselves (Excalidraw+,
and `examples/with-nextjs` here).

It's an entry point of its own now, emitted next to `fonts-google.js` as
`fonts-google-catalog.js`.

Claude Fable 5.2, effort 30

* feat(fonts): pinned fonts are favorites again

"Pin" already names what a drag onto the top picks does, so a second
kind of pinning in the same picker was easy to confuse with it. The
naming goes back:

- the prop: `pinnedFonts` -> `fontFavorites` (same shape, `fonts` and
  `onChange`)
- the list's section "Favorites", the drop zone's "Drag to favorite" and
  "Remove favorite"
- the locale keys `fontList.favoriteFonts`, `addToFavorites`,
  `removeFromFavorites`

The tip stays "Drag a font to pin".

Claude Fable 5.2, effort 10

---------

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-12-01 12:42:28 +00:00
David Luzar 4eb1e648aa ci(repo): track bundle size and performance of master builds (#12469)
- `Stats` workflow on master: posts the production build's file sizes (raw, gzip, Brotli; initial load vs. lazy; bytes per source package) and, once staging serves the commit, its page-load and pan/zoom measurements to the Excalidraw+ backend; OSS_STATS_TOKEN lives in the master-only `stats` environment
- `scripts/stats/`: bundle-stats Vite plugin and wrapper config (`yarn stats:bundle`), the Playwright runner (`yarn stats:perf`) and the poster
- `yarn stats:compare`: builds the checkout, serves it with `vite preview` and compares it with staging (alternating loads, Mann-Whitney U test); prints a table or writes CSV with `--out`
- `excalidraw:app-start` mark in the app's entry, ending the runs' "HTML + JS" phase
- `playwright` 1.58.2 dev dependency (installs no browsers by itself)

Claude Opus 5.5 (xhigh)
2026-10-27 15:34:46 +01:00
Márk Tolmácsanddwelle cd514d72d6 feat(editor): LaserPointer based freedraw (#11507)
Introduces constant width freedraw mode, keeping the original variable mode as default.

---------

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
2026-06-24 09:16:22 +02:00
Márk Tolmácsanddwelle 3004c642da fix: Fractional index validation (#11258)
- Vendored fractional-indexing and converted to TypeScript
- Stricter index format validation in fractional-indexing
- Added format validation to fractional index validation

---
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
2026-05-04 11:37:17 +02:00
David Luzar d080833f4d chore: bump typescript@5.9.3 (#10431) 2025-12-01 22:37:42 +01:00
Márk Tolmácsanddwelle 8fd970320e chore: Uncap the nodejs version requirement (#10238)
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
2025-11-03 17:30:35 +01:00
Marcel Mraz 258605d1d5 chore: release multiple packages (#9698) 2025-06-30 12:19:15 +02:00
Narek Malkhasyan e058a08b33 fix: use rimraf instead of rm -rf (#9460) 2025-05-07 14:13:27 +02:00
Marcel Mraz 432a46ef9e refactor: separate elements logic into a standalone package (#9285) 2025-03-26 15:24:59 +01:00
Marcel Mraz 21ffaf4d76 refactor: auto ordered imports (#9163) 2025-03-12 15:23:31 +01:00
David Luzar d92384b77d revert: vite@6 -> vite@5 (#9220) 2025-03-04 17:45:52 +00:00
David Luzar d21c6a1bc6 chore: bump vite@6.x (#9210) 2025-03-04 14:00:13 +01:00
Marcel Mraz ecef5d12f4 chore: release @excalidraw/excalidraw@18.0.0 🎉 (#9127) 2025-02-28 16:49:09 +01:00
David Luzar 31e8476c78 chore: upgrade to react@19 (#9182) 2025-02-25 19:18:42 +01:00
Aakansha Doshi 57cf577376 fix: cleanup scripts and support upto node 22 (#8794) 2024-11-11 23:56:00 +05:30
Aakansha Doshi da33481fa3 chore: support upto node 22.x.x (#8755) 2024-11-04 18:57:40 +05:30
David Luzar 80f3b75d42 chore: revert vite 5.4.2 -> 5.0.12 (#8499) 2024-09-12 12:56:45 +02:00
Aakansha Doshi 51ea184938 build: upgrade vite to 5.4.x, vitest to 2.x and related vite packages (#8459)
* build: upgrade vite to 5.x, vitest to 2.x and related vite packages

* upgrade vitest-ui and coverage

* pass empty set to fix type error and update snap

* set ignoreEmptyLines to false

* update threshold

* update coverage threshold

* downgrade vite-plugin-pwa as its better to push separately with testing

* add package resolutions for strip-ansi, string-width and wrap-ansi

* disable pwa

* only add resolution for strip-ansi
2024-09-05 18:35:36 +05:30
Márk Tolmácsanddwelle f4dd23fc31 chore: Unify math types, utils and functions (#8389)
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
2024-09-02 22:23:38 +00:00
David Luzar b427617f66 build: add rm:build, rm:node_modules & clean-install scripts (#8323) 2024-08-05 23:37:33 +02:00
Márk Tolmács c641860cb1 fix: CVE-2023-45133 (#7988)
* Upgrade @babel/* versions to 7.24 to ensure non-vulnerable Babel versions
* Pinning React version to 18.2.0 exactly, avoiding test-utils type version clashes
* Fix warning message on yarn start
* Moving react to peer dependencies
* Moving app dependencies from workspace into app
* Bump vitest to 1.6.0 to fix history.test.tsx breaking

---------

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
2024-08-02 14:44:38 +02:00
David Luzar cc4c51996c build: specify packageManager field (#8010) 2024-05-14 10:45:27 +02:00
Andreas GebhardtandAakansha Doshi 6539029d2a fix: docker build of Excalidraw app (#7430)
* fix: docker build of Excalidraw app

Fixes #7403.

* deps: update (container) Nginx to 1.24

---------

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
2024-05-07 18:00:58 +05:30
Márk Tolmács f79fb9aae2 chore: Bump vitest to 1.5.3 to support VSCode vitest Extension (#7968)
Bump vitest to 1.5.3 to support VSCode vitest Extension

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
2024-05-01 20:47:52 +02:00
Ryan Dianddwelle 88812e0386 feat: resize elements from the sides (#7855)
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
2024-04-30 18:05:00 +02:00
dependabot[bot] 678bb2b819 build(deps-dev): bump vite from 5.0.6 to 5.0.12 (#7586)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.0.6 to 5.0.12.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.0.12/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.0.12/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-24 19:29:50 +05:30
Aakansha Doshi 4f0a2a9593 docs: add next js with app router example (#7552)
* move the existing example to with-script-in-browser

* Add example with next js app router

* disable ssr for excalidraw client comp

* typo

* update output dir

* don't include nextjs example in tsconfig

* remove meta.json

* lint

* remove example.ts

* port

* move the examples outside packages and use the deps as workspaces in examples

* update gitignore

* fix example

* update path of build dir

* fix

* fix scripts

* try local path

* fix

* update commands

* fix

* fix

* fix script

* skip ts

* disable ts

* add vercel.json

* install

* update tsconfig

* fix lint

* remove console.log

* lets see if this works

* revert

* remove ts nocheck

* add types and some utils in nextjs example

* fix types

* updatw example and remove nextjs dynamic syntax so we don't import excal twice

* move both examples to workspaces and create generic example to be used by browser and next js both

* copy the static assets to nextjs

* fix ts config

* render custom menu items

* fix custom footer

* fix types in browser example

* use regular imports for importing excal and import it using dynamic next js in app router instead

* Add example for pages router

* fix css discrepancies

* fix css

* configure output dir

* fix

* fix css

* rename to with-nextjs

* move components to examples/excalidraw/components
2024-01-24 17:07:54 +05:30
Aakansha Doshi a8064ba3ee build: Welcome ESM and Bye Bye UMD (#7441)
* build: Welcome ESM and Bye Bye UMD

* remove package

* create unbundled esm build

* update script for example

* fix typo

* dummy commit

* update autorelease script to build esm

* revert dummy commit

* move react, react-dom and testing library to dev dependencies

* remove entry.js, publicPath and yarn install:deps script

* fix

* upgrade esbuild to fix glob import error for locales

* remove webpack chunk names as thats not needed anymore

* marking the code sideeffects free

* make the library tree-shakeable and move fonts to fonts directory

* allow side effects for css, scss files

* remove tree-shaking

* comment code for tree shaking

* move to vite for example

* bye bye webpack

* ignore ts

* separate build and output dir

* use esbuild for creating bundle for example

* update output dir

* lint

* create browser dev build with source maps and prod with minification

* add dev and prod builds for bundler

* lint

* update script

* remove await

* load prod build

* create minified build in dist

* prod and dev builds using export field

* remove import.meta

* dummy

* define import.meta prod and dev

* fix

* export types

* add types field

* typo

* lint

* Update scripts/buildPackage.js

* move types inside export

* newline
2024-01-01 20:18:44 +05:30
David Luzar 20e3acf7a6 feat: bump socket.io-client & collab tweaks (#7444) 2023-12-16 00:23:59 +01:00
Aakansha Doshi 88a2b286c7 feat: move utils to utils package and make @excalidraw/utils a workspace (#7432)
* feat: move utils to utils package and make @excalidraw/utils a workspace

* remove esm and update types path

* remove esm script

* fix package.json and yarn.lock

* update path

* fix

* fix lint and test
2023-12-13 21:51:27 +05:30
Aakansha Doshi d6cd8b78f1 build: decouple package deps and introduce yarn workspaces (#7415)
* feat: decouple package deps and introduce yarn workspaces

* update root directory

* fix

* fix scripts

* fix lint

* update path in scripts

* remove yarn.lock files from packages

* ignore workspace

* dummy

* dummy

* remove comment check

* revert workflow changes

* ignore ws when installing gh actions

* remove log

* update path

* fix

* fix typo
2023-12-12 11:32:51 +05:30
Aakansha Doshi b7d7ccc929 fix: env variable for text-to-diagram and use frozen lock file when install deps in excalidraw-app (#7409) 2023-12-07 19:32:19 +05:30
Aakansha Doshi f14ad61bd0 build: move build process and excalidraw-app dependencies in its own package.json (#7021)
* build: move build process and excalidraw-app dependencies in its own package.json

* fix

* fix public path

* move bug-issue-template to excalidraw-app

* make env vars accessible in excalidraw app

* update build script

* install when building

* add ts ignore

* fix build-version script

* update config in vercel.json

* add vercel config for example

* fix vercel config

* update install script in vercel

* update install script in lint.yml

* update install script in test workflows

* push locales to locales folder pwa

* add favicons to manifest

* move react to peer deps in editor

* fix ts

* Enable vite intellisense

* add global.d.ts for excalidraw-app

* remove console.log

* remove react, react-dom and vite from excalidraw-app deps

* increase size limit
2023-12-07 16:39:11 +05:30
Aakansha Doshi 8963baf5ad chore: upgrade to vite 5.x and vitest 1.x (#7407)
* chore: upgrade to vite 5.x and vitest 1.x

* fix coverage

* move to ESM for vite config

* use ESM for vitest
2023-12-07 15:30:08 +05:30
Aakansha Doshi 557add5bf7 feat: Support Mermaid Class diagrams 🥳 (#7381)
* feat: support mermaid class diagrams

* upgrade mermaid-to-excalidraw

* upgrade mermaid-to-excalidraw

* add sequence diagrams in supported chart types

* upgrade mermaid-to-excalidraw

* update i18n
2023-12-06 21:31:54 +05:30
dependabot[bot] a04cc707c3 build(deps-dev): bump vite from 4.4.2 to 4.4.12 (#7393)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.4.2 to 4.4.12.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v4.4.12/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.4.12/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-06 15:31:44 +05:30
David Luzar f8d5c2a1b6 build: allow a range of major node versions (#7306) 2023-11-17 14:23:19 +01:00
Aakansha Doshi 23b24ea5c3 build: use caret for specifying node version to avoid major upgrades automatically (#7297) 2023-11-16 16:18:38 +05:30
Aakansha Doshi 54153629c0 chore: update release scripts (#7282)
* chore: update release scripts

* update docs
2023-11-14 16:37:57 +05:30
David Luzar 7b00089314 chore: bump @excalidraw/random-username (#7272) 2023-11-11 19:23:22 +01:00
Aakansha Doshianddwelle e8def8da8d feat: Support mermaid flowchart and sequence diagrams to excalidraw diagrams 🥳 (#6920)
* feat: integrate mermaidToExcalidraw

* create mermaid to excal dialog

* allow mermaid syntax and export in preview

* fix

* fix webpack config

* fix markdown error by using named export

* center preview

* set elements as selected when inserted onto canvas

* persist mermaid data to storage

* store canvas data in refs

* load mermaid lazily

* tweak design

* compute width, height correctly for arrows

* fix undefined vertex issue

* add mermaid icon in dropdown

* add a note in dialog

* reset preview when error

* show error in preview when error

* show mermaid error messgae react way

* design tweaks

* add example and docs link

* fix

* tweak design to remove scroll bar

* show a spinner unless mermaid loaded

* regenerate ids when needed via programmatic api, this makes sure for mermaid diagrams ids are regenerated

* tweak

* add option to transform viewport to scene coords in transform api

* make opts optional and use 100% zoom when inserting to canvas

* fix arrow bindings in safari and firefox

* fix elements insert position and viewport centering

* fix: Update start/end points by 0.5 so bindings don't overlap with start/end bound element coordinates.

* defer rendering the preview

* tweak text

* fix tests

* remove only

* make design responsive

* fix: show extra tools dropdown in mobile

* fix mobile css

* width auto

* upgrade mermaid-to-excalidraw

* don't pass appState in deps as its not used

* upgrade mermaid-to-excalidraw to fix firefox issue

* use types from mermaid-to-excalidraw

* upgrade mermaid-to-excalidraw

* use stable version of mermaid-to-excalidraw

* upgrade mermaid-to-excalidraw

* fix width of shapes toolbar for smaller screen size and also fix regression of mobile menu

* use i18n

* better api

* enable test coverage in ui

* Add tests

* use common utils to update and get text editor

* updgrade mermaid-to-excalidraw to support sequence diagrams

* fix test

* don't update arrow container height anytime in when redrawing text bounding box

* increase size limit

* increase size limit of vendor to 900kb

* use openDialog for mermaid

* upgrade mermaid-to-excalidraw

* update frame id post generation

* upgrade mermaid-to-excalidraw to add entity codes support

* update size limit

* upgrade mermaid-to-excalidraw package with frame api changes

* upgrade mermaid-to-excalidraw to remove directive and use config

* don't highlight mermaid tool and remove unused api setSelection

* stop using loading state to update text area

* move some styling to scss

* review fixes

* use modifiedTableIcon props and remove stale snap

* css

* dialog css

* fix snap

* use dialog border

* change mermaidToExcalidrawLib to state

* better styling of errors

* make modal bigger

* fix mobile

* update snaps

* fix icon color

* fix dark mode insert button color

* horizontally center spinner

* render canvas conditionally on loaded state

* rd tweaks

* tweak class names

* remove max height

* typo in example

* upgrade mermaid-to-excalidraw

* simplify error state

* fix height & overflow on vertical breakpoint

* fix lint

* show errors in overlay

* set textarea font family

* reduce opacity

* update snap

* upgrade to mermaid  0.1.2

---------

Co-authored-by: dwelle <luzar.david@gmail.com>
2023-11-03 17:41:34 +05:30
Preetanddwelle d2a508104e fix: Better fill rendering with latest RoughJS (#7031)
Co-authored-by: dwelle <luzar.david@gmail.com>
2023-10-20 15:08:24 +02:00
Areanddwelle 2e61926a6b feat: initial Laser Pointer MVP (#6739)
* feat: initial Laser pointer mvp

* feat: add laser-pointer package and integrate it with collab

* chore: fix yarn.lock

* feat: update laser-pointer package, prevent panning from showing

* feat: add laser pointer tool button when collaborating, migrate to official package

* feat: reduce laser tool button size

* update icon

* fix icon & rotate

* fix: lock zoom level

* fix icon

* add `selected` state, simplify and reduce api

* set up pointer callbacks in viewMode if laser tool active

* highlight extra-tools button if one of the nested tools active

* add shortcut to laser pointer

* feat: don't update paths if nothing changed

* ensure we reset flag if no rAF scheduled

* move `lastUpdate` to instance to optimize

* return early

* factor out into constants and add doc

* skip iteration instead of exit

* fix naming

* feat: remove testing variable on window

* destroy on editor unmount

* fix incorrectly resetting `lastUpdate` in `stop()`

---------

Co-authored-by: dwelle <luzar.david@gmail.com>
2023-10-05 17:05:16 +02:00
a376bd9495 feat: partition main canvas vertically (#6759)
Co-authored-by: Marcel Mraz <marcel.mraz@adacta-fintech.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2023-08-12 22:56:59 +02:00
Aakansha Doshi b85d5fa12b test: add coverage report for PR (#6840)
* test: add coverage report for PR

* gh token

* fix

* fix

* add reporter

* fix

* enable v8 for coverage

* no watch

* test

* add threshold

* fix

* change name so the action isn't required

* change job name

* rename job so it doesn't collid with test required check

* remove log
2023-08-01 16:13:04 +05:30
David Luzar 12e37e3dd2 fix: forgotten REACT_APP env variables (#6834) 2023-07-31 15:29:24 +02:00
48924688c7 build: migrate to Vite 🚀 (#6818)
* init

* add: vite dev build working

* fix: href serving from public

* feat: add ejs plugin

* feat: migrated env files and ejs templating

* chore: add types related to envs

* chore: add vite-env types

* feat: support vite pwa

* chore: upgrade vite pwa

* chore: pin node version to 16.18.1

* chore: preserve use of nodejs 14

* refactor: preserve REACT_APP as env prefix

* chore: support esm environment variables

* fix ts config

* use VITE prefix and remove vite-plugin-env-compatible

* introduce import-meta-loader for building pacakge as webpack isn't compatible with import.meta syntax

* lint

* remove import.meta.env in main.js

* set debug flag to false

* migrate to vitest and use jest-canvas-mock 2.4.0 so its comp
atible with vite

* integrate vitest-ui

* fix most of teh test

* snaps

* Add script for testing with vite ui

* fix all tests related to mocking

* fix more test

* fix more

* fix flip.test.tsx

* fix contentxmenu snaps

* fix regression snaps

* fix excalidraw.test.tsx and this makes all tests finally pass :)

* use node 16

* specify node version

* use node 16 in lint as well

* fix mobile.test.tsx

* use node 16

* add style-loader

* upgrade to node 18

* fix lint package.json

* support eslint with vite

* fix lint

* fix lint

* fix ts

* remove pwa/sw stuff

* use env vars in EJS the vite way

* fix lint

* move remainig jest mock/spy to vite

* don't cache locales

* fix regex

* add fonts cache

* tweak

* add custom service worker

* upgrade vite and create font cache again

* cache fonts.css and locales

* tweak

* use manifestTransforms for filtering locales

* use assets js pattern for locales

* add font.css to globIgnore so its pushed to fonts cache

* create a separate chunk for locales with rollup

* remove manifestTransforms and fix glob pattern for locales to filter from workbox pre-cache

* push sourcemaps in production

* add comments in config

* lint

* use node 18

* disable pwa in dev

* fix

* fix

* increase limit of bundle

* upgrade vite-pwa to latest

* remove public/workbox so workbox assets are not precached

* fon't club en.json and percentages.json with manual locales chunk to fix first load+offline mode

* tweak regex

* remove happy-dom as its not used

* add comment

* use any instead of ts-ignore

* cleanup

* remove jest-canvas-mock resolution as vite-canvas-mock was patched locking deps at 2.4.0

* use same theme color present in entry point

* remove vite-plugin-eslint as it improves DX significantly

* integrate vite-plugin-checker for ts errors

* add nabla/vite-plugin-eslint

* use eslint from checker only

* add env variable VITE_APP_COLLAPSE_OVERLAY for collapsing the checker overlay

* tweak vite checker overlay badge position

* Enable eslint behind flag as its not working well with windows with non WSL

* make port configurable

* open the browser when server ready

* enable eslint by default

---------

Co-authored-by: Weslley Braga <weslley@bambee.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2023-07-27 23:50:11 +05:30
Aakansha Doshi 8104068bd5 revert: "build: Migrate to Vite 🚀" (#6814)
Revert "build: Migrate to Vite 🚀 (#6713)"

This reverts commit e93bbc5776.
2023-07-26 22:34:06 +05:30