Documentation

Rendering and maintenance

v1 · Deprecated

Framework v1 is deprecated for new games. Existing games remain playable and editable.

Build errors and limits

Required exports

Export Type Notes
gameConfig GameStateConfigFn Returns the initial config. Called once.
getSelectableItems GetSelectableItemsFn Returns the viewer-visible click targets.
applyActions ApplyActionsFn Mutates state in place.
getPlayerScores GetPlayerScoresFn Returns Scores map.
isGameOver IsGameOverFn Returns a boolean.

Gotchas

  • Every value in pieces / spaces MUST be a PieceDef / SpaceDef instance. Raw object literals are rejected.
  • A kind used only at runtime (via state.addPiece(id, new Foo())) MUST also appear in pieceDefs or spaceDefs, otherwise addPiece throws "PieceDef kind ... is not registered".
  • Imports resolve only to other /src files (relative or absolute /src path) and the "boardweaver" runtime. There's no node_modules, so a bare import like import x from "pieces/Foo" fails the build : use "./pieces/Foo" or "/src/pieces/Foo".

Gotchas

  • Style validation is .strict(): an unknown style property (e.g. transform typoed as tranform, or background shorthand) is REJECTED, not silently dropped.
  • No CSS shorthand parsing anywhere : border, background, font, transition, animation etc. are absent by design.
  • A piece's render() MUST NOT return a Pieces node (or contain one in its children) : piece-side BWSS rejects it.
  • A space's render() MUST return exactly one Pieces node for piece children to appear (zero → no pieces + warning; multiple → fallback to default container + warning).
  • Image.src is a GameImageKey string : unknown keys render nothing. See images.
  • Svg.paths[*].d is character-class restricted: digits, MLHVCSQTAZmlhvcsqtaz, whitespace, +-.eE, only. URLs, parens, and quote marks throw.
  • Text inside a Box is a plain string child : there's no Text node. To style text, set typography style fields on the enclosing Box.

Need a hand with this?

Join our Discord