@connectorvol/tree 8.0.1 → 9.0.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.
- package/dist/(components)/BoardSettingsTrigger.svelte +10 -0
- package/dist/(components)/BoardSettingsTrigger.svelte.d.ts +18 -0
- package/dist/(components)/DrillBreadcrumbs.svelte +6 -8
- package/dist/(components)/DrillBreadcrumbs.svelte.d.ts +0 -3
- package/dist/(components)/DrillForkSanLabel.svelte +2 -5
- package/dist/(components)/DrillForkSanLabel.svelte.d.ts +0 -3
- package/dist/(components)/DrillVariationList.svelte +29 -15
- package/dist/(components)/DrillVariationList.svelte.d.ts +0 -3
- package/dist/(components)/Move.svelte +348 -349
- package/dist/(components)/Move.svelte.d.ts +0 -3
- package/dist/(components)/MoveComment.svelte +31 -24
- package/dist/(components)/MoveComment.svelte.d.ts +2 -0
- package/dist/(components)/MoveSanWithMenu.svelte +4 -7
- package/dist/(components)/MoveSanWithMenu.svelte.d.ts +0 -3
- package/dist/(components)/MoveWithIcon.svelte +60 -65
- package/dist/(components)/MoveWithIcon.svelte.d.ts +1 -4
- package/dist/(components)/PieceIcon.svelte +27 -44
- package/dist/(components)/PieceIcon.svelte.d.ts +3 -6
- package/dist/(components)/TreeViewer.svelte +957 -907
- package/dist/(components)/TreeViewer.svelte.d.ts +10 -3
- package/dist/(components)/VariantDropdownNavigator.svelte +22 -6
- package/dist/(components)/VariantDropdownNavigator.svelte.d.ts +8 -3
- package/dist/(components)/VariationGroup.svelte +85 -89
- package/dist/(constants)/treeViewerThemes.d.ts +12 -0
- package/dist/(constants)/treeViewerThemes.js +19 -0
- package/dist/(models)/treeViewerTheme.d.ts +17 -0
- package/dist/(models)/treeViewerTheme.js +1 -0
- package/dist/(utils)/treeViewerPanelNavigation.svelte.d.ts +2 -2
- package/dist/(utils)/treeViewerPanelNavigation.svelte.js +12 -5
- package/dist/components/ui/context-menu/context-menu-content.svelte +24 -20
- package/dist/components/ui/context-menu/context-menu-sub-content.svelte +14 -14
- package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +26 -22
- package/dist/components/ui/toggle/index.d.ts +1 -1
- package/dist/components/ui/toggle/index.js +1 -1
- package/dist/components/ui/toggle/toggle-variants.d.ts +35 -0
- package/dist/components/ui/toggle/toggle-variants.js +19 -0
- package/dist/components/ui/toggle/toggle.svelte +1 -27
- package/dist/components/ui/toggle/toggle.svelte.d.ts +1 -35
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/utils/overlayPortalTarget.d.ts +6 -0
- package/dist/utils/overlayPortalTarget.js +15 -0
- package/package.json +15 -14
|
@@ -1,390 +1,389 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
2
|
+
import type { ChessTreeNode } from "../(models)/chessTreeNode.js";
|
|
3
|
+
|
|
4
|
+
import { parseComment } from "@connectorvol/chessops/pgn";
|
|
5
|
+
|
|
6
|
+
import { createPreviewHover } from "../(utils)/createPreviewHover.js";
|
|
7
|
+
import { getGameContext } from "../(utils)/context.js";
|
|
8
|
+
import Move from "./Move.svelte";
|
|
9
|
+
import MoveComment from "./MoveComment.svelte";
|
|
10
|
+
import MoveSanWithMenu from "./MoveSanWithMenu.svelte";
|
|
11
|
+
import VariationGroup from "./VariationGroup.svelte";
|
|
12
|
+
|
|
13
|
+
const HIGHEST_LEVEL = 1;
|
|
14
|
+
|
|
15
|
+
type TMoveProps = {
|
|
16
|
+
/** Возвращает узел хода в дереве партии. */
|
|
17
|
+
chessNode: ChessTreeNode;
|
|
18
|
+
/** Возвращает глубину вложенности относительно корня отображения. */
|
|
19
|
+
depth: number;
|
|
20
|
+
/** Возвращает родительский узел или null для корня. */
|
|
21
|
+
parentNode: ChessTreeNode | null;
|
|
22
|
+
/** Возвращает true, если нужна пустая ячейка хода (сетка верхнего уровня). */
|
|
23
|
+
shouldReserveEmptyMoveCell: boolean;
|
|
24
|
+
/** Возвращает true, если нужно отрисовать соседние варианты у развилки. */
|
|
25
|
+
shouldRenderSiblingVariations?: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const {
|
|
29
|
+
chessNode,
|
|
30
|
+
depth,
|
|
31
|
+
parentNode,
|
|
32
|
+
shouldReserveEmptyMoveCell,
|
|
33
|
+
shouldRenderSiblingVariations = true,
|
|
34
|
+
}: TMoveProps = $props();
|
|
35
|
+
|
|
36
|
+
/** Контекст игры без деструктуризации — иначе selectable и chessTree «замораживаются» при первом рендере TreeViewer. */
|
|
37
|
+
const game = getGameContext();
|
|
38
|
+
|
|
39
|
+
/** Представляет обработчик выбора текущего узла по `mousedown`. */
|
|
40
|
+
function handleMoveMouseDown() {
|
|
41
|
+
if (!game.selectable || !moveNode) return;
|
|
42
|
+
game.chessTree.currentNode = chessNode;
|
|
43
|
+
|
|
44
|
+
game.onSelectNode();
|
|
45
|
+
game.onChessNodeSelected?.(game.chessTree.currentNode);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const moveNode = $derived(chessNode);
|
|
49
|
+
const previewHover = createPreviewHover({
|
|
50
|
+
setPreviewFen: game.setPreviewFen,
|
|
51
|
+
getFen: () => moveNode.data.fen,
|
|
52
|
+
getLastMove: () => moveNode.data.lastMove ?? null,
|
|
53
|
+
getDelayMs: () => game.previewHoverDelayMs,
|
|
54
|
+
});
|
|
55
|
+
const isCurrentMove = $derived(
|
|
56
|
+
chessNode.id === game.chessTree.currentNode.id,
|
|
57
|
+
);
|
|
58
|
+
/** Представляет текст первого PGN-комментария узла после разбора `comments[0]`, синхронно с правкой строки под деревом. */
|
|
59
|
+
const commentParseCache = new Map<string, ReturnType<typeof parseComment>>();
|
|
60
|
+
|
|
61
|
+
function getParsedComment(raw: string | undefined) {
|
|
62
|
+
if (raw === undefined) return null;
|
|
63
|
+
const cached = commentParseCache.get(raw);
|
|
64
|
+
if (cached) return cached;
|
|
65
|
+
const parsed = parseComment(raw);
|
|
66
|
+
commentParseCache.set(raw, parsed);
|
|
67
|
+
return parsed;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const firstCommentParsed = $derived(
|
|
71
|
+
getParsedComment(moveNode.data.comments?.[0]),
|
|
72
|
+
);
|
|
73
|
+
const firstCommentText = $derived(firstCommentParsed?.text);
|
|
74
|
+
const childMoves = $derived(chessNode.children);
|
|
75
|
+
const isForcedLineStart = $derived(
|
|
76
|
+
chessNode.id === game.chessTree.forcedNodeId,
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
/** Представляет признак активного drill-down «варианты отдельно». */
|
|
80
|
+
const variationDrillDownActive = $derived(
|
|
81
|
+
game.chessTree.isVariationDrillDownActive(),
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Представляет признак: развилка на этом уровне совпадает с узлом, для которого
|
|
86
|
+
* `ChessTree` рассчитывает акцент направляющих при текущем выборе.
|
|
87
|
+
*/
|
|
88
|
+
const isActiveForkForSelection = $derived(
|
|
89
|
+
shouldRenderSiblingVariations &&
|
|
90
|
+
parentNode !== null &&
|
|
91
|
+
(parentNode.children?.length ?? 0) > 1 &&
|
|
92
|
+
game.chessTree.currentGuideHighlightForkParent?.id === parentNode.id,
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const spaceBlockClass = "px-3 py-2";
|
|
96
|
+
const spaceInlineBlockClass = "p-2";
|
|
97
|
+
|
|
98
|
+
const isHighestLevel = $derived(depth === HIGHEST_LEVEL);
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Представляет признак: комментарий в верхней сетке — последняя строка (ниже нет ходов и вариантов).
|
|
102
|
+
* Для чёрного полухода нижнюю границу рисует обёртка сетки (`isFullMainLineTailRow`).
|
|
103
|
+
*/
|
|
104
|
+
const showCommentBottomBorder = $derived(
|
|
105
|
+
isHighestLevel &&
|
|
106
|
+
!!firstCommentText &&
|
|
107
|
+
(childMoves?.length ?? 0) === 0 &&
|
|
108
|
+
!isForcedLineStart &&
|
|
109
|
+
moveNode.data.ply % 2 === 1 &&
|
|
110
|
+
!(
|
|
111
|
+
parentNode !== null &&
|
|
112
|
+
parentNode.children.length > 1 &&
|
|
113
|
+
shouldRenderSiblingVariations
|
|
114
|
+
),
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Представляет признак: в верхней сетке после белого полухода показывается пустая ячейка чёрных
|
|
119
|
+
* без ноды (партия оборвалась на ходе белых) — нижнюю границу рисуем только под двумя первыми колонками.
|
|
120
|
+
*/
|
|
121
|
+
const addsEmptyMainLineBlackCell = $derived(
|
|
122
|
+
isHighestLevel &&
|
|
123
|
+
moveNode.data.ply % 2 === 1 &&
|
|
124
|
+
!isForcedLineStart &&
|
|
125
|
+
(parentNode === null || parentNode.children.length <= 1) &&
|
|
126
|
+
!firstCommentText &&
|
|
127
|
+
(childMoves?.length ?? 0) === 0,
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Представляет признак: верхняя строка — первый полуход чёрных от корня партии (нотация «1... SAN»).
|
|
132
|
+
*/
|
|
133
|
+
const isLeadingBlackHalfMoveFromRoot = $derived(
|
|
134
|
+
isHighestLevel &&
|
|
135
|
+
parentNode !== null &&
|
|
136
|
+
parentNode.data.ply === 0 &&
|
|
137
|
+
moveNode.data.ply % 2 === 0,
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
/** Представляет true, если в контекстном меню показывать «Поднять приоритет». */
|
|
141
|
+
const showUpPriorityItem = $derived(depth > HIGHEST_LEVEL + 1);
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Представляет признак: SAN главного варианта (children[0]) переносится в блок списка веток,
|
|
145
|
+
* чтобы не дублировать его перед группой (например «8. g3» только среди g3 / f3 / a3).
|
|
146
|
+
*/
|
|
147
|
+
const shouldRenderSanInsideVariationGroup = $derived(
|
|
148
|
+
!isHighestLevel &&
|
|
149
|
+
shouldRenderSiblingVariations &&
|
|
150
|
+
parentNode !== null &&
|
|
151
|
+
parentNode.children.length > 1 &&
|
|
152
|
+
parentNode.children[0]?.id === chessNode.id,
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Представляет обработчик клика по зоне линий ветвления, открывающий режим «варианты отдельно».
|
|
157
|
+
*/
|
|
158
|
+
function onVariationLinesHit(e: MouseEvent) {
|
|
159
|
+
e.stopPropagation();
|
|
160
|
+
if (parentNode === null) return;
|
|
161
|
+
const selectFork =
|
|
162
|
+
!game.chessTree.isCurrentNodeWithinForkSubtree(parentNode);
|
|
163
|
+
game.chessTree.openVariationDrillDown(parentNode, { selectFork });
|
|
164
|
+
game.onSelectNode();
|
|
165
|
+
game.onChessNodeSelected?.(game.chessTree.currentNode);
|
|
166
|
+
}
|
|
158
167
|
</script>
|
|
159
168
|
|
|
160
169
|
{#snippet emptyMove()}
|
|
161
|
-
|
|
170
|
+
<div class="flex items-center justify-center text-center">...</div>
|
|
162
171
|
{/snippet}
|
|
163
172
|
|
|
164
173
|
{#snippet emptyMainLineBlackCell()}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
174
|
+
<div
|
|
175
|
+
class="tree-viewer-tail-no-node-cell flex min-w-0 items-center justify-center border-b-0 p-2 text-center"
|
|
176
|
+
></div>
|
|
168
177
|
{/snippet}
|
|
169
178
|
|
|
170
179
|
{#snippet fullMovesCounter(minus: number = 0)}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
180
|
+
<span
|
|
181
|
+
class={{
|
|
182
|
+
"flex items-center justify-center text-center": isHighestLevel,
|
|
183
|
+
inline: !isHighestLevel,
|
|
184
|
+
"border-b": addsEmptyMainLineBlackCell && isHighestLevel,
|
|
185
|
+
"tree-viewer-overflow-tail-border":
|
|
186
|
+
addsEmptyMainLineBlackCell && isHighestLevel,
|
|
187
|
+
}}
|
|
188
|
+
style:border-color="var(--tree-viewer-border)"
|
|
189
|
+
>
|
|
190
|
+
{moveNode.data.fullMoves - minus}{!isHighestLevel &&
|
|
191
|
+
moveNode.data.ply % 2 === 1
|
|
192
|
+
? "..."
|
|
193
|
+
: !isHighestLevel && moveNode.data.ply % 2 === 0
|
|
194
|
+
? "..."
|
|
195
|
+
: ""}
|
|
196
|
+
</span>
|
|
188
197
|
{/snippet}
|
|
189
198
|
|
|
190
199
|
{#snippet variationMoveRow(child: ChessTreeNode)}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
/>
|
|
200
|
+
<Move
|
|
201
|
+
chessNode={child}
|
|
202
|
+
shouldReserveEmptyMoveCell={parentNode !== null &&
|
|
203
|
+
parentNode.children.length > 1}
|
|
204
|
+
depth={depth + 1}
|
|
205
|
+
shouldRenderSiblingVariations={false}
|
|
206
|
+
{parentNode}
|
|
207
|
+
/>
|
|
200
208
|
{/snippet}
|
|
201
209
|
|
|
202
210
|
{#if isHighestLevel}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
211
|
+
{#if moveNode.data.ply % 2 === 1}
|
|
212
|
+
{@render fullMovesCounter()}
|
|
213
|
+
{/if}
|
|
206
214
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
{#if variationDrillDownActive && moveNode.data.ply % 2 === 0 && game.chessTree.drillForkParent !== null && game.chessTree.drillForkParent.children[0]?.id === chessNode.id && moveNode.parentId}
|
|
216
|
+
<span
|
|
217
|
+
class={{
|
|
218
|
+
"flex items-center justify-center text-center": isHighestLevel,
|
|
219
|
+
}}
|
|
220
|
+
>
|
|
221
|
+
{moveNode.data.fullMoves}
|
|
222
|
+
</span>
|
|
223
|
+
{@render emptyMove()}
|
|
224
|
+
{/if}
|
|
217
225
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
{#if isLeadingBlackHalfMoveFromRoot}
|
|
227
|
+
<span
|
|
228
|
+
class={{
|
|
229
|
+
"flex items-center justify-center text-center": isHighestLevel,
|
|
230
|
+
}}
|
|
231
|
+
>
|
|
232
|
+
{Math.max(1, moveNode.data.fullMoves - 1)}
|
|
233
|
+
</span>
|
|
234
|
+
{@render emptyMove()}
|
|
235
|
+
{/if}
|
|
236
|
+
|
|
237
|
+
{#if moveNode.parentId}
|
|
238
|
+
<MoveSanWithMenu
|
|
239
|
+
{chessNode}
|
|
240
|
+
{parentNode}
|
|
241
|
+
selectable={game.selectable}
|
|
242
|
+
{isHighestLevel}
|
|
243
|
+
{isCurrentMove}
|
|
244
|
+
previewHover={{
|
|
245
|
+
onmouseenter: previewHover.onmouseenter,
|
|
246
|
+
onmouseleave: previewHover.onmouseleave,
|
|
247
|
+
}}
|
|
248
|
+
onMoveMouseDown={handleMoveMouseDown}
|
|
249
|
+
{spaceInlineBlockClass}
|
|
250
|
+
nags={moveNode.data.nags}
|
|
251
|
+
chessTree={game.chessTree}
|
|
252
|
+
{showUpPriorityItem}
|
|
253
|
+
onDeleteVariant={game.onDeleteVariant}
|
|
254
|
+
mainRowBottomEdge={addsEmptyMainLineBlackCell}
|
|
255
|
+
/>
|
|
256
|
+
{/if}
|
|
257
|
+
{#if isHighestLevel && moveNode.data.ply % 2 === 1}
|
|
258
|
+
{#if isForcedLineStart || (parentNode != null && parentNode.children.length > 1) || !!firstCommentText}
|
|
259
|
+
{@render emptyMove()}
|
|
260
|
+
{:else if (childMoves?.length ?? 0) === 0}
|
|
261
|
+
{@render emptyMainLineBlackCell()}
|
|
227
262
|
{/if}
|
|
263
|
+
{/if}
|
|
228
264
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
onMoveMouseDown={handleMoveMouseDown}
|
|
242
|
-
{spaceInlineBlockClass}
|
|
243
|
-
nags={moveNode.data.nags}
|
|
244
|
-
chessTree={game.chessTree}
|
|
245
|
-
{showUpPriorityItem}
|
|
246
|
-
onDeleteVariant={game.onDeleteVariant}
|
|
247
|
-
mainRowBottomEdge={addsEmptyMainLineBlackCell}
|
|
248
|
-
/>
|
|
249
|
-
{/if}
|
|
250
|
-
{#if isHighestLevel && moveNode.data.ply % 2 === 1}
|
|
251
|
-
{#if isForcedLineStart || (parentNode != null && parentNode.children.length > 1) || !!firstCommentText}
|
|
252
|
-
{@render emptyMove()}
|
|
253
|
-
{:else if (childMoves?.length ?? 0) === 0}
|
|
254
|
-
{@render emptyMainLineBlackCell()}
|
|
255
|
-
{/if}
|
|
265
|
+
{#if firstCommentText}
|
|
266
|
+
{#if moveNode.data.ply % 2 === 1}
|
|
267
|
+
<MoveComment
|
|
268
|
+
text={firstCommentText}
|
|
269
|
+
{isHighestLevel}
|
|
270
|
+
{spaceBlockClass}
|
|
271
|
+
showBottomBorder={showCommentBottomBorder}
|
|
272
|
+
/>
|
|
273
|
+
{#if !shouldReserveEmptyMoveCell && childMoves?.[0] && !isForcedLineStart}
|
|
274
|
+
{@render fullMovesCounter()}
|
|
275
|
+
{@render emptyMove()}
|
|
276
|
+
{/if}
|
|
256
277
|
{/if}
|
|
257
278
|
|
|
258
|
-
{#if
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
{#if !shouldReserveEmptyMoveCell && childMoves?.[0] && !isForcedLineStart}
|
|
266
|
-
{@render fullMovesCounter()}
|
|
267
|
-
{@render emptyMove()}
|
|
268
|
-
{/if}
|
|
269
|
-
{/if}
|
|
270
|
-
|
|
271
|
-
{#if moveNode.data.ply % 2 === 0}
|
|
272
|
-
<MoveComment
|
|
273
|
-
text={firstCommentText}
|
|
274
|
-
{isHighestLevel}
|
|
275
|
-
{spaceBlockClass}
|
|
276
|
-
/>
|
|
277
|
-
{/if}
|
|
279
|
+
{#if moveNode.data.ply % 2 === 0}
|
|
280
|
+
<MoveComment
|
|
281
|
+
text={firstCommentText}
|
|
282
|
+
{isHighestLevel}
|
|
283
|
+
{spaceBlockClass}
|
|
284
|
+
showBottomBorder={showCommentBottomBorder}
|
|
285
|
+
/>
|
|
278
286
|
{/if}
|
|
287
|
+
{/if}
|
|
279
288
|
{:else}
|
|
280
|
-
|
|
281
|
-
|
|
289
|
+
{#if moveNode.data.ply % 2 === 0 && game.chessTree.forcedNodeId === moveNode.parentId && parentNode?.children[0].id === moveNode.id}
|
|
290
|
+
{@render fullMovesCounter(1)}
|
|
291
|
+
{/if}
|
|
292
|
+
|
|
293
|
+
{#if !shouldRenderSanInsideVariationGroup}
|
|
294
|
+
<MoveSanWithMenu
|
|
295
|
+
{chessNode}
|
|
296
|
+
{parentNode}
|
|
297
|
+
selectable={game.selectable}
|
|
298
|
+
{isHighestLevel}
|
|
299
|
+
{isCurrentMove}
|
|
300
|
+
previewHover={{
|
|
301
|
+
onmouseenter: previewHover.onmouseenter,
|
|
302
|
+
onmouseleave: previewHover.onmouseleave,
|
|
303
|
+
}}
|
|
304
|
+
onMoveMouseDown={handleMoveMouseDown}
|
|
305
|
+
{spaceInlineBlockClass}
|
|
306
|
+
nags={moveNode.data.nags}
|
|
307
|
+
chessTree={game.chessTree}
|
|
308
|
+
{showUpPriorityItem}
|
|
309
|
+
onDeleteVariant={game.onDeleteVariant}
|
|
310
|
+
/>
|
|
311
|
+
{/if}
|
|
312
|
+
{#if firstCommentText}
|
|
313
|
+
{#if moveNode.data.ply % 2 === 1}
|
|
314
|
+
<MoveComment text={firstCommentText} {isHighestLevel} {spaceBlockClass} />
|
|
315
|
+
{#if !shouldReserveEmptyMoveCell && childMoves?.[0] && !shouldRenderSanInsideVariationGroup}
|
|
316
|
+
{@render fullMovesCounter()}
|
|
317
|
+
{/if}
|
|
282
318
|
{/if}
|
|
283
319
|
|
|
284
|
-
{#if
|
|
285
|
-
|
|
286
|
-
{chessNode}
|
|
287
|
-
{parentNode}
|
|
288
|
-
{pieceSet}
|
|
289
|
-
selectable={game.selectable}
|
|
290
|
-
{isHighestLevel}
|
|
291
|
-
{isCurrentMove}
|
|
292
|
-
previewHover={{
|
|
293
|
-
onmouseenter: previewHover.onmouseenter,
|
|
294
|
-
onmouseleave: previewHover.onmouseleave,
|
|
295
|
-
}}
|
|
296
|
-
onMoveMouseDown={handleMoveMouseDown}
|
|
297
|
-
{spaceInlineBlockClass}
|
|
298
|
-
nags={moveNode.data.nags}
|
|
299
|
-
chessTree={game.chessTree}
|
|
300
|
-
{showUpPriorityItem}
|
|
301
|
-
onDeleteVariant={game.onDeleteVariant}
|
|
302
|
-
/>
|
|
303
|
-
{/if}
|
|
304
|
-
{#if firstCommentText}
|
|
305
|
-
{#if moveNode.data.ply % 2 === 1}
|
|
306
|
-
<MoveComment
|
|
307
|
-
text={firstCommentText}
|
|
308
|
-
{isHighestLevel}
|
|
309
|
-
{spaceBlockClass}
|
|
310
|
-
/>
|
|
311
|
-
{#if !shouldReserveEmptyMoveCell && childMoves?.[0] && !shouldRenderSanInsideVariationGroup}
|
|
312
|
-
{@render fullMovesCounter()}
|
|
313
|
-
{/if}
|
|
314
|
-
{/if}
|
|
315
|
-
|
|
316
|
-
{#if moveNode.data.ply % 2 === 0}
|
|
317
|
-
<MoveComment
|
|
318
|
-
text={firstCommentText}
|
|
319
|
-
{isHighestLevel}
|
|
320
|
-
{spaceBlockClass}
|
|
321
|
-
/>
|
|
322
|
-
{/if}
|
|
320
|
+
{#if moveNode.data.ply % 2 === 0}
|
|
321
|
+
<MoveComment text={firstCommentText} {isHighestLevel} {spaceBlockClass} />
|
|
323
322
|
{/if}
|
|
323
|
+
{/if}
|
|
324
324
|
{/if}
|
|
325
325
|
|
|
326
326
|
{#if parentNode && parentNode?.children.length > 1 && shouldRenderSiblingVariations}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
327
|
+
{@const showVariationDrillExpand =
|
|
328
|
+
!game.chessTree.isNodeOnMainLine(chessNode)}
|
|
329
|
+
<VariationGroup
|
|
330
|
+
{parentNode}
|
|
331
|
+
{isHighestLevel}
|
|
332
|
+
{isActiveForkForSelection}
|
|
333
|
+
{showVariationDrillExpand}
|
|
334
|
+
{onVariationLinesHit}
|
|
335
|
+
{variationMoveRow}
|
|
336
|
+
isBranchOnCurrentPath={(n) => game.chessTree.isCurrentOnPathFromNode(n)}
|
|
337
|
+
/>
|
|
338
338
|
{/if}
|
|
339
339
|
|
|
340
|
-
{#if isForcedLineStart}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
<
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
>
|
|
354
|
-
|
|
355
|
-
{pieceSet}
|
|
356
|
-
chessNode={chessNode.children[0]}
|
|
357
|
-
shouldReserveEmptyMoveCell={chessNode.children.length > 1}
|
|
358
|
-
depth={depth + 1}
|
|
359
|
-
shouldRenderSiblingVariations={true}
|
|
360
|
-
parentNode={chessNode}
|
|
361
|
-
></Move>
|
|
362
|
-
</div>
|
|
340
|
+
{#if isForcedLineStart && childMoves?.[0]}
|
|
341
|
+
{#if isHighestLevel}
|
|
342
|
+
<div class="col-span-3 col-start-1 w-full min-w-0">
|
|
343
|
+
<div
|
|
344
|
+
class="{spaceBlockClass} tracking-tight"
|
|
345
|
+
style:background-color="var(--tree-viewer-bg)"
|
|
346
|
+
>
|
|
347
|
+
<Move
|
|
348
|
+
chessNode={chessNode.children[0]}
|
|
349
|
+
shouldReserveEmptyMoveCell={chessNode.children.length > 1}
|
|
350
|
+
depth={depth + 1}
|
|
351
|
+
shouldRenderSiblingVariations={true}
|
|
352
|
+
parentNode={chessNode}
|
|
353
|
+
></Move>
|
|
354
|
+
</div>
|
|
363
355
|
</div>
|
|
356
|
+
{:else}
|
|
357
|
+
<Move
|
|
358
|
+
chessNode={chessNode.children[0]}
|
|
359
|
+
shouldReserveEmptyMoveCell={childMoves.length > 1}
|
|
360
|
+
{depth}
|
|
361
|
+
parentNode={chessNode}
|
|
362
|
+
></Move>
|
|
363
|
+
{/if}
|
|
364
364
|
{/if}
|
|
365
365
|
|
|
366
366
|
{#if shouldReserveEmptyMoveCell && moveNode.data.ply % 2 === 1 && isHighestLevel && !isForcedLineStart && childMoves?.[0]}
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
{@render fullMovesCounter()}
|
|
368
|
+
{@render emptyMove()}
|
|
369
369
|
{/if}
|
|
370
370
|
{#if variationDrillDownActive && isHighestLevel && moveNode.data.ply % 2 === 1 && !shouldReserveEmptyMoveCell && childMoves?.[0] && !isForcedLineStart && game.chessTree.drillForkParent !== null && game.chessTree.drillForkParent.children[0]?.id === chessNode.id}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
371
|
+
<span
|
|
372
|
+
class={{
|
|
373
|
+
"flex items-center justify-center text-center": isHighestLevel,
|
|
374
|
+
}}
|
|
375
|
+
>
|
|
376
|
+
{moveNode.data.fullMoves}
|
|
377
|
+
</span>
|
|
378
|
+
{@render emptyMove()}
|
|
379
379
|
{/if}
|
|
380
380
|
{#if childMoves?.[0] && !shouldRenderSanInsideVariationGroup}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
{/if}
|
|
381
|
+
{#if !isForcedLineStart}
|
|
382
|
+
<Move
|
|
383
|
+
chessNode={chessNode.children[0]}
|
|
384
|
+
shouldReserveEmptyMoveCell={childMoves?.length > 1}
|
|
385
|
+
{depth}
|
|
386
|
+
parentNode={chessNode}
|
|
387
|
+
></Move>
|
|
388
|
+
{/if}
|
|
390
389
|
{/if}
|