@connectorvol/tree 4.1.0 → 4.3.0
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/(classes)/chessTree.svelte.d.ts +2 -0
- package/dist/(classes)/chessTree.svelte.js +7 -1
- package/dist/(components)/Move.svelte +346 -310
- package/dist/(components)/MoveWithIcon.svelte +79 -48
- package/dist/(components)/NagBadges.svelte +30 -30
- package/dist/(components)/TreeViewer.svelte +878 -842
- package/dist/(components)/TreeViewerPanelManager.svelte +99 -98
- package/dist/(components)/VariantDropdownNavigator.svelte +177 -173
- package/dist/(components)/VariantDropdownNavigator.svelte.d.ts +3 -0
- package/dist/(utils)/parseSanMove.d.ts +6 -0
- package/dist/(utils)/parseSanMove.js +40 -7
- package/dist/components/ui/checkbox/checkbox.svelte +39 -0
- package/dist/components/ui/checkbox/checkbox.svelte.d.ts +4 -0
- package/dist/components/ui/checkbox/index.d.ts +2 -0
- package/dist/components/ui/checkbox/index.js +4 -0
- package/dist/components/ui/popover/index.d.ts +9 -0
- package/dist/components/ui/popover/index.js +11 -0
- package/dist/components/ui/popover/popover-close.svelte +7 -0
- package/dist/components/ui/popover/popover-close.svelte.d.ts +4 -0
- package/dist/components/ui/popover/popover-content.svelte +31 -0
- package/dist/components/ui/popover/popover-content.svelte.d.ts +10 -0
- package/dist/components/ui/popover/popover-description.svelte +20 -0
- package/dist/components/ui/popover/popover-description.svelte.d.ts +5 -0
- package/dist/components/ui/popover/popover-header.svelte +20 -0
- package/dist/components/ui/popover/popover-header.svelte.d.ts +5 -0
- package/dist/components/ui/popover/popover-portal.svelte +7 -0
- package/dist/components/ui/popover/popover-portal.svelte.d.ts +3 -0
- package/dist/components/ui/popover/popover-title.svelte +20 -0
- package/dist/components/ui/popover/popover-title.svelte.d.ts +5 -0
- package/dist/components/ui/popover/popover-trigger.svelte +17 -0
- package/dist/components/ui/popover/popover-trigger.svelte.d.ts +4 -0
- package/dist/components/ui/popover/popover.svelte +7 -0
- package/dist/components/ui/popover/popover.svelte.d.ts +3 -0
- package/dist/components/ui/toggle/index.d.ts +3 -0
- package/dist/components/ui/toggle/index.js +5 -0
- package/dist/components/ui/toggle/toggle.svelte +51 -0
- package/dist/components/ui/toggle/toggle.svelte.d.ts +43 -0
- package/package.json +11 -9
|
@@ -1,109 +1,110 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import ArrowLeft from "@lucide/svelte/icons/arrow-left";
|
|
3
|
+
import ArrowRight from "@lucide/svelte/icons/arrow-right";
|
|
4
|
+
import ListStart from "@lucide/svelte/icons/list-start";
|
|
5
|
+
import ListEnd from "@lucide/svelte/icons/list-end";
|
|
6
|
+
import PlayButtonIcon from "@lucide/svelte/icons/circle-play";
|
|
7
|
+
import StopButtonIcon from "@lucide/svelte/icons/circle-stop";
|
|
8
|
+
import * as Button from "../components/ui/button/index.js";
|
|
9
|
+
import * as ButtonGroup from "../components/ui/button-group/index.js";
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
import type { Snippet } from "svelte";
|
|
12
|
+
import type { ChessTree } from "../(classes)/chessTree.svelte.js";
|
|
13
|
+
import type { ClassValue } from "clsx";
|
|
14
|
+
import { getOrCreateTreeViewerPanelNavigation } from "../(utils)/treeViewerPanelNavigation.svelte.js";
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
type Props = {
|
|
17
|
+
chessTree: ChessTree;
|
|
18
|
+
className?: ClassValue;
|
|
19
|
+
setChessFen: (fen: string) => void;
|
|
20
|
+
setChessboardFen: (animationTime?: number) => void;
|
|
21
|
+
extraActions?: Snippet;
|
|
22
|
+
};
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
const {
|
|
25
|
+
extraActions,
|
|
26
|
+
chessTree,
|
|
27
|
+
setChessFen,
|
|
28
|
+
setChessboardFen,
|
|
29
|
+
className,
|
|
30
|
+
}: Props = $props();
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
panelNav.bindCallbacks(setChessFen, setChessboardFen);
|
|
38
|
-
});
|
|
32
|
+
const panelNav = $derived.by(() => {
|
|
33
|
+
const nav = getOrCreateTreeViewerPanelNavigation(chessTree);
|
|
34
|
+
nav.bindCallbacks(setChessFen, setChessboardFen);
|
|
35
|
+
return nav;
|
|
36
|
+
});
|
|
39
37
|
</script>
|
|
40
38
|
|
|
41
39
|
<div class={[className]}>
|
|
42
|
-
<ButtonGroup.Root>
|
|
43
|
-
<ButtonGroup.Root class="hidden sm:flex"></ButtonGroup.Root>
|
|
44
40
|
<ButtonGroup.Root>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
41
|
+
<ButtonGroup.Root class="hidden sm:flex"></ButtonGroup.Root>
|
|
42
|
+
<ButtonGroup.Root>
|
|
43
|
+
<Button.Root
|
|
44
|
+
variant="outline"
|
|
45
|
+
size="icon"
|
|
46
|
+
aria-label="Previous Move"
|
|
47
|
+
onclick={() => panelNav.selectPreviousNode()}
|
|
48
|
+
class={{
|
|
49
|
+
"bg-primary text-white":
|
|
50
|
+
panelNav.highlightedButtons.previous,
|
|
51
|
+
"cursor-pointer": true,
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<ArrowLeft />
|
|
55
|
+
</Button.Root>
|
|
56
|
+
<Button.Root
|
|
57
|
+
variant="outline"
|
|
58
|
+
size="icon"
|
|
59
|
+
aria-label="Go to Start"
|
|
60
|
+
onclick={() => panelNav.stepToStart()}
|
|
61
|
+
class={{
|
|
62
|
+
"bg-primary text-white": panelNav.highlightedButtons.start,
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
<ListStart />
|
|
66
|
+
</Button.Root>
|
|
67
|
+
<Button.Root
|
|
68
|
+
variant={panelNav.isPlaying ? "default" : "outline"}
|
|
69
|
+
size="icon"
|
|
70
|
+
aria-label={panelNav.isPlaying
|
|
71
|
+
? "Stop Auto Play"
|
|
72
|
+
: "Start Auto Play"}
|
|
73
|
+
onclick={() => panelNav.toggleAutoPlay()}
|
|
74
|
+
class={{
|
|
75
|
+
"bg-primary text-white": panelNav.isPlaying,
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
{#if panelNav.isPlaying}
|
|
79
|
+
<StopButtonIcon />
|
|
80
|
+
{:else}
|
|
81
|
+
<PlayButtonIcon />
|
|
82
|
+
{/if}
|
|
83
|
+
</Button.Root>
|
|
84
|
+
<Button.Root
|
|
85
|
+
variant="outline"
|
|
86
|
+
size="icon"
|
|
87
|
+
aria-label="Go to End"
|
|
88
|
+
onclick={() => panelNav.stepToEnd()}
|
|
89
|
+
class={{
|
|
90
|
+
"bg-primary text-white": panelNav.highlightedButtons.end,
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
<ListEnd />
|
|
94
|
+
</Button.Root>
|
|
95
|
+
<Button.Root
|
|
96
|
+
variant="outline"
|
|
97
|
+
size="icon"
|
|
98
|
+
aria-label="Next Move"
|
|
99
|
+
onclick={() => panelNav.selectNextNode()}
|
|
100
|
+
class={{
|
|
101
|
+
"bg-primary text-white": panelNav.highlightedButtons.next,
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
<ArrowRight />
|
|
105
|
+
</Button.Root>
|
|
106
|
+
</ButtonGroup.Root>
|
|
107
|
+
<ButtonGroup.Root class="hidden sm:flex"></ButtonGroup.Root>
|
|
105
108
|
</ButtonGroup.Root>
|
|
106
|
-
|
|
107
|
-
</ButtonGroup.Root>
|
|
108
|
-
{@render extraActions?.()}
|
|
109
|
+
{@render extraActions?.()}
|
|
109
110
|
</div>
|
|
@@ -1,173 +1,177 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { ChessTreeNode } from "../(models)/chessTreeNode.js";
|
|
3
|
-
import
|
|
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
|
-
export function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
if (!
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ChessTreeNode } from "../(models)/chessTreeNode.js";
|
|
3
|
+
import type { PieceSet } from "@connectorvol/shared";
|
|
4
|
+
import NagBadges from "./NagBadges.svelte";
|
|
5
|
+
import MoveWithIcon from "./MoveWithIcon.svelte";
|
|
6
|
+
type Props = {
|
|
7
|
+
variants: ChessTreeNode[];
|
|
8
|
+
onActivateVariant: (node: ChessTreeNode) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Представляет CSS-селектор элемента, относительно которого нужно позиционировать dropdown.
|
|
11
|
+
*/
|
|
12
|
+
anchorSelector?: string;
|
|
13
|
+
/** Возвращает набор фигур для иконок SAN. */
|
|
14
|
+
pieceSet: PieceSet;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const { variants, onActivateVariant, anchorSelector = "", pieceSet }: Props = $props();
|
|
18
|
+
|
|
19
|
+
let requestedOpen = $state(false);
|
|
20
|
+
let activeIndex = $state(0);
|
|
21
|
+
let anchorRect = $state<DOMRect | null>(null);
|
|
22
|
+
|
|
23
|
+
const isOpen = $derived(requestedOpen && variants.length > 1);
|
|
24
|
+
|
|
25
|
+
const safeActiveIndex = $derived(
|
|
26
|
+
variants.length === 0
|
|
27
|
+
? 0
|
|
28
|
+
: Math.min(Math.max(activeIndex, 0), variants.length - 1),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
function readAnchorRect(): void {
|
|
32
|
+
if (!anchorSelector) {
|
|
33
|
+
anchorRect = null;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const el = document.querySelector(anchorSelector);
|
|
37
|
+
anchorRect = el instanceof HTMLElement ? el.getBoundingClientRect() : null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function close(): void {
|
|
41
|
+
requestedOpen = false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function forceClose(): void {
|
|
45
|
+
close();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function open(): void {
|
|
49
|
+
if (variants.length <= 1) return;
|
|
50
|
+
requestedOpen = true;
|
|
51
|
+
activeIndex = 0;
|
|
52
|
+
readAnchorRect();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function handleKeyDown(e: KeyboardEvent): boolean {
|
|
56
|
+
if (!isOpen) return false;
|
|
57
|
+
|
|
58
|
+
if (e.key === "Escape") {
|
|
59
|
+
close();
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (e.key === "ArrowDown") {
|
|
64
|
+
if (variants.length <= 1) return true;
|
|
65
|
+
activeIndex = Math.min(safeActiveIndex + 1, variants.length - 1);
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (e.key === "ArrowUp") {
|
|
70
|
+
if (variants.length <= 1) return true;
|
|
71
|
+
activeIndex = Math.max(safeActiveIndex - 1, 0);
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (e.key === "ArrowRight") {
|
|
76
|
+
const node = variants[safeActiveIndex];
|
|
77
|
+
if (!node) return true;
|
|
78
|
+
onActivateVariant(node);
|
|
79
|
+
close();
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function onWindowMouseDown(e: MouseEvent): void {
|
|
87
|
+
if (!isOpen) return;
|
|
88
|
+
const path = e.composedPath?.() ?? [];
|
|
89
|
+
const clickedInside = path.some(
|
|
90
|
+
(t) => t instanceof HTMLElement && t.dataset?.["variantDropdown"] === "1",
|
|
91
|
+
);
|
|
92
|
+
if (!clickedInside) close();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
$effect(() => {
|
|
96
|
+
if (!isOpen) return;
|
|
97
|
+
|
|
98
|
+
readAnchorRect();
|
|
99
|
+
|
|
100
|
+
const onScrollOrResize = () => readAnchorRect();
|
|
101
|
+
window.addEventListener("scroll", onScrollOrResize, true);
|
|
102
|
+
window.addEventListener("resize", onScrollOrResize, { passive: true });
|
|
103
|
+
return () => {
|
|
104
|
+
window.removeEventListener("scroll", onScrollOrResize, true);
|
|
105
|
+
window.removeEventListener("resize", onScrollOrResize);
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const position = $derived(
|
|
110
|
+
!isOpen || !anchorRect
|
|
111
|
+
? null
|
|
112
|
+
: (() => {
|
|
113
|
+
const gap = 8;
|
|
114
|
+
const minW = 224; // ~14rem
|
|
115
|
+
const viewportW = window.innerWidth;
|
|
116
|
+
const viewportH = window.innerHeight;
|
|
117
|
+
|
|
118
|
+
// Prefer to the right of anchor; fallback to left if overflowing.
|
|
119
|
+
let left = anchorRect.right + gap;
|
|
120
|
+
if (left + minW > viewportW - gap) {
|
|
121
|
+
left = Math.max(gap, anchorRect.left - gap - minW);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Align tops, but keep in viewport.
|
|
125
|
+
let top = anchorRect.top;
|
|
126
|
+
top = Math.min(Math.max(gap, top), viewportH - gap);
|
|
127
|
+
|
|
128
|
+
return { left, top };
|
|
129
|
+
})(),
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
function getMovePrefix(node: ChessTreeNode): string {
|
|
133
|
+
const fm = node.data.fullMoves;
|
|
134
|
+
if (!fm) return "";
|
|
135
|
+
return node.data.ply % 2 === 1 ? `${fm}.` : `${fm - 1}...`;
|
|
136
|
+
}
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
<svelte:window onmousedown={onWindowMouseDown} />
|
|
140
|
+
|
|
141
|
+
{#if isOpen}
|
|
142
|
+
<div
|
|
143
|
+
data-variant-dropdown="1"
|
|
144
|
+
class="z-50 min-w-[14rem] rounded-md border bg-white p-1 shadow-md outline-none"
|
|
145
|
+
role="menu"
|
|
146
|
+
aria-label="Варианты следующего хода"
|
|
147
|
+
style={position
|
|
148
|
+
? `position: fixed; left: ${position.left}px; top: ${position.top}px;`
|
|
149
|
+
: "position: fixed;"}
|
|
150
|
+
>
|
|
151
|
+
{#each variants as variant, index (variant.id)}
|
|
152
|
+
<button
|
|
153
|
+
type="button"
|
|
154
|
+
data-variant-dropdown="1"
|
|
155
|
+
class={{
|
|
156
|
+
"flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-left text-sm outline-none": true,
|
|
157
|
+
"bg-accent text-accent-foreground": index === safeActiveIndex,
|
|
158
|
+
"hover:bg-accent hover:text-accent-foreground": true,
|
|
159
|
+
}}
|
|
160
|
+
onclick={(e) => {
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
e.stopPropagation();
|
|
163
|
+
onActivateVariant(variant);
|
|
164
|
+
close();
|
|
165
|
+
}}
|
|
166
|
+
>
|
|
167
|
+
<span class="flex min-w-0 flex-wrap items-center gap-x-1 gap-y-0.5">
|
|
168
|
+
{#if getMovePrefix(variant)}
|
|
169
|
+
<span>{getMovePrefix(variant)}</span>
|
|
170
|
+
{/if}
|
|
171
|
+
<MoveWithIcon san={variant.data.san} ply={variant.data.ply} {pieceSet} />
|
|
172
|
+
<NagBadges nags={variant.data.nags} class="!ml-0" />
|
|
173
|
+
</span>
|
|
174
|
+
</button>
|
|
175
|
+
{/each}
|
|
176
|
+
</div>
|
|
177
|
+
{/if}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ChessTreeNode } from "../(models)/chessTreeNode.js";
|
|
2
|
+
import type { PieceSet } from "@connectorvol/shared";
|
|
2
3
|
type Props = {
|
|
3
4
|
variants: ChessTreeNode[];
|
|
4
5
|
onActivateVariant: (node: ChessTreeNode) => void;
|
|
@@ -6,6 +7,8 @@ type Props = {
|
|
|
6
7
|
* Представляет CSS-селектор элемента, относительно которого нужно позиционировать dropdown.
|
|
7
8
|
*/
|
|
8
9
|
anchorSelector?: string;
|
|
10
|
+
/** Возвращает набор фигур для иконок SAN. */
|
|
11
|
+
pieceSet: PieceSet;
|
|
9
12
|
};
|
|
10
13
|
declare const VariantDropdownNavigator: import("svelte").Component<Props, {
|
|
11
14
|
forceClose: () => void;
|
|
@@ -17,6 +17,12 @@ export interface ParsedSanMove {
|
|
|
17
17
|
isCheckmate: boolean;
|
|
18
18
|
/** Возвращает координаты назначения (например, "f3", "e4") */
|
|
19
19
|
destination?: string;
|
|
20
|
+
/** Возвращает уточнение (файл или ранг) при неоднозначности хода (например, "d" для Ndb5, "4" для N4b6) */
|
|
21
|
+
disambiguation?: string;
|
|
22
|
+
/** Возвращает тип фигуры превращения */
|
|
23
|
+
promotionPieceType?: PieceType;
|
|
24
|
+
/** Возвращает файл пешки при взятии (например, "e" для exd5) */
|
|
25
|
+
pawnFile?: string;
|
|
20
26
|
}
|
|
21
27
|
/**
|
|
22
28
|
* Представляет функцию для парсинга SAN нотации в информацию о ходе
|