TsunagiPiecetype
ONE GROUP OF A DRAWING: what tsunagiDrawing hands a page instead of one long string, so that a page keeping its
drawing in a framework's own tree writes only the groups whose text changed. A piece is a <g> with these
attributes, holding either its SVG text or more pieces (a pair's washes, its line and its little marbles are a piece
each, so a finger moving through a cell changes one or two pairs and not the thousands of elements of a 30×30 board).
Import it
import type { TsunagiPiece } from "@johnmorrisdotca/tsunagi/draw";
Definition
type TsunagiPiece = {
key: string;
attributes: Readonly<Record<string, string>>;
html?: string;
pieces?: readonly TsunagiPiece[];
};
Members
| Name | Type | Description |
|---|---|---|
key | string | Stable from one drawing of a board to the next. |
attributes | Readonly<Record<string, string>> | |
html (optional) | string | undefined | Its SVG text, unless it holds |
pieces (optional) | readonly TsunagiPiece[] | undefined |
Examples
import type { TsunagiPiece } from "@johnmorrisdotca/tsunagi/draw";
const value: TsunagiPiece = {key:"ground",attributes:{class:"tsu-ground"},html:""};
console.log(value);{ key: 'ground', attributes: { class: 'tsu-ground' }, html: '' }What it prints (run when this page was built)