Skip to content

List the shadow-scale playground as an example, with Flat, Soft and Deep presets - #4875

Merged
max-sixty merged 10 commits into
mainfrom
agent-a93798c395eac215a
Nov 1, 2026
Merged

max-sixty merged 10 commits into
mainfrom
agent-a93798c395eac215a

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The shadow-scale tool from #4478, a playground whose page draws its own instrument and its own Save and Reset, is now a catalog example, and it gains Flat, Soft and Deep presets drawn by the page.

  • Catalog: tests/fixtures/pages/page-drawn-playground.html moves to examples/shadow-scale.html, its only copy, and docs/examples.html lists it as "Design tokens · Tune a shadow scale" after Panel motion. The example still carries actions="page" for the corpus floor test. Its catalog still is published to leaf-assets; the refresh recaptured every preview, so the pin also moves the README's demo images.
  • Presets with no Leaf change: lf-playground-preset sets only lf-playground-controls, so a playground whose settings are all contributor slices had no presets. The page can already provide them: each chip passes a whole scale to the slice handle's set, the playground records the press as one tune that Undo takes back whole (Record a playground's unsent settings in the page's log, and map where widget state lives #4845), Enter and Space reach it as a native button, and the page sets aria-pressed on the chip whose value matches get(). Rejected: letting lf-playground-setting carry a slice's JSON plus a hand-over for page-drawn preset buttons, which would be a second API for what set and get do.
  • Guidance: five lines in packages/playground/instructions/author.md say how.
  • Example writes: the example now writes aria-pressed through keeps, including its existing level and layer buttons, since the suite refuses writes that change nothing and no browser test had loaded this page before.

test_a_page_drawn_preset_sets_its_whole_slice_as_one_gesture applies Deep by pointer and Flat by Enter, checks each records exactly one tune and shows pressed, and that two Undos step back to Deep, then Soft. That test, #4478's two page-actions tests, the catalog metadata test, the corpus floor test, check:browser and page check --render on the example pass.

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

max-sixty and others added 10 commits October 27, 2026 00:07
A playground no longer refuses to start without an lf-playground-control: a
preview whose script declares contributor slices and an instruction provider is a
whole playground.

A playground marked actions="page" draws no rail of actions. Its page builds
its own submission and Reset as ordinary buttons, which the page's CSS styles,
and hands them over with playground.registerActions({submit, reset}). They
become the controls of the playground's commands, so the digit, Alt+0, On me's
arrival and availability reach them, and the playground writes the submission's
words (submit-label, then Undo choice) and records the choice as before. The
instruction stays where lf-playground-output is written. The choice is markup,
not only the call, because the initial drawing is the first paint: a bar drawn
there and withdrawn when the script registered would move the page as it loads.

The full-height and narrow playground grids keep the bar's row implicit, so a
playground without one leaves no empty row; bundled playgrounds render as before.

