Files
excalidraw/examples/with-script-in-browser/components
David LuzarandMark Tolmacs 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>
2026-12-02 20:22:50 +01:00
..