Reference · Puzzle board element
KarakuriElementOptionstype
Full native host options; attributes take priority over starting choices.
Import it
import type { KarakuriElementOptions } from "@johnmorrisdotca/karakuri/element";
Also exported from: @johnmorrisdotca/karakuri/element/define
Definition
type KarakuriElementOptions = Partial<MountOptions>;
Members
| Name | Type | Description |
|---|---|---|
game (optional) | "save-the-character" | "pin-rescue" | "nuts-and-bolts" | "stretch-grabber" | "grid-escape" | "rope-cut" | "tube-sort" | "choice-story" | undefined | |
controller (optional) | Controller | undefined | A matching host-owned controller, for preserving an existing position. |
keyboard (optional) | boolean | undefined | Allow a focused canvas to use the keyboard. Default true. |
keyboardStep (optional) | number | undefined | Arrow movement in game units; Shift always moves one unit. Default 10. |
level (optional) | number | undefined | The level to start on, from 1. |
lang (optional) | KarakuriLanguage | undefined |
|
ui (optional) | "full" | "board" | undefined |
|
room (optional) | (() => number) | undefined | The most height, in pixels, the board may take now. A page that puts something above or under the board says how much room is left
(it is asked again whenever the board is fitted: on a resize, and when the box it sits in changes size). By default most of the
window: 82% of its height, less 120 pixels for the bar and buttons when |
clock (optional) | "real" | "manual" | undefined |
|
onStatus (optional) | ((event: StatusEvent) => void) | undefined | Called whenever the level's status changes (and once at the start, as |
onChange (optional) | ((event: StatusEvent) => void) | undefined | Called after each move, release or step that changed what is shown (the bar's line included). |
Examples
import type { KarakuriElementOptions } from "@johnmorrisdotca/karakuri/element";
const options: KarakuriElementOptions = { game: "tube-sort", keyboardStep: 10 };
console.log(options.game);tube-sortWhat it prints (run when this page was built)