The references now say that a page script drawing the page's own interface
builds ordinary elements, which page CSS styles; the offer helpers build Leaf's
controls, which page CSS stays off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A playground marked actions="page" whose page script never calls
registerActions left the user no way to answer, and nothing reported it. Now,
once the page first presents, after every whileInterfaceConnected declare has
run, such a playground fails with a message naming registerActions, which the
page's error report carries and page check fails on. A playground arriving
after that presentation (a revision applied in place, a message) has no
settled point of its own to wait for and is not checked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	packages/playground/initial/lf-playground.js
#	packages/playground/vendor/lf-playground-initial.js
#	packages/playground/widgets/lf-playground.js
The corpus floor (test_every_declared_attribute_and_enum_stands_in_an_example)
failed on the new attribute. The fixture is the shadow-scale workshop that
motivated the change: a page-drawn instrument with its own Save and Reset.
Main moved the playground's initial producer into widgets/playground-view.js
(#4545), lets page CSS reach every control (#4490), draws presses from their
actions (#4547, #4563), registers commands through lfCommands, and already
lets a playground run with no lf-playground-control. The PR's prose about
offer() and data-controls, its relaxed control check and its deleted
initial/vendor producer files take main's side.

What stays from the PR is actions="page", now built in the Lit view:

- playground-view.js draws no actions bar under actions="page", and no rail
  unless controls are written there; the instruction renders after the stage,
  where it was written. `give({submit, reset})` takes the page's buttons, and
  render writes the submission's words into the page's button from the same
  template Leaf's own submission uses (submit-label, then Undo choice).
- lf-playground.js's registerActions hands the buttons to the view and sets
  the playground's commands then, since a Decision command needs its control:
  the 1 key, Alt+0 and On me's arrival reach the page's buttons. A page that
  never calls registerActions still fails after first presentation.
- The copy control and popover wiring run only when Leaf draws the popover.
- The PR's test and corpus fixture pass the contributor editor main's
  registerContributor now requires.

Behavior from main kept: the submit no longer disables while a submission is
in flight (#4516), so a page's button follows the same rule.
# Conflicts:
#	packages/playground/instructions/author.md
#	packages/playground/widgets/lf-playground.js
#	packages/playground/widgets/playground-view.js
…eep presets

The page-drawn playground fixture becomes `examples/shadow-scale.html`, listed
in the catalog under Everyday work. It stays in the corpus, where it is the page
that shows `actions="page"`, so the fixture copy goes.

Its inspector now has a "Start from: Flat · Soft · Deep" row. Each button
passes a whole scale to the contributor handle's `set`, and the page marks the
button whose scale matches `get()` with `aria-pressed`. Leaf needed no change
for this: a press inside the playground already records the whole
configuration as one `tune`, so Undo takes a preset back whole, and a native
button already has its keyboard route. Leaf-owned presets for contributor
slices (JSON values in `lf-playground-setting` plus a hand-over of page-drawn
preset buttons) would have been a second API for what `set` and `get` already
compose. `author.md` now tells authors to draw presets this way, since
`lf-playground-preset` sets only `lf-playground-control`s.

The page now writes its `aria-pressed` states with `keeps`. The suite's write
watch refused the unchanged writes, which no browser test had loaded the page
to see.

The catalog card needs its still: run `wt refresh-previews` before landing.
# Conflicts:
#	packages/playground/instructions/author.md
#	tests/browser/widgets/test_playgrounds.py
@max-sixty
max-sixty merged commit d74dac1 into main Nov 1, 2026
4 checks passed
@max-sixty
max-sixty deleted the agent-a93798c395eac215a branch November 1, 2026 04:11
leaf-agent added a commit that referenced this pull request Nov 3, 2026
…hanges (#5261)

The shadow-scale playground (from #4875) set `this.#parts.add.disabled`
on every repaint. The `disabled` setter rewrites the attribute even when
its value is already set, so each repaint at the layer limit restated
the flag. The suite's write watch reports that as `unchanged write:
disabled on button.ws-add`, which failed
`test_presses_and_fills_leave_no_element_naming_stale_keys[shadow-scale]`
on Linux and macOS in the scheduled run. The paint now calls
`toggleAttribute("disabled", …)`, which writes only when the flag
changes. The `keeps.js` header recommends this for a flag. The button is
disabled in the same states as before.

The journey failed on current main with that exact message and passes
with the change.
`test_a_page_drawn_preset_sets_its_whole_slice_as_one_gesture` in
`tests/browser/widgets/test_playgrounds.py` also still passes.

Closes #5181 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 5, 2026
`wt refresh-previews` recaptured all 19 catalog stills and moved the asset
pin to max-sixty/leaf-assets@9c3dd34381b8, and the README's image URLs
follow the pin. No demo image changed.

`data-explorer` has no catalog still, so none of these differences comes
from this branch's change: the page is a link in `docs/examples.html`
rather than a card. They are look changes landed since the pin last moved
(#4875). `dynamic-widgets` differs most, in 9% of its pixels, and the four
largest show the same layouts with today's control faces.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
max-sixty added a commit that referenced this pull request Nov 5, 2026
At 390x844 under a finger, `data-explorer`'s first screen now holds both
filters, the result count, all four columns of the result table and
Build query. Before, the count stood at 878px, under the floating panel,
and the table scrolled sideways with Risk and Owner past its frame's
edge. This is the last live item of the phone-quality queue. Of the four
others, three already pass on current main and one is `lf-tabs`' own
phone design. They are listed below with the measurements behind each
verdict.

This changes desktop too: the row buttons' words are shorter at every
width. `data-explorer` has no catalog still, since it is a link in
`docs/examples.html` rather than a card, so no still shows this change.

This PR also moves the asset pin to max-sixty/leaf-assets@9c3dd34381b8:
`wt refresh-previews` recaptured all 19 catalog stills, and the README's
image URLs follow the pin. None of those differences comes from the
change above. They are look changes landed since the pin last moved on
31 October (#4875). `dynamic-widgets` differs most, in 9% of its pixels,
and the four largest show the same layouts with today's control faces.
No demo image changed. The capture ran on this branch's base, 22accdd.

## What changed

`examples/data-explorer.html`:

- **At every width**, the buttons read "Move up", "Move down" and
"Remove", and each `.query-row` is `role="group"` with
`aria-label="Filter N"`, renumbered as rows move. A button's accessible
name is its visible text, and the group says which filter it acts on.
- **At every width**, the result table drops its `min-width: 30rem`.
- **At 42rem or narrower**, a filter row is flex items sized to their
content. Each select is as wide as its longest option, the fields' side
padding is `--sp-2` (`--wa-form-control-padding-inline`), and Value
(`.query-value`, basis 5rem) takes the rest. So Field, Operator and
Value share one line down to a 360px window, and Value wraps onto its
own line below that. The three buttons take the next line.
- **At 42rem or narrower**, the table is `table-layout: auto`, because
equal columns split words below about a 355px window ("Checko|ut").

`tests/journeys/test_render_widgets.py`: the data explorer journey now
reaches each button through its group by name, and asserts the group's
number follows the row when it moves. It fails with the group role
removed, and with the label following the filter's id instead of its
place.

## Evidence

Stills are under
`/Users/maximilian/.tmp/leaf.agent-a1ac83feeb90a4603/phone-examples/`:

| state | before | after |
| --- | --- | --- |
| 390x844 touch, at rest | `data-explorer-390-before.png` |
`data-explorer-390-after.png` |
| same, dark | `data-explorer-390-dark-before.png` |
`data-explorer-390-dark-after.png` |
| 390x844, after typing 80 into filter 2's value by touch |
`data-explorer-390-before-typing.png` |
`data-explorer-390-after-typing.png` |
| 360x740 and 320x568 touch | not captured |
`data-explorer-360-after.png`, `data-explorer-320-after.png` |
| 320x568 touch, all six releases | not captured |
`data-explorer-320-six-rows-after.png` |
| 1120x700 | `data-explorer-1120-before.png` |
`data-explorer-1120-after.png` |
| 1280x800 | `data-explorer-1280-before.png` |
`data-explorer-1280-after.png` |
| 1440x900 | `data-explorer-1440-before.png` |
`data-explorer-1440-after.png` |
| 844x390 (`playground-short-window`) |
`data-explorer-844x390-before.png` | `data-explorer-844x390-after.png` |

The pairs come from `uv run leaf-dev stills --authored --state
data-explorer` with `--viewport phone` (with and without `--scheme
dark`), `--viewport 1120x700`, `--viewport desktop`, and `--state
playground-short-window`. The measurements come from `leaf-dev probe
data-explorer --viewport phone` (or `--viewport WxH --touch`) with a
journey that taps the value field, fills it and swipes the page with CDP
touch events:

| at 390x844, touch | main | this branch |
| --- | --- | --- |
| "2 releases shown" top | 878px (panel at 782) | 551px |
| table frame client / scroll width | 336 / 480 | 336 / 336 |
| Risk and Owner headers | right edges 377, 436 (frame ends 363) | 254,
313 |
| Build query top | below the fold | 717px |
| after filling 80 by touch | count at 861, off screen | count at 551,
on screen, no scroll |

**Names.** The accessibility tree at every width reads `group "Filter
2"` holding `button "Move up"`, `button "Move down"` and `button
"Remove"`.

**Table.** With the default rows and with all six releases, no word
splits across lines at 320, 340, 355, 360, 390 or 430px in Chromium, nor
at 320, 340 or 390px in Firefox. The frame overflows only at 320px with
no filters, by 1px (limit 4 and 6 in Chromium, limit 6 in Firefox). The
cost of auto layout is that column edges move when the result set
changes. At 390x844, Owner's left edge moves 14px when filter 2's value
goes from 40 to 80, and it spans 18px across the seven result sets read
(15px at 320x568, 17px at 360x740, 20px at 430x932, in Chromium).

**Fields.** Each select holds its longest option ("is above", 62px of
text) at 320, 340, 355, 360, 390 and 430px (inner room 91, 101, 64, 66,
76, 89px).

**Reach.** With a third filter added, the corpus sweep's own aim reader
(`aims.js` `flooredAims` with the selector list from `shadow.css`) finds
no control under the 44px floor at 390x844 or 360x740. At 320x568 it
reports two buttons scrolled under the playground's sticky controls
after Add filter moves focus, and main's page reports two as well.

**Desktop.** The buttons' words change at every width. Where a row wraps
depends on the windows below, read on both arms with `probe --base
--authored`:

| window | row height, main → here | count top, main → here | frame
client / scroll, main → here |
| --- | --- | --- | --- |
| 700x900 | 100 → 100 | 511 → 511 | 646 / 646 → 646 / 646 |
| 800x900 | 100 → 100 | 350 → 350 | 478 / 480 → 478 / 478 |
| 844x390 | 100 → 100 | 358 → 358 | 507 / 507 → 507 / 507 |
| 1000x800 | 100 → 100 | 350 → 350 | 611 / 611 → 611 / 611 |
| 1280x800 | 100 → 62 | 350 → 274 | 798 / 798 → 798 / 798 |
| 1440x900 | 62 → 62 | 274 → 274 | 905 / 905 → 905 / 905 |

So at 1280x800 the shorter buttons fit beside the fields, and the rows
are 38px shorter each. At 800x900 the removed minimum stops a 2px
sideways scroll on main. At 1120x700 the rows keep their shape and only
the words change.

## The rest of the queue, re-measured on main at 390x844 by touch

- **`alert-review`**, no change. The side list becomes a 2357px strip of
14 tabs in a 364px row, which is `lf-tabs`' recorded phone design for a
queue (`packages/default/styles/tabs.css`, "A list beside its panels"):
the open item stays one row down however long the queue. By touch, a
swipe scrolls the strip (scrollLeft 0 → 342 → 1993), each group label
sticks at the row's start, tapping the last tab opens it whole in view,
and Next on me returns to the first open item. Still:
`alert-review-390-unchanged.png`.
- **`code-comparison`**, no change. #4638 moved its controls from the
playground's sticky rail into the preview two days after the issue's
survey. Only the 38px header and 53px tab strip stick now, and the
controls scroll away with the page. Reader A scrolls sideways (312 /
819) because "compact · scroll" is the treatment the page compares.
Still: `code-comparison-390-unchanged.png`.
- **`dynamic-widgets`**, no change. All four `lf-text-document` tab
strips are 340 / 340 with both disclosures open, and nothing on the page
scrolls sideways. Still: `dynamic-widgets-390-unchanged.png`.
- **`github-discoveries`**, no change. No `pre` is 811px wide now. Six
code listings inside the collapsed "Source & details" scroll inside
their own 276px box (widest 590px), and the page doesn't scroll
sideways. A finger swipe on the AX listing scrolls it 212px with no page
scroll. Still: `github-discoveries-390-unchanged.png`.

The issue's second paragraph, touch controls under 32px, was settled in
#3902, whose corpus sweep holds every tab to the 44px floor at 390px.

## What ran

- `uv run pytest -n 2
"tests/journeys/test_render_widgets.py::test_structured_data_explorer_keeps_one_aggregate_query_configuration"
"tests/journeys/test_render_export.py::test_playground_examples_keep_their_offline_interaction_mode[data-explorer]"`:
2 passed. These are the only tests that read the page's selectors and
button names.
-
`tests/journeys/test_render_gate.py::test_page_fixture_renders[data-explorer]`
fails only on "closed surfaces: g opened no go-to". The gate, the phone
resize, scroll and typed-box journeys pass. The same failure appears
with this branch's base (22accdd) version of `data-explorer.html`, and
on `heat-loss`, which this branch doesn't touch, so this branch doesn't
cause it.
- `uv run pre-commit run --files examples/data-explorer.html
tests/journeys/test_render_widgets.py`

## Not verified

- WebKit and a real phone. Chromium and Firefox ran under emulation.
- A voice-control tool: the name fix was checked in the accessibility
tree.
- The whole corpus aim sweep
(`test_the_layer_holds_its_whole_page_rules_on_the_corpus`,
`--run-main`). Its reader ran on this page alone at three widths.
- The other 15 refreshed stills by eye: I read their pixel differences
and looked at the four largest.

## Calls Max may reverse

- `table-layout: auto` on a phone, which takes the column movement
above, up to 20px, in exchange for whole words below 355px. The
alternative keeps equal columns, which hold still and split words below
about 355px.
- The asset pin moves in this PR although its stills are unrelated to
the change. Dropping that commit leaves the stills as they were on 31
October.
- `code-comparison`'s "Comparison viewport" slider changes nothing
visible at a phone for most of its range, because the stage is 314px:
400 and 520 both draw 314px candidates, and only 280 and 300 differ.
Hiding it on a phone would hide a value the instruction still submits,
so I left it and noted it as a follow-up.

Closes #4023

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

---------

Co-authored-by: Claude Opus 5.5 <[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