2017-02-18 07:03:17 -07:00
|
|
|
interface Lichess {
|
2021-01-21 15:26:09 -07:00
|
|
|
load: Promise<void>; // window.onload promise
|
2020-09-02 10:15:29 -06:00
|
|
|
info: any;
|
2020-10-02 10:55:28 -06:00
|
|
|
requestIdleCallback(f: () => void, timeout?: number): void;
|
2019-12-29 03:42:30 -07:00
|
|
|
sri: string;
|
2019-12-03 19:03:00 -07:00
|
|
|
storage: LichessStorageHelper;
|
2020-09-02 03:44:51 -06:00
|
|
|
tempStorage: LichessStorageHelper;
|
2019-12-03 19:03:00 -07:00
|
|
|
once(key: string, mod?: 'always'): boolean;
|
|
|
|
powertip: any;
|
2020-09-01 05:42:43 -06:00
|
|
|
widget: any;
|
2019-12-03 19:03:00 -07:00
|
|
|
spinnerHtml: string;
|
|
|
|
assetUrl(url: string, opts?: AssetUrlOpts): string;
|
2019-04-29 09:26:07 -06:00
|
|
|
loadCss(path: string): void;
|
|
|
|
loadCssPath(path: string): void;
|
2020-08-03 01:44:30 -06:00
|
|
|
jsModule(name: string): string;
|
2020-09-06 04:31:38 -06:00
|
|
|
loadScript(url: string, opts?: AssetUrlOpts): Promise<void>;
|
2020-09-13 04:21:21 -06:00
|
|
|
loadModule(name: string): Promise<void>;
|
2019-12-03 19:03:00 -07:00
|
|
|
hopscotch: any;
|
2020-09-11 06:59:10 -06:00
|
|
|
userComplete: () => Promise<UserComplete>;
|
2020-09-06 04:57:13 -06:00
|
|
|
slider(): Promise<void>;
|
2020-08-31 10:43:32 -06:00
|
|
|
makeChat(data: any): any;
|
2019-12-03 19:03:00 -07:00
|
|
|
idleTimer(delay: number, onIdle: () => void, onWakeUp: () => void): void;
|
|
|
|
pubsub: Pubsub;
|
2020-09-11 08:22:52 -06:00
|
|
|
contentLoaded(parent?: HTMLElement): void;
|
2020-09-01 10:39:44 -06:00
|
|
|
unload: {
|
|
|
|
expected: boolean;
|
|
|
|
};
|
2020-09-04 09:28:11 -06:00
|
|
|
watchers(el: HTMLElement): void;
|
2020-09-04 02:45:09 -06:00
|
|
|
redirect(o: RedirectTo): void;
|
2019-12-03 19:03:00 -07:00
|
|
|
reload(): void;
|
|
|
|
escapeHtml(str: string): string;
|
2020-04-04 04:44:15 -06:00
|
|
|
announce(d: LichessAnnouncement): void;
|
2020-10-20 07:36:06 -06:00
|
|
|
studyTour(study: Study): void;
|
|
|
|
studyTourChapter(study: Study): void;
|
2019-12-03 19:03:00 -07:00
|
|
|
|
2021-03-27 07:04:28 -06:00
|
|
|
trans(i18n: I18nDict): Trans;
|
2020-09-01 05:42:43 -06:00
|
|
|
quantity(n: number): 'zero' | 'one' | 'few' | 'many' | 'other';
|
2019-12-03 19:03:00 -07:00
|
|
|
|
|
|
|
socket: any;
|
2020-09-26 09:57:38 -06:00
|
|
|
sound: SoundI;
|
2020-08-17 11:30:29 -06:00
|
|
|
miniBoard: {
|
|
|
|
init(node: HTMLElement): void;
|
2020-09-22 00:11:41 -06:00
|
|
|
initAll(parent?: HTMLElement): void;
|
2020-08-17 11:30:29 -06:00
|
|
|
};
|
2020-08-16 02:10:50 -06:00
|
|
|
miniGame: {
|
2020-09-02 03:16:24 -06:00
|
|
|
init(node: HTMLElement): string | null;
|
2020-09-22 00:11:41 -06:00
|
|
|
initAll(parent?: HTMLElement): void;
|
2021-04-18 13:19:55 -06:00
|
|
|
update(node: HTMLElement, data: GameUpdate): void;
|
2020-08-16 02:10:50 -06:00
|
|
|
finish(node: HTMLElement, win?: Color): void;
|
|
|
|
};
|
2019-12-03 19:03:00 -07:00
|
|
|
ab?: any;
|
|
|
|
|
|
|
|
// socket.js
|
2017-06-28 07:47:14 -06:00
|
|
|
StrongSocket: {
|
2021-02-06 06:26:05 -07:00
|
|
|
new (url: string, version: number | false, cfg?: any): any;
|
|
|
|
firstConnect: Promise<(tpe: string, data: any) => void>;
|
2020-09-12 03:14:24 -06:00
|
|
|
defaultParams: Record<string, any>;
|
2021-02-06 06:26:05 -07:00
|
|
|
};
|
2019-12-03 19:03:00 -07:00
|
|
|
|
2020-09-29 23:46:55 -06:00
|
|
|
timeago(date: number | Date): string;
|
2020-09-01 10:39:44 -06:00
|
|
|
timeagoLocale(a: number, b: number, c: number): any;
|
2021-07-14 06:59:43 -06:00
|
|
|
dateFormat: () => (date: Date) => string;
|
2019-12-03 19:03:00 -07:00
|
|
|
|
|
|
|
// misc
|
2021-03-06 03:06:05 -07:00
|
|
|
advantageChart?: {
|
2019-05-07 04:09:15 -06:00
|
|
|
update(data: any): void;
|
2018-01-16 16:33:30 -07:00
|
|
|
(data: any, trans: Trans, el: HTMLElement): void;
|
2021-02-06 06:26:05 -07:00
|
|
|
};
|
2019-12-03 19:03:00 -07:00
|
|
|
movetimeChart: any;
|
2021-06-21 09:46:54 -06:00
|
|
|
RoundNVUI?(redraw: () => void): {
|
2019-01-25 01:06:31 -07:00
|
|
|
render(ctrl: any): any;
|
2021-02-06 06:26:05 -07:00
|
|
|
};
|
2021-06-21 09:46:54 -06:00
|
|
|
AnalyseNVUI?(redraw: () => void): {
|
2019-01-25 01:06:31 -07:00
|
|
|
render(ctrl: any): any;
|
2021-02-06 06:26:05 -07:00
|
|
|
};
|
2021-06-21 09:46:54 -06:00
|
|
|
PuzzleNVUI?(redraw: () => void): {
|
2021-06-06 05:40:03 -06:00
|
|
|
render(ctrl: any): any;
|
|
|
|
};
|
2019-04-28 21:20:01 -06:00
|
|
|
playMusic(): any;
|
2019-12-03 19:03:00 -07:00
|
|
|
quietMode?: boolean;
|
|
|
|
keyboardMove?: any;
|
2021-05-17 13:55:17 -06:00
|
|
|
analysis?: any; // expose the analysis ctrl
|
2017-02-21 04:21:59 -07:00
|
|
|
}
|
|
|
|
|
2021-03-27 07:04:28 -06:00
|
|
|
type I18nDict = { [key: string]: string };
|
2021-04-07 09:48:32 -06:00
|
|
|
type I18nKey = string;
|
2021-03-27 07:04:28 -06:00
|
|
|
|
2021-02-06 06:26:05 -07:00
|
|
|
type RedirectTo = string | { url: string; cookie: Cookie };
|
2020-09-04 02:45:09 -06:00
|
|
|
|
2020-09-11 06:59:10 -06:00
|
|
|
type UserComplete = (opts: UserCompleteOpts) => void;
|
|
|
|
|
|
|
|
interface UserCompleteOpts {
|
2021-02-06 06:26:05 -07:00
|
|
|
input: HTMLInputElement;
|
2020-09-06 05:20:58 -06:00
|
|
|
tag?: 'a' | 'span';
|
|
|
|
minLength?: number;
|
2020-09-12 00:43:33 -06:00
|
|
|
populate?: (result: LightUser) => string;
|
2020-09-11 14:32:41 -06:00
|
|
|
onSelect?: (result: LightUser) => void;
|
2020-09-06 05:20:58 -06:00
|
|
|
focus?: boolean;
|
|
|
|
friend?: boolean;
|
|
|
|
tour?: string;
|
|
|
|
swiss?: string;
|
|
|
|
}
|
|
|
|
|
2020-09-26 09:57:38 -06:00
|
|
|
interface SoundI {
|
2020-09-02 03:16:24 -06:00
|
|
|
loadOggOrMp3(name: string, path: string): void;
|
2020-09-26 09:57:38 -06:00
|
|
|
loadStandard(name: string, soundSet?: string): void;
|
|
|
|
play(name: string, volume?: number): void;
|
2020-08-31 02:37:59 -06:00
|
|
|
getVolume(): number;
|
|
|
|
setVolume(v: number): void;
|
2020-09-26 09:57:38 -06:00
|
|
|
speech(v?: boolean): boolean;
|
|
|
|
changeSet(s: string): void;
|
2021-05-22 08:50:50 -06:00
|
|
|
say(text: string, cut?: boolean, force?: boolean, translated?: boolean): boolean;
|
2020-09-26 09:57:38 -06:00
|
|
|
sayOrPlay(name: string, text: string): void;
|
2021-05-20 04:18:42 -06:00
|
|
|
preloadBoardSounds(): void;
|
2020-09-26 09:57:38 -06:00
|
|
|
soundSet: string;
|
2020-09-26 10:05:00 -06:00
|
|
|
baseUrl: string;
|
2020-08-31 02:37:59 -06:00
|
|
|
}
|
|
|
|
|
2019-04-29 09:26:07 -06:00
|
|
|
interface LichessSpeech {
|
|
|
|
step(s: { san?: San }, cut: boolean): void;
|
|
|
|
}
|
|
|
|
|
2019-08-07 09:10:30 -06:00
|
|
|
interface PalantirOpts {
|
|
|
|
uid: string;
|
|
|
|
redraw(): void;
|
|
|
|
}
|
2019-08-02 17:03:49 -06:00
|
|
|
interface Palantir {
|
2019-08-08 08:22:55 -06:00
|
|
|
render(h: any): any;
|
2019-08-02 17:03:49 -06:00
|
|
|
}
|
|
|
|
|
2018-01-10 09:41:33 -07:00
|
|
|
interface Cookie {
|
|
|
|
name: string;
|
|
|
|
value: string;
|
|
|
|
maxAge: number;
|
|
|
|
}
|
|
|
|
|
2017-03-28 06:32:59 -06:00
|
|
|
interface AssetUrlOpts {
|
|
|
|
sameDomain?: boolean;
|
|
|
|
noVersion?: boolean;
|
2020-09-01 05:42:43 -06:00
|
|
|
version?: string;
|
2017-03-28 06:32:59 -06:00
|
|
|
}
|
|
|
|
|
2020-09-04 04:08:24 -06:00
|
|
|
type Timeout = ReturnType<typeof setTimeout>;
|
|
|
|
|
2017-07-08 03:06:36 -06:00
|
|
|
declare type SocketSend = (type: string, data?: any, opts?: any, noRetry?: boolean) => void;
|
|
|
|
|
2019-07-27 01:08:27 -06:00
|
|
|
type TransNoArg = (key: string) => string;
|
|
|
|
|
2017-12-03 13:02:11 -07:00
|
|
|
interface Trans {
|
|
|
|
(key: string, ...args: Array<string | number>): string;
|
2019-07-27 01:08:27 -06:00
|
|
|
noarg: TransNoArg;
|
2017-12-03 13:02:11 -07:00
|
|
|
plural(key: string, count: number, ...args: Array<string | number>): string;
|
2021-04-07 09:48:32 -06:00
|
|
|
vdom<T>(key: string, ...args: T[]): Array<string | T>;
|
|
|
|
vdomPlural<T>(key: string, count: number, countArg: T, ...args: T[]): Array<string | T>;
|
2017-12-03 13:02:11 -07:00
|
|
|
}
|
2017-02-21 15:22:50 -07:00
|
|
|
|
2019-04-24 20:17:52 -06:00
|
|
|
type PubsubCallback = (...data: any[]) => void;
|
|
|
|
|
2017-02-21 04:21:59 -07:00
|
|
|
interface Pubsub {
|
2019-04-29 09:26:07 -06:00
|
|
|
on(msg: string, f: PubsubCallback): void;
|
|
|
|
off(msg: string, f: PubsubCallback): void;
|
2019-07-04 21:26:42 -06:00
|
|
|
emit(msg: string, ...args: any[]): void;
|
2017-02-18 07:03:17 -07:00
|
|
|
}
|
|
|
|
|
2017-03-28 06:32:59 -06:00
|
|
|
interface LichessStorageHelper {
|
|
|
|
make(k: string): LichessStorage;
|
2019-04-29 08:03:56 -06:00
|
|
|
makeBoolean(k: string): LichessBooleanStorage;
|
2019-05-02 01:56:10 -06:00
|
|
|
get(k: string): string | null;
|
|
|
|
set(k: string, v: string): void;
|
2019-12-29 03:42:30 -07:00
|
|
|
fire(k: string, v?: string): void;
|
2017-03-28 06:32:59 -06:00
|
|
|
remove(k: string): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LichessStorage {
|
2019-05-02 01:56:10 -06:00
|
|
|
get(): string | null;
|
2019-10-09 19:36:23 -06:00
|
|
|
set(v: any): void;
|
2017-03-28 06:32:59 -06:00
|
|
|
remove(): void;
|
2019-12-29 03:42:30 -07:00
|
|
|
listen(f: (e: LichessStorageEvent) => void): void;
|
|
|
|
fire(v?: string): void;
|
2017-03-28 06:32:59 -06:00
|
|
|
}
|
|
|
|
|
2019-04-29 08:03:56 -06:00
|
|
|
interface LichessBooleanStorage {
|
|
|
|
get(): boolean;
|
2020-09-06 02:33:15 -06:00
|
|
|
set(v: boolean): void;
|
2019-04-29 08:03:56 -06:00
|
|
|
toggle(): void;
|
|
|
|
}
|
|
|
|
|
2019-12-29 03:42:30 -07:00
|
|
|
interface LichessStorageEvent {
|
|
|
|
sri: string;
|
|
|
|
nonce: number;
|
|
|
|
value?: string;
|
|
|
|
}
|
|
|
|
|
2020-04-04 04:44:15 -06:00
|
|
|
interface LichessAnnouncement {
|
|
|
|
msg?: string;
|
|
|
|
date?: string;
|
|
|
|
}
|
|
|
|
|
2021-04-20 15:06:23 -06:00
|
|
|
interface LichessEditor {
|
|
|
|
getFen(): string;
|
|
|
|
setOrientation(o: Color): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare namespace Editor {
|
|
|
|
export interface Config {
|
|
|
|
baseUrl: string;
|
2021-08-09 00:50:40 -06:00
|
|
|
fen?: string;
|
2021-04-20 15:06:23 -06:00
|
|
|
options?: Editor.Options;
|
|
|
|
is3d: boolean;
|
|
|
|
animation: {
|
|
|
|
duration: number;
|
|
|
|
};
|
|
|
|
embed: boolean;
|
|
|
|
positions?: OpeningPosition[];
|
2021-06-27 11:01:39 -06:00
|
|
|
endgamePositions?: EndgamePosition[];
|
2021-04-20 15:06:23 -06:00
|
|
|
i18n: I18nDict;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Options {
|
|
|
|
orientation?: Color;
|
|
|
|
onChange?: (fen: string) => void;
|
|
|
|
inlineCastling?: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface OpeningPosition {
|
|
|
|
eco?: string;
|
|
|
|
name: string;
|
|
|
|
fen: string;
|
|
|
|
epd?: string;
|
|
|
|
}
|
2021-06-27 11:01:39 -06:00
|
|
|
|
|
|
|
export interface EndgamePosition {
|
|
|
|
name: string;
|
|
|
|
fen: string;
|
2021-06-27 11:04:52 -06:00
|
|
|
epd?: string;
|
2021-06-27 11:01:39 -06:00
|
|
|
}
|
2021-04-20 15:06:23 -06:00
|
|
|
}
|
|
|
|
|
2017-02-18 07:03:17 -07:00
|
|
|
interface Window {
|
2021-02-06 06:26:05 -07:00
|
|
|
lichess: Lichess;
|
2017-03-28 06:32:59 -06:00
|
|
|
|
2021-09-05 17:33:23 -06:00
|
|
|
readonly chrome?: unknown;
|
|
|
|
readonly moment: any;
|
|
|
|
readonly Mousetrap: any;
|
2021-02-06 06:26:05 -07:00
|
|
|
Chessground: any;
|
2021-09-05 17:33:23 -06:00
|
|
|
readonly InfiniteScroll: (selector: string) => void;
|
|
|
|
readonly lichessReplayMusic: () => {
|
2021-02-06 06:26:05 -07:00
|
|
|
jump(node: Tree.Node): void;
|
|
|
|
};
|
2021-09-05 17:33:23 -06:00
|
|
|
readonly hopscotch: any;
|
2019-08-02 17:03:49 -06:00
|
|
|
LichessSpeech?: LichessSpeech;
|
2021-09-05 17:33:23 -06:00
|
|
|
readonly LichessEditor?: (element: HTMLElement, config: Editor.Config) => LichessEditor;
|
2021-09-06 12:54:10 -06:00
|
|
|
readonly Palantir?: {
|
2021-01-21 15:26:09 -07:00
|
|
|
palantir(opts: PalantirOpts): Palantir;
|
2019-08-02 17:03:49 -06:00
|
|
|
};
|
2021-09-05 17:33:23 -06:00
|
|
|
LichessChat: (element: Element, opts: any) => any;
|
|
|
|
readonly LichessFlatpickr: (element: Element, opts: any) => any;
|
|
|
|
readonly LichessNotify: (element: any, opts: any) => any;
|
|
|
|
readonly LichessChallenge: (element: any, opts: any) => any;
|
|
|
|
readonly LichessDasher: (element: any, opts: any) => any;
|
|
|
|
readonly LichessAnalyse: any;
|
|
|
|
readonly LichessCli: any;
|
|
|
|
readonly LichessRound: any;
|
|
|
|
readonly stripeHandler: any;
|
|
|
|
readonly Stripe: any;
|
|
|
|
readonly Textcomplete: any;
|
|
|
|
readonly UserComplete: any;
|
|
|
|
readonly Sortable: any;
|
|
|
|
readonly Peer: any;
|
|
|
|
|
|
|
|
readonly passwordComplexity: unknown;
|
|
|
|
readonly Tagify: unknown;
|
2017-02-18 07:03:17 -07:00
|
|
|
}
|
2017-02-21 15:22:50 -07:00
|
|
|
|
2021-02-06 06:26:05 -07:00
|
|
|
interface Study {
|
2020-10-20 07:36:06 -06:00
|
|
|
userId?: string | null;
|
|
|
|
isContrib?: boolean;
|
|
|
|
isOwner?: boolean;
|
|
|
|
setTab(tab: string): void;
|
|
|
|
}
|
|
|
|
|
2021-03-05 01:55:21 -07:00
|
|
|
interface LightUserNoId {
|
2021-02-06 06:26:05 -07:00
|
|
|
name: string;
|
|
|
|
title?: string;
|
|
|
|
patron?: boolean;
|
2017-02-22 05:00:27 -07:00
|
|
|
}
|
2017-02-23 04:31:53 -07:00
|
|
|
|
2021-03-05 01:55:21 -07:00
|
|
|
interface LightUser extends LightUserNoId {
|
|
|
|
id: string;
|
|
|
|
}
|
|
|
|
|
2021-07-15 08:11:31 -06:00
|
|
|
interface LightUserOnline extends LightUser {
|
|
|
|
online: boolean;
|
|
|
|
}
|
|
|
|
|
2020-01-15 16:16:00 -07:00
|
|
|
interface Navigator {
|
2021-01-21 15:26:09 -07:00
|
|
|
deviceMemory?: number; // https://developer.mozilla.org/en-US/docs/Web/API/Navigator/deviceMemory
|
2020-01-15 16:16:00 -07:00
|
|
|
}
|
|
|
|
|
2021-02-06 06:26:05 -07:00
|
|
|
declare type VariantKey =
|
|
|
|
| 'standard'
|
|
|
|
| 'chess960'
|
|
|
|
| 'antichess'
|
|
|
|
| 'fromPosition'
|
|
|
|
| 'kingOfTheHill'
|
|
|
|
| 'threeCheck'
|
|
|
|
| 'atomic'
|
|
|
|
| 'horde'
|
|
|
|
| 'racingKings'
|
|
|
|
| 'crazyhouse';
|
2017-04-04 15:25:35 -06:00
|
|
|
|
2018-11-22 12:19:05 -07:00
|
|
|
declare type Speed = 'bullet' | 'blitz' | 'classical' | 'correspondence' | 'unlimited';
|
2017-04-04 15:25:35 -06:00
|
|
|
|
2021-02-06 06:26:05 -07:00
|
|
|
declare type Perf =
|
|
|
|
| 'bullet'
|
|
|
|
| 'blitz'
|
|
|
|
| 'classical'
|
|
|
|
| 'correspondence'
|
|
|
|
| 'chess960'
|
|
|
|
| 'antichess'
|
|
|
|
| 'fromPosition'
|
|
|
|
| 'kingOfTheHill'
|
|
|
|
| 'threeCheck'
|
|
|
|
| 'atomic'
|
|
|
|
| 'horde'
|
|
|
|
| 'racingKings'
|
|
|
|
| 'crazyhouse';
|
2017-04-04 15:25:35 -06:00
|
|
|
|
2018-11-22 12:19:05 -07:00
|
|
|
declare type Color = 'white' | 'black';
|
2017-04-04 15:25:35 -06:00
|
|
|
|
2021-04-20 15:06:23 -06:00
|
|
|
declare type Files = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h';
|
2021-07-16 05:49:40 -06:00
|
|
|
declare type Ranks = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8';
|
2021-04-20 15:06:23 -06:00
|
|
|
declare type Key = 'a0' | `${Files}${Ranks}`;
|
2018-11-22 12:19:05 -07:00
|
|
|
declare type Uci = string;
|
2017-06-26 05:02:52 -06:00
|
|
|
declare type San = string;
|
2017-06-22 08:40:51 -06:00
|
|
|
declare type Fen = string;
|
|
|
|
declare type Ply = number;
|
|
|
|
|
2017-04-04 15:25:35 -06:00
|
|
|
interface Variant {
|
2021-02-06 06:26:05 -07:00
|
|
|
key: VariantKey;
|
|
|
|
name: string;
|
|
|
|
short: string;
|
|
|
|
title?: string;
|
2017-04-04 15:25:35 -06:00
|
|
|
}
|
|
|
|
|
2018-11-22 03:06:27 -07:00
|
|
|
interface Paginator<A> {
|
2021-02-06 06:26:05 -07:00
|
|
|
currentPage: number;
|
|
|
|
maxPerPage: number;
|
|
|
|
currentPageResults: Array<A>;
|
|
|
|
nbResults: number;
|
|
|
|
previousPage?: number;
|
|
|
|
nextPage?: number;
|
|
|
|
nbPages: number;
|
2018-11-22 03:06:27 -07:00
|
|
|
}
|
|
|
|
|
2017-04-04 15:25:35 -06:00
|
|
|
declare namespace Tree {
|
|
|
|
export type Path = string;
|
|
|
|
|
2021-09-04 12:28:15 -06:00
|
|
|
interface ClientEvalBase {
|
2017-06-22 08:40:51 -06:00
|
|
|
fen: Fen;
|
2017-04-04 15:25:35 -06:00
|
|
|
depth: number;
|
|
|
|
nodes: number;
|
|
|
|
pvs: PvData[];
|
|
|
|
cp?: number;
|
|
|
|
mate?: number;
|
|
|
|
}
|
2021-09-04 12:28:15 -06:00
|
|
|
export interface CloudEval extends ClientEvalBase {
|
|
|
|
cloud: true;
|
|
|
|
maxDepth: undefined;
|
|
|
|
millis: undefined;
|
|
|
|
}
|
|
|
|
export interface LocalEval extends ClientEvalBase {
|
|
|
|
cloud?: false;
|
|
|
|
maxDepth: number;
|
|
|
|
knps: number;
|
|
|
|
millis: number;
|
|
|
|
}
|
|
|
|
export type ClientEval = CloudEval | LocalEval;
|
2017-04-04 15:25:35 -06:00
|
|
|
|
|
|
|
export interface ServerEval {
|
|
|
|
cp?: number;
|
|
|
|
mate?: number;
|
2017-06-26 05:02:52 -06:00
|
|
|
best?: Uci;
|
2020-10-16 10:03:33 -06:00
|
|
|
fen: Fen;
|
|
|
|
knodes: number;
|
|
|
|
depth: number;
|
2021-04-18 13:19:55 -06:00
|
|
|
pvs: PvDataServer[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PvDataServer {
|
|
|
|
moves: string;
|
|
|
|
mate?: number;
|
|
|
|
cp?: number;
|
2017-04-04 15:25:35 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface PvData {
|
|
|
|
moves: string[];
|
|
|
|
mate?: number;
|
|
|
|
cp?: number;
|
|
|
|
}
|
|
|
|
|
2018-04-14 21:14:14 -06:00
|
|
|
export interface TablebaseHit {
|
|
|
|
winner: Color | undefined;
|
|
|
|
best?: Uci;
|
|
|
|
}
|
|
|
|
|
2017-04-04 15:25:35 -06:00
|
|
|
export interface Node {
|
|
|
|
id: string;
|
2017-06-22 08:40:51 -06:00
|
|
|
ply: Ply;
|
2017-12-30 06:18:24 -07:00
|
|
|
uci?: Uci;
|
2017-06-22 08:40:51 -06:00
|
|
|
fen: Fen;
|
2017-04-04 15:25:35 -06:00
|
|
|
children: Node[];
|
|
|
|
comments?: Comment[];
|
2017-08-14 18:44:04 -06:00
|
|
|
gamebook?: Gamebook;
|
2017-06-24 06:20:20 -06:00
|
|
|
dests?: string;
|
2020-03-30 15:19:04 -06:00
|
|
|
drops?: string | null;
|
|
|
|
check?: Key;
|
2021-09-04 12:28:15 -06:00
|
|
|
threat?: LocalEval;
|
2017-04-04 15:25:35 -06:00
|
|
|
ceval?: ClientEval;
|
|
|
|
eval?: ServerEval;
|
2020-03-30 15:19:04 -06:00
|
|
|
tbhit?: TablebaseHit | null;
|
2017-04-04 15:25:35 -06:00
|
|
|
glyphs?: Glyph[];
|
|
|
|
clock?: Clock;
|
|
|
|
parentClock?: Clock;
|
2020-03-30 15:19:04 -06:00
|
|
|
forceVariation?: boolean;
|
2017-04-04 15:25:35 -06:00
|
|
|
shapes?: Shape[];
|
|
|
|
comp?: boolean;
|
2017-04-05 16:07:13 -06:00
|
|
|
san?: string;
|
2017-06-24 05:10:09 -06:00
|
|
|
threefold?: boolean;
|
2017-06-28 07:34:50 -06:00
|
|
|
fail?: boolean;
|
2020-03-30 08:19:35 -06:00
|
|
|
puzzle?: 'win' | 'fail' | 'good' | 'retry';
|
2017-10-16 17:57:41 -06:00
|
|
|
crazy?: NodeCrazy;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface NodeCrazy {
|
|
|
|
pockets: [CrazyPocket, CrazyPocket];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CrazyPocket {
|
|
|
|
[role: string]: number;
|
2017-04-04 15:25:35 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface Comment {
|
|
|
|
id: string;
|
2021-02-06 06:26:05 -07:00
|
|
|
by:
|
|
|
|
| string
|
|
|
|
| {
|
|
|
|
id: string;
|
|
|
|
name: string;
|
|
|
|
};
|
2017-04-04 15:25:35 -06:00
|
|
|
text: string;
|
|
|
|
}
|
|
|
|
|
2017-08-14 18:44:04 -06:00
|
|
|
export interface Gamebook {
|
|
|
|
deviation?: string;
|
2017-08-18 16:28:17 -06:00
|
|
|
hint?: string;
|
2021-02-06 06:26:05 -07:00
|
|
|
shapes?: Shape[];
|
2017-08-14 18:44:04 -06:00
|
|
|
}
|
|
|
|
|
2018-01-14 15:26:55 -07:00
|
|
|
type GlyphId = number;
|
|
|
|
|
|
|
|
interface Glyph {
|
|
|
|
id: GlyphId;
|
2017-04-04 15:25:35 -06:00
|
|
|
name: string;
|
|
|
|
symbol: string;
|
|
|
|
}
|
|
|
|
|
2017-07-02 05:59:36 -06:00
|
|
|
export type Clock = number;
|
2017-04-04 15:25:35 -06:00
|
|
|
|
2021-02-06 06:26:05 -07:00
|
|
|
export interface Shape {}
|
2017-04-04 15:25:35 -06:00
|
|
|
}
|
2017-12-05 18:19:01 -07:00
|
|
|
|
2021-04-20 12:39:30 -06:00
|
|
|
interface GameUpdate {
|
|
|
|
id: string;
|
|
|
|
fen: Fen;
|
|
|
|
lm: Uci;
|
|
|
|
wc?: number;
|
|
|
|
bc?: number;
|
|
|
|
}
|
|
|
|
|
2020-09-09 09:27:15 -06:00
|
|
|
interface CashStatic {
|
2017-12-05 18:19:01 -07:00
|
|
|
powerTip: any;
|
|
|
|
}
|
|
|
|
|
2020-09-09 09:27:15 -06:00
|
|
|
interface Cash {
|
2020-09-09 13:55:51 -06:00
|
|
|
powerTip(options?: PowerTip.Options | 'show' | 'hide'): Cash;
|
2017-12-05 18:19:01 -07:00
|
|
|
clock: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare namespace PowerTip {
|
|
|
|
type Placement = 'n' | 'e' | 's' | 'w' | 'nw' | 'ne' | 'sw' | 'se' | 'nw-alt' | 'ne-alt' | 'sw-alt' | 'se-alt';
|
|
|
|
|
|
|
|
interface Options {
|
2020-09-11 01:40:02 -06:00
|
|
|
preRender?: (el: HTMLElement) => void;
|
2017-12-05 18:19:01 -07:00
|
|
|
placement?: Placement;
|
|
|
|
smartPlacement?: boolean;
|
|
|
|
popupId?: string;
|
|
|
|
poupClass?: string;
|
|
|
|
offset?: number;
|
|
|
|
fadeInTime?: number;
|
|
|
|
fadeOutTime?: number;
|
|
|
|
closeDelay?: number;
|
|
|
|
intentPollInterval?: number;
|
|
|
|
intentSensitivity?: number;
|
|
|
|
manual?: boolean;
|
|
|
|
openEvents?: string[];
|
|
|
|
closeEvents?: string[];
|
|
|
|
}
|
|
|
|
}
|
2020-09-12 10:55:09 -06:00
|
|
|
|
2021-04-20 12:37:16 -06:00
|
|
|
declare namespace Prefs {
|
|
|
|
const enum Coords {
|
|
|
|
Hidden = 0,
|
|
|
|
Inside = 1,
|
|
|
|
Outside = 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
const enum AutoQueen {
|
|
|
|
Never = 1,
|
|
|
|
OnPremove = 2,
|
|
|
|
Always = 3,
|
|
|
|
}
|
|
|
|
|
|
|
|
const enum ShowClockTenths {
|
|
|
|
Never = 0,
|
|
|
|
Below10Secs = 1,
|
|
|
|
Always = 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
const enum ShowResizeHandle {
|
|
|
|
Never = 0,
|
|
|
|
OnlyAtStart = 1,
|
|
|
|
Always = 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
const enum MoveEvent {
|
|
|
|
Click = 0,
|
|
|
|
Drag = 1,
|
|
|
|
ClickOrDrag = 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
const enum Replay {
|
|
|
|
Never = 0,
|
|
|
|
OnlySlowGames = 1,
|
|
|
|
Always = 2,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-17 08:37:45 -06:00
|
|
|
interface Dictionary<T> {
|
2021-04-17 08:47:31 -06:00
|
|
|
[key: string]: T | undefined;
|
2021-04-17 08:37:45 -06:00
|
|
|
}
|
|
|
|
|
2021-04-20 12:37:16 -06:00
|
|
|
type SocketHandlers = Dictionary<(d: any) => void>;
|
|
|
|
|
2021-04-07 12:26:38 -06:00
|
|
|
declare const lichess: Lichess;
|