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 source

Glossary contract

The optional pack field is:

properties: {
  TICK: {
    accent: 'tick',
    describe: 'Repeats its steps, one for each of your turns.',
  },
}

Glossary keys SHALL be uppercase custom property tokens. Each value SHALL be an object with only accent and describe. accent SHALL be one of you, push, stop, win, sink, defeat, or tick; it maps to the existing property colour tokens, with tick using the signal-lime colour. describe SHALL be a non-empty plain-text sentence of at most 80 characters. Unknown fields, invalid keys, invalid accents, empty descriptions, and overlong descriptions SHALL reject the whole pack before catalog mutation.

For this change, a level's implemented custom property set is the union of its automata[].property values. A glossary entry supplies presentation metadata for such a word; it does not by itself add a parser predicate or engine behavior. Pair words are deliberately reserved for W13. A missing glossary entry uses the documented TICK-lime fallback only when that property is otherwise implemented by the level.

Metadata plumbing

Normalization SHALL preserve the glossary in the pack source, pack-service views, CommonJS export, and data-only share payload. Catalog level records SHALL expose the pack glossary and the level's derived implemented-property set to the stage. The same normalized values SHALL be used for local CommonJS and shared payloads; notes or first-encounter state SHALL NOT become authored pack data.

Board and ledger

The board SHALL classify every word in the current level's implemented custom property set as a property tile. It SHALL use the glossary accent when present, and the TICK-lime fallback when absent. Operators and nouns keep their current roles. The ledger SHALL use the same derived classification and accent mapping as the board, so a custom property cannot appear as a noun in one presentation and a property in another.

The board and ledger APIs SHALL accept this data as options or a pure view model. They SHALL not inspect the pack registry, local storage, or CommonJS source directly. D21's beat strip remains an independent consumer of the same level metadata and keeps its accepted current/next-step behavior.

First-encounter card

When the player enters a proof containing a custom property word with a glossary description, the stage SHALL request a card before normal play. The card data SHALL contain pack ID, property word, tile accent, description, and one example sentence formed from the level's own visible noun and the property word, such as MOUSE IS TICK. The card SHALL have an ENTER acknowledgement and an accessible equivalent of the same content.

Encounter state SHALL be keyed by pack ID and property word and persisted at the existing progress boundary. Re-entering another proof in the same pack shall not show the card again for that word. A different pack using the same word shall have its own first encounter. Core properties SHALL never create a card. If a property has no glossary description, it remains renderable but has no teaching card.

Inspect and ledger details

Inspect mode and the ledger's hover or keyboard-focus details affordance SHALL expose the glossary description for a declared custom property. The accessible text SHALL include the property word and its description, and SHALL remain available after the first-encounter card is dismissed. The details path SHALL not mutate engine state or progress beyond the first-encounter acknowledgement.

Compatibility

Packs without properties remain valid. Existing core properties retain their current colors and behavior. Existing packs without custom properties have no new card or metadata state. Shared payloads that predate this field continue to decode with an empty glossary.

Browser acceptance fixture

Use a small data-only imported pack with a non-TICK property such as WIND and an accent/description. The fixture SHALL verify that the word is a chamfered property tile, the card appears once and can be acknowledged, a second proof does not repeat it, and inspect/ledger details expose the description. Repeat the checks at desktop width, 390x844, and prefers-reduced-motion, with no browser console errors. The existing Clockwork automata fixture SHALL continue to verify beat-strip behavior separately.