Reference
Cube engine and views
import { … } from "@johnmorrisdotca/kyuubu";
38.7 kB minified and gzipped, with everything it imports (measured with esbuild)
Exports
| Name | Kind | What it is |
|---|---|---|
algorithmName | function | The name of one of the method's algorithms, as a person would say it: "Three corners round", 「コーナーの三点交換」. |
applySolve | function | A cube after these steps. |
CliResult | type | What the command line came to: the exit code, and what goes to standard output and standard error. |
CliSurroundings | type | What the command line is told about where it runs. |
CliWords | type | The command line's words: its help, its refusals and what it reports. |
Cloth | type | A cloth's name. |
clothVars | function | A cloth as CSS variables; nothing for a name that is not a cloth, so the defaults stay. |
COMMIT_ANGLE | constant | The point of no return, in degrees, where none is given: let go short of it and the layer goes back. |
countsAsMove | function | Whether a move counts towards a solve's moves: a turn of the whole cube in the hand does not. |
countSolveMoves | function | How many of the steps count as moves: every turn, and no turn of the whole cube. |
CUBE_FACE_ORDER | constant | The faces in the order a state is written: up, right, front, down, left, back. |
CUBE_OPTION_GROUPS | constant | The order the groups are shown in, with what each is called. |
CUBE_OPTIONS | constant | Every choice the package offers, grouped, with what each is called in each way of making a cube. |
CUBE_OPTIONS_LEFT_OUT | constant | What is not a choice, by the way of making a cube that has it and its name there, each with why: a function, a value that is itself the state, a list that needs a program to write. |
CUBE_SCALE_INTERACTIVE | constant | What a cube drawn at each scale is, apart from its width: a small one is for looking at, so it is not turned by a hand or a key unless asked. |
CUBE_SCALE_PX | constant | How wide each is, in pixels: a cube is as tall as it is wide. |
CUBE_SCALES | constant | HOW BIG A CUBE IS DRAWN, as a setting: small for a list or a picker, medium, and large. |
CUBE_THEMES | constant | Looks that come with the package. |
CubeAxis | type | An axis of the cube: 0 is x (to the right), 1 is y (up) and 2 is z (towards the viewer). |
CubeFace | type | A face's letter: U, R, F, D, L or B. |
CubeFaceLetter | type | A face as the notation names it. |
CubeMaker | type | The three ways a cube is made. |
CubeMove | type | One turn: a layer, or the whole cube, turned about an axis by one, two or three quarter turns. |
cubeNet | function | The cube unfolded flat, as lines of text: the top above the front, the left, front, right and back in a row, and the bottom below. |
CubeOption | type | One choice. |
CubeScale | type | One of the three. |
cubeSlots | function | Every sticker slot of a cube of this size, in the order its state is written, and the way back from a slot to its place. |
cubeSolved | function | SOLVED: every face one colour. |
CubeTheme | type | How a cube looks: its six colours, its plastic, and the shape of a sticker. |
CubeTurns | type | One, two or three quarter turns, counter-clockwise seen from the axis's positive end. |
CubeView | class | A cube on the screen. |
CubeViewEvents | type | What a cube tells the listeners on adds: a turn a person made, with the stickers after it; and the view turned, in degrees. |
CubeViewOptions | type | Everything a cube on the screen can be told when it is made. |
cubeWidthPx | function | The width in pixels a cube is drawn at: width when it is a number above zero, and otherwise the scale's. |
CubeWords | type | THE WORDS THE CUBE ITSELF SAYS, in English and Japanese: what a screen reader calls it, whether it is solved, the names of the steps of a solve and what each is for, and the names of the method's algorithms. |
decodeCubeMoves | function | The moves written in a code, or null where any of it is not a move. |
DEFAULT_COLOURS | constant | The standard colours, by the letter a solved face carries: white up, red right, green front, yellow down, orange left, blue back. |
DEFAULT_PLASTIC | constant | The colour of the plastic between the stickers, where none is given. |
DRAG_CLEAR_RATIO | constant | How much more one layer must go the pointer's way than the other to be picked before that. |
DRAG_DECIDE_PX | constant | How far it goes before a drag that could be either of two layers picks the likelier anyway. |
DRAG_START_PX | constant | How far the pointer goes, in pixels, before a drag picks a layer at all. |
dragAngle | function | The angle, in degrees, a picked layer has been dragged to: forwards is positive, and it stops at a half turn either way. |
dragHint | function | The drag that makes this turn, from the way the cube is looked at now (view, as viewMatrix makes it). |
DragHint | type | What to drag to make a turn of one layer, or of several about one axis as one (a wide turn). |
DragPick | type | The layer a drag has picked: its axis and layer, and the way across the screen (a unit vector, x right and y down) that turns it forwards by the right-hand rule. |
encodeCubeMoves | function | Moves written three characters each, such as x23y02z*1: compact, and readable without knowing the cube's size. |
FACE_FRAMES | constant | Which way each face looks, and its rows and columns as the face is seen from outside, in the order above. |
FACE_PROPERTIES | constant | The CSS custom property that colours each face, where no colour is given in code: set it on the cube's element or any ancestor. |
faceMove | function | A face turned, depth layers in from it (1 is the face itself), on a cube of this size; null where the cube has no such layer. |
faceOfNormal | function | The face whose outward normal this is. |
faceOfSlot | function | The face letter a solved cube shows at this slot. |
fill | function | A line of a table with its braces filled in: fill("A {n}×{n} cube", { n: 3 }) is "A 3×3 cube". |
FLICK_ANGLE | constant | The least a flick must have turned the layer, in degrees. |
FLICK_SPEED | constant | A flick: the layer still turning this fast the drag's own way, in degrees a millisecond, when the pointer lets go. |
fromJSON | function | The solves in a JSON export, or null where the text is not one: not JSON, not this format, or a later one. |
fromText | function | A solve read back from plain lines, or null where they are not one. |
FULL_SCRAMBLE_LENGTHS | constant | The lengths official competitions scramble each size to, near enough: what a "full" scramble means here. |
Guide | class | A guide through a list of moves or the method's steps, for a cube of side n starting from state. |
GUIDE_CSS | constant | The guide's stylesheet, put in the page once. |
GuideHandle | type | A guide beside a cube, on the page. |
GuideHeard | type | What a guide made of a turn it was told of: the movement finished, part of it made, a detour, or a detour taken back by hand. |
GuidePanelOptions | type | How a guide beside a cube is set up: what it walks, and how it speaks. |
GuideSource | type | What a guide walks: moves as written ("R U R' U'", wide turns and rotations read as parseSolve reads them), or as moves, each a movement; or the layer-by-layer method, step by step from the cube as it is (2×2 and 3×3). |
GuideStep | type | The movement a guide asks for now. |
HINT_MIN_FACING | constant | How squarely a face must face the viewer for an arrow to be drawn on it: the cosine of its angle to the eye. |
HINT_MIN_FOLLOW | constant | How closely a drag along the arrow must go the way the layer turns: the cosine between them. |
HintArrow | type | The arrow a hint draws, in the cube's doubled units (a sticker is 2 across), lying on a face. |
isCloth | function | Whether a text names a cloth. |
isCubeScale | function | Whether a value is one of the three scales. |
isCubeState | function | Whether a string is a state of a cube this size: the right length, and the right number of every colour. |
joinTurns | function | Turns of one layer in a row written as one, and any that come to nothing left out: "U' U2" is "U", "U' U" is nothing. |
keepScrambling | function | Keep a cube turning. |
KeepScramblingHandle | type | What a running loop can be told. |
KeepScramblingOptions | type | How it is run. |
KeyReading | type | What a key means: a turn, a depth for the next face letter, or nothing. |
KYUUBU_CLOTHS | constant | THE CLOTHS A PLAYER'S STAGE MAY BE LAID IN: the same five the whole family offers, and itsutsu.com's boards: green, blue, red, black and wood. |
KyuubuLanguage | type | The two languages the package speaks. |
KyuubuStrings | type | Every word the package says: the cube's and the command line's. |
languageOf | function | The language a tag names, as far as the package speaks it: anything beginning "ja" is Japanese, and the rest is English. |
layerOf | function | The layer, 0 to n − 1 from the axis's negative side, that a cubie centre sits in. |
Mat3 | type | A 3×3 matrix, rows of three. |
MAX_CLI_COUNT | constant | The most scrambles the command line makes at once. |
MAX_CLI_LENGTH | constant | The longest scramble the command line will make. |
MAX_RECORD_MOVES | constant | The most turns one record may hold, scramble and solve each. |
MAX_RECORD_SEED | constant | The longest seed kept with a solve. |
MAX_RECORD_SIZE | constant | The largest cube a record may be of: the package is made and tested for 2×2 to 7×7. |
MAX_RECORDS | constant | The most solves read from one file. |
MAX_REPLAY_STEPS | constant | The longest solve a replay takes, in steps. |
middleMove | function | The middle layer of an odd cube, turned as M, E or S; null on an even cube, which has none. |
MIN_RECORD_SIZE | constant | The smallest cube a record may be of. |
mountGuide | function | A guide drawn in an element, for the cube in view: the view shows the hint, and a person makes each movement on it. |
mountMoveList | function | A list of moves drawn in an element. |
MOVE_LIST_CSS | constant | The list's stylesheet, put in the page once. |
moveFits | function | Whether a move can be made on a cube of this size. |
moveForDrag | function | The turn a drag across a sticker means: the layer that carries it most nearly the way the pointer went, that way. |
moveForRelease | function | The move a release makes: the picked layer turned by those quarters, or null for none. |
moveForWheel | function | The turn the wheel means over a sticker. |
MoveListGroup | type | A run of moves under a heading: a scramble, a solution. |
MoveListHandle | type | A list on the page. |
MoveListItem | type | One move of a list: its code, what it turns in words (worked out from the code when left out), and the name a screen reader gives its button (the code and the words when left out). |
MoveListOptions | type | How a list is set up. |
movementSays | function | A movement in plain words, for a cube held with its front towards you: "Turn the right face away from you.", 「右の面を奥に回します。」. |
movementText | function | A movement in notation: one layer as moveNotation writes it; several layers from a face inwards, about one axis and as far, as a wide turn (Rw, 3Rw'); anything else as its moves one after another. |
moveName | function | What a move turns, in a few plain words, in English or Japanese; null for anything that is not a move in standard form. |
moveNotation | function | A move as a person writes it, for a cube of this size. |
movesForRelease | function | Every layer a release turns: the picked layer, and the one beside it where the drag took a seam, each by those quarters; none for none. |
movesNotation | function | Moves as a person writes them, a space between each. |
nextTurn | function | One random layer, a quarter or a half turn either way, never about the axis the last one used, so it never undoes or joins it. |
NotationFault | type | Why a line of notation could not be read, and where. |
OptionGroup | type | What the choices are gathered under, in the order a page shows them. |
OptionKind | type | How a choice is made: a number in a range, on or off, one of a few, a colour, or text (moves are text with notation in it). |
paceSeconds | function | Seconds for a pace given as a number or a name; the default for anything else. |
parseMove | function | One move read back from the notation, for a cube of this size, or null where it is not one: R, R', R2, 2R', M2, x'. |
parseMoves | function | A line of notation read back, or null where any of it is not a move on this cube. |
parseSolve | function | A solve, or a scramble, read from the way it is written, for a cube of this size. |
parseSolveMove | function | One written step read for a cube of this size, or why it is not one. |
pastCommit | function | Whether a dragged layer is past the point of no return: letting go now, at rest, makes a move. |
permutationOf | function | Where every sticker goes under one turn: to[i] is the slot the sticker in slot i lands on. |
pickDrag | function | The layer a drag across a sticker means, once it can be told: null while the pointer has not gone far enough, or while the two layers that carry the sticker are too nearly as likely as each other. |
planReplay | function | A scramble and a solve read, checked and timed. |
prefersReducedMotion | function | Whether this device asks for less motion. |
quartersForRelease | function | What letting go makes of a dragged layer: the quarter turns it snaps to, from −2 to 2, where 0 is back where it was and no move at all. |
quarterTurn | function | A quarter turn counter-clockwise, seen from the axis's positive end. |
randomScramble | function | A scramble of length turns, each of one layer chosen at random, never two in a row about the same axis, so no turn undoes or joins the one before it and the count is the count. |
readKey | function | What a key means on a cube of side n, given the depth a digit before it set (1 where none did). |
readSolveLink | function | A solve read out of a link to alg.cubing.net, the page most reconstructions are shared by, so that a person can paste the address and not copy two boxes by hand. |
RECORD_FORMAT | constant | The version of the JSON's shape. |
Replay | class | A planned solve played on a cube: play, pause, a step either way, anywhere by seek, faster or slower, once or over and over. |
REPLAY_LOOP_REST_MS | constant | How long a looped replay rests on the solved cube before it begins again, in milliseconds. |
REPLAY_SCRAMBLE_STEP_MS | constant | How long each turn of the scramble takes when the replay walks through it, in milliseconds. |
REPLAY_SCRUB_MS | constant | How long each turn made by moving the slider takes, in milliseconds. |
REPLAY_SCRUB_TURNS | constant | How many turns moving the slider shows one by one: a longer jump goes straight to this many steps short of where it is going, and turns the rest. |
REPLAY_SPEEDS | constant | The speeds a replay offers: the solve's own pace, half, a quarter and a tenth of it. |
REPLAY_STEP_MS | constant | How long a step takes when the solve gives no time of its own, in milliseconds. |
ReplayClock | type | The clock a replay runs by; the page's own unless a test gives another. |
ReplayCube | type | The part of a cube's view a replay needs: CubeView is one. |
ReplayFault | type | Why a replay could not be planned: which text would not read, and where. |
ReplayOptions | type | How a replay is set up. |
ReplayPlan | type | A solve ready to be played: read, checked and timed. |
ReplaySource | type | What a replay is made from. |
ReplayStatus | type | What a replay tells whoever is showing it. |
rotationHint | function | WHICH WAY TO TURN THE WHOLE CUBE: no drag on a sticker makes it (a key or a button does: x, y, z), so there is no sticker to take hold of, but the way it goes can still be drawn. |
rotationKeys | function | The key or keys that make a turn of the whole cube: X, Shift+X, X X. |
runCli | function | The whole command line. |
SCRAMBLE_DEFAULT_PACE | constant | The pace when none is given: one turn a second. |
SCRAMBLE_PACES | constant | How often it turns, in seconds, by name. |
SCRAMBLE_SHORTEST | constant | The shortest wait it allows, in seconds: faster is a blur, and a page that asks for it gets this. |
Scrambled | type | What the loop turns: the cube on the screen has all of it. |
ScrambleOptions | type | How a scramble is made. |
ScramblePace | type | One of those names. |
ScramblePage | type | The part of a page the loop listens to: a Document is one. |
scrubPath | function | What moving the slider from one position of a solve to another turns: the steps between, forwards when going on and each one undone, last first, when going back. |
ScrubPath | type | The turns that take a cube from one position of a solve to another, for a slider that turns the cube as it moves. |
Seam | type | A seam a hand has taken hold of: a turn about this axis would carry the layer the sticker is in and the one beside it, together. |
SEAM_BAND | constant | How near a seam between two layers a touch lands to take both: this share of a sticker's width on each side of the line between them, so that the middle of a sticker, and a little more than half of its width, is still the one layer. |
seamsAt | function | The seams a touch at this place on a sticker is taking hold of, nearest first: where it lands within SEAM_BAND of a sticker's width of the line that parts the sticker's layer from the one beside it, along either of the two directions the sticker can be turned across. |
seededRandom | function | A SEEDED RANDOM SOURCE: the same seed gives the same numbers, in the same order, on every device and in every version from 1.1.0 on. |
SOLVABLE_SIZES | constant | The sizes the method is written for. |
SOLVE_ALGORITHMS | constant | The algorithms the method uses, by name. |
SolveAlgorithm | type | The name of one of the method's algorithms: a key of SOLVE_ALGORITHMS. |
solvedCube | function | A solved cube of this size. |
SolveLink | type | A solve as a link carries it: its scramble, its moves, and its title where it has one. |
SolveMove | type | One thing a solver did: a turn, a wide turn or a turn of the whole cube. |
solveMoves | function | Every layer a list of steps turns, in order: what turnAll takes. |
SolvePart | type | A part of a step: turns to line something up, or one of the method's algorithms. |
SolveReading | type | What reading a solve gives: its steps, or the first thing that could not be read. |
SolveRecord | type | One solve: the cube's size, the scramble that mixed it, and the turns made after. |
SolveStage | type | The stages of the method, in the order they are done. |
SolveStep | type | One step of a solve: its stage, the turns that do it, and the parts they come in. |
solveSteps | function | The layer-by-layer solve of a 2×2 or 3×3 in this state, as steps a person can follow, or null for a size the method is not written for. |
SolveSummary | type | What a record comes to, worked out from its turns. |
solveText | function | The steps written out in standard form, a space between each. |
stageName | function | The name of a step of the solve, as a person would say it: "White cross", 「白のクロス」. |
stageSays | function | What a step of the solve is for, in a sentence: "Make a yellow cross on the top." |
StickerSlot | type | Where one sticker slot sits: its cubie's centre and the direction it faces. |
STRINGS | constant | The package's words in both languages. |
summarize | function | A record's scramble and turns in notation, the cube before and after, whether it ended solved, and its count of moves. |
toCSV | function | A list of solves as CSV, for a spreadsheet: a header, then a row a solve, with lines ended CRLF as RFC 4180 has them. |
toJSON | function | One solve or many, as JSON: { "format": 1, "generator": "kyuubu 1.1.0", "solves": [ … ] }. |
toText | function | A solve as a few plain lines, to paste in a chat or a note: |
turnAll | function | The state after every turn in order. |
turnCube | function | The state after one turn. |
undoAll | function | A list of moves undone, last first. |
undoOf | function | The move that takes this one back. |
Vec3 | type | A point in the cube's doubled coordinates: a cubie's centre is a whole even or odd step from the middle, by the cube's size. |
VERSION | constant | The package's version, as in package.json. |
viewMatrix | function | The way the viewer looks at the cube: turned about the model's y (yaw), then tipped about the screen's x (pitch), in degrees. |
wholeMove | function | The whole cube turned in the hand, as x, y or z. |
WORDS | constant | The cube's words in both languages. |