Skip to content

Add the scenario lists, the New Scenario dialog and a scene backdrop - #162

Open
maniator wants to merge 5 commits into
mainfrom
claude/project-thread-i61qql
Open

maniator wants to merge 5 commits into
mainfrom
claude/project-thread-i61qql

Conversation

@maniator

@maniator maniator commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What & why

A game with scenarios needs two ways to pick one: a launch window it can open on, and a File > New Scenario… dialog. Both are reusable UI, so they live here. They draw from one shared entry shape that the caller works out: title, facts, brief, goals with Goal/Better/Best marks, the best result kept, and why a scenario is locked. The lists read no saves and know nothing of a simulation. The launch window can sit over a screen saver scene running as a moving backdrop.

  • windows/scenarioList: scenarioLaunchTemplate draws one window with a heading, numbered rows and a foot the caller fills. Each row has its brief, its trophies and a Play button, or the lock reason. The pieces are exported too: scenarioRowsTemplate, scenarioDetailsTemplate, scenarioGoalsTemplate, scenarioTrophiesTemplate and scenarioBestText.
  • windows/newScenario: newScenarioView, a view for ModalShell. It shows a list box beside the picked entry's details, with Play and Cancel. The arrow keys, Home and End move the pick, and Enter plays. A double-click also plays, but the Play button is always there, so no action is double-click only. Lead entries (a sandbox, say) carry their own details.
  • windows/screenSaver/sceneBackdrop: startSceneBackdrop runs a screen saver scene on a canvas the page draws with the new scene-backdrop class. It sizes the scene to the canvas's box, rebuilds it on resize, and holds one still frame under reduced motion. backdropSize gives the canvas size.
  • styles/game/scenario-list.css sits in a new vc.windows.scenario-list layer, declared after vc.windows.appearance and imported by styles.css. The .scene-backdrop rule lives in styles/game/screen-saver.css.

Design notes that came with the owner's pick of this look:

  • The trophies carry the best mark's name beside them, so the result never rests on color alone.
  • Rows are at least 44 px tall on touch screens.
  • On a narrow window the list sits over the details, so the goals table never clips.
  • The backdrop scene is Endless Tower.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New component or export
  • Visual or audio change (new art, a new look, a new sound)
  • Breaking change to an export
  • Refactor / internal-only (no visible or API change)
  • Docs / tooling

Quality gates

  • npm run typecheck
  • npm run lint
  • npm run format:check (npm run format fixes it)

npm run icons:check, npm test (2425 passed after the rebase), npm run build and the gallery typecheck are green locally too. The pinned mcr.microsoft.com/playwright:v1.61.1-jammy image minted the new spec's baselines and ran it twice in a row without a flake, along with the screen saver spec.

Versioning

  • Left version alone, or this is a release PR
  • Added a change note with its level under .changes/, or this PR changes nothing the package ships
  • Updated the README where it went stale, or read it and it did not

The note is minor. README ("Cascade layers") and ARCHITECTURE.md name the new sheet and modules, and the gallery has a Scenario lists page.

Complexity

The lists are drawn on demand, never per frame. The launch window draws once, one pass over the entries, O(n) in a handful of scenarios. The dialog redraws through ModalShell.render on each pick (one pass, and lit touches only what changed). Key handling is an indexOf over the ids. The backdrop is the screen saver's existing loop (runScene): one canvas at a quarter of the CSS pixel size, at most 30 frames a second, and Endless Tower paints each room once onto a layer canvas, so a frame is one copy whatever the tower's height. A resize rebuilds the scene once. There are no new caches or counters, and nothing runs once the backdrop is stopped or its canvas leaves the page.

Hot-path record (section 6): the backdrop reuses runScene unchanged. The lists are on-demand UI with no frame-loop or render-model work.

Screenshots / recordings

Every scheme on both screens is in e2e/__screenshots__/ (*-scenario-launch.png, *-new-scenario.png, new-scenario-locked.png). The gallery's Scenario lists page shows the backdrop moving.

