Reference
Tile and table elements
import { … } from "@johnmorrisdotca/jarajara/element";
97.7 kB minified and gzipped, with everything it imports (measured with esbuild)
Jarajara's custom elements, as classes, with nothing defined: import this to extend them or to define them under
other names. @johnmorrisdotca/jarajara/element/define defines the lot as <jarajara-tile>, <jarajara-rack>,
<jarajara-layout>, <jarajara-table>, <jarajara-group>, <jarajara-set> and <jarajara-viewer>. Safe to import
on a server, where there is no page: the classes then extend nothing.
Exports
| Name | Kind | What it is |
|---|---|---|
Allowance | type | How many of a thing a game allows: a number, or no limit at all. |
allowanceOf | function | Read an allowance from an attribute: nothing or unlimited is no limit, off or 0 is none, a number is that many. |
defineRack | function | Register a rack under its standard tag or a host's own tag. |
ELEMENT_SIZES | constant | The sizes every element takes, as a tile's width in pixels. |
followLanguage | function | Redraw an element when the page changes its language (<html lang>), as a language chooser does, until the function returned is called. |
hintPair | function | What a hint is: the free pair that leaves the stacks lowest after it, so a hint never digs a tile deeper than it must. |
JarajaraGroup | class | A GROUP OF TILES, SHOWN: <jarajara-group group="winds">, the four winds with their names and how many of each the set holds. |
JarajaraLayout | class | A GAME OF AWASE ON ANY PAGE: <jarajara-layout size="15">, a stacked layout of tiles drawn on a cloth, with the rules of the solitaire in it: tap a free tile, then its match, and the pair goes. |
JarajaraRack | class | A RACK OF TILES ON ANY PAGE, lined up in front of you: <jarajara-rack tiles="123m456p789s1112z">. |
JarajaraSet | class | THE WHOLE SET, SHOWN: <jarajara-set>, all 42 faces by suit with how many of each the 144 tiles hold, or, with tiles, what a hand or a wall holds of it: each face as have/total, faces it has none of dimmed. |
JarajaraTable | class | AWASE AT A TABLE, ON ANY PAGE: <jarajara-table players="3">, two to four players round one layout, each taking a free pair in turn: the seats with their winds and scores, the layout on a cloth, and computers playing the seats that are not people's. |
JarajaraTile | class | ONE TILE ON ANY PAGE: <jarajara-tile code="F">, in any design and with any back, face up or face down, turned over by a tap when it has flip. |
JarajaraViewer | class | A TILE LOOKED UP BY ITS CODE, NAME OR KEY: <jarajara-viewer query="east"> shows the tile big, with what it is called in English and in Japanese, its code, suit and rank, how many the set holds, what a pair of them scores at the table, and how a hand writes it. |
languageOf | function | The language an element speaks: its own lang, or the nearest one above it, or the page's; Japanese for anything that starts ja. |
MOST_SOUNDING | constant | The most clicks sounding at one moment, across every element on the page. |
RackDetail | type | How the rack lies, for the page to hear of: what is turned, raised and marked (by place in tiles), and how the tiles are put in order. |
RackLayoutOptions | type | How a rack is laid out. |
RackPlace | type | One tile's place: across and down in tile widths from where the rack starts. |
rackPlaces | function | Where each of count tiles lies, in order: the first at x 0, each a step on, groups set apart, raised tiles lifted. |
RackTurnOptions | type | How a rack's tiles are turned face down or face up. |
rackWidth | function | How wide a rack is, in tile widths: the last tile's place and the tile itself. |
setPageSounds | function | Give every element on the page another player for its sounds: a page's own, or a test's stand-in that only records what was asked. |
SpinOptions | type | How a tile is spun. |
STRINGS | constant | THE WORDS THE ELEMENTS SAY, to a screen reader and in their own captions, in the two languages the family speaks. |
TileRef | type | Tiles as a method is given them: a number is the place of one tile in the rack as it was written (tiles), from 0; a letter or a name ("F", "east", "3p") is every tile of that face; a list is each of its parts. |