Skip to the content

Jarajaraジャラジャラ

Draw mahjong tiles, arrange racks and stacked boards, and play seeded Awase alone or at a shared table.

Jarajara is the Japanese sound of mahjong tiles rattling together. About the name

Contents

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

NameKindWhat it is
AllowancetypeHow many of a thing a game allows: a number, or no limit at all.
allowanceOffunctionRead an allowance from an attribute: nothing or unlimited is no limit, off or 0 is none, a number is that many.
defineRackfunctionRegister a rack under its standard tag or a host's own tag.
ELEMENT_SIZESconstantThe sizes every element takes, as a tile's width in pixels.
followLanguagefunctionRedraw an element when the page changes its language (<html lang>), as a language chooser does, until the function returned is called.
hintPairfunctionWhat a hint is: the free pair that leaves the stacks lowest after it, so a hint never digs a tile deeper than it must.
JarajaraGroupclassA GROUP OF TILES, SHOWN: <jarajara-group group="winds">, the four winds with their names and how many of each the set holds.
JarajaraLayoutclassA 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.
JarajaraRackclassA RACK OF TILES ON ANY PAGE, lined up in front of you: <jarajara-rack tiles="123m456p789s1112z">.
JarajaraSetclassTHE 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.
JarajaraTableclassAWASE 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.
JarajaraTileclassONE 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.
JarajaraViewerclassA 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.
languageOffunctionThe language an element speaks: its own lang, or the nearest one above it, or the page's; Japanese for anything that starts ja.
MOST_SOUNDINGconstantThe most clicks sounding at one moment, across every element on the page.
RackDetailtypeHow 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.
RackLayoutOptionstypeHow a rack is laid out.
RackPlacetypeOne tile's place: across and down in tile widths from where the rack starts.
rackPlacesfunctionWhere each of count tiles lies, in order: the first at x 0, each a step on, groups set apart, raised tiles lifted.
RackTurnOptionstypeHow a rack's tiles are turned face down or face up.
rackWidthfunctionHow wide a rack is, in tile widths: the last tile's place and the tile itself.
setPageSoundsfunctionGive 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.
SpinOptionstypeHow a tile is spun.
STRINGSconstantTHE WORDS THE ELEMENTS SAY, to a screen reader and in their own captions, in the two languages the family speaks.
TileReftypeTiles 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.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/jarajara 1.7.0.