import { type DrawBoardOptions } from "./draw.ts"; import type { GameSettings, GameState, MoveInput, OpeningChoice } from "./types.ts"; declare const ElementBase: { new (): HTMLElement; prototype: HTMLElement; }; /** * Reads a bounded JSON move list for a board embed, or null for malformed input. * @param value - JSON moves, or null for an empty record. * @returns Valid move data, or null when the syntax, bounds or shape are invalid. Legality belongs to replayMoves. * @example * ```ts * import { parseEmbedMoves } from "@johnmorrisdotca/narabe/element"; * console.log(parseEmbedMoves('[{"row":7,"col":7}]')); * ``` * * */ export declare function parseEmbedMoves(value: string | null): MoveInput[] | null; /** * Host state, rules, replay choices, drawing options and callbacks. * @example * ```ts * import type { NarabeElementOptions } from "@johnmorrisdotca/narabe/element"; * const options: NarabeElementOptions = { settings: { variant: "freestyle" }, draw: { legal: true } }; * console.log(options.settings?.variant); * ``` * * */ export type NarabeElementOptions = { /** Complete host position, taking precedence over replay input. */ state?: GameState; /** Advanced native engine settings; attributes override these. */ settings?: Partial; /** Trusted host moves, used when the moves attribute is absent. */ moves?: readonly MoveInput[]; /** Native colour-opening decisions. */ choices?: readonly OpeningChoice[]; /** Whether recorded clock forfeits may replay. */ clocked?: boolean; /** Native SVG drawing options. */ draw?: DrawBoardOptions; /** Called after a position changes, with the structured state. */ onChange?: (state: GameState) => void; }; /** * Real host option keys, checked by the embed builder. * @example * ```ts * import { NARABE_EMBED_OPTION_KEYS } from "@johnmorrisdotca/narabe/element"; * console.log(NARABE_EMBED_OPTION_KEYS); * ``` * * */ export declare const NARABE_EMBED_OPTION_KEYS: string[]; /** * Native drawing option keys, checked by the embed builder. * @example * ```ts * import { NARABE_DRAW_OPTION_KEYS } from "@johnmorrisdotca/narabe/element"; * console.log(NARABE_DRAW_OPTION_KEYS); * ``` * * */ export declare const NARABE_DRAW_OPTION_KEYS: string[]; /** * A board position and keyboard-operable replay of the native game engine. * @example * ```ts * import { NarabeBoard } from "@johnmorrisdotca/narabe/element"; * console.log(NarabeBoard.observedAttributes.includes("moves")); * ``` * * */ export declare class NarabeBoard extends ElementBase { #private; static observedAttributes: string[]; /** Current structured position, or null after an input error. */ get state(): GameState | null; /** Advanced host state, replay and SVG options. */ get options(): NarabeElementOptions; set options(value: NarabeElementOptions); connectedCallback(): void; disconnectedCallback(): void; attributeChangedCallback(): void; /** Show a replay position by index, bounded to the available timeline. */ seek(step: number): void; /** Show the next position. */ next(): void; /** Show the previous position. */ previous(): void; /** The `game` attribute, reflected. */ get game(): string | null; set game(value: string | number | boolean | null | undefined); /** The `grid` attribute, reflected. */ get grid(): string | null; set grid(value: string | number | boolean | null | undefined); /** The `seed` attribute, reflected. */ get seed(): string | null; set seed(value: string | number | boolean | null | undefined); /** The `step` attribute, reflected. */ get step(): string | null; set step(value: string | number | boolean | null | undefined); /** The `last-move` attribute, reflected. */ get lastMove(): string | null; set lastMove(value: string | number | boolean | null | undefined); /** The `winning-line` attribute, reflected. */ get winningLine(): string | null; set winningLine(value: string | number | boolean | null | undefined); /** The `forbidden` attribute, reflected. */ get forbidden(): string | null; set forbidden(value: string | number | boolean | null | undefined); /** The `legal` attribute, reflected. */ get legal(): string | null; set legal(value: string | number | boolean | null | undefined); /** The `controls` attribute, reflected. */ get controls(): string | null; set controls(value: string | number | boolean | null | undefined); /** The `size` attribute, reflected. */ get size(): string | null; set size(value: string | number | boolean | null | undefined); /** The `width` attribute, reflected. */ get width(): string | null; set width(value: string | number | boolean | null | undefined); /** The `theme` attribute, reflected. */ get theme(): string | null; set theme(value: string | number | boolean | null | undefined); /** The `label` attribute, reflected. */ get label(): string | null; set label(value: string | number | boolean | null | undefined); /** The moves attribute, reflected. Assign an array to serialize a host record. */ get moves(): string | null; set moves(value: string | readonly MoveInput[] | null); } /** * Defines the default board or a subclass under a custom tag. Safe on a server. * @param tagName - The tag to define; narabe-board by default. * @param registry - The page's registry, or undefined on a server. * @returns Nothing; an existing definition is left alone. * @example * ```ts * import { defineBoard } from "@johnmorrisdotca/narabe/element"; * defineBoard(); * console.log(typeof defineBoard); * ``` * * */ export declare function defineBoard(tagName?: string, registry?: CustomElementRegistry | undefined): void; export {};