Skip to content

Take no room for a sidebar the contents map has left, and drop the retired column variables - #1273

Merged
max-sixty merged 4 commits into
mainfrom
sidebar-map-room
Sep 27, 2026
Merged

max-sixty merged 4 commits into
mainfrom
sidebar-map-room

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

A first sidebar that holds only an lf-toc stays in the flow between an 848px shell,
where the default package fixes the map into the left margin, and 1296px, where the
core theme floats the sidebar. In that band the empty sidebar kept its
margin: var(--sp-4) 0 30px, and as a flow-root box it also kept the blocks on either
side of it from collapsing their margins. On feature-gallery at 1200px, the render
gate's width, that put 54px between the lede and the paragraph after it where the
floated posture gives 13px. The docs site patched it for itself (#1246) by zeroing the
margins, which still left 23px because the box stayed flow-root.

The core theme now handles this beside the posture declaration that #1278 moved there:
under the margin posture, a first sidebar whose only child is the lf-toc is
display: block with no block margins, so the blocks on either side meet as they do
when the sidebar floats. The rule has to be in the core theme, because package CSS is
now confined to the package's own widgets and could not reach the aside. The docs
copy is deleted. From 1296px the core theme's float margins still outrank the new rule,
so the floated sidebar is unchanged.

The surveyor's reading of no gap at 1000px came from the page, not from Leaf: the
feature gallery hides #bg-sidebar below a 1152px shell (its own
@container lf-shell (max-width: 1151px), from #237), so there the gap only shows
from 1152 to 1295px. Any other page with this shape has the gap from 848px.

layouts.css no longer pins --lf-shift: 0px and --lf-gutter-l. These were left
over from the column model #1246 retired, and they only fed --lf-sidebar-free-left,
which nothing read, and a + 0px term in the default package's outline width. The core
theme's main rule that set those two properties and --lf-sidebar-claim is gone.
--lf-sidebar-claim was an alias for --sidebar-max with one reader, the map's width,
which now reads --sidebar-max directly.

Behaviour that moved: between 848 and 1296px of shell, on a fine pointer, a page
whose first sidebar holds only the contents map loses the gap under the block before
it (41px on the feature gallery at 1200px). test_a_left_sidebar_uses_the_margin_until_the_page_needs_it_back
now checks that band: the block after the sidebar stands where it would with the
sidebar gone. test_the_reading_map_returns_when_a_hidden_sidebar_comes_back asserted
the wrapper's display was flow-root, which only stood in for "the wrapper came
back". It now asserts that the display is not none.

layouts.css still selects lf-pane by tag. The survey read this as a pane-depth
inconsistency that the role alone would fix. Keying on the role alone breaks two things
the tag carries. An authored pane is held only as the workspace body or a cell of it,
and test_a_pane_inside_a_plain_section_of_a_workspace_flows goes red if the depth
limit is dropped. The tag is also the only mark present at first paint: on
alert-review the runtime paints data-lf-reading-role 450-650ms after first paint.
That needs a first-paint, authored-versus-generated mark, so it is a TODO.md entry
under Shared definitions.

This was written by Claude Code on behalf of max-sixty

🤖 Generated with Claude Code

max-sixty and others added 2 commits September 26, 2026 21:35
…tired column variables

A first sidebar that holds only an `lf-toc` stays in the flow between an 848px shell,
where the default package fixes the map into the left margin, and 1296px, where the
core theme floats the sidebar. In that band the empty sidebar kept its
`margin: var(--sp-4) 0 30px`, and as a `flow-root` box it also kept the blocks on either
side of it from collapsing their margins. On `feature-gallery` at 1200px, the render
gate's width, that put 54px between the lede and the paragraph after it where the
floated posture gives 13px. The docs site patched it for itself (#1246) by zeroing the
margins, which still left 23px because the box stayed `flow-root`.

The default package now owns this beside the rule that moves the map: under the margin
posture, a first sidebar whose only child is the `lf-toc` is `display: block` with no
block margins, so the blocks on either side meet as they do when the sidebar floats.
The docs copy is deleted. From 1296px the core theme's float margins still outrank the
new rule, so the floated sidebar is unchanged.

The surveyor's reading of no gap at 1000px came from the page, not from Leaf: the
feature gallery hides `#bg-sidebar` below a 1152px shell (its own
`@container lf-shell (max-width: 1151px)`, from #237), so there the gap only shows
from 1152 to 1295px. Any other page with this shape has the gap from 848px.

`layouts.css` no longer pins `--lf-shift: 0px` and `--lf-gutter-l`. These were left
over from the column model #1246 retired, and they only fed `--lf-sidebar-free-left`,
which nothing read, and a `+ 0px` term in the outline width. `--lf-sidebar-claim` was
an alias for `--sidebar-max` with one reader, which now reads `--sidebar-max` directly.

Behaviour that moved: between 848 and 1296px of shell, on a fine pointer, a page
whose first sidebar holds only the contents map loses the gap under the block before
it (41px on the feature gallery at 1200px). `test_a_left_sidebar_uses_the_margin_until_the_page_needs_it_back`
now checks that band: the block after the sidebar stands where it would with the
sidebar gone. `test_the_reading_map_returns_when_a_hidden_sidebar_comes_back` asserted
the wrapper's display was `flow-root`, which only stood in for "the wrapper came
back". It now asserts that the display is not `none`.

`layouts.css` still selects `lf-pane` by tag. The survey read this as a pane-depth
inconsistency that the role alone would fix. Keying on the role alone breaks two things
the tag carries. An authored pane is held only as the workspace body or a cell of it,
and `test_a_pane_inside_a_plain_section_of_a_workspace_flows` goes red if the depth
limit is dropped. The tag is also the only mark present at first paint: on
`alert-review` the runtime paints `data-lf-reading-role` 450-650ms after first paint.
That needs a first-paint, authored-versus-generated mark, so it is a `TODO.md` entry
under Shared definitions.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	TODO.md
leaf-agent
leaf-agent previously approved these changes Sep 27, 2026
# Conflicts:
#	TODO.md
leaf-agent
leaf-agent previously approved these changes Sep 27, 2026
# Conflicts:
#	skills/leaf/packages/default/theme.css
@max-sixty
max-sixty merged commit 4cb10a7 into main Sep 27, 2026
5 checks passed
@max-sixty
max-sixty deleted the sidebar-map-room branch September 27, 2026 06:41
max-sixty added a commit that referenced this pull request Sep 27, 2026
…d render where it changes (#1297)

One measurement now decides what stands in a column page's margin: the
rail, the contents map, the first sidebar and the sidenotes. The column
moves off centre where a sidebar or note needs the room, and the render
gate renders each page at the widths where its margin content changes.

**Before**, each resident moved into the margin at its own threshold:
- the rail was measured by script (about 960px);
- the contents map was a container query at 848px;
- a sidebar was a container query at 1296px;
- a note was a container query at 1536px.

The sidebar and note thresholds were pixel copies of tokens that assumed
the default column, so a page that widened its column got a sidebar
positioned off the window's edge. The gate reads at 1200px, so it never
saw a sidebar or note in the margin.

**Now**, `settleResidency` (margin-layout.js) reads the room beside
`main` once a frame and writes the answer on `main`:
- `data-lf-margin` holds one token per posture standing: `rail`, `map`,
`sidebar` or `note`;
- `--lf-shift` holds the column's offset, which the column Layout
applies as a relative offset (layouts.css).

It admits residents in order:
1. The rail stands where the room right of the centred column holds
`--rail`. It never moves the column.
2. The first sidebar stands where the room on both sides together holds
the rail and `--sidebar`. With a fine pointer, a sidebar holding the
contents map stands as the map's spine (`--map`, 48px) where a full
sidebar does not fit. It does the same where the map is all it holds,
since a float would hold nothing. A map-only sidebar left in the flow
takes no room there (#1273's rule, now keyed on the `map` token).
3. The notes stand where the room holds everything admitted so far and
`--note`.

Each element declares its postures in CSS (`--lf-resident`), so the
media and Layout conditions stay in the stylesheet. The widths the
script reads are registered lengths, so a page may restate them in any
unit. A resident that a closed disclosure or an unchosen view hides
takes no room, and a toggle asks for a new reading. One the page hides
itself stays a resident, so a page can show it only once it stands in
the margin. The stylesheet keys every posture on the tokens instead of
`@container lf-shell` queries, and chrome-layout's `syncLayout` asks for
the reading.

With the default column (768px box), a sidebar reaches the margin from
1130px and a note from 1152px. A sidebar and a note together need
1416px. The column moves over by what one side lacks, so at 1200px a
note page's text sits 168px left of centre. A page that changes its
column's width gets thresholds that follow it.

**First paint.** Residency is now decided by script, so a page whose
residents stand in the margin paints with them in the flow and moves
them on the first rendering frame. That is the trade chosen when
measuring won over fixed widths ("layout waits one frame for script").
The bootstrap can't take the reading earlier: it is a classic script,
and its first frame can come before the residents are parsed.

Page CSS can follow the margin by keying on the tokens. The feature
gallery's copied 1151px width became `main:not([data-lf-margin~="map"],
[data-lf-margin~="sidebar"]) #bg-sidebar`. page-authoring.md documents
the tokens, and the registry's sidebar and sidenote descriptions say
when each stands.

**Render gate.** The sweep now runs from 360 to 1920px and records the
page's own residents at each width, without the rail, which holds only
Leaf's markers. For each step where they change, the gate halves the
step to the exact width and renders the page there in the light scheme.
That is where each resident has the least room it will ever have.
`version check --render` names those widths when it passes. The
sidenote-in-a-clipping-box test that was strict xfail now passes, and
the static test that compared the gate's 1200px to the theme's container
floors is deleted.

**Comment bar.** Above or below a passage, the bar's lane started at its
first measured width, which a restored draft's words widen. A reloaded
draft opened 292px further left than the same draft typed fresh. The
start is now the compact control's minimum, so one draft opens in one
lane.

**The corpus is unchanged.** It still sets each example's body in one
column page. Every example already gets the full gate, sweep included,
in its own Layout through the nightly `test_page_fixture_renders`. A
multi-Layout corpus would need the wide and workspace Layouts to work
below `main`. TODO.md now says exactly this.

Behaviour the tests pin moved:
-
`test_margin_residents_stand_where_the_room_beside_the_column_holds_them`
derives each threshold from the tokens and checks one pixel either side.
- `test_a_note_hangs_in_the_margin_where_the_room_holds_it`: at 1190px
the note now hangs, with the column moved left.
- `test_a_left_sidebar_uses_the_margin_until_the_page_needs_it_back`:
its sidebar holds a line beside the map, so it still floats. A map-only
copy checks that sidebar takes no room at 1100 and 1400px.
- The contents-map widget test expects a map-only sidebar not to float.
- `test_unchanged_margin_refresh_cost_is_bounded_by_refresh_count`
allows one more read of `main` per refresh, for the residency reading.
- `test_a_thread_beside_its_cluster_takes_the_room_to_the_visible_edge`
removes the gallery's note, which would otherwise move the column at the
width the case was picked for.
- `test_the_render_gate_exercises_both_schemes_at_both_viewports`
expects the margin renders after the four fixed ones.
- New: `test_a_note_the_page_does_not_show_takes_no_room`,
`test_the_render_gate_renders_where_the_margin_content_changes` and
`test_a_draft_below_its_passage_keeps_its_lane_whatever_it_holds`
(bug-back checked).

Still open, in TODO.md: `data-rail="right"` reserves the rail at every
width, so a phone keeps a 295px column.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.

2 participants