Reference
Playable boards
import { … } from "@johnmorrisdotca/meikyuu/play";
50.2 kB minified and gzipped, with everything it imports (measured with esbuild)
Meikyuu, played in a page: mountMeikyuu draws a maze, an arrow puzzle or a mixed one into any element and
plays it by touch and mouse, with zoom and pan for big mazes, page left beside the board to scroll by, a tall maze that lies down on a wide screen, Undo, Restart, Hint, a celebration that respects
prefers-reduced-motion, optional sounds, and the words in English and Japanese. A separate entry
(@johnmorrisdotca/meikyuu/play), so a server never loads any of it.
Exports
| Name | Kind | What it is |
|---|---|---|
createMeikyuuSounds | function | Create the optional synthesized native sound player; sound playback is requested by host actions. |
EDGE | constant | How near an edge of the box a line's end must be dragged to move the view, and the most the view moves in a frame there, in pixels. |
EDGE_STEP | constant | The native viewport edge-pan step in pixels. |
edgeNudge | function | How far to move the view in a frame for a finger at (px, py) of a box: the board moves the other way, toward the finger. |
ensureMeikyuuPlayStyle | function | Put the style in the page once: in the document's head, or in the shadow root the host is in. |
FIT_MODES | constant | What a fit makes visible: both the whole board (default); width the board as wide as the box, which for a board taller than the box is the top of it with the rest to move down to; height the board as tall as the box, the left of it for a board wider than the box. |
FitMode | type | Fit both dimensions, only the width, or only the height of a board. |
fitView | function | The view that shows the board as a mode says, with a margin of pad cells: centred where it fits, and at the top or left where it does not. |
isFitted | function | Whether the view is the board fitted, as the mode says. |
keptView | function | A view kept where some of the board can be seen: its middle never leaves the area (with a margin). |
MEIKYUU_GUTTER | constant | The page left beside the box, in pixels: the least, and the most the zoom-out widens it to. |
MEIKYUU_GUTTER_MAX | constant | The maximum native viewport gutter in pixels. |
MEIKYUU_ORIENTATIONS | constant | WHICH WAY UP A MAZE IS LOOKED AT. |
MEIKYUU_PLAY_STYLE | constant | THE STYLE a playable Meikyuu board wears (mountMeikyuu, <meikyuu-board>): the drawing's own (MEIKYUU_STYLE) and the board's box, its buttons, its lines of words and its tabs. |
MEIKYUU_RESERVE | constant | What a window is assumed to hold besides the box, in pixels: the page's header, and the board's buttons and lines of words. |
MEIKYUU_SOUND_KINDS | constant | THE SOUNDS, made in the browser: short tones from the Web Audio API, one for each thing that happens (a step, drawing back, a key, an arrow bumping, an arrow flying off, an unlock, a solve, a loss). |
MeikyuuEventDetail | type | What every event tells of the board. |
MeikyuuMount | type | The mounted flat maze, arrow or mixed board, its game/actions, view and cleanup handle. |
MeikyuuMountOptions | type | Native puzzle/level/recipe, display, controls, sound, stones and event callbacks for a flat player. |
MeikyuuOrientation | type | The native portrait, landscape or automatic board orientation. |
MeikyuuPuzzle | type | What is being played. |
MeikyuuSoundKind | type | One native synthesized board sound. |
MeikyuuSounds | type | Native synthesized sound playback and cleanup methods. |
MOST_CELL_PIXELS | constant | The scales a view may have: the whole board fitted, to a cell this many pixels wide (at least a bit past the fit, so a small maze can still zoom). |
mountMeikyuu | function | Draw a puzzle into host and play it. |
pannedBy | function | The view moved so that the board slides by (dx, dy) pixels under the box. |
pointAt | function | The point of the board under a pixel of the box. |
puzzleOf | function | The puzzle a set of options names: a level of the package's lists, or a recipe given, or null. |
scaleLimits | function | Read the minimum and maximum view scale for this viewport and gutter. |
View | type | A BOARD LOOKED AT THROUGH A BOX, which may be zoomed in until a cell is as big as a thumb and moved about: the arithmetic of the view, without a page. |
ViewBox | type | How a box of width by height pixels shows a board: the margin round it in cells, and how far in a view may go. |
viewBoxOf | function | The text of the viewBox attribute that shows the view. |
visibleArea | function | The part of the board the view shows. |
zoomedAbout | function | The view zoomed by factor about the pixel (px, py) of the box, which stays over the same spot of the board. |