Reference
SVG board
import { … } from "@johnmorrisdotca/suido/draw";
7.2 kB minified and gzipped, with everything it imports (measured with esbuild)
Suido's drawing: SVG text for a board and a piece, the style that turns the
drawing into flowing water, and the function that paints a board in play.
A separate entry (@johnmorrisdotca/suido/draw), so a server that only
checks an answer never loads any of it.
Exports
| Name | Kind | What it is |
|---|---|---|
ArmState | type | What the water does at one opening of a piece. |
attachSuidoView | function | Lets the box box move and zoom the board drawn in svg (which must have a viewBox of the whole board). |
boxOf | function | The size of a board in the drawing's units. |
CellState | type | How one cell is to look. |
cellStates | function | The state of every piece of a board whose pieces face as masks say. |
clampView | function | A view kept inside the board, never further in than most and never showing past an edge. |
drawGuidePiece | function | A piece of the guide (SUIDO_PIECE_GUIDE) as SVG text: its tiny board drawn by drawSuido, with the water in it where the guide says the picture has some, and the piece's name as its description for a screen reader. |
DrawOptions | type | What to draw with. |
drawPiece | function | One piece on its own, as SVG text: for a legend, an icon, or a page that shows how the pieces look. |
drawSuido | function | A board as SVG text. |
drawSuidoThumb | function | A board as a small picture, in a few dozen elements however big the board is: for a page that shows a whole block of levels at once. |
needsZoom | function | Whether the pieces of a board across a box boxPx wide are smaller than a thumb is comfortable with, so that a board offers to be zoomed. |
paintSuido | function | Update the existing board SVG with current facings and water, returning its flow state. |
panView | function | A view moved by (dx, dy) in the drawing's units. |
stepFor | function | The milliseconds the water takes through one cell, so that the deepest cell is reached in FILL_MS at most. |
SUIDO_FIT | constant | The whole board. |
SUIDO_MOST_ZOOM | constant | The furthest in a view goes: this many times the whole board. |
SUIDO_STYLE | constant | THE STYLE a Suido board is drawn with: colours as custom properties, the water's flow as transitions, and the one rule that matters for a game played with fingers: nothing on the board can be selected, dragged or double-tapped. |
SuidoBox | type | A board's size in the drawing's units: a hundred across a cell. |
SuidoView | type | The part of a board shown: how far in (1 is the whole board), and where its top left corner is, in the drawing's units. |
SuidoViewer | type | What attachSuidoView hands back. |
SuidoViewerOptions | type | What a viewer may be asked for. |
viewBoxOf | function | The viewBox that shows a view. |
viewShowing | function | The view moved the least that shows the whole of a cell (a margin of half a cell round it where there is room), and no further in than it was. |
zoomAbout | function | A view zoomed by factor about the point (ax, ay) of the board, which stays under the same place in the box. |