clone

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

main
miau-is-true / openspec / changes / add-custom-property-presentation / design.md
design.md 4.3K rendered
1## Glossary contract23The optional pack field is:45```js6properties: {7 TICK: {8 accent: 'tick',9 describe: 'Repeats its steps, one for each of your turns.',10 },11}12```1314Glossary keys SHALL be uppercase custom property tokens. Each value SHALL be15an object with only `accent` and `describe`. `accent` SHALL be one of16`you`, `push`, `stop`, `win`, `sink`, `defeat`, or `tick`; it maps to the17existing property colour tokens, with `tick` using the signal-lime colour.18`describe` SHALL be a non-empty plain-text sentence of at most 8019characters. Unknown fields, invalid keys, invalid accents, empty descriptions,20and overlong descriptions SHALL reject the whole pack before catalog mutation.2122For this change, a level's implemented custom property set is the union of its23`automata[].property` values. A glossary entry supplies presentation metadata24for such a word; it does not by itself add a parser predicate or engine25behavior. Pair words are deliberately reserved for W13. A missing glossary26entry uses the documented TICK-lime fallback only when that property is27otherwise implemented by the level.2829## Metadata plumbing3031Normalization SHALL preserve the glossary in the pack source, pack-service32views, CommonJS export, and data-only share payload. Catalog level records SHALL33expose the pack glossary and the level's derived implemented-property set to the34stage. The same normalized values SHALL be used for local CommonJS and shared35payloads; notes or first-encounter state SHALL NOT become authored pack data.3637## Board and ledger3839The board SHALL classify every word in the current level's implemented custom40property set as a property tile. It SHALL use the glossary accent when present,41and the TICK-lime fallback when absent. Operators and nouns keep their current42roles. The ledger SHALL use the same derived classification and accent mapping43as the board, so a custom property cannot appear as a noun in one presentation44and a property in another.4546The board and ledger APIs SHALL accept this data as options or a pure view47model. They SHALL not inspect the pack registry, local storage, or CommonJS48source directly. D21's beat strip remains an independent consumer of the same49level metadata and keeps its accepted current/next-step behavior.5051## First-encounter card5253When the player enters a proof containing a custom property word with a54glossary description, the stage SHALL request a card before normal play. The55card data SHALL contain pack ID, property word, tile accent, description, and56one example sentence formed from the level's own visible noun and the property57word, such as `MOUSE IS TICK`. The card SHALL have an ENTER acknowledgement and58an accessible equivalent of the same content.5960Encounter state SHALL be keyed by pack ID and property word and persisted at61the existing progress boundary. Re-entering another proof in the same pack62shall not show the card again for that word. A different pack using the same63word shall have its own first encounter. Core properties SHALL never create a64card. If a property has no glossary description, it remains renderable but has65no teaching card.6667## Inspect and ledger details6869Inspect mode and the ledger's hover or keyboard-focus details affordance SHALL70expose the glossary description for a declared custom property. The accessible71text SHALL include the property word and its description, and SHALL remain72available after the first-encounter card is dismissed. The details path SHALL73not mutate engine state or progress beyond the first-encounter acknowledgement.7475## Compatibility7677Packs without `properties` remain valid. Existing core properties retain their78current colors and behavior. Existing packs without custom properties have no79new card or metadata state. Shared payloads that predate this field continue to80decode with an empty glossary.8182## Browser acceptance fixture8384Use a small data-only imported pack with a non-TICK property such as `WIND` and85an accent/description. The fixture SHALL verify that the word is a chamfered86property tile, the card appears once and can be acknowledged, a second proof87does not repeat it, and inspect/ledger details expose the description. Repeat88the checks at desktop width, 390x844, and prefers-reduced-motion, with no89browser console errors. The existing Clockwork automata fixture SHALL continue90to verify beat-strip behavior separately.