@connectorvol/tree 8.0.0 → 9.0.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/(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/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
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { BoardSettings } from "@connectorvol/chessboard";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
`BoardSettings` без `bind:design` читает/пишет стор дизайна из контекста
|
|
7
|
+
(см. `+layout.svelte` → `setBoardDesignSettingsContext`). Все доски ниже по дереву
|
|
8
|
+
подписаны на тот же стор и реактивно подхватывают изменения.
|
|
9
|
+
-->
|
|
10
|
+
<BoardSettings />
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const BoardSettingsTrigger: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type BoardSettingsTrigger = InstanceType<typeof BoardSettingsTrigger>;
|
|
18
|
+
export default BoardSettingsTrigger;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ChessTreeNode } from "../(models)/chessTreeNode.js";
|
|
3
|
-
import type { PieceSet } from "@connectorvol/shared";
|
|
4
3
|
import ArrowRight from "@lucide/svelte/icons/arrow-right";
|
|
5
4
|
import HomeIcon from "@lucide/svelte/icons/house";
|
|
6
5
|
import * as DropdownMenu from "../components/ui/dropdown-menu/index.js";
|
|
@@ -12,8 +11,6 @@
|
|
|
12
11
|
chessTree: ChessTree;
|
|
13
12
|
/** Возвращает цепочку узлов-развилок для хлебных крошек. */
|
|
14
13
|
drillForkCrumbs: ChessTreeNode[];
|
|
15
|
-
/** Возвращает набор фигур для иконок SAN. */
|
|
16
|
-
pieceSet: PieceSet;
|
|
17
14
|
/** Представляет переход по крошке drill-down. */
|
|
18
15
|
onNavigateCrumb: (targetForkIndex: number) => void;
|
|
19
16
|
/** Представляет выход на уровень выше относительно крошки с индексом. */
|
|
@@ -25,7 +22,6 @@
|
|
|
25
22
|
const {
|
|
26
23
|
chessTree,
|
|
27
24
|
drillForkCrumbs,
|
|
28
|
-
pieceSet,
|
|
29
25
|
onNavigateCrumb,
|
|
30
26
|
onNavigateToParentFromCrumb,
|
|
31
27
|
onExitToFullTree,
|
|
@@ -35,7 +31,9 @@
|
|
|
35
31
|
</script>
|
|
36
32
|
|
|
37
33
|
<nav
|
|
38
|
-
class="col-span-3 border-b
|
|
34
|
+
class="col-span-3 border-b px-3 py-2"
|
|
35
|
+
style:background-color="var(--tree-viewer-bg)"
|
|
36
|
+
style:border-color="var(--tree-viewer-border)"
|
|
39
37
|
aria-label="Навигация по уровням вариантов"
|
|
40
38
|
>
|
|
41
39
|
<ol
|
|
@@ -57,17 +55,17 @@
|
|
|
57
55
|
<div class="relative inline-flex">
|
|
58
56
|
<button
|
|
59
57
|
type="button"
|
|
58
|
+
style:color={"var(--tree-viewer-text)"}
|
|
60
59
|
class={{
|
|
61
60
|
"inline-flex items-baseline gap-y-0.5 rounded px-0.5 py-0.5 text-left underline-offset-2 cursor-pointer outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0": true,
|
|
62
61
|
"font-bold ": fork.id === chessTree.currentNode.id,
|
|
63
|
-
"text-gray-900": i === drillForkCrumbs.length - 1,
|
|
64
62
|
"text-primary": i !== drillForkCrumbs.length - 1,
|
|
65
63
|
}}
|
|
66
64
|
aria-current={i === drillForkCrumbs.length - 1 ? "page" : undefined}
|
|
67
65
|
aria-label="Перейти к этому уровню вариантов"
|
|
68
66
|
onclick={() => onNavigateCrumb(i)}
|
|
69
67
|
>
|
|
70
|
-
<DrillForkSanLabel {fork}
|
|
68
|
+
<DrillForkSanLabel {fork} />
|
|
71
69
|
</button>
|
|
72
70
|
|
|
73
71
|
{#if fork.id === chessTree.currentNode.id}
|
|
@@ -109,7 +107,7 @@
|
|
|
109
107
|
e.stopPropagation();
|
|
110
108
|
}}
|
|
111
109
|
>
|
|
112
|
-
<DrillForkSanLabel fork={parent}
|
|
110
|
+
<DrillForkSanLabel fork={parent} />
|
|
113
111
|
</DropdownMenu.Item>
|
|
114
112
|
{/if}
|
|
115
113
|
<DropdownMenu.Item
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { ChessTreeNode } from "../(models)/chessTreeNode.js";
|
|
2
|
-
import type { PieceSet } from "@connectorvol/shared";
|
|
3
2
|
import type { ChessTree } from "../(classes)/chessTree.svelte.js";
|
|
4
3
|
type TDrillBreadcrumbsProps = {
|
|
5
4
|
/** Возвращает дерево партии. */
|
|
6
5
|
chessTree: ChessTree;
|
|
7
6
|
/** Возвращает цепочку узлов-развилок для хлебных крошек. */
|
|
8
7
|
drillForkCrumbs: ChessTreeNode[];
|
|
9
|
-
/** Возвращает набор фигур для иконок SAN. */
|
|
10
|
-
pieceSet: PieceSet;
|
|
11
8
|
/** Представляет переход по крошке drill-down. */
|
|
12
9
|
onNavigateCrumb: (targetForkIndex: number) => void;
|
|
13
10
|
/** Представляет выход на уровень выше относительно крошки с индексом. */
|
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
import type { ChessTreeNode } from "../(models)/chessTreeNode.js";
|
|
3
3
|
import MoveWithIcon from "./MoveWithIcon.svelte";
|
|
4
4
|
import NagBadges from "./NagBadges.svelte";
|
|
5
|
-
import type { PieceSet } from "@connectorvol/shared";
|
|
6
5
|
|
|
7
6
|
type TDrillForkSanLabelProps = {
|
|
8
7
|
/** Возвращает узел-развилку или ход для подписи. */
|
|
9
8
|
fork: ChessTreeNode;
|
|
10
|
-
/** Возвращает набор фигур для иконок SAN. */
|
|
11
|
-
pieceSet: PieceSet;
|
|
12
9
|
};
|
|
13
10
|
|
|
14
|
-
const { fork
|
|
11
|
+
const { fork }: TDrillForkSanLabelProps = $props();
|
|
15
12
|
</script>
|
|
16
13
|
|
|
17
14
|
{#if fork.data.ply % 2 === 1}
|
|
@@ -20,7 +17,7 @@
|
|
|
20
17
|
<span>{Math.max(0, fork.data.fullMoves - 1)}...</span>
|
|
21
18
|
{/if}
|
|
22
19
|
<span class="inline-flex items-center gap-0 -ml-px">
|
|
23
|
-
<MoveWithIcon san={fork.data.san} ply={fork.data.ply}
|
|
20
|
+
<MoveWithIcon san={fork.data.san} ply={fork.data.ply} /><NagBadges
|
|
24
21
|
nags={fork.data.nags}
|
|
25
22
|
/>
|
|
26
23
|
</span>
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { ChessTreeNode } from "../(models)/chessTreeNode.js";
|
|
2
|
-
import type { PieceSet } from "@connectorvol/shared";
|
|
3
2
|
type TDrillForkSanLabelProps = {
|
|
4
3
|
/** Возвращает узел-развилку или ход для подписи. */
|
|
5
4
|
fork: ChessTreeNode;
|
|
6
|
-
/** Возвращает набор фигур для иконок SAN. */
|
|
7
|
-
pieceSet: PieceSet;
|
|
8
5
|
};
|
|
9
6
|
declare const DrillForkSanLabel: import("svelte").Component<TDrillForkSanLabelProps, {}, "">;
|
|
10
7
|
type DrillForkSanLabel = ReturnType<typeof DrillForkSanLabel>;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ChessTreeNode } from "../(models)/chessTreeNode.js";
|
|
3
|
-
import type { PieceSet } from "@connectorvol/shared";
|
|
4
3
|
import Move from "./Move.svelte";
|
|
5
4
|
|
|
6
5
|
type TDrillVariationListProps = {
|
|
7
6
|
/** Возвращает родительский узел текущего уровня drill-down. */
|
|
8
7
|
drillForkParent: ChessTreeNode;
|
|
9
|
-
/** Возвращает набор фигур для иконок SAN. */
|
|
10
|
-
pieceSet: PieceSet;
|
|
11
8
|
/** Возвращает true, если направляющие drill-панели должны быть акцентными. */
|
|
12
9
|
isDrillForkGuideForSelection: boolean;
|
|
13
10
|
/** Возвращает true, если ветка текущего выбора проходит через узел. */
|
|
@@ -16,36 +13,54 @@
|
|
|
16
13
|
|
|
17
14
|
const {
|
|
18
15
|
drillForkParent,
|
|
19
|
-
pieceSet,
|
|
20
16
|
isDrillForkGuideForSelection,
|
|
21
17
|
isBranchOnCurrentPath,
|
|
22
18
|
}: TDrillVariationListProps = $props();
|
|
19
|
+
|
|
20
|
+
let isLineHovered = $state(false);
|
|
21
|
+
|
|
22
|
+
const isVerticalHighlighted = $derived(
|
|
23
|
+
isLineHovered || isDrillForkGuideForSelection,
|
|
24
|
+
);
|
|
23
25
|
</script>
|
|
24
26
|
|
|
25
27
|
<div class="col-span-3 block w-full min-w-0">
|
|
26
28
|
<div
|
|
27
|
-
class="tree-viewer-overflow-tail-border relative flex min-w-0 w-full max-w-full gap-0
|
|
29
|
+
class="tree-viewer-overflow-tail-border relative flex min-w-0 w-full max-w-full gap-0 align-top border-b"
|
|
30
|
+
style:background-color="var(--tree-viewer-bg)"
|
|
31
|
+
style:border-color="var(--tree-viewer-border)"
|
|
28
32
|
>
|
|
29
33
|
<div
|
|
30
|
-
class=
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"border-gray-300": !isDrillForkGuideForSelection,
|
|
34
|
-
}}
|
|
34
|
+
class="relative w-4 shrink-0 self-stretch"
|
|
35
|
+
onmouseenter={() => (isLineHovered = true)}
|
|
36
|
+
onmouseleave={() => (isLineHovered = false)}
|
|
35
37
|
aria-hidden="true"
|
|
36
|
-
|
|
38
|
+
>
|
|
39
|
+
<div
|
|
40
|
+
class={{
|
|
41
|
+
"absolute inset-y-2 right-0 w-0.5 border-r-2 transition-opacity duration-150": true,
|
|
42
|
+
"opacity-50": !isVerticalHighlighted,
|
|
43
|
+
"opacity-100": isVerticalHighlighted,
|
|
44
|
+
}}
|
|
45
|
+
style:border-color="var(--tree-viewer-border)"
|
|
46
|
+
aria-hidden="true"
|
|
47
|
+
></div>
|
|
48
|
+
</div>
|
|
37
49
|
<ul
|
|
38
50
|
class="m-0 flex min-w-0 flex-1 list-none flex-col gap-1.5 py-2 pr-2 pl-0"
|
|
39
51
|
>
|
|
40
52
|
{#each drillForkParent.children as drillChild (drillChild.id)}
|
|
41
53
|
{@const branchOnPath = isBranchOnCurrentPath(drillChild)}
|
|
54
|
+
{@const isHorizontalHighlighted =
|
|
55
|
+
isLineHovered || (isDrillForkGuideForSelection && branchOnPath)}
|
|
42
56
|
<li class="relative min-w-0 pl-3">
|
|
43
57
|
<span
|
|
44
58
|
class={{
|
|
45
|
-
"pointer-events-none absolute left-0 top-[0.65em] w-3 border-t-2 transition-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
59
|
+
"pointer-events-none absolute left-0 top-[0.65em] w-3 border-t-2 transition-opacity duration-150": true,
|
|
60
|
+
"opacity-50": !isHorizontalHighlighted,
|
|
61
|
+
"opacity-100": isHorizontalHighlighted,
|
|
48
62
|
}}
|
|
63
|
+
style:border-color="var(--tree-viewer-border)"
|
|
49
64
|
aria-hidden="true"
|
|
50
65
|
></span>
|
|
51
66
|
<div class="tracking-tight">
|
|
@@ -55,7 +70,6 @@
|
|
|
55
70
|
shouldReserveEmptyMoveCell={drillForkParent.children.length > 1}
|
|
56
71
|
shouldRenderSiblingVariations={false}
|
|
57
72
|
parentNode={drillForkParent}
|
|
58
|
-
{pieceSet}
|
|
59
73
|
/>
|
|
60
74
|
</div>
|
|
61
75
|
</li>
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { ChessTreeNode } from "../(models)/chessTreeNode.js";
|
|
2
|
-
import type { PieceSet } from "@connectorvol/shared";
|
|
3
2
|
type TDrillVariationListProps = {
|
|
4
3
|
/** Возвращает родительский узел текущего уровня drill-down. */
|
|
5
4
|
drillForkParent: ChessTreeNode;
|
|
6
|
-
/** Возвращает набор фигур для иконок SAN. */
|
|
7
|
-
pieceSet: PieceSet;
|
|
8
5
|
/** Возвращает true, если направляющие drill-панели должны быть акцентными. */
|
|
9
6
|
isDrillForkGuideForSelection: boolean;
|
|
10
7
|
/** Возвращает true, если ветка текущего выбора проходит через узел. */
|