clone

a browser grid puzzle game where you push words around to rewrite the rules of each level

Specify no-truncation proof title fitting

Dami committed 206931d
commit
206931d471553259baef4b4c6f619b1321fa09e1
parent
f3c751c5ff2252e74022186018b6f5914a422a5c
author
Dami <dami.etoile@gmail.com>
5 files changed, +197 -0
Aopenspec/changes/add-proof-title-fitting/.openspec.yaml2+
Aopenspec/changes/add-proof-title-fitting/design.md62++++++++++++++++++++++++++++
Aopenspec/changes/add-proof-title-fitting/proposal.md35++++++++++++++++
Aopenspec/changes/add-proof-title-fitting/specs/game-presentation/spec.md66++++++++++++++++++++++++++++++
Aopenspec/changes/add-proof-title-fitting/tasks.md32+++++++++++++++
A openspec/changes/add-proof-title-fitting/.openspec.yaml +2 -0
A openspec/changes/add-proof-title-fitting/design.md +62 -0
@@ -0,0 +1,62 @@
1+## Context2+3+The design review recorded in `docs/design-inbox.md` and the current4+"Proof titles never truncate" section of `docs/design.md` require authored5+words to remain visible. The title is currently rendered inside a fixed HUD6+region, so a long title can collide with the step counter or clip at the7+mobile edge.8+9+## Decisions10+11+### Use measured owning regions12+13+Each scene computes the title region from its actual geometry. In the Proof14+HUD, the region begins after the `[NN]` number tile and ends before the step15+counter, with a 16px inset on both sides. INDEX and Win derive equivalent16+regions from their own settled layout. Text measurement uses the existing17+font/Pretext-compatible measurement path and never changes cell size or grid18+coordinates.19+20+### Shrink, then wrap, never ellipsize21+22+Start at 22px for the Proof HUD and reduce one pixel at a time to a 16px23+floor while testing the full title on one line. If the title still exceeds24+the measured width, wrap only at word boundaries into at most two lines. The25+renderer must retain the authored words and must not add `…`, silently drop a26+word, or split a word to force a fit.27+28+If a title cannot fit into two lines at the 16px floor, the renderer keeps the29+two measured lines in the owning region and reports the overflow to its layout30+result for diagnostics/tests. This presentation change does not invent a new31+runtime warning; the separate mods diagnostics change owns the >32-character32+authoring note.33+34+### Preserve the HUD-to-board contract35+36+When the Proof title takes two lines, the `PROOF NN OF NN` subline and board37+origin move down as one measured group. The board retains at least 40px of38+clear space below the HUD. The board cell size and authored coordinates remain39+unchanged; only the available vertical presentation region is recomputed.40+41+### Keep motion and reduced motion deterministic42+43+Title fitting is settled geometry. Existing title type/drop, INDEX banner44+type, Win stamp, slow-motion clock, and reduced-motion behavior continue to45+consume the fitted lines. Reduced motion shows both final lines immediately.46+No fitting decision may delay input or alter pointer hit rectangles.47+48+## Risks and mitigations49+50+- A narrow title region can create an unexpected two-line title. Test the51+ exact desktop and 390x844 mobile widths and return measured line geometry.52+- A board shift can collide with the footer or ledger. Add layout assertions53+ for the 40px gap and bottom safe region.54+- Different scenes may drift into different wrapping behavior. Share a pure55+ fit helper and test its output directly before wiring each renderer.56+57+## Non-goals58+59+- Changing title copy, sentence case, level IDs, or authoring data.60+- Adding a title-length warning to the loader or diagnostics envelope.61+- Changing Pretext's grid placement or simulation coordinates.62+- Changing navigation, pointer hit testing, or scene transition timing.
A openspec/changes/add-proof-title-fitting/proposal.md +35 -0
@@ -0,0 +1,35 @@
1+## Why2+3+Authored proof titles are player-facing content. The current presentation can4+clip a long modded title in the Proof HUD, which hides the level's identity and5+violates the copy rule that authored titles never receive an ellipsis.6+7+## What Changes8+9+- Define one measured, no-truncation fitting rule for proof titles in the Proof10+ HUD, INDEX banner, and Win card.11+- Give the Proof HUD title the measured space between the level number tile and12+ the step counter, with a 16px inset on both sides.13+- Shrink the title from 22px to 16px in 1px steps, then wrap at word14+ boundaries to no more than two lines when it still does not fit.15+- Move the Proof HUD subline and board together when the title wraps so the16+ documented 40px HUD-to-board gap remains intact.17+- Keep integer grid coordinates, simulation state, pointer targets, and the18+ separate mods diagnostics warning contract unchanged.19+20+## Capabilities21+22+### Modified Capabilities23+24+- `game-presentation`: fit authored proof titles in their owning scene regions25+ without truncation or grid/layout ambiguity.26+27+## Impact28+29+- Affected presentation layout and text measurement for Proof, INDEX, and Win.30+- Affected focused renderer/layout tests and browser visual acceptance at31+ desktop and mobile sizes.32+- No engine rules, level data, input semantics, mod loader validation, or33+ authoring diagnostics are changed by this proposal.34+- The separate warning for titles longer than 32 characters remains owned by35+ the diagnostics change and is deliberately out of scope here.
A openspec/changes/add-proof-title-fitting/specs/game-presentation/spec.md +66 -0
@@ -0,0 +1,66 @@
1+## MODIFIED Requirements2+3+### Requirement: Authored proof titles SHALL remain visible in scene HUD regions4+5+The presentation SHALL render an authored proof title without an ellipsis or6+discarded words. In the Proof HUD, it SHALL measure the space between the7+`[NN]` number tile and the step counter, subtract 16px from each side, start8+at 22px, and shrink in 1px steps to a 16px minimum before wrapping at word9+boundaries. A wrapped title SHALL use at most two lines. INDEX banners and Win10+cards SHALL use the same shrink-then-wrap behavior with their own measured11+regions. Text fitting SHALL not change integer grid coordinates, simulation12+state, or pointer hit rectangles.13+14+#### Scenario: A normal Proof title stays on one line15+16+- **WHEN** a Proof title fits between the number tile and step counter at17+ 22px with the 16px side insets18+- **THEN** the HUD renders the complete title on one line and keeps the19+ existing subline and board placement20+21+#### Scenario: A long Proof title shrinks before wrapping22+23+- **WHEN** the complete authored title does not fit at 22px but fits at a24+ size between 16px and 21px25+- **THEN** the HUD renders the complete title on one line at the largest26+ fitting integer pixel size and adds no ellipsis27+28+#### Scenario: A long modded title wraps at word boundaries29+30+- **WHEN** the complete title still does not fit at 16px31+- **THEN** the HUD renders every authored word across no more than two lines,32+ breaks only between words, and adds no ellipsis or clipped replacement33+34+#### Scenario: A wrapped Proof title preserves board clearance35+36+- **WHEN** the Proof title uses two lines37+- **THEN** the `PROOF NN OF NN` subline and board shift down together and the38+ measured HUD-to-board gap remains at least 40px without changing cell size39+ or object coordinates40+41+#### Scenario: INDEX and Win use the shared fitting rule42+43+- **WHEN** an INDEX banner or Win card receives a title that needs shrinking44+ or wrapping45+- **THEN** that scene applies the same 22px-to-16px shrink and two-line46+ word-boundary wrap rule within its measured region, with complete copy and47+ no ellipsis48+49+#### Scenario: Mobile fitting remains inside the viewport50+51+- **WHEN** a long title is rendered at 390x84452+- **THEN** its lines remain inside the scene's title region, the board or card53+ content retains its safe gap, and existing pointer targets remain unchanged54+55+#### Scenario: Reduced motion shows settled fitted copy56+57+- **WHEN** reduced motion is enabled while a title is long enough to shrink or58+ wrap59+- **THEN** the complete fitted title and any required two-line layout appear60+ immediately with no intermediate clipping or transition-only omission61+62+#### Scenario: Fitting is presentation-only63+64+- **WHEN** a title is measured, shrunk, or wrapped65+- **THEN** the engine state, level IDs, integer grid coordinates, navigation,66+ and pointer hit rectangles are unchanged
A openspec/changes/add-proof-title-fitting/tasks.md +32 -0
@@ -0,0 +1,32 @@
1+## 1. Shared fitting contract2+3+- [ ] 1.1 Add a pure title-fit helper that measures a complete string, shrinks4+ 22px to 16px in 1px steps, and wraps at word boundaries into at most two5+ lines without adding an ellipsis.6+- [ ] 1.2 Return measured line widths, font size, line count, overflow status,7+ and owning-region geometry so renderers and tests use one contract.8+- [ ] 1.3 Add focused tests for one-line, shrink-only, two-line, long-word,9+ empty-title, and reduced-motion settled results.10+11+## 2. Scene integration12+13+- [ ] 2.1 Apply the helper to the Proof HUD using the measured region between14+ the number tile and step counter with 16px insets.15+- [ ] 2.2 Move the Proof subline and board down as one group for two-line16+ titles while retaining at least 40px HUD-to-board clearance.17+- [ ] 2.3 Apply the same helper to the INDEX banner without changing its18+ banner or pointer hit geometry.19+- [ ] 2.4 Apply the same helper to the Win card without changing its actions20+ or input hit geometry.21+- [ ] 2.5 Verify desktop, 390x844 mobile, `?slowmo=8`, and reduced-motion22+ settled frames for a long modded title.23+24+## 3. Verification and handoff25+26+- [ ] 3.1 Run focused title/layout tests and the full Node suite.27+- [ ] 3.2 Run the production build and browser checks for Proof, INDEX, Win,28+ mobile layout, navigation, and pointer actions.29+- [ ] 3.3 Confirm no engine, mod loader, diagnostics, or pointer semantics30+ changed; leave the >32-character warning to its separate change.31+- [ ] 3.4 Post the local long-title screenshots and layout evidence to the32+ design inbox for review before publishing a preview revision.