Reference
Browser table and SVG
import { … } from "@johnmorrisdotca/tenka/ui";
81.9 kB minified and gzipped, with everything it imports (measured with esbuild)
Tenka drawn and played in the browser, in plain DOM: a whole table against
the computer (mountTenka), and the map on its own (tenkaMapSvg, drawn
from tenkaMapModel). Its own entry, so the rules never carry the map.
Exports
| Name | Kind | What it is |
|---|---|---|
continentNameIn | function | A continent's name in a table of strings, by its key ("northAmerica", "asia"…). |
continentView | function | The part of the map that frames a continent, with a margin, widened to the map's own shape so it fills the same box; the whole world for null. |
landInDirection | function | The territory a key moves to from another: the nearest counter in that direction, a little straighter being better than a little nearer, and only among those inside view (the whole map when none is given), so that the focus never leaves what is on the screen. |
mountTenka | function | A WHOLE TABLE OF TENKA IN PLAIN DOM: the map, whose turn it is and what to do, the players, your cards and the last dice, played against the computer (or by people taking turns on one device, with computers all false). |
nearestLand | function | The territory whose counter is nearest a point of the map, within reach map units, or null. |
NO_MARKS | constant | Nothing lit up. |
ownerColour | function | The colour a territory's owner is drawn in. |
TENKA_MAP_SHAPES | constant | How each map is drawn. |
TENKA_NEUTRAL_COLOUR | constant | The grey of the neutral army. |
TENKA_SEAT_COLOURS | constant | THE COLOURS A TABLE IS DRAWN IN: one for each of six seats, and a grey for the neutral army that holds a third of the world in a game for two. |
TENKA_STRINGS | constant | The package's words in each language it speaks: TENKA_STRINGS.en, TENKA_STRINGS.ja. |
TENKA_STYLE | constant | The table's own styles, scoped to .tk-root, with every colour a CSS variable so a page can wear it in its own colours (set them on the element or any ancestor, or pass them as theme). |
TenkaArrow | type | A way to move between territories from a keyboard. |
TenkaBackHow | type | What a dressing is told about the back it is asked to draw. |
TenkaCardHow | type | What a dressing is told about a card it is asked to draw. |
TenkaDieHow | type | What a dressing is told about a die it is asked to draw. |
TenkaDrawn | type | Something a dressing drew: the element to put on the table, and what to do when the table takes it away again (stop a timer, say). |
TenkaDressing | type | HOW A TABLE DRAWS ITS DICE AND ITS CARDS, if not the plain way: each is a function that is given what the rules decided and hands back the element to show. |
TenkaLand | type | One territory as a drawing needs it. |
TenkaLocale | type | The languages the package speaks: English and Japanese. |
tenkaMapModel | function | EVERYTHING A DRAWING OF THE WORLD NEEDS, for one game: each territory's outline in its owner's colour, its counter's place and armies, and its ring. |
TenkaMapModel | type | The whole world as a drawing needs it, in map units: tenkaMapModel makes one, tenkaMapSvg and TenkaMap draw it. |
tenkaMapSvg | function | THE WORLD AS AN SVG ELEMENT, drawn from a model (tenkaMapModel): the sea, each territory in its owner's colour, the continents' borders and the sea links, the rings of a choice, and a counter of armies on each. |
TenkaRing | type | How a territory is ringed: the one chosen, one it can reach, or the target. |
tenkaSay | function | A line from a table of strings with its braces filled in: tenkaSay(strings.moveIn, { n: 3 }) is "Move 3 in". |
tenkaShapesOf | function | How a game's map is drawn: the world unless the game says otherwise. |
tenkaStrings | function | The table of strings for a locale with a page's own words laid over it. |
TenkaStrings | type | Every table word, including local embed error feedback. |
TenkaTableHandle | type | Native game access, restoration, redealing and presentation updates. |
TenkaTableOptions | type | Native table settings; defaults to three players, with two computers. |
TenkaView | type | A part of the map to show, in map units: left, top, width, height (an SVG viewBox). |
territoryNameIn | function | A territory's name in a table of strings, by its key (TENKA_TERRITORIES[n].key, such as "alaska"); "" for a key that is no territory's. |