Repository navigation
Add a pin-case gallery and test, a below-corner pin seat, and a two-tone Pixels view - #2825
Conversation
…lear A pin with no clear seat walked out through its enclosing boundaries, ending at `main`'s edge, so on a page of edge-to-edge cards the marker for the second card stood 500px below it, under the last card. Clear room was also judged against every painted box whole, which needed a registry key (`x-face`) to let a widget's own slots count as room. A pin now offers four seats touching its target, in order: just outside its top-right corner, after a run of text's last word, just inside the corner, and just above it. It takes the first that covers no words, controls or media. Where none is clear it stays by its target: the seat clear of controls that covers least, else its corner slid left past the controls along the target's top, else the corner itself. Hiding annotations reveals what a pin covers. Removed: external seats and their attachment through comment placement, the withheld state for an unseated pin, the painted-box rule with its walls and neighbours, and `x-face`. Tests of those behaviours go with them; the edge-to-edge cards test now holds the pin on its card, clear of its Action. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ords The corner of a block whose first line runs full now gives way to the first clear spot lower down the same edge, such as the empty end of the next line, before the pin tries the room above. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…controls The layout pass seats one pin at a time, so the pins it had placed reached the clear-seat search but not the last fallback, which stacked crowded pins on one spot; seatRows now takes them as `occupied`. A seat slid left or pushed down is kept only inside the pin's bounds, and the buttons in a widget's shadow tree count as controls a pin keeps off. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…dget controls through every shadow tree Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ncluded Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # tests/browser/test_render_margin.py
# Conflicts: # skills/leaf/assets/registry.json
… below the document's top The seat after a run's last word was centred on that line, so a touch-sized pin taller than the line reached up over the run's previous line: on Linux fonts the release-notes suggestion's pin covered words it decides. It now stands level with the last line's top. The seat above the corner takes the corner's own right edge, so a full-width target's seat above stays inside the pin's inset bounds. A scrollable document bounds every seat by its own top, so no seat stands where no scroll can reach it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`leaf-dev pins [--base [REF]]` lays out 22 targets, ordinary and pathological, each with comments, on one page with no Layout, so every comment takes a pin. It reads each case at a desktop and a phone width for pins over words, controls or media, out of reach of their target, off screen, over each other, or not shown, and writes a Leaf page of crops with targets and pins outlined; with --base each crop is a before/after pair against main. A new browser test holds every case to the same reading, so a placement the gallery shows wrong is added as a case and fails until it is fixed or the case accepts that fault at that width, saying why. The catalogue found that the seat above a window-wide target's corner stood in the edge inset and was never taken; #2795 carried that fix, and this corrects the seat-order comment. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…rew, blue where after did lf-shot's Pixels view painted every changed pixel one warning colour, so a mark that moved showed as two blobs with nothing saying which was the old place and which the new. `changedPixels` now returns three masks: a pixel only the before image draws on its ground, one only the after image draws, and one both or neither do, as a recolour or a redrawn shadow. Each run of touching changed pixels takes as its ground the commonest colour among the unchanged pixels touching it, so a move inside a panel, beside a rule, or on a dark theme reads the right way round. Pixels paints them in danger, accent and warn. A shot authored with `pixels` and not `outlines` now opens in Pixels, where it used to open in Plain: an author who asks for the pixel view alone is showing a change one picture says best. The reading waits for that paint, and a shot an inspector configures with inspect() keeps its own presentation. `leaf-dev pins --base` uses it: each case's two arms are cropped to one shared rectangle, so the pair lines up, and the pair opens on its changed pixels, the base's pin red and this tree's blue. The pin boxes drawn on the crops are gone, since the view now shows the pins themselves. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A pin by a full-width figure or keypad that sits right under a paragraph had no clear seat touching its target, and took the seat above the corner over the end of the paragraph, though the room below the target was empty. Pins now try one more seat, just below the bottom-right corner at the corner's inset, before falling back to covering anything. It is offered only where the row under the target is empty from the target's left edge to the corner, measured from the target's own foot: where the next block starts right below, as with list items shorter than a pin, a pin there would read as that block's. The pin catalogue gains a tight-list case for that guard, and the wide-image, dense-text and keypad cases no longer accept covering words on a phone. Its off-screen fault is now across only, since a pin below a tall target is past the window's foot at the capture's scroll and reached by scrolling. TODO.md #29 records the details of lf-shot's comparison views still to settle. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The Pixels view painted each changed pixel at one of three alphas, so a moved mark's soft edge became a staircase that an enlarged view drew as blocks. A changed pixel's alpha now rises with how far it moved, from faint at one level to opaque at twice SLIGHT, and the edge fades as the image's own edge does. `leaf-dev pins` captured at one device pixel per CSS pixel, and the report's column drew a phone crop about 1.85 times its size. It now captures at 2x. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… threads Each `leaf-dev pins` run wrote its report into its own run directory, so previewing the next run started a fresh page and the user's threads on the last one were left behind. The report is now written to one path, `.tmp/pins/report/pins.html`, and the printed preview uses one slot: a running `--user` preview takes each run as a new revision of the same page, with its threads anchored where they were. Captures still go to each run's directory. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ault, and drop --case A full run takes about 10s, 20s with --base, so a subset buys nothing and its rewrite of the shared report page detached the threads on the cases it skipped. Each case's accepted faults now carry their reason in `why`, which the page shows. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The pin-case test fails at phone width in the normal browser fixture: list-items-1 and scroll-pane-p each report a pin over words. I reproduced the same failure in two focused pytest runs (-n 0 included), while leaf-dev pins reports no faults for those cases. The command and test serve the same case markup through different page fixtures, so the gallery can claim a clear seat while the browser gate rejects it. Please make the command and test exercise the same page setup and settle the actual pin placement those cases reveal.
The Pixels contract says a recolour appears in the both (amber) mask, but changedPixels() puts a full-frame recolour entirely in before (red). With a 2×2 opaque white image changed to black, the first pixel returns {before: 255, after: 0, both: 0}. The fallback ground ??= whole ??= commonest(other) chooses black from the after image when no unchanged pixel borders the run, so every white-before/black-after pixel reads as content only Before drew. A changed background or full crop therefore gives the reader the wrong side of the change. The no-unchanged-ground case needs a classification that does not treat the after image itself as the neutral ground.
…ghbour, and keep enclosed pixels out of a change's ground On Linux the suite lays text out in DejaVu (tests/fonts.conf) but leaf-dev pins did not, so the command measured narrower text and reported no fault where the test found list-items-1 and scroll-pane-p over words. use_linux_fonts() is now the one home, called by the suite and by leaf-dev pins. With three 27px list items and 44px pins, a pin whose corner the previous pin took slid left onto words although the corner pushed below that pin covered nothing. seatRows now takes whichever of the two covers less, the slid seat on a tie, and offers the pushed seat only within the room its cover was read from. The scroll-pane cases' paragraphs take a px width, so their room beside does not depend on the font. changedPixels took a run's ground from any unchanged pixel touching it, and fell back to the after image's commonest colour, so a whole-frame recolour, or one around a mark that kept its colour, read as one-sided. Ground now comes only from unchanged pixels an unchanged path joins to the frame's edge; a run with none is in both. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Adds
leaf-dev pins, a small catalogue of comment-pin cases that doubles as a browser test, makeslf-shot's Pixels view one two-tone picture of what changed, and gives pins a seat below a target's corner before they cover anything.Pin cases (
dev/leaf_dev/pins.py): 23 ordinary and pathological targets (paragraphs, headings, quoted passages, edge-to-edge cards, tiles, a keypad, list items shorter than a pin, scroll panes) on one page with no Layout, read at 1280px and 390px for seven faults: a pin over words, controls or media, too far from its target, past the window's edge, overlapping another pin, or not shown. The catalogue is few cases and not chosen to flatter the placement; a placement that looks wrong anywhere becomes a new case.leaf-dev pins [--base REF]writes a Leaf page of crops at 2x (before/after pairs with--base) to one stable path, so a--userpreview keeps its threads across runs; a full run takes about 10s, 20s with--base. On Linux the command lays text out in the suite's DejaVu fontconfig (use_linux_fonts, shared withtests/conftest.py), so it and the test measure the same text.test_each_pin_case_seats_its_pins_by_their_targets_clear_of_what_they_hideholds every case to the same reading; a case accepts a fault only with awhy, which the page shows.Below-corner seat (
margin-layout.jspinSeating): after the seats beside, inside and above the corner, a pin may stand just below the target's bottom-right corner, offered only when the strip under the target, measured from its own foot, holds nothing. This moves a phone-width wide image's pin off the paragraph above it. And where no seat is clear, a pin crowded off its corner by the pin before it now takes the corner pushed below that pin when that covers less than sliding left onto words (short list items at phone width), but only within the room its cover was read from.Two-tone Pixels (
image-difference.js,lf-shot.js,shot.css):changedPixels/compareImagePixelsnow return{width, height, before, after, both}. Each run of changed pixels is judged against the commonest unchanged colour around it (unchanged pixels joined to the frame's edge, so a mark the change encloses is not ground), so a moved mark paints red where only the before image drew it and blue where only the after did; a recolour, or a run with no ground such as a whole-frame recolour, paints amber. Alpha grows with how far a pixel moved. A shot withpixelsand nooutlinesnow opens in Pixels (previously Plain);TODO.md#29 records the rest of the view design (colour key, which views a pair offers, the "identical" label).Open: comments on a quoted passage still put their pin by the paragraph's corner, which the passage cases accept as "far".
Tests: runtime 433 pass;
check:browser; the pin-case and pin/seat/fold margin tests pass on macOS and in a Linux container with CI's fonts; thelf-shotbrowser tests pass on macOS.