@metreeca/tile
    Preparing search index...

    Headless board.

    Tracks the gesture under way on a board, leaving where the cards stand to the application: a card is picked up and either dropped onto a cell, the move waiting there until the application settles it, or cancelled, the card going back where it was. No card is picked up while a move is waiting, so moves are settled one at a time.

    A gesture yields a new board and leaves this one as it stands. One that changes nothing yields this board itself, which a rendering layer takes as nothing to redraw.

    interface Placeable {
        held: Optional<string>;
        pending: Optional<Move>;
        settled: Optional<Move>;
        focus: Optional<string>;
        active: Optional<string>;
        activate(card: string): this;
        pick(card: string, focus?: boolean): this;
        drop(move: Move): this;
        cancel(): this;
        settle(): this;
    }
    Index
    held: Optional<string>

    The key of the card being carried, or undefined if none is picked up.

    pending: Optional<Move>

    The move waiting to be settled, or undefined if none is waiting.

    settled: Optional<Move>

    The move settled last, or undefined if none was settled since a card was last picked up: the application took it if the card now stands where the move left it, and refused it otherwise.

    focus: Optional<string>

    The key of the card owing the focus, or undefined if none does: the card last picked up from the keyboard takes the focus back whenever it is drawn afresh, in the cell it moved into or the one it is sent back to, until another card is picked up.

    active: Optional<string>

    The key of the card the keyboard last stood on, or undefined if none: the one card of the board reached with Tab, the others being reached from it with the arrow keys.

    • Marks the card the keyboard stands on.

      Parameters

      • card: string

        The key of the card reached

      Returns this

      A board with card active

    • Picks up a card.

      Parameters

      • card: string

        The key of the card to carry

      • Optionalfocus: boolean

        Whether the card is picked up from the keyboard, so that it owes the focus

      Returns this

      A board holding card, owing the focus to it if picked up from the keyboard and to no card otherwise, with no move settled, or this board if a card is already held or a move is waiting

    • Drops the held card onto a cell.

      Parameters

      • move: Move

        The move performed, from the cell the held card stands in to the one it is dropped onto

      Returns this

      A board holding no card, with move waiting if it carries the card into a different cell, or this board if move is not about the held card

    • Sends the held card back where it was picked up from.

      Returns this

      A board holding no card, or this board if no card is held

    • Ends the wait for the pending move.

      Returns this

      A board with no move waiting and the pending move settled, or this board if none is waiting