Notes for reviewers

  • The modal's 560 px cap is widened for this dialog by a #modal:has(> .modal-box > .sl-dialog) rule in vc.page, the same way the Open window widens it.
  • The trophy ink is var(--trophy, #b07800). No scheme sets --trophy yet, so every scheme uses the fallback.
  • The backdrop takes a canvas the page's own template draws, so no DOM is built by hand.
  • The gallery's backdrop uses a fixed seed, and the spec runs with reduced motion, so the shots see one still frame.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ms7trY1ut5RQ7Dh1hB8uGD

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Gallery preview: https://components.verticopolis.com/pr-preview/pr-162/

Built from b5226b8. It updates when a push changes the package or the gallery, and it goes away with the next gallery deploy after this pull request closes.

…dialog

windows/scenarioList draws a game's scenarios as numbered rows in a launch
window, each with its brief, its trophies (with the best mark's name
beside them) and a Play button, or why it is locked. windows/newScenario
is the New Scenario dialog for the shared modal: a list box beside the
picked scenario's details, with Play and Cancel, the arrow keys, Home,
End and Enter. Both draw from the same entries, which the caller works
out. The gallery has a page for them, with screenshot tests in each
scheme on a computer and a phone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ms7trY1ut5RQ7Dh1hB8uGD
windows/screenSaver/sceneBackdrop runs a scene on a canvas the page draws
with the scene-backdrop class, sized to its box, rebuilt on resize, and
still under reduced motion. The gallery's Scenario lists page puts the
launch window over Endless Tower, from a fixed seed so the screenshot
tests (run with reduced motion) see the same still frame every time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ms7trY1ut5RQ7Dh1hB8uGD
@maniator
maniator force-pushed the claude/project-thread-i61qql branch from 567a4e0 to b62af9d Compare November 26, 2026 09:51
@maniator maniator changed the title Add the scenario lists: a launch window of rows and the New Scenario dialog Add the scenario lists, the New Scenario dialog and a scene backdrop Nov 26, 2026
@maniator
maniator marked this pull request as ready for review November 26, 2026 09:51
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T10:14:16.084320Z b5226b8 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@maniator maniator left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review: CONDITIONAL GO on b62af9d

This comes from a separate thread. Copilot is out of quota, so it ran /gds-code-review (Blind Hunter, Edge Case Hunter, Acceptance Auditor, Hot-Path Auditor) and stand-in-pr-review. Locally I ran the three new unit files (23/23), typecheck, lint and Prettier over src, gallery and e2e, all green. There are no earlier threads. When I wrote this, CI's Typecheck and lint and its Compare the gallery screenshots jobs were still running; the rest are green.

Findings

patch

  1. sceneBackdrop.ts:53: the resize listener outlives the canvas, and a window drag rebuilds the scene on every resize event. Both contradict the doc comment and the body. Details and fix are inline.
  2. newScenario.ts:140: in a list box that scrolls, a keyboard pick can land out of view, because only aria-activedescendant moves. Details and fix are inline.

nit (optional)

  • newScenarioKeyTarget: from no pick, ArrowDown skips the first entry (inline).

Checked, no finding

  • No simulation rules and no engine imports. Entries, marks, lock reasons and the best tier all come from the caller, and scenarioBestText and the trophies only word that tier. All UI is lit templates with @event bindings. The backdrop takes a canvas the page's own template draws.
  • The cascade layers: scenario-list.css declares the full vc.windows.* order with scenario-list last. Sheets that do not list it yet append it last on first use, so the order is the same whichever sheet loads first. The modal widening sits in vc.page, as the body says.
  • Accessibility: the trophies are role="img" with the result in words, ticks carry a hidden "(reached)", and the goals table has row and column headers. Locked rows have no Play button, and Play is disabled for a locked pick (a test and an e2e cover it). Rows are 44 px under pointer: coarse.
  • Screenshots: the spec runs with reduced motion and a fixed seed, so the backdrop shows one still frame. Baselines were minted in the pinned image.
  • Public-safe: the gallery's scenarios are made up, and nothing names a private consumer.
  • The change note is minor for new exports. README's cascade-layers section and ARCHITECTURE.md are updated.
  • Design sign-off: the body records the owner's pick of this look (chooser C plus A, Endless Tower backdrop). Under this repository's design rule, keep the screenshots in front of him before merge if the pick was made on mockups, not on these renders.

Hot-path record (section 6), b62af9d

Item Result
HP-1 callers and tier Lists: on demand, at open and on each pick (dialog). Backdrop: runScene's rAF loop, at most MAX_FPS, plus start on every window resize.
HP-2 whole-collection work One pass over the entries per draw. newScenarioKeyTarget builds an id array and runs an indexOf, both O(n) in a handful of entries, per key press.
HP-3 allocations Per draw: templates and the id array. Per resize: a whole new scene with its layer canvases (patch 1: coalesce to one per frame).
HP-4 sorts None.
HP-5 containers None new.
HP-6 id lookups find/some/indexOf over a handful of entries, on demand only.
HP-7 inherited algorithms runScene and Endless Tower are reused unchanged.
HP-8 caches None added or removed. Endless Tower's per-room layer canvas is kept within a scene's life.
HP-9 remedy Patch 1: guard on isConnected and coalesce resizes to rAF.
HP-10 identical results and invalidation A resize rebuilds at the new size. A test pins that.
HP-11 WASM, build and deps No new dependency. There are three new windows/* subpaths through the existing map and one new sheet in styles.css.
HP-12 rendering One canvas at a quarter of the CSS resolution, pointer-events: none, and aria-hidden from the caller. The lists are DOM only.

Verdict: CONDITIONAL GO. The conditions are patches 1 and 2 with their tests, plus green required checks. I will re-review the delta.

Reviewed against Verticopolis conventions (.github/copilot-instructions.md).


Generated by Claude Code

Comment thread src/ui/screenSaver/sceneBackdrop.ts Resolved
Comment thread src/ui/newScenario.ts Resolved
Comment thread src/ui/newScenario.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b62af9daeb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ui/newScenario.ts Resolved
… the pick in view

Review fixes. The backdrop rebuilds its scene at most once a frame
during a window drag, and its resize listener goes with the stop or at
the first resize after the canvas has left the page. The New Scenario
list scrolls the picked row into view when a key moves the pick, and
from no pick the arrow keys start at the first row. A goal with fewer
than three marks leaves the later cells empty so the columns stay in
line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ms7trY1ut5RQ7Dh1hB8uGD

Copy link
Copy Markdown
Contributor Author

Independent review: GO on 9f17f3a

This re-review covers the b62af9d..9f17f3a delta (one commit; the range-diff shows the first two commits unchanged), using /gds-code-review plus stand-in-pr-review.

  • Patch 1 is fixed. The backdrop's resize now queues one rAF rebuild, and further resize events in that frame do nothing more. The returned stop ends the scene, cancels a queued frame and removes the listener. A resize, or the queued frame, after the canvas has left the page calls stop and builds nothing. The doc comment now says exactly this. The tests cover three resizes building once, stop canceling a queued frame, and a detached canvas releasing the window.
  • Patch 2 is fixed. The picked option carries ref(scrollNear) and the others ref(leave), both module-level stable functions. Lit calls scrollNear only when an option becomes the picked one, and el?. keeps lit's undefined disconnect calls harmless. A re-render with the same pick does not scroll again. Both cases are tested.
  • The nit is fixed. From no pick, ArrowDown and ArrowUp land on the first entry (tested).
  • New in this commit: the goals table pads a goal with fewer than three marks with empty cells, so the columns line up (tested).
  • I ran the three unit files locally (28/28), plus typecheck, lint and Prettier, all green. All four threads are resolved, Codex's duplicate of patch 2 included. When I wrote this, CI's Typecheck and lint and its Compare the gallery screenshots jobs were still running.

The section 6 record carries from b62af9d, except HP-3 and HP-9: a resize now rebuilds at most once a frame, and the listener ends with the canvas.

Verdict: GO, once the required checks are green on 9f17f3a. Under the design rule, merge also waits on the owner's own OK of this look.

Reviewed against Verticopolis conventions (.github/copilot-instructions.md).


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f17f3a04d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread gallery/scenarioList.ts Resolved
The modal's own list indent and paragraph spacing pushed the list box in
from the edge and opened gaps between its rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ms7trY1ut5RQ7Dh1hB8uGD

Copy link
Copy Markdown
Contributor Author

Independent review: GO carries to 6739223

The 9f17f3a..6739223 delta is one commit. It adds two margin: 0 rules in vc.page (.modal-box .sl-listbox, .modal-box .sl-option), which win over the modal's own list spacing. It also brings the 8 re-minted New Scenario baselines from the pinned image. Margins only: no change to the 44 px touch rows, the scroll container or any script, and the launch-window baselines are untouched. The hot-path record still stands.

Verdict: GO on 6739223, once the required checks are green, the screenshot compare included. Merge still waits on the owner's design OK.


Generated by Claude Code

…p once its canvas is laid out

The sl- prefix collided with Starlight's own utility classes on the docs
sites: the visually hidden helper hid the search box's text. The classes
now use scn-. A template ref hands the backdrop its canvas before it is on
the page, so the first build now waits a frame for its real size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ms7trY1ut5RQ7Dh1hB8uGD

Copy link
Copy Markdown
Contributor Author

The red "Compare the gallery screenshots" runs came from this PR. The visually hidden helper .sl-hidden collided with Starlight's own sl-hidden utility class, so the search box lost its text in the site header, the menu bar and the fireworks shots. b5226b8 renames every scenario class to the scn- prefix. It also makes the backdrop wait for a laid-out canvas, which answers the Codex thread. The full e2e suite passes locally in the pinned image (233 passed).


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Independent review: GO on b5226b8

This covers the 6739223..b5226b8 delta, one commit.

  • The class rename moves sl- to scn- across the two modules, the sheet, the unit tests, the e2e spec and the gallery CSS. No scenario class keeps the sl- prefix. The sl- names left in site/src/styles/gallery.css are Starlight's own (--sl-nav-*, .sl-menu-button, .sl-markdown-content). This fixes the collision of .sl-hidden with Starlight's utility class, which hid the search text.
  • The backdrop start answers Codex's thread. A canvas that is not on the page yet queues one rAF rebuild instead of starting at window size. stop cancels that queued frame, and a canvas still detached on that frame calls stop, which removes the listener. The new unit test sizes the canvas only after insertion and asserts one build at 100x50.
    • Nit (optional): a page that inserts the canvas later than the next frame gets no backdrop. "On the next frame" in the doc comment says that.
  • I ran the three unit files locally (29/29), plus typecheck, lint and Prettier over src, gallery, e2e and site/src. All five threads are resolved. Only the classic launch baselines moved, consistent with the backdrop now being sized to its holder. Compare the gallery screenshots and Typecheck and lint were still running when I wrote this.

The hot-path record carries. The deferred first build is one extra rAF, once.

Verdict: GO on b5226b8, once the required checks are green. Merge still waits on the owner's design OK.

Reviewed against Verticopolis conventions (.github/copilot-instructions.md).


Generated by Claude Code

This branch has not been deployed

No deployments
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