import { OGSConnectivity } from "./OGSConnectivity"; import { GobanConfig } from "../GobanBase"; import type { GobanTheme, GobanThemeBackgroundCSS } from "./themes/GobanTheme"; export declare const GOBAN_FONT = "Verdana,Arial,sans-serif"; export type ShadowTheme = "none" | "low" | "mid" | "high" | "custom" | "default" | "anime"; export type BoardGridBackgroundSize = "9" | "13" | "19"; export type BoardGridBackgroundNumericSize = 9 | 13 | 19; export type CustomBoardGridBackgrounds = Record; export declare const emptyCustomBoardGridBackgrounds: CustomBoardGridBackgrounds; export type BoardBackgroundAsset = { kind: "default"; url: string; hasGrid: false; } | { kind: "grid"; url: string; hasGrid: true; size: BoardGridBackgroundNumericSize; marginProfile: "coordinate-space-all-sides"; bakedCoordinates: false; }; export interface ResolvedBoardBackground { baseCSS: GobanThemeBackgroundCSS; grid?: { asset: Extract; css: GobanThemeBackgroundCSS; x: number; y: number; width: number; height: number; url: string; }; } export interface CustomShadowConfig { black?: { gradientTransform?: string; shadow_color?: string; }; white?: { gradientTransform?: string; shadow_color?: string; }; } export interface GobanSelectedThemes { "board": string; "white": string; "black": string; "removal-graphic": "square" | "x"; "removal-scale": number; "stone-scale": number; "stone-shadows"?: ShadowTheme; "custom-shadow-config"?: CustomShadowConfig; "custom-board-grid-backgrounds"?: CustomBoardGridBackgrounds; } export type LabelPosition = "all" | "none" | "top-left" | "top-right" | "bottom-right" | "bottom-left"; export interface GobanMetrics { width: number; height: number; mid: number; offset: number; } export interface CaptureDisplayConfig { stone_color: "black" | "white"; stone_count: number; stone_radius?: number; stone_overlap?: number; max_stones?: number; } export interface CaptureDisplay { readonly element: HTMLCanvasElement | SVGSVGElement; updateStoneCount(count: number): void; destroy(): void; } /** * Goban serves as a base class for our renderers as well as a namespace for various * classes, types, and enums. * * You can't create an instance of a Goban directly, you have to create an instance of * one of the renderers, such as GobanSVG. */ export declare abstract class Goban extends OGSConnectivity { static THEMES: import("./themes").ThemesInterface; static THEMES_SORTED: { [key: string]: GobanTheme[]; white: GobanTheme[]; black: GobanTheme[]; board: GobanTheme[]; }; protected abstract setTheme(themes: GobanSelectedThemes, dont_redraw: boolean): void; parent: HTMLElement; protected title_div?: HTMLElement; evaluation_bar_container?: HTMLDivElement; evaluation_bar_div?: HTMLDivElement; private analysis_scoring_color?; private analysis_scoring_last_position; private _evaluation; private _evaluation_bar_width; private board_background_sync_key?; private last_pointer_up_timestamp; private last_pointer_up_square; private synthesized_double_click; private prng; /** * Resolve whether a pointer release should be handled as a single click, a * double-click, or ignored, for `double-click-to-move`. Called from each * renderer's `pointerUp` so the logic isn't duplicated. `double_clicked` is * `true` when the browser delivered a native `dblclick` event. * * Returns: * - `"double"` — submit-as-double-click (place + submit), * - `"single"` — ordinary single click (place provisional), * - `"ignore"` — drop this event (wrong square, or a native `dblclick` that * we already handled via the timing fallback). */ protected resolveDoubleClick(pt: { i: number; j: number; }, double_clicked: boolean, right_click?: boolean): "single" | "double" | "ignore"; getStonePlacementOffset(i: number, j: number): { x: number; y: number; }; constructor(config: GobanConfig, preloaded_data?: GobanConfig); destroy(): void; set evaluation(value: number); get evaluation(): number; protected getSelectedThemes(): GobanSelectedThemes; protected putOrClearLabel(x: number, y: number, mode?: "put" | "clear"): boolean; protected getAnalysisScoreColorAtLocation(x: number, y: number): "black" | "white" | string | undefined; protected putAnalysisScoreColorAtLocation(x: number, y: number, color?: "black" | "white" | string, sync_review_move?: boolean): void; protected putAnalysisRemovalAtLocation(x: number, y: number, removal?: boolean): void; /** Marks scores on the board when in analysis mode. Note: this will not * clear existing scores, this is intentional as I think it's the expected * behavior of reviewers */ markAnalysisScores(): void; setSquareSizeBasedOnDisplayWidth(display_width: number, suppress_redraw?: boolean): void; protected resolveBoardBackground(theme_board: Pick, themes: GobanSelectedThemes): ResolvedBoardBackground; protected syncBoardBackgroundIfNeeded(theme_board: Pick, themes: GobanSelectedThemes, sync: (background: ResolvedBoardBackground) => void, force?: boolean): void; protected invalidateBoardBackgroundSync(): void; private getBoardBackgroundSyncKey; protected applyBaseBoardBackground(background: ResolvedBoardBackground): void; set evaluation_bar_width(width: number); get evaluation_bar_width(): number; static computeEvaluationBarWidth(display_width: number): number; static computeSquareSizeFromDisplayWidth(display_width: number, config: { bounded_width: number; bounded_height: number; draw_left_labels: boolean; draw_right_labels: boolean; draw_top_labels: boolean; draw_bottom_labels: boolean; evaluation_bar: boolean; }): number; setLabelPosition(label_position: LabelPosition): void; protected onAnalysisToggleStoneRemoval(ev: MouseEvent | TouchEvent): void; /** Clears any analysis scores on the board */ clearAnalysisScores(): void; setSquareSize(new_ss: number, suppress_redraw?: boolean): void; setStoneFontScale(new_ss: number, suppress_redraw?: boolean): void; computeMetrics(): GobanMetrics; protected onAnalysisScoringStart(ev: MouseEvent | TouchEvent): void; protected onAnalysisScoringMove(ev: MouseEvent | TouchEvent): void; protected normalizeCaptureConfig(config: CaptureDisplayConfig): Required; protected calculateCaptureDisplayDimensions(config: Required, count: number): { radius: number; displayCount: number; stone_spacing: number; width: number; height: number; }; }