mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-12-05 18:55:28 +03:00
fix/hit-cache-version
9
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
548eff0c3d |
feat(packages/excalidraw): [ui] rewrite ui regions (#11787)
* feat(packages/excalidraw): [ui] rewrite ui regions * feat(packages/excalidraw): [ui] keep footer + status overlay within editor bounds The top and center regions move into `.exc-region-mesh`, a sibling of `.exc-region-bottom` inside `.exc-regions` (a `minmax(0,1fr) auto` two-row grid). The footer band and the toast/scroll-back overlay no longer share column tracks with the top row, so wide top-left/top-right content can no longer push them past the editor edge, and nothing in the footer can displace the toolbar. The mesh's side columns keep their content floors (`minmax(auto, 1fr)`), so the top row negotiates width as in production: toolbar exactly centered while both sides fit, shifted aside once one side outgrows its share, and overflowing to the right (clipped at the editor edge) only when nothing fits. Host slots stay rigid at their intrinsic width; the collaborator list is the one flexible piece, collapsing avatars into the "+N" pill (flex-basis 0, so the avatar-count ResizeObserver can't feed back into layout). The desktop top-right occupants are wrapped in the shared `.exc-region-top-right-content` cluster. Claude Opus 5.5 (xhigh) * feat(packages/excalidraw): [ui] flush UI area with docked sidebar The layer-ui wrapper (and with it the ViewportStatusFrame border, which tracks its width) now stops at a docked sidebar's visible edge instead of the --right-sidebar-width column it reserves — the sidebar's 8px outer margin was a dead gap between the UI area and the sidebar. The regions container compensates with a matching right inset so right-aligned UI (and the status stack's center) keeps its previous visual position. Also moves the in-flow mobile bottom-bar status-stack rule inside the mobile block: it must out-rank the standalone mobile stack rule (which re-adds the absolute positioning the regions model removed from the base rule), else the scroll-back button paints over MobileShapeActions instead of stacking above it. Claude Fable 5 * feat(packages/excalidraw): [ui] stack top + center regions in three columns Replaces the 3×4 mesh with three column stacks: each column is a flex column of its top region and the center region below it, so a center region clears exactly its own column's top region. The mesh needed spanning rows that absorb overhangs to express the same dependencies, plus the invariant that only the top regions may occupy a single track. Only the top regions size the columns: the center regions have `contain: inline-size`, so a wide styles panel overflows toward the canvas instead of widening its column and offsetting the toolbar. The top-row width negotiation is unchanged (`minmax(auto,1fr) auto minmax(auto,1fr)`), and a real column-gap replaces the toolbar's inline margins now that there are no zero-height rows for gaps to double up in. Behavior change: the stats panel now clears only the top-right UI — a top-left UI taller than the top-right no longer pushes it down. The empty center-center region is dropped, and the status stack is absolutely positioned against `.exc-regions` instead of being a grid item spanning both rows. Claude Opus 5.5 (xhigh) * fix(packages/excalidraw): [ui] bound the stats panel; RTL docked-sidebar inset The stats panel now scrolls within its region like the styles panel, instead of running past the footer and covering the help button in short windows. The inset that keeps region content clear of a docked sidebar used a physical `right`, but the sidebar docks on the left in RTL — so the 8px went to the free edge and the toolbar sat 4px off. It's now `inset-inline-end`. Claude Opus 5.5 (xhigh) * feat(packages/excalidraw): [ui] make regions positioning contexts Every region is now `position: relative`, so absolutely positioned host content anchors to its own region. Excalidraw+ hangs its call tray below the top-right UI with `absolute top-10 right-0`; without a positioned region it anchored to `.exc-regions` instead, which lands in the same spot in LTR only by coincidence and on the wrong side in RTL. Claude Opus 5.5 (xhigh) * feat(packages/excalidraw): [ui] render host top-right UI alongside defaults on phone On phones, `renderTopRightUI` content used to replace the editor's top-right controls (sidebar trigger, pen-mode button) — any non-nullish return value hid them. It now renders next to them, same as on desktop and as before the new mobile layout (#9996). excalidraw.com returns null on phones, so it's unaffected; Excalidraw+ already patched its fork to render both. Claude Opus 5.5 (xhigh) * feat: Progressive collapse Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * feat: Region API with priority-based collapse and overflow menu Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * feat: Vertical and footer region collapse, phone mapping, status stack placement Signed-off-by: Mark Tolmacs <mark@lazycat.hu> * fix(packages/excalidraw): [ui] let shrink items shrink in the top-left region The floor counts shrink items at their minWidth, but the top-left grid track sized to the content's min-content, so a nowrap item (e.g. a host scene name) overflowed the region under the toolbar instead of truncating. Claude Opus 5.5 (reasoning: xhigh) * fix(packages/excalidraw): [ui] region floors stuck at 0 or too small - compute the floor before the budget check: a floor measured before the items' tunneled content rendered (0px) shrank the region to 0, which left no budget, so the floor was never re-measured (fresh load at a narrow width put the top-right UI over the toolbar) - count gaps for displayed zero-width items (e.g. absolutely positioned host content), which still take a gap in the row - user list minWidth includes the current user's pill (57px, not 36px) Claude Opus 5.5 (reasoning: xhigh) * fix(packages/excalidraw): [ui] compute the toolbar fold count analytically Every foldable tool is as wide as the hand tool, so the fold count is a closed-form function of the region's width — no fold-and-remeasure loop. Folds land in the same frame as the resize (flushSync in the ResizeObserver), resize down/up end in the same state, and an open "more tools" menu no longer corrupts the cached tool widths (it ratcheted the toolbar track until reload). * fix(packages/excalidraw): [ui] measure the editor interface before first paint The constructor can't measure the container, so the first render always assumed a desktop editor with the full UI; a tablet-sized editor painted the full toolbar and switched to the compact one on some later render. * fix(packages/excalidraw): [ui] no layout shifts around the collaborator list - floored top-right content can shrink to the floor, so the list no longer renders a frame with the avatars of its previous width (overflowing under the toolbar) - the list re-renders in its ResizeObserver callback, before paint (it was a frame late e.g. when a host item next to it appeared) - the list is as tall as the buttons next to it (it grew the row by 1px) * feat(packages/excalidraw): [ui] replace region "⋯" menus with collapse="hide" A second "⋯" next to the toolbar's own is confusing. Items now either adapt (`render`) or go away (`hide`, with 32px to spare), on desktop and phone. The stats panel just scrolls down to 120px, like the styles panel. * feat(packages/excalidraw): [ui] keep region items collapsed on tablets The compact UI below 1180px frees room, so items collapsed at a wider editor expanded again — they came and went while resizing. * fix(packages/excalidraw): [ui] don't clip the styles and stats panel shadows Their region items were scroll containers on top of the panels' own scrolling. * feat(excalidraw-app): [ui] hide the promo while collaborating or when it doesn't fit * fix(packages/excalidraw): [ui] keep the styles panel clear of the minimap The minimap (from master, ported into the bottom-left region) floats above the canvas actions, in the left column's way. Its region now stops above it — the region's budget follows, so the panel scrolls — instead of the hardcoded MINIMAP_RESERVED_HEIGHT the old max-height used. * fix(packages/excalidraw): [ui] phone: "more tools" menu opens above the scroll-back button The status stack kept its z-index inside the bottom bar (it applies to a static flex item too), which put it above the toolbar's menu. * fix(packages/excalidraw): [ui] RTL: follow frame inset on the docked sidebar's side The inset was a physical `right`, but the sidebar docks on the left in RTL: the frame was drawn over the sidebar and left a sidebar-wide strip of canvas outside it. --------- Signed-off-by: Mark Tolmacs <mark@lazycat.hu> Co-authored-by: Mark Tolmacs <mark@lazycat.hu> |
||
|
|
e1b7aacb35 |
feat(packages/excalidraw): replace the export functions with exportScene (#12347)
* [export] rewrite - init * restore elements + filter deleted in export API (restores #11470 behavior) * fix snaps * port export callers added on master to the new API + snaps - renderOverrides (#12100), sticky notes (#12064) and arrow-label hole (#10947) tests called the old positional exportToSvg/exportToCanvas - embedded-scene snapshots gain master's new element fields (created, baseFontSize, labelPosition); decoded payloads match master's Claude Opus 5.5 (xhigh) * restore elements in embedded scene + json clipboard export (restores #12060 behavior) - master's #12060 made every public export entry point restore its input (legacy elements reach lower-level code with `created: null`), incl. the PNG metadata embed and the json clipboard copy in the removed @excalidraw/utils wrappers - SVG embed now serializes the restored, non-deleted elements (same as master's utils path), PNG embed serializes restoreElements(data.elements) and json clipboard copies the non-deleted restored elements - port #12060's utils tests to the new API, observing renderers/serializer instead of the (now identical) scene export functions Claude Opus 5.5 (xhigh) * make config.canvasBackgroundColor the single export background knob - background resolved once in configExportDimension; exportToSvg no longer reads appState.exportBackground (now omitted from ExportSceneData's appState type), and honors `canvasBackgroundColor: false` - outline arrowheads (circle/triangle/diamond_outline, cardinality_zero_*) are filled with the resolved background color, also when the background isn't painted (as on master) — the canvas path filled them transparent, showing the arrow's shaft through them; SVG ignored the config color - JPEG: `canvasBackgroundColor: false` falls back to the default background (+ warning) instead of rendering black; no more warning for the default - callers (exportCanvas, ImageExportDialog, library/chart/publish previews, AI) pass the background via config only Claude Opus 5.5 (xhigh) * resolve export theme before creating frame labels - frame labels were colored by appState.exportWithDarkMode, ignoring config.theme (export dialog's dark toggle), and in dark exports the dark-theme label color got dark-filtered again by the renderer (#7a7a7a -> #848484) - theme is now resolved once in configExportDimension; dark labels are pre-reverted so they render with the editor's frame name color Claude Opus 5.5 (xhigh) * drop appState.exportWithDarkMode theme fallback in export - `config.theme` is the only theme input (defaults to light); the type already omitted `exportWithDarkMode` from `data.appState` - callers that relied on the fallback (PublishLibrary item preview, AI frame export) pass `theme` explicitly, keeping their behavior Claude Opus 5.5 (xhigh) * exportToClipboard: don't restore appState before exportToSvg (already restored there) Claude Opus 5.5 (xhigh) * remove unused getExportSize, type getCanvasSize's [x, y, width, height] (not Bounds) Claude Opus 5.5 (xhigh) * fix typos in export comments/JSDoc Claude Opus 5.5 (xhigh) * port with-script-in-browser example to the new export API - exportToSvg/Blob/Canvas/Clipboard take `{ data, config }`; theme via `config.theme`, padding 10 kept explicit (new default is 0) - dropped the no-op `width`/`height` appState overrides from the SVG export Claude Opus 5.5 (xhigh) * call getDimensions once, ignore it when widthOrHeight is set - with an explicit `fit: "contain"`, getDimensions ran twice (the second time on its own output); it now supplies width/height (+ scale) once, and `contain` scales the content into that frame - getDimensions + widthOrHeight both applied; widthOrHeight now wins (with a warning), like width/height/maxWidthOrHeight already did - `fit: "none"` (the E+ export server path) renders identically Claude Opus 5.5 (xhigh) * type the export size options as mutually exclusive - `width`/`height`, `maxWidthOrHeight`, `widthOrHeight` and `getDimensions` are now a union where the unused options are `?: never`, so combining them is a type error (runtime still ignores/warns for JS callers) - the `never` keys are remapped over `keyof`, so every option keeps its JSDoc in completions & hovers (verified via the TS language service) Claude Opus 5.5 (xhigh) * replace getDimensions with a `scale` function, round the canvas size - `config.scale` also accepts `(width, height) => number`, called with the export dimensions at scale 1 (padding included) — covers content-dependent scaling (e.g. E+'s pixel budgets) without the getDimensions round trip - remove `getDimensions`: its returned `scale` replaced `config.scale` and multiplied the returned size, so callers thinking in output pixels had to divide it back out - exportToCanvas rounds the canvas size instead of letting the canvas truncate it (float noise like 28.999999999999996 lost a pixel); half pixels now round up (frame label area 20.5px, mermaid preview 89.5px) Claude Opus 5.5 (xhigh) * align fit/padding/position export docs with the code - `fit` defaults to "contain" when `width`/`height` is set, otherwise "none" (the doc said the opposite); dropped the unimplemented "x/y force none" claim - padding is always subtracted for `maxWidthOrHeight`/`widthOrHeight` (they ignore `fit`), not added - `position` values are "center" | "topLeft" (doc listed "none") Claude Opus 5.5 (xhigh) * derive a missing export width/height from the aspect ratio - with `fit: "contain"` (the default when a size is given), passing only `width` or `height` now derives the other from the content's aspect ratio, as documented — it defaulted to the content's unscaled size, e.g. `{ height: 50 }` of 200x100 content gave a 200x50 canvas with 60x30 content in wide empty bands (now 80x50 with padding 10) - with `fit: "none"` the missing side stays the content extent Claude Opus 5.5 (xhigh) * default export `fit` to "none" when x/y is set - `{ x, y, width, height }` was scaled to fit with `x`/`y` silently ignored (`fit` defaulted to "contain" whenever a size was given); an explicit region now crops by default, `fit: "contain"` still opts in (and ignores `x`/`y`, as now documented) Claude Opus 5.5 (xhigh) * ignore export x/y when the content is scaled to fit - with `fit: "contain"`, `maxWidthOrHeight` or `widthOrHeight`, `x`/`y` shifted the fitted content by a mix of scene units and pixels; they're now dropped with a warning, which the previous commit already documented (its "ignored" claim was based on a coincidental probe) Claude Opus 5.5 (xhigh) * pad an export x/y region on all sides - with `position: "center"` (the default), the centering adjustment also ran on axes pinned by `x`/`y`, shifting the region by the padding: the canvas started exactly at `x`/`y` with all padding on the right/bottom (`position: "topLeft"` padded all sides); `position` now only applies to unpinned axes, as documented Claude Opus 5.5 (xhigh) * consolidate exportToCanvas/Blob/Svg into exportScene({ type, data, config }) - `type: "canvas" | "png" | "jpeg" | "svg"`, return type per `type` (overloads, plus a union overload for dynamic callers); per-type options are type-checked: `quality` only for jpeg, `embedScene` for png/svg, `renderEmbeddables`/`skipInliningFonts`/`reuseImages` for svg - the format replaces `mimeType` (and its "image/jpg" typo handling) - `appState.exportEmbedScene` -> `config.embedScene` (no longer read from `data.appState`); `data.files` is optional - `config.createCanvas` -> `config.environment.createCanvas` (where #11997's render environment and richtext's text metrics will go) - exportToCanvas/Blob/Svg are no longer exported (no aliases); exportToClipboard stays, routed through exportScene - callers, the with-script-in-browser example and tests ported Claude Opus 5.5 (xhigh) * export: take only scene settings from data.appState, frameRendering -> config.frames - `data.appState` is typed as (and stripped at runtime to) the scene settings a .excalidraw file stores; the renderer state is built from those + defaults, so editor state passed in (a live AppState: open dialog, cropping, frame highlight…) can't affect the output. It only supplies the default background and what `embedScene` embeds - `appState.frameRendering` -> `config.frames: { name, outline, clip }` - editor callers translate their export settings via one internal `getExportConfigFromAppState`; `exportCanvas` drops its redundant exportBackground/viewBackgroundColor options - fixes the editor's SVG export ignoring `exportScale` (the branch's exportCanvas SVG path had dropped it; master passed it) Claude Opus 5.5 (xhigh) * type export positioning options as width/height-only - `fit`, `position`, `x`, `y`, `origin` move into the size-option union's `width`/`height` member, so combining them with `maxWidthOrHeight` / `widthOrHeight` (which ignore them) is a type error; runtime unchanged (still ignores/warns for JS callers) - docs stay visible in completions (same `keyof` remap as the size options) Claude Opus 5.5 (xhigh) * move export `loadFonts` into `config.environment` - font loading is a host capability, next to `createCanvas` (svg gets `environment: { loadFonts }` only, as it creates no canvas) Claude Opus 5.5 (xhigh) * changelog: export API (exportScene, config, migration table) Claude Opus 5.5 (xhigh) * export: default padding back to 10, canvas at least 1px - export bounds are geometric (no stroke width), so padding 0 cut half of the strokes on the content's edge and made flat content (a line) zero-height — the library/chart/publish previews, which inherited master's default of 10, rendered blank thumbnails for lines - canvas dimensions never go below 1px (a 0-sized canvas can't be encoded); SVG snapshot sizes are back to master's Claude Opus 5.5 (xhigh) * export: clamp padding against the fitted size, before deriving from it - the padding clamp used the content's unpadded size, so flat content (a horizontal line) lost its padding with maxWidthOrHeight/widthOrHeight (`{ padding: 10, maxWidthOrHeight: 400 }` → 200x0); it now only considers the target being fitted into - a missing width/height was derived before clamping (`{ height: 10, padding: 10 }` → 0x10, SVG viewBox NaN/Infinity) - a zero-extent content axis no longer yields a NaN scale under contain Claude Opus 5.5 (xhigh) * export: clip frame exports to the frame - frame clipping was off for exportingFrame (to avoid the rounded per-element clip), relying on the canvas/SVG edge — which only crops when the export is exactly the frame; a larger export (size options) painted children and overlapping elements into the margins, and SVG frame exports had stopped clipping (master clipped them) - everything drawn is now clipped to the frame with square corners: a canvas clip after the background (`renderConfig.clipToFrame`), and an SVG group with the frame's clip path; the background isn't clipped Claude Opus 5.5 (xhigh) * changelog: fill in PR numbers for the placeholder links Claude Opus 5.5 (xhigh) |
||
|
|
2423819ee0 |
feat(packages/excalidraw): interaction and UI control (#11605)
* feat(packages/excalidraw): add `props.interaction` and `props.ui` * fix: prevent browser zoom when interaction disabled * changelog * clean up interactive state on disable and consolidate `viewMode` and interaction state updates * render UI rendered to `children` even if editor-exported * support `allowed.navigation` and `allowed.embeds/interactiveContent` * change naming `allowed` -> `enabled` * changelog: add PR links Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * clear flowchart sessions via consolidated `app.flowchart` after master merge Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor getters -> methods --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
51ca8abde4 |
feat(packages/excalidraw): viewport locking (#11554)
Co-authored-by: barnabasmolnar <barnabas@excalidraw.com> Co-authored-by: Arnost Pleskot <arnostpleskot@gmail.com> Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com> Signed-off-by: Mark Tolmacs <mark@lazycat.hu> |
||
|
|
47cbb5b6fb |
refactor: single source of truths with editor interface (#10178)
* refactor device to editor interface and derive styles panel * allow host app to control form factor and ui mode * add editor interface event listener * put new props inside UIOptions * refactor: move related apis into one file * expose getFormFactor * privatize the setting of desktop mode and fix snapshots * refactor and fix test * remove unimplemented code * export getFormFactor() * replace `getFormFactor` with `getEditorInterface` * remove dead & useless * comment * fix ts --------- Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com> |
||
|
|
95d89a751a |
refactor: decouple radio button selection from .buttonList wrapper (#9528)
* refactor: decouple radio button selection from `.buttonList` * fix |
||
|
|
5fc13e4309 |
feat: add props.renderScrollbars (#9399)
* Expose renderScrollbars to AppState * fix: scrollbar rendering should use al renderable elements * remove `appState.renderScrollbars` * clean unused --------- Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com> |
||
|
|
21ffaf4d76 | refactor: auto ordered imports (#9163) | ||
|
|
ecef5d12f4 | chore: release @excalidraw/excalidraw@18.0.0 🎉 (#9127) |