vue-pgn-viewer 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,110 @@
1
1
  import { Api } from 'chessground/api';
2
2
  import { Color } from 'chessops';
3
+ import { CommentShape } from 'chessops/pgn';
3
4
  import { ComponentOptionsMixin } from 'vue';
4
5
  import { ComponentProvideOptions } from 'vue';
5
6
  import { Config } from 'chessground/config';
6
7
  import { DefineComponent } from 'vue';
8
+ import { FEN } from 'chessground/types';
9
+ import { Move } from 'chessops';
10
+ import { Node as Node_2 } from 'chessops/pgn';
11
+ import { Position } from 'chessops';
7
12
  import { PublicProps } from 'vue';
8
13
 
14
+ declare type AnyNode = Node_2<MoveData>;
15
+
16
+ declare type Clocks = {
17
+ white?: number;
18
+ black?: number;
19
+ };
20
+
9
21
  declare type ComponentProps = {
10
22
  config?: PgnViewerConfig;
11
23
  };
12
24
 
25
+ declare type Game = {
26
+ mainline: MoveData[];
27
+ initial: Initial;
28
+ moves: AnyNode;
29
+ players: Players;
30
+ metadata: Metadata;
31
+ title(): string;
32
+ hasPlayerName(): boolean;
33
+ nodeAt(path: Path): AnyNode | undefined;
34
+ dataAt(path: Path): MoveData | Initial | undefined;
35
+ pathAtMainlinePly(ply: Ply | "last"): Path;
36
+ };
37
+
13
38
  declare type GoTo = "first" | "prev" | "next" | "last";
14
39
 
15
40
  declare type Id = string;
16
41
 
42
+ declare type Initial = InitialOrMove & {
43
+ pos: Position;
44
+ };
45
+
46
+ declare type InitialOrMove = {
47
+ fen: FEN;
48
+ turn: Color;
49
+ check: boolean;
50
+ comments: string[];
51
+ shapes: CommentShape[];
52
+ clocks: Clocks;
53
+ };
54
+
17
55
  declare type Lichess = string | false;
18
56
 
19
- declare type Pane = "board" | "menu" | "pgn";
57
+ declare type Metadata = {
58
+ externalLink?: string;
59
+ isLichess: boolean;
60
+ timeControl?: {
61
+ initial: number;
62
+ increment: number;
63
+ };
64
+ orientation?: Color;
65
+ result?: string;
66
+ };
67
+
68
+ declare type MoveData = InitialOrMove & {
69
+ path: Path;
70
+ ply: number;
71
+ move: Move;
72
+ san: San;
73
+ uci: Uci;
74
+ startingComments: string[];
75
+ nags: number[];
76
+ emt?: number;
77
+ };
78
+
79
+ declare type Options = {
80
+ pgn: string;
81
+ fen?: string;
82
+ chessground: Config;
83
+ orientation?: Color;
84
+ showPlayers: ShowPlayers;
85
+ showMoves: ShowMoves;
86
+ showClocks: boolean;
87
+ showControls: boolean;
88
+ initialPly: Ply | "last";
89
+ scrollToMove: boolean;
90
+ keyboardToMove: boolean;
91
+ drawArrows: boolean;
92
+ menu: {
93
+ getPgn: {
94
+ enabled?: boolean;
95
+ fileName?: string;
96
+ };
97
+ practiceWithComputer?: {
98
+ enabled?: boolean;
99
+ };
100
+ analysisBoard?: {
101
+ enabled?: boolean;
102
+ };
103
+ };
104
+ lichess: Lichess;
105
+ classes?: string;
106
+ translate?: Translate;
107
+ };
20
108
 
21
109
  declare type Path = {
22
110
  path: string;
@@ -37,16 +125,17 @@ ready: (api: PgnViewerApi) => any;
37
125
  }, string, PublicProps, Readonly<ComponentProps> & Readonly<{
38
126
  onReady?: ((api: PgnViewerApi) => any) | undefined;
39
127
  }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
40
- board: HTMLDivElement;
128
+ div: HTMLDivElement;
41
129
  }, HTMLDivElement>;
42
130
 
43
131
  export declare type PgnViewerApi = {
132
+ game: Game;
44
133
  path: Path;
45
134
  translate: Translate;
46
- ground: Api;
135
+ ground?: Api;
47
136
  div?: HTMLElement;
48
137
  flipped: boolean;
49
- pane: Pane;
138
+ pane: string;
50
139
  autoScrollRequested: boolean;
51
140
  focus(): void;
52
141
  orientation(): string;
@@ -61,44 +150,30 @@ export declare type PgnViewerApi = {
61
150
  setGround(api: Api): void;
62
151
  };
63
152
 
64
- export declare type PgnViewerConfig = Partial<PgnViewerOptions>;
153
+ export declare type PgnViewerConfig = Partial<Options>;
65
154
 
66
- declare type PgnViewerOptions = {
67
- pgn: string;
68
- fen?: string;
69
- chessground: Config;
70
- orientation?: Color;
71
- showPlayers: ShowPlayers;
72
- showMoves: ShowMoves;
73
- showClocks: boolean;
74
- showControls: boolean;
75
- initialPly: Ply | "last";
76
- scrollToMove: boolean;
77
- keyboardToMove: boolean;
78
- drawArrows: boolean;
79
- menu: {
80
- getPgn: {
81
- enabled?: boolean;
82
- fileName?: string;
83
- };
84
- practiceWithComputer?: {
85
- enabled?: boolean;
86
- };
87
- analysisBoard?: {
88
- enabled?: boolean;
89
- };
90
- };
91
- lichess: Lichess;
92
- classes?: string;
93
- translate?: Translate;
155
+ declare type Player = {
156
+ name?: string;
157
+ title?: string;
158
+ rating?: number;
159
+ isLichessUser: boolean;
160
+ };
161
+
162
+ declare type Players = {
163
+ white: Player;
164
+ black: Player;
94
165
  };
95
166
 
96
167
  declare type Ply = number;
97
168
 
169
+ declare type San = string;
170
+
98
171
  declare type ShowMoves = false | "right" | "bottom" | "auto";
99
172
 
100
173
  declare type ShowPlayers = true | false | "auto";
101
174
 
102
175
  declare type Translate = (key: string) => string | undefined;
103
176
 
177
+ declare type Uci = string;
178
+
104
179
  export { }