Skip to content

feat(core): LayoutPriority.Fill — one view/group fills, siblings stay fixed#1389

Open
mathuo wants to merge 1 commit into
masterfrom
feat/layout-priority-fill
Open

feat(core): LayoutPriority.Fill — one view/group fills, siblings stay fixed#1389
mathuo wants to merge 1 commit into
masterfrom
feat/layout-priority-fill

Conversation

@mathuo

@mathuo mathuo commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

Adds LayoutPriority.Fill so a view (standalone gridview) or group (dockview) absorbs all surplus/deficit space while its siblings keep their fixed sizes — the common "central content fills, side/bottom panels stay put" layout that the existing proportional priorities (Low/High/Normal) can't express.

Closes #1378.

Motivation

Today every priority participates in proportional redistribution, so resizing the window / adding / removing a panel rescales every view. Consumers end up fighting this with manual setSize calls on every layout change. Fill solves it declaratively: designate one leaf as the filler and the rest hold their size.

What's included

Engine ( standalone gridview + splitview)

  • LayoutPriority.Fill — a fill view absorbs surplus/deficit in layout/relayout/distributeEmptySpace; siblings are held fixed.
  • Multiple fill views split the surplus equally (spilling to siblings only once a fill hits a min/max).
  • A hidden fill view can't absorb, so the layout falls back to normal proportional distribution.
  • BranchNode propagates Fill up the grid tree (highest precedence), so it works in nested layouts.
  • Runtime priority setter on GridviewPanel triggers a full relayout so propagation up the branch tree takes effect.

Dockview (group-level)

  • Set at creation: api.addGroup({ priority: LayoutPriority.Fill }).
  • Set at runtime: group.api.priority = LayoutPriority.Fill.
  • Serialized on the group and restored on load (toJSON/fromJSON).
  • Priority is a group concept in dockview (the group is the grid leaf; tabs share one box), not per-panel.

Backwards compatibility

Fully backwards compatible. Every behaviour change is gated on a fill view being present, so existing layouts and serialized state are unchanged. The serialized priority key only appears when a group opts in; older payloads simply omit it and load unchanged.

Tests

  • splitview: single-fill absorb (grow/shrink/add/remove), equal multi-fill split, Fill-beats-High, vertical orientation.
  • gridview: priority round-trips through toJSON/fromJSON.
  • dockview: addGroup({ priority }) + round-trip persistence, runtime group.api.priority, and a behavioural test (three groups; middle set to Fill; only it resizes while siblings stay fixed).

dockview-core: 1082/1082 green, tsc clean.

🤖 Generated with Claude Code

Add `LayoutPriority.Fill` so a view (standalone gridview) or group
(dockview) absorbs all surplus/deficit space while its siblings keep
their fixed sizes — the common "central content fills, side panels stay
put" layout that proportional priorities cannot express. Closes #1378.

- splitview: fill views absorb space in layout/relayout/distributeEmptySpace;
  multiple fills split the surplus equally; hidden fills fall back to normal
- gridview: Fill propagates up the branch tree (highest precedence); the
  runtime priority setter forces a full relayout so propagation takes effect
- dockview: group-level priority via addGroup({ priority }),
  group.api.priority, and toJSON/fromJSON round-trip

Backwards compatible: every behaviour change is gated on a fill view being
present, so existing layouts and serialized state are unchanged; the
serialized `priority` key only appears when a group opts in.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: LayoutPriority.Fill — one view absorbs remaining space, siblings keep fixed sizes

1 participant