Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Add Library Shelf: the playable page and its place in the catalogue, on the rules in `library-shelf/shelf.js` #285
Check · Review · Land · Live done — Landed and live in production.
Library Shelf is now a playable page at /library-shelf/, built only on library-shelf/shelf.js, and it is listed in the catalogue. All 8 new page tests, serve/shell/town/plaza and the library-shelf cases of playtest.test.mjs pass.
shipped production is serving it deploy ab54f53
Library Shelf is now a playable page at /library-shelf/, built only on library-shelf/shelf.js, and it is listed in the catalogue. All 8 new page tests, serve/shell/town/plaza and the library-shelf cases of playtest.test.mjs pass. I did not run the full bun test or tsc (the repo has no tsconfig/package.json; I didn't check for scripts/gate.ts), and I never opened the page in a real browser, so the drawing is checked only through the pixel-capture test harness. main had not moved, so no rebase was needed.
- The page: it draws an oak shelf with two runners and a dashed slot where the returned book must land. You drag a book along its runner, or press Tab to choose one and use the arrow keys for one cell at a time. U or the undo button undoes, and R restarts the level. The HUD shows level, name, slides, par and points straight from the rules state.
- Dragging: a drag is limited to what
M.slideaccepts, so the book stops at the book or shelf end in its way. Tab moves from book to book and leaves the canvas after the last one, so keyboard focus isn't trapped. - Visual rules: the returned book is the red one and also has a ribbon bookmark. Every spine has an arrow for its sliding axis. Shadows fall screen-right, and the dust motes stop under
prefers-reduced-motion. The canvas aria-label says how to play, the rules popup is four lines,#muteis there, and no.mp3is committed. - Catalogue: the
GAMESentry and root<li>are added exactly as specified. The town building comes from theGAMESlist, sotown.jsneeded no edit. The README has the Games table row, the no-music list and the ambient-motion note.bun scripts/og.mjswas run forog/library-shelf.pngandog/home.png. - Tests:
rounds.mjshas a scripted round that drags each book along the rules' ownsolveplan until the shelf is cleared.serve.test.mjsasserts/library-shelf/and/library-shelf/shelf.jsanswer 200.library-shelf/page.test.mjscovers drag, refusal, Tab and arrows, undo, level advance, the draw-once-per-change rule, mute, and the page-source checks.
I added no game rules and no dependencies. There is no hint button, though solve is there for one if you want it.
To try it, run bun serve.mjs and open /library-shelf/.
Library Shelf is served on the preview (/library-shelf/ and /library-shelf/shelf.js both answer 200). The page drives the game only through the rules' slide, undo and restart. Keyboard works: Tab walks the books and then leaves the canvas, arrows slide, U and R work, and there are 44px buttons and a live status line. I could not open the forge's screenshots (the sandbox denies that path), so the drawing is judged from the source only.
Two things I would do next:
- Make the ribbon and spine-arrow test check pixels. Today it greps the page source, so it would pass even if the ribbon drew in the wrong place.
- Say something when undo is pressed on a finished shelf. It currently does nothing, silently.
Library Shelf is now a playable page at
/library-shelf/, built only onlibrary-shelf/shelf.js, and it is listed in the catalogue. All 8 new page tests,serve/shell/town/plazaand thelibrary-shelfcases ofplaytest.test.mjspass. I did not run the fullbun testortsc(the repo has notsconfig/package.json; I didn't check forscripts/gate.ts), and I never opened the page in a real browser, so the drawing is checked only through the pixel-capture test harness.mainhad not moved, so no rebase was needed.M.slideaccepts, so the book stops at the book or shelf end in its way. Tab moves from book to book and leaves the canvas after the last one, so keyboard focus isn't trapped.prefers-reduced-motion. The canvas aria-label says how to play, the rules popup is four lines,#muteis there, and no.mp3is committed.GAMESentry and root<li>are added exactly as specified. The town building comes from theGAMESlist, sotown.jsneeded no edit. The README has the Games table row, the no-music list and the ambient-motion note.bun scripts/og.mjswas run forog/library-shelf.pngandog/home.png.rounds.mjshas a scripted round that drags each book along the rules' ownsolveplan until the shelf is cleared.serve.test.mjsasserts/library-shelf/and/library-shelf/shelf.jsanswer 200.library-shelf/page.test.mjscovers drag, refusal, Tab and arrows, undo, level advance, the draw-once-per-change rule, mute, and the page-source checks.I added no game rules and no dependencies. There is no hint button, though
solveis there for one if you want it.To try it, run
bun serve.mjsand open/library-shelf/.Closes #271