リファレンス
SVGの盤
import { … } from "@johnmorrisdotca/tsunagi/draw";
最小化と gzip 圧縮をしたサイズは 13.7 kB(読み込むものをすべて含み、esbuild で計測)
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Tsunagi's drawing: a board as SVG text, with its colour sets, its boards,
the style that gives the drawing its look, and where everything sits in it
(so a page can tell which cell a finger is over). A separate entry
(@johnmorrisdotca/tsunagi/draw), so a server that only checks an answer
never loads any of it.
エクスポート
| 名前 | 種類 | 概要 |
|---|---|---|
beadShades | 関数 | A marble on a line's way between its ends: the pair's colour, or for numbers the line's own soft tint, with nothing written on it. |
CELL | 定数 | How wide a cell is in the drawing's units. |
cellAtPoint | 関数 | The cell under a point of the drawing, or null where there is none: off the board, in the frame, on a hexagon's missing corner. |
colourOfPair | 関数 | The colour of a pair in a set, round and round. |
COORDINATE_ROOM | 定数 | The room the row numbers and column letters take on every side, where they are drawn. |
drawTsunagi | 関数 | A board as SVG text, with the lines in options.lines drawn on it. |
drawTsunagiCode | 関数 | A level's layout code drawn, or an empty string for a code that is no layout at that size. |
drawTsunagiMarble | 関数 | One marble on its own, as SVG text: for a legend or an icon. |
drawTsunagiPair | 関数 | What one pair's line is made of in a drawing, for a page that keeps a drawing in its DOM and redraws only the pair whose line changed: its washes and its little marbles, each to go inside the group of that pair's (.tsu-washes > [data-pair] and .tsu-beads > [data-pair], and .tsu-ghosts > [data-pair] on a board that wraps), and its line (a .tsu-line for the .tsu-lines group, to replace any of that pair's). |
FRAME | 定数 | The frame round the playing surface, in the drawing's units. |
GeometryOptions | 型 | Coordinate labels and wrap ghost-cell choices for geometry. |
HEX_RADIUS | 定数 | A hexagon's centre to its corner, in cells: a pointy-top hexagon one cell wide. |
hexagonPoints | 関数 | A hexagon's corners about a centre, pointy at the top, as an SVG points list. |
hsl | 関数 | A colour as a CSS string, lightened or darkened by shift percentage points, at an opacity. |
lineColour | 関数 | The stroke a pair's line is drawn in: its colour, or a soft tint of it for numbers. |
lineRuns | 関数 | A line as the runs it is drawn in, each a list of points through its cells' middles. |
marbleShades | 関数 | A marble's shading: the highlight at its upper left, its body, and its rim, and the ink its number is written in. |
PORTAL_STUB | 定数 | How far from the middle of a portal's cell a line stops going in, and starts coming out, as a share of a cell: just inside the ring. |
portalMark | 関数 | The mark of portal index, from 0: its Greek letter, or its number once the letters are used up. |
round | 関数 | A number as short as it can be written for a drawing: two places. |
TSUNAGI_BOARD_NAMES | 定数 | The ready-made boards. |
TSUNAGI_BOARDS | 定数 | Every ready-made board's look. |
TSUNAGI_COLOUR_SET_NAMES | 定数 | The colour sets there are. |
TSUNAGI_COLOUR_SETS | 定数 | Every set carries a colour for each of the eighty-two pairs a board can have (PAIR_LETTERS): its sixteen, which every board to 15×15 has been drawn in, then the same hues again turned round the colour wheel and made lighter or darker, round after round, so that no two pairs of a 30×30 board wear exactly one colour. |
TSUNAGI_DEFAULT_BOARD | 定数 | The default: paper, which takes its colours from the page (--tsu-paper and the rest of TSUNAGI_STYLE), light or dark. |
TSUNAGI_DEFAULT_COLOUR_SET | 定数 | The sets' default: the one itsutsu.com plays in. |
TSUNAGI_PORTAL_COLOURS | 定数 | The colours and the marks of a board's portals: the two rings of a portal are drawn alike, in one of these colours and with one of these letters, so that they can be told from any other pair and from a marble. |
TSUNAGI_PORTAL_GLYPHS | 定数 | The letters that mark portals: Greek, which no marble or number is. |
TSUNAGI_SHELL | 定数 | The plain shell marble a number is written on: highlight, body, rim, and the ink. |
TSUNAGI_STRINGS | 定数 | Native board words, with the same keys in every shipped language. |
TSUNAGI_STYLE | 定数 | THE STYLE a Tsunagi drawing wears: the colours of its board as custom properties, the two things that move (a flashing ring round a marble Check found unjoined, and the burst where an explosion took a line out), and the one rule that matters for a puzzle played with fingers: nothing in the drawing can be selected, dragged or double-tapped. |
tsunagiBoardLook | 関数 | A board as asked: a ready-made one by name, or a look of your own. |
TsunagiBoardLook | 型 | What a board is made of: every part a CSS colour. |
TsunagiBoardName | 型 | A supported named native board appearance. |
TsunagiColour | 型 | A colour as hue (0 to 360), saturation and lightness (each 0 to 100). |
tsunagiColourSet | 関数 | A colour set as asked: one of the named sets, or colours of your own (used round and round when a board has more pairs than you gave). |
TsunagiColourSetName | 型 | A supported named palette for the native board. |
TsunagiDrawOptions | 型 | DRAWING a board as SVG text: a string, to put in a page, a file or an image, with nothing to load and nothing run. |
TsunagiFill | 型 | Marbles along every line (the dots), or the line alone. |
tsunagiGeometry | 関数 | The geometry of a layout's drawing. |
TsunagiGeometry | 型 | The board dimensions, cell centres and playable-cell mapping used by SVG and pointer input. |
TsunagiLanguage | 型 | THE WORDS A TSUNAGI BOARD SAYS, in English and Japanese: what a screen reader hears of the drawing, the buttons and the lines under a playable board, and what each challenge on a level means. |
tsunagiLanguageOf | 関数 | The language a piece of text is in: Japanese for anything starting ja, English for everything else. |
TsunagiMarks | 型 | How the pairs are told apart: by colour, or by the number on each pair's marbles. |
TsunagiPoint | 型 | A point in the drawing. |
tsunagiSay | 関数 | A line in a language, with its values filled in; the line itself if there is none by that name. |
washColour | 関数 | The faint wash a line leaves on the cells it runs through. |
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。