@behindthemusictree/genre-tree-view 5.0.0 → 6.4.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/index.cjs +665 -600
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -19
- package/dist/index.d.ts +29 -19
- package/dist/index.js +684 -619
- package/dist/index.js.map +1 -1
- package/dist/styles.css +173 -69
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// src/GenreTree.tsx
|
|
2
2
|
import { useEffect as useEffect5, useRef as useRef5, useMemo as useMemo2 } from "react";
|
|
3
3
|
import * as d3 from "d3";
|
|
4
|
-
import { MdFitScreen, MdZoomIn as MdZoomIn2, MdZoomOut } from "react-icons/md";
|
|
5
4
|
|
|
6
5
|
// src/NodeHelper.tsx
|
|
7
6
|
import ReactDOMServer from "react-dom/server";
|
|
@@ -25,6 +24,9 @@ var MENU_WIDTH = 130;
|
|
|
25
24
|
var PER_TREE_ACCENT_DOT = true;
|
|
26
25
|
var ROOT_TINT_RATIO = 0.08;
|
|
27
26
|
var POP_SECTOR_TINT_RATIO = 0.8;
|
|
27
|
+
var UNDERGROUND_DARKEN_RATIO = 0.62;
|
|
28
|
+
var UNDERGROUND_SECTOR_FILL_OPACITY = 0.15;
|
|
29
|
+
var SCENE_SECTOR_OUTER_RADIUS = 1e5;
|
|
28
30
|
var CENTER_NODE_NAME = "Mainstream Pop";
|
|
29
31
|
var TREE_COLORS = [
|
|
30
32
|
"#4F46E5",
|
|
@@ -106,6 +108,11 @@ function isMainstreamPopLineage(index, nodeId) {
|
|
|
106
108
|
const topRoot = index.ancestorsOf(nodeId)[0] ?? index.byId.get(nodeId);
|
|
107
109
|
return topRoot?.name === CENTER_NODE_NAME;
|
|
108
110
|
}
|
|
111
|
+
function shadeSurface(hex, ratio) {
|
|
112
|
+
const channel = (offset) => parseInt(hex.slice(offset, offset + 2), 16);
|
|
113
|
+
const toHex = (value) => Math.round(value * ratio).toString(16).padStart(2, "0");
|
|
114
|
+
return `#${toHex(channel(1))}${toHex(channel(3))}${toHex(channel(5))}`;
|
|
115
|
+
}
|
|
109
116
|
function getGenreNodeStyle(index, nodeId) {
|
|
110
117
|
if (isMainstreamPopLineage(index, nodeId)) {
|
|
111
118
|
return { fill: tintSurface("#ffffff", POP_SECTOR_TINT_RATIO), textColor: TEXT_COLOR };
|
|
@@ -124,6 +131,9 @@ var MIN_NODE_WIDTH = 180;
|
|
|
124
131
|
var MAX_NODE_WIDTH = 700;
|
|
125
132
|
var MIN_NODE_HEIGHT = 35;
|
|
126
133
|
var MAX_NODE_HEIGHT = 120;
|
|
134
|
+
var NODE_SIZE_REFERENCE_COUNT = 100;
|
|
135
|
+
var HIGH_DENSITY_NODE_MAX_FLOOR_SCALE = 1.5;
|
|
136
|
+
var LOW_DENSITY_DOT_MAX_RADIUS = 70;
|
|
127
137
|
var TOOLBAR_MENU_X_GAP = 4;
|
|
128
138
|
var ACTIONS_OVERLAY_WIDTH = MENU_WIDTH + TOOLBAR_MENU_X_GAP;
|
|
129
139
|
var ACTIONS_OVERLAY_HEIGHT = RECT_BASE_DIMENSIONS.HEIGHT * 7;
|
|
@@ -138,23 +148,47 @@ var HORIZONTAL_SEPARATION_BETWEEN_NODES = (NODE_DIMENSIONS.WIDTH + HORIZONTAL_SE
|
|
|
138
148
|
var VERTICAL_SEPARATION_BETWEEN_NODES = NODE_DIMENSIONS.HEIGHT + VERTICAL_SEPARATION_BETWEEN_RECTANGLES;
|
|
139
149
|
var VERTICAL_ORIENTATION_DEPTH_SEPARATION = VERTICAL_SEPARATION_BETWEEN_NODES * 2 * DEPTH_AXIS_SPACING_FACTOR;
|
|
140
150
|
var SIBLING_SEPARATION_BETWEEN_NODES = MAX_NODE_WIDTH + HORIZONTAL_SEPARATION_BETWEEN_RECTANGLES;
|
|
141
|
-
function
|
|
142
|
-
|
|
151
|
+
function getDensityAdjustedMax(baseMax, min, nodeCount) {
|
|
152
|
+
const safeNodeCount = Number.isFinite(nodeCount) ? Math.max(1, nodeCount) : 1;
|
|
153
|
+
const availableRangeScale = Math.min(1, NODE_SIZE_REFERENCE_COUNT / safeNodeCount);
|
|
154
|
+
const denseTreeFloor = min * HIGH_DENSITY_NODE_MAX_FLOOR_SCALE;
|
|
155
|
+
return denseTreeFloor + (baseMax - denseTreeFloor) * availableRangeScale;
|
|
156
|
+
}
|
|
157
|
+
function getDensityAdjustedDotMax(nodeCount) {
|
|
158
|
+
const safeNodeCount = Number.isFinite(nodeCount) ? Math.max(1, nodeCount) : 1;
|
|
159
|
+
const inverseDensityRadius = NODE_DOT_MAX_RADIUS * NODE_SIZE_REFERENCE_COUNT / safeNodeCount;
|
|
160
|
+
const denseTreeFloor = NODE_DOT_MIN_RADIUS * HIGH_DENSITY_NODE_MAX_FLOOR_SCALE;
|
|
161
|
+
return Math.max(denseTreeFloor, Math.min(LOW_DENSITY_DOT_MAX_RADIUS, inverseDensityRadius));
|
|
162
|
+
}
|
|
163
|
+
function getItemCountRange(nodes, options = {}) {
|
|
143
164
|
const counts = nodes.map((node) => node.itemCount);
|
|
144
|
-
|
|
165
|
+
const validScaleMax = options.itemCountScaleMax !== void 0 && Number.isFinite(options.itemCountScaleMax) && options.itemCountScaleMax >= 0;
|
|
166
|
+
const nodeCount = options.nodeCountForSizing ?? nodes.length;
|
|
167
|
+
const observedMin = counts.length === 0 ? 0 : Math.min(...counts);
|
|
168
|
+
const observedMax = counts.length === 0 ? 0 : Math.max(...counts);
|
|
169
|
+
const includeDensityCaps = options.nodeCountForSizing !== void 0 || validScaleMax;
|
|
170
|
+
return {
|
|
171
|
+
min: validScaleMax ? 0 : observedMin,
|
|
172
|
+
max: validScaleMax ? options.itemCountScaleMax : observedMax,
|
|
173
|
+
...includeDensityCaps && {
|
|
174
|
+
maxNodeWidth: getDensityAdjustedMax(MAX_NODE_WIDTH, MIN_NODE_WIDTH, nodeCount),
|
|
175
|
+
maxNodeHeight: getDensityAdjustedMax(MAX_NODE_HEIGHT, MIN_NODE_HEIGHT, nodeCount),
|
|
176
|
+
maxDotRadius: getDensityAdjustedDotMax(nodeCount)
|
|
177
|
+
}
|
|
178
|
+
};
|
|
145
179
|
}
|
|
146
180
|
function logarithmicPosition(itemCount, range) {
|
|
147
181
|
const { min, max } = range;
|
|
148
182
|
const logMin = Math.log1p(Math.max(min, 0));
|
|
149
183
|
const logMax = Math.log1p(Math.max(max, 0));
|
|
150
184
|
const logValue = Math.log1p(Math.max(itemCount, 0));
|
|
151
|
-
return logMax > logMin ? (logValue - logMin) / (logMax - logMin) : 0;
|
|
185
|
+
return logMax > logMin ? Math.max(0, Math.min(1, (logValue - logMin) / (logMax - logMin))) : 0;
|
|
152
186
|
}
|
|
153
187
|
function calculateNodeDimensions(itemCount, range) {
|
|
154
188
|
const t = logarithmicPosition(itemCount, range);
|
|
155
189
|
return {
|
|
156
|
-
WIDTH: Math.round(MIN_NODE_WIDTH + t * (MAX_NODE_WIDTH - MIN_NODE_WIDTH)),
|
|
157
|
-
HEIGHT: Math.round(MIN_NODE_HEIGHT + t * (MAX_NODE_HEIGHT - MIN_NODE_HEIGHT))
|
|
190
|
+
WIDTH: Math.round(MIN_NODE_WIDTH + t * ((range.maxNodeWidth ?? MAX_NODE_WIDTH) - MIN_NODE_WIDTH)),
|
|
191
|
+
HEIGHT: Math.round(MIN_NODE_HEIGHT + t * ((range.maxNodeHeight ?? MAX_NODE_HEIGHT) - MIN_NODE_HEIGHT))
|
|
158
192
|
};
|
|
159
193
|
}
|
|
160
194
|
var NODE_MIN_BORDER_WIDTH = 1;
|
|
@@ -194,10 +228,13 @@ function calculateRootLabelFontSize(layoutFontSize, zoomScale) {
|
|
|
194
228
|
return Math.max(layoutFontSize, ROOT_LABEL_MIN_SCREEN_PX / zoomScale);
|
|
195
229
|
}
|
|
196
230
|
var NODE_DOT_MIN_RADIUS = 3;
|
|
197
|
-
var NODE_DOT_MAX_RADIUS =
|
|
231
|
+
var NODE_DOT_MAX_RADIUS = 24;
|
|
198
232
|
var NODE_DOT_LABEL_GAP = 6;
|
|
233
|
+
var NODE_LAYOUT_SLOT_RADIUS = 8;
|
|
199
234
|
function calculateNodeDotRadius(itemCount, range) {
|
|
200
|
-
|
|
235
|
+
const minArea = NODE_DOT_MIN_RADIUS ** 2;
|
|
236
|
+
const maxArea = (range.maxDotRadius ?? NODE_DOT_MAX_RADIUS) ** 2;
|
|
237
|
+
return Math.sqrt(minArea + logarithmicPosition(itemCount, range) * (maxArea - minArea));
|
|
201
238
|
}
|
|
202
239
|
var WHEEL_RADIUS = 260;
|
|
203
240
|
var WHEEL_VIEWPORT_HEIGHT = WHEEL_RADIUS * 2 + MAX_NODE_HEIGHT / 2;
|
|
@@ -231,19 +268,22 @@ var PAN_MIN_VISIBLE_PX = 80;
|
|
|
231
268
|
var PAN_ZOOM_SETTLE_MS = 100;
|
|
232
269
|
var DEFAULT_VIEWPORT_CENTER_GUARD_MS = 1e3;
|
|
233
270
|
var INFO_PANEL_WIDTH = 280;
|
|
271
|
+
var INFO_PANEL_SHEET_MAX_WIDTH = 767;
|
|
272
|
+
var INFO_PANEL_SHEET_PEEK_FRACTION = 0.4;
|
|
273
|
+
var INFO_PANEL_SHEET_DRAG_THRESHOLD_PX = 32;
|
|
234
274
|
|
|
235
275
|
// src/NodeHelper.tsx
|
|
236
276
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
237
277
|
function buildTreeHierarchyStructure(d3Lib, nodes) {
|
|
238
278
|
return d3Lib.stratify().id((d) => d.id).parentId((d) => d.parentId)(nodes);
|
|
239
279
|
}
|
|
240
|
-
function calculateLocalRootDimensions(d3Lib, nodes) {
|
|
280
|
+
function calculateLocalRootDimensions(d3Lib, nodes, options = {}) {
|
|
241
281
|
const root = buildTreeHierarchyStructure(d3Lib, nodes);
|
|
242
|
-
const range = getItemCountRange(root.descendants().map((d) => d.data));
|
|
282
|
+
const range = getItemCountRange(root.descendants().map((d) => d.data), options);
|
|
243
283
|
return calculateNodeDimensions(root.data.itemCount, range);
|
|
244
284
|
}
|
|
245
|
-
function calculateRootAnchorClearance(d3Lib, nodes, rootItemCount, rootItemCountRange, axis) {
|
|
246
|
-
const localExtent = calculateLocalRootDimensions(d3Lib, nodes)[axis];
|
|
285
|
+
function calculateRootAnchorClearance(d3Lib, nodes, rootItemCount, rootItemCountRange, axis, options = {}) {
|
|
286
|
+
const localExtent = calculateLocalRootDimensions(d3Lib, nodes, options)[axis];
|
|
247
287
|
const displayExtent = calculateNodeDimensions(rootItemCount, rootItemCountRange)[axis];
|
|
248
288
|
return (localExtent + displayExtent) / 2;
|
|
249
289
|
}
|
|
@@ -327,13 +367,31 @@ function appendPaths(d3Lib, svg, treeData, itemCountRange, orientation = "horizo
|
|
|
327
367
|
}
|
|
328
368
|
|
|
329
369
|
// src/tree-renderer.ts
|
|
330
|
-
function
|
|
331
|
-
const
|
|
332
|
-
const
|
|
333
|
-
const
|
|
370
|
+
function getLayoutSpacings(itemCountRange, depthSpacingScale = 1) {
|
|
371
|
+
const maxWidth = itemCountRange.maxNodeWidth ?? MAX_NODE_WIDTH;
|
|
372
|
+
const maxHeight = itemCountRange.maxNodeHeight ?? MAX_NODE_HEIGHT;
|
|
373
|
+
const verticalSeparation = maxHeight + VERTICAL_SEPARATION_BETWEEN_RECTANGLES;
|
|
374
|
+
return {
|
|
375
|
+
horizontalDepth: (maxWidth + ACTIONS_OVERLAY_WIDTH + HORIZONTAL_SEPARATION_BETWEEN_RECTANGLES) * DEPTH_AXIS_SPACING_FACTOR * depthSpacingScale,
|
|
376
|
+
verticalBreadth: verticalSeparation,
|
|
377
|
+
verticalDepth: verticalSeparation * 2 * DEPTH_AXIS_SPACING_FACTOR * depthSpacingScale,
|
|
378
|
+
verticalSibling: maxWidth + HORIZONTAL_SEPARATION_BETWEEN_RECTANGLES
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
function calculateSvgDimensions(d3Lib, treeData, orientation = "horizontal", hideRoot = false, depthSpacingScale = 1, suppliedItemCountRange) {
|
|
382
|
+
const treeNodes = treeData.descendants();
|
|
383
|
+
const nodes = treeNodes;
|
|
384
|
+
const itemCountRange = suppliedItemCountRange ?? getItemCountRange(
|
|
385
|
+
treeNodes.map((d) => d.data)
|
|
386
|
+
);
|
|
387
|
+
const maxNodeDimensions = {
|
|
388
|
+
WIDTH: itemCountRange.maxNodeWidth ?? MAX_NODE_WIDTH,
|
|
389
|
+
HEIGHT: itemCountRange.maxNodeHeight ?? MAX_NODE_HEIGHT
|
|
390
|
+
};
|
|
334
391
|
const maximumLevel = d3Lib.max(nodes, (d) => d.depth);
|
|
335
|
-
const
|
|
336
|
-
const
|
|
392
|
+
const layoutSpacings = getLayoutSpacings(itemCountRange, depthSpacingScale);
|
|
393
|
+
const depthSeparation = layoutSpacings.verticalDepth;
|
|
394
|
+
const depthSeparationHorizontal = layoutSpacings.horizontalDepth;
|
|
337
395
|
if (isVerticalOrientation(orientation)) {
|
|
338
396
|
const svgHeight2 = hideRoot ? maximumLevel * depthSeparation : maximumLevel * depthSeparation + maxNodeDimensions.HEIGHT + ACTIONS_OVERLAY_HEIGHT / 2;
|
|
339
397
|
const rootWidth = calculateNodeDimensions(
|
|
@@ -395,10 +453,15 @@ function calculateSvgDimensions(d3Lib, treeData, orientation = "horizontal", hid
|
|
|
395
453
|
const svgWidth = maximumLevel * depthSeparationHorizontal + maxNodeDimensions.WIDTH + ACTIONS_OVERLAY_WIDTH;
|
|
396
454
|
return { svgWidth, svgHeight, highestVerticalCoordinate, rootDepthOffset: 0 };
|
|
397
455
|
}
|
|
398
|
-
function setupTreeLayout(d3Lib, treeData, highestVerticalCoordinate, orientation = "horizontal", rootDepthOffset = 0, svgWidth = 0, depthSpacingScale = 1) {
|
|
456
|
+
function setupTreeLayout(d3Lib, treeData, highestVerticalCoordinate, orientation = "horizontal", rootDepthOffset = 0, svgWidth = 0, depthSpacingScale = 1, suppliedItemCountRange) {
|
|
457
|
+
const treeNodes = treeData.descendants();
|
|
458
|
+
const itemCountRange = suppliedItemCountRange ?? getItemCountRange(
|
|
459
|
+
treeNodes.map((d) => d.data)
|
|
460
|
+
);
|
|
461
|
+
const layoutSpacings = getLayoutSpacings(itemCountRange, depthSpacingScale);
|
|
399
462
|
if (isVerticalOrientation(orientation)) {
|
|
400
463
|
const maximumLevel = d3Lib.max(treeData.descendants(), (d) => d.depth);
|
|
401
|
-
const depthSeparation =
|
|
464
|
+
const depthSeparation = layoutSpacings.verticalDepth;
|
|
402
465
|
treeData.each(function(d) {
|
|
403
466
|
d.x = d.x + highestVerticalCoordinate;
|
|
404
467
|
d.y = depthAxisSign(orientation) === -1 ? (maximumLevel - d.depth) * depthSeparation : d.depth * depthSeparation + rootDepthOffset;
|
|
@@ -420,24 +483,30 @@ function setupTreeLayout(d3Lib, treeData, highestVerticalCoordinate, orientation
|
|
|
420
483
|
});
|
|
421
484
|
return treeData;
|
|
422
485
|
}
|
|
423
|
-
function createTreeLayout(d3Lib, root, orientation = "horizontal", depthSpacingScale = 1) {
|
|
486
|
+
function createTreeLayout(d3Lib, root, orientation = "horizontal", depthSpacingScale = 1, suppliedItemCountRange) {
|
|
487
|
+
const nodes = root.descendants();
|
|
488
|
+
const itemCountRange = suppliedItemCountRange ?? getItemCountRange(
|
|
489
|
+
nodes.map((d) => d.data)
|
|
490
|
+
);
|
|
491
|
+
const layoutSpacings = getLayoutSpacings(itemCountRange, depthSpacingScale);
|
|
424
492
|
const nodeSize = isVerticalOrientation(orientation) ? [
|
|
425
|
-
|
|
426
|
-
|
|
493
|
+
layoutSpacings.verticalSibling,
|
|
494
|
+
layoutSpacings.verticalDepth
|
|
427
495
|
] : [
|
|
428
|
-
|
|
429
|
-
|
|
496
|
+
layoutSpacings.verticalBreadth,
|
|
497
|
+
layoutSpacings.horizontalDepth
|
|
430
498
|
];
|
|
431
499
|
const treeLayout = d3Lib.tree().nodeSize(nodeSize).separation(() => 1);
|
|
432
500
|
return treeLayout(root);
|
|
433
501
|
}
|
|
434
|
-
function renderTree(d3Lib, svgRef, treeData, svgWidth, svgHeight, reparentingNodeId, reparentForbiddenIds, rootColor, callbacks, orientation = "horizontal", hideRoot = false, selectedNodeId = null) {
|
|
502
|
+
function renderTree(d3Lib, svgRef, treeData, svgWidth, svgHeight, reparentingNodeId, reparentForbiddenIds, rootColor, callbacks, orientation = "horizontal", hideRoot = false, selectedNodeId = null, suppliedItemCountRange) {
|
|
435
503
|
const { onReparentTargetSelect, onNodeClick } = callbacks;
|
|
436
504
|
if (!svgRef.current) {
|
|
437
505
|
throw new Error("SVG reference is null");
|
|
438
506
|
}
|
|
439
|
-
const
|
|
440
|
-
|
|
507
|
+
const treeNodes = treeData.descendants();
|
|
508
|
+
const itemCountRange = suppliedItemCountRange ?? getItemCountRange(
|
|
509
|
+
treeNodes.map((d) => d.data)
|
|
441
510
|
);
|
|
442
511
|
const svg = d3Lib.select(svgRef.current).append("svg").attr("width", svgWidth).attr("height", svgHeight).style("overflow", "visible").append("g");
|
|
443
512
|
const safeRootId = treeData.data.id.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
@@ -584,6 +653,48 @@ function renderTree(d3Lib, svgRef, treeData, svgWidth, svgHeight, reparentingNod
|
|
|
584
653
|
return svg;
|
|
585
654
|
}
|
|
586
655
|
|
|
656
|
+
// src/FloatingControls.tsx
|
|
657
|
+
import { ZoomControls } from "@behindthemusictree/ui";
|
|
658
|
+
|
|
659
|
+
// src/BusyIndicator.tsx
|
|
660
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
661
|
+
function BusyIndicator() {
|
|
662
|
+
return /* @__PURE__ */ jsxs2("div", { className: "gtv-busy", role: "status", "aria-live": "polite", children: [
|
|
663
|
+
/* @__PURE__ */ jsx2("span", { className: "gtv-busy-ring", "aria-hidden": "true" }),
|
|
664
|
+
/* @__PURE__ */ jsx2("span", { className: "gtv-skeleton-sr-only", children: "Updating genre tree\u2026" })
|
|
665
|
+
] });
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// src/FloatingControls.tsx
|
|
669
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
670
|
+
function FloatingControls({ panZoom, onFit, orientation, zoomControls, leading, busy }) {
|
|
671
|
+
return /* @__PURE__ */ jsxs3(
|
|
672
|
+
"div",
|
|
673
|
+
{
|
|
674
|
+
className: [
|
|
675
|
+
"gtv-wheel-floating-controls",
|
|
676
|
+
orientation === "horizontal" && "gtv-wheel-floating-controls--horizontal"
|
|
677
|
+
].filter(Boolean).join(" "),
|
|
678
|
+
children: [
|
|
679
|
+
busy && /* @__PURE__ */ jsx3(BusyIndicator, {}),
|
|
680
|
+
leading && /* @__PURE__ */ jsx3("div", { className: "gtv-floating-controls-leading", children: leading }),
|
|
681
|
+
zoomControls !== "never" && /* @__PURE__ */ jsx3(
|
|
682
|
+
ZoomControls,
|
|
683
|
+
{
|
|
684
|
+
onZoomIn: panZoom.zoomIn,
|
|
685
|
+
onZoomOut: panZoom.zoomOut,
|
|
686
|
+
onFit,
|
|
687
|
+
canZoomIn: panZoom.canZoomIn,
|
|
688
|
+
canZoomOut: panZoom.canZoomOut,
|
|
689
|
+
orientation,
|
|
690
|
+
className: zoomControls === "auto" ? "gtv-zoom-controls gtv-zoom-controls--auto" : "gtv-zoom-controls"
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
|
|
587
698
|
// src/use-pan-zoom.ts
|
|
588
699
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
589
700
|
|
|
@@ -982,9 +1093,10 @@ function usePanZoom(viewportRef, wheelZoom = "always", stageRef, options = {}) {
|
|
|
982
1093
|
const newScale = clampZoomScale(Math.max(targetScale, currentScale), minScaleRef.current);
|
|
983
1094
|
const centerX = (rect.left + rect.width / 2 - viewportRect.left - view.x) / currentScale;
|
|
984
1095
|
const centerY = (rect.top + rect.height / 2 - viewportRect.top - view.y) / currentScale;
|
|
985
|
-
const availableCenterX =
|
|
1096
|
+
const availableCenterX = obscured?.side === "left" ? obscured.width + (viewportRect.width - obscured.width) / 2 : obscured?.side === "right" ? (viewportRect.width - obscured.width) / 2 : viewportRect.width / 2;
|
|
1097
|
+
const availableCenterY = obscured?.side === "bottom" ? (viewportRect.height - obscured.height) / 2 : viewportRect.height / 2;
|
|
986
1098
|
const targetPanX = availableCenterX - centerX * newScale;
|
|
987
|
-
const targetPanY =
|
|
1099
|
+
const targetPanY = availableCenterY - centerY * newScale;
|
|
988
1100
|
zoomAnimationRef.current = null;
|
|
989
1101
|
if (animationFrameIdRef.current !== null) {
|
|
990
1102
|
cancelAnimationFrame(animationFrameIdRef.current);
|
|
@@ -1138,6 +1250,9 @@ function resolveInfoPanelSide() {
|
|
|
1138
1250
|
}
|
|
1139
1251
|
function resolveInfoPanelObscuredArea(element, viewport, panelWidth) {
|
|
1140
1252
|
if (!element || !viewport) return null;
|
|
1253
|
+
if (viewport.clientWidth > 0 && viewport.clientWidth <= INFO_PANEL_SHEET_MAX_WIDTH) {
|
|
1254
|
+
return { side: "bottom", height: viewport.clientHeight * INFO_PANEL_SHEET_PEEK_FRACTION };
|
|
1255
|
+
}
|
|
1141
1256
|
return { width: panelWidth, side: resolveInfoPanelSide() };
|
|
1142
1257
|
}
|
|
1143
1258
|
|
|
@@ -1219,14 +1334,14 @@ function useTreeIndex(nodes) {
|
|
|
1219
1334
|
}
|
|
1220
1335
|
|
|
1221
1336
|
// src/InfoPanel.tsx
|
|
1222
|
-
import { useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
1337
|
+
import { useEffect as useEffect3, useRef as useRef3, useState as useState5 } from "react";
|
|
1223
1338
|
import { MdArrowBack, MdClose, MdZoomIn } from "react-icons/md";
|
|
1224
1339
|
|
|
1225
1340
|
// src/InfoPanelExpandButton.tsx
|
|
1226
1341
|
import { MdCloseFullscreen, MdOpenInFull } from "react-icons/md";
|
|
1227
|
-
import { jsx as
|
|
1342
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1228
1343
|
function InfoPanelExpandButton({ expanded, onExpandedChange, style }) {
|
|
1229
|
-
return /* @__PURE__ */
|
|
1344
|
+
return /* @__PURE__ */ jsx4(
|
|
1230
1345
|
"button",
|
|
1231
1346
|
{
|
|
1232
1347
|
type: "button",
|
|
@@ -1234,7 +1349,7 @@ function InfoPanelExpandButton({ expanded, onExpandedChange, style }) {
|
|
|
1234
1349
|
style,
|
|
1235
1350
|
onClick: () => onExpandedChange(!expanded),
|
|
1236
1351
|
"aria-label": expanded ? "Collapse panel" : "Expand panel",
|
|
1237
|
-
children: expanded ? /* @__PURE__ */
|
|
1352
|
+
children: expanded ? /* @__PURE__ */ jsx4(MdCloseFullscreen, { className: "gtv-icon", size: 16 }) : /* @__PURE__ */ jsx4(MdOpenInFull, { className: "gtv-icon", size: 16 })
|
|
1238
1353
|
}
|
|
1239
1354
|
);
|
|
1240
1355
|
}
|
|
@@ -1242,11 +1357,11 @@ function InfoPanelExpandButton({ expanded, onExpandedChange, style }) {
|
|
|
1242
1357
|
// src/InfoPanelSection.tsx
|
|
1243
1358
|
import { useState as useState3 } from "react";
|
|
1244
1359
|
import { MdExpandMore } from "react-icons/md";
|
|
1245
|
-
import { jsx as
|
|
1360
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1246
1361
|
function InfoPanelSection({ title, children }) {
|
|
1247
1362
|
const [open, setOpen] = useState3(true);
|
|
1248
|
-
return /* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */
|
|
1363
|
+
return /* @__PURE__ */ jsxs4("div", { className: "gtv-info-panel-children", children: [
|
|
1364
|
+
/* @__PURE__ */ jsxs4(
|
|
1250
1365
|
"button",
|
|
1251
1366
|
{
|
|
1252
1367
|
type: "button",
|
|
@@ -1254,8 +1369,8 @@ function InfoPanelSection({ title, children }) {
|
|
|
1254
1369
|
"aria-expanded": open,
|
|
1255
1370
|
onClick: () => setOpen((isOpen) => !isOpen),
|
|
1256
1371
|
children: [
|
|
1257
|
-
/* @__PURE__ */
|
|
1258
|
-
/* @__PURE__ */
|
|
1372
|
+
/* @__PURE__ */ jsx5("span", { className: "gtv-info-panel-children-title", children: title }),
|
|
1373
|
+
/* @__PURE__ */ jsx5(MdExpandMore, { className: "gtv-icon gtv-info-panel-section-chevron", size: 16 })
|
|
1259
1374
|
]
|
|
1260
1375
|
}
|
|
1261
1376
|
),
|
|
@@ -1268,7 +1383,7 @@ import { useState as useState4 } from "react";
|
|
|
1268
1383
|
import { MdMoreVert, MdModeEdit } from "react-icons/md";
|
|
1269
1384
|
import { FaPlus, FaTrashAlt, FaPlay, FaPause, FaSpinner } from "react-icons/fa";
|
|
1270
1385
|
import { PiGraphFill as PiGraphFill2 } from "react-icons/pi";
|
|
1271
|
-
import { Fragment, jsx as
|
|
1386
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1272
1387
|
function NodeToolbar({
|
|
1273
1388
|
node,
|
|
1274
1389
|
playingNodeId,
|
|
@@ -1289,9 +1404,9 @@ function NodeToolbar({
|
|
|
1289
1404
|
const isPlayable = node.itemCount > 0;
|
|
1290
1405
|
const isThisPlaying = playingNodeId === node.id;
|
|
1291
1406
|
const playLabel = isThisPlaying && playState === "playing" ? "Pause" : isThisPlaying && playState === "loading" ? "Loading..." : "Play";
|
|
1292
|
-
const playIcon = isThisPlaying && playState === "playing" ? /* @__PURE__ */
|
|
1293
|
-
return /* @__PURE__ */
|
|
1294
|
-
/* @__PURE__ */
|
|
1407
|
+
const playIcon = isThisPlaying && playState === "playing" ? /* @__PURE__ */ jsx6(FaPause, { className: "gtv-icon", size: "0.6em" }) : isThisPlaying && playState === "loading" ? /* @__PURE__ */ jsx6(FaSpinner, { className: "gtv-icon gtv-icon--spin", size: "0.6em" }) : /* @__PURE__ */ jsx6(FaPlay, { className: "gtv-icon", size: "0.6em" });
|
|
1408
|
+
return /* @__PURE__ */ jsxs5("div", { className: ["gtv-toolbar", className].filter(Boolean).join(" "), children: [
|
|
1409
|
+
/* @__PURE__ */ jsx6(
|
|
1295
1410
|
"button",
|
|
1296
1411
|
{
|
|
1297
1412
|
type: "button",
|
|
@@ -1303,8 +1418,8 @@ function NodeToolbar({
|
|
|
1303
1418
|
children: playIcon
|
|
1304
1419
|
}
|
|
1305
1420
|
),
|
|
1306
|
-
isActionable && /* @__PURE__ */
|
|
1307
|
-
/* @__PURE__ */
|
|
1421
|
+
isActionable && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1422
|
+
/* @__PURE__ */ jsx6(
|
|
1308
1423
|
"button",
|
|
1309
1424
|
{
|
|
1310
1425
|
type: "button",
|
|
@@ -1312,13 +1427,13 @@ function NodeToolbar({
|
|
|
1312
1427
|
title: "Add sub-genre",
|
|
1313
1428
|
"aria-label": "Add sub-genre",
|
|
1314
1429
|
onClick: () => onAddChild?.(node.id),
|
|
1315
|
-
children: /* @__PURE__ */
|
|
1430
|
+
children: /* @__PURE__ */ jsx6(FaPlus, { className: "gtv-icon", size: "0.6em" })
|
|
1316
1431
|
}
|
|
1317
1432
|
),
|
|
1318
1433
|
primaryExtraActions.map((action) => {
|
|
1319
1434
|
const enabled = action.enabled ? action.enabled(node) : true;
|
|
1320
1435
|
const label = action.label(node);
|
|
1321
|
-
return /* @__PURE__ */
|
|
1436
|
+
return /* @__PURE__ */ jsx6(
|
|
1322
1437
|
"button",
|
|
1323
1438
|
{
|
|
1324
1439
|
type: "button",
|
|
@@ -1332,8 +1447,8 @@ function NodeToolbar({
|
|
|
1332
1447
|
action.key
|
|
1333
1448
|
);
|
|
1334
1449
|
}),
|
|
1335
|
-
/* @__PURE__ */
|
|
1336
|
-
/* @__PURE__ */
|
|
1450
|
+
/* @__PURE__ */ jsxs5("div", { className: "gtv-toolbar-overflow", children: [
|
|
1451
|
+
/* @__PURE__ */ jsx6(
|
|
1337
1452
|
"button",
|
|
1338
1453
|
{
|
|
1339
1454
|
type: "button",
|
|
@@ -1343,11 +1458,11 @@ function NodeToolbar({
|
|
|
1343
1458
|
"aria-haspopup": "menu",
|
|
1344
1459
|
"aria-expanded": menuOpen,
|
|
1345
1460
|
onClick: () => setMenuOpen((open) => !open),
|
|
1346
|
-
children: /* @__PURE__ */
|
|
1461
|
+
children: /* @__PURE__ */ jsx6(MdMoreVert, { size: "0.6em" })
|
|
1347
1462
|
}
|
|
1348
1463
|
),
|
|
1349
|
-
menuOpen && /* @__PURE__ */
|
|
1350
|
-
/* @__PURE__ */
|
|
1464
|
+
menuOpen && /* @__PURE__ */ jsxs5("div", { className: "gtv-menu-card gtv-toolbar-overflow-menu", children: [
|
|
1465
|
+
/* @__PURE__ */ jsxs5(
|
|
1351
1466
|
"button",
|
|
1352
1467
|
{
|
|
1353
1468
|
type: "button",
|
|
@@ -1357,12 +1472,12 @@ function NodeToolbar({
|
|
|
1357
1472
|
onRenameRequest?.(node);
|
|
1358
1473
|
},
|
|
1359
1474
|
children: [
|
|
1360
|
-
/* @__PURE__ */
|
|
1361
|
-
/* @__PURE__ */
|
|
1475
|
+
/* @__PURE__ */ jsx6("span", { className: "gtv-menu-row-icon", children: /* @__PURE__ */ jsx6(MdModeEdit, { className: "gtv-icon", size: 13 }) }),
|
|
1476
|
+
/* @__PURE__ */ jsx6("span", { className: "gtv-menu-row-label", children: "Rename" })
|
|
1362
1477
|
]
|
|
1363
1478
|
}
|
|
1364
1479
|
),
|
|
1365
|
-
/* @__PURE__ */
|
|
1480
|
+
/* @__PURE__ */ jsxs5(
|
|
1366
1481
|
"button",
|
|
1367
1482
|
{
|
|
1368
1483
|
type: "button",
|
|
@@ -1372,14 +1487,14 @@ function NodeToolbar({
|
|
|
1372
1487
|
onReparentRequest?.(node);
|
|
1373
1488
|
},
|
|
1374
1489
|
children: [
|
|
1375
|
-
/* @__PURE__ */
|
|
1376
|
-
/* @__PURE__ */
|
|
1490
|
+
/* @__PURE__ */ jsx6("span", { className: "gtv-menu-row-icon", children: /* @__PURE__ */ jsx6(PiGraphFill2, { className: "gtv-icon", size: 13 }) }),
|
|
1491
|
+
/* @__PURE__ */ jsx6("span", { className: "gtv-menu-row-label", children: "Change parent" })
|
|
1377
1492
|
]
|
|
1378
1493
|
}
|
|
1379
1494
|
),
|
|
1380
1495
|
overflowExtraActions.map((action) => {
|
|
1381
1496
|
const enabled = action.enabled ? action.enabled(node) : true;
|
|
1382
|
-
return /* @__PURE__ */
|
|
1497
|
+
return /* @__PURE__ */ jsxs5(
|
|
1383
1498
|
"button",
|
|
1384
1499
|
{
|
|
1385
1500
|
type: "button",
|
|
@@ -1390,15 +1505,15 @@ function NodeToolbar({
|
|
|
1390
1505
|
action.onClick(event, node);
|
|
1391
1506
|
},
|
|
1392
1507
|
children: [
|
|
1393
|
-
/* @__PURE__ */
|
|
1394
|
-
/* @__PURE__ */
|
|
1508
|
+
/* @__PURE__ */ jsx6("span", { className: "gtv-menu-row-icon", children: action.icon(node) }),
|
|
1509
|
+
/* @__PURE__ */ jsx6("span", { className: "gtv-menu-row-label", children: action.label(node) })
|
|
1395
1510
|
]
|
|
1396
1511
|
},
|
|
1397
1512
|
action.key
|
|
1398
1513
|
);
|
|
1399
1514
|
}),
|
|
1400
|
-
/* @__PURE__ */
|
|
1401
|
-
/* @__PURE__ */
|
|
1515
|
+
/* @__PURE__ */ jsx6("div", { className: "gtv-menu-divider" }),
|
|
1516
|
+
/* @__PURE__ */ jsxs5(
|
|
1402
1517
|
"button",
|
|
1403
1518
|
{
|
|
1404
1519
|
type: "button",
|
|
@@ -1408,8 +1523,8 @@ function NodeToolbar({
|
|
|
1408
1523
|
onDeleteRequest?.(node);
|
|
1409
1524
|
},
|
|
1410
1525
|
children: [
|
|
1411
|
-
/* @__PURE__ */
|
|
1412
|
-
/* @__PURE__ */
|
|
1526
|
+
/* @__PURE__ */ jsx6("span", { className: "gtv-menu-row-icon", children: /* @__PURE__ */ jsx6(FaTrashAlt, { className: "gtv-icon", size: 13 }) }),
|
|
1527
|
+
/* @__PURE__ */ jsx6("span", { className: "gtv-menu-row-label", children: "Delete" })
|
|
1413
1528
|
]
|
|
1414
1529
|
}
|
|
1415
1530
|
)
|
|
@@ -1420,7 +1535,7 @@ function NodeToolbar({
|
|
|
1420
1535
|
}
|
|
1421
1536
|
|
|
1422
1537
|
// src/InfoPanel.tsx
|
|
1423
|
-
import { Fragment as Fragment2, jsx as
|
|
1538
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1424
1539
|
var MINI_NODE_MIN_DIAMETER = 14;
|
|
1425
1540
|
var MINI_NODE_MAX_DIAMETER = 32;
|
|
1426
1541
|
var MINI_NODE_MIN_FONT_SIZE = 10;
|
|
@@ -1452,10 +1567,6 @@ function InfoPanel({
|
|
|
1452
1567
|
onZoomIn,
|
|
1453
1568
|
actions,
|
|
1454
1569
|
readOnly = false,
|
|
1455
|
-
editMode = false,
|
|
1456
|
-
onEditModeChange,
|
|
1457
|
-
renderTitleEditor,
|
|
1458
|
-
renderParentsEditor,
|
|
1459
1570
|
renderDangerZone,
|
|
1460
1571
|
expanded = false,
|
|
1461
1572
|
onExpandedChange,
|
|
@@ -1463,13 +1574,32 @@ function InfoPanel({
|
|
|
1463
1574
|
hideExpandButton = false
|
|
1464
1575
|
}) {
|
|
1465
1576
|
const panelRef = useRef3(null);
|
|
1577
|
+
const [sheetFull, setSheetFull] = useState5(false);
|
|
1578
|
+
const grabberDragRef = useRef3(null);
|
|
1579
|
+
const onGrabberPointerDown = (event) => {
|
|
1580
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
1581
|
+
grabberDragRef.current = { startY: event.clientY, dragged: false };
|
|
1582
|
+
};
|
|
1583
|
+
const onGrabberPointerUp = (event) => {
|
|
1584
|
+
const drag = grabberDragRef.current;
|
|
1585
|
+
if (!drag) return;
|
|
1586
|
+
const dy = event.clientY - drag.startY;
|
|
1587
|
+
if (Math.abs(dy) < INFO_PANEL_SHEET_DRAG_THRESHOLD_PX) return;
|
|
1588
|
+
drag.dragged = true;
|
|
1589
|
+
if (dy < 0) setSheetFull(true);
|
|
1590
|
+
else if (sheetFull) setSheetFull(false);
|
|
1591
|
+
else if (!hideClose) onClose();
|
|
1592
|
+
};
|
|
1593
|
+
const onGrabberClick = () => {
|
|
1594
|
+
const dragged = grabberDragRef.current?.dragged ?? false;
|
|
1595
|
+
grabberDragRef.current = null;
|
|
1596
|
+
if (!dragged) setSheetFull((full) => !full);
|
|
1597
|
+
};
|
|
1466
1598
|
useEffect3(() => {
|
|
1467
1599
|
panelRef.current?.toggleAttribute("inert", collapsed);
|
|
1468
1600
|
}, [collapsed]);
|
|
1469
|
-
const editing = editMode && !readOnly;
|
|
1470
|
-
const shownParent = editing && renderParentsEditor ? null : parentNode;
|
|
1471
1601
|
const miniTreeRange = getItemCountRange([
|
|
1472
|
-
...
|
|
1602
|
+
...parentNode ? [parentNode.node] : [],
|
|
1473
1603
|
node,
|
|
1474
1604
|
...childNodes.map((child) => child.node)
|
|
1475
1605
|
]);
|
|
@@ -1483,9 +1613,9 @@ function InfoPanel({
|
|
|
1483
1613
|
};
|
|
1484
1614
|
const miniNodeContent = (target, background, range) => {
|
|
1485
1615
|
const { diameter, fontSize } = miniNodeSize(target, range);
|
|
1486
|
-
return /* @__PURE__ */
|
|
1487
|
-
/* @__PURE__ */
|
|
1488
|
-
/* @__PURE__ */
|
|
1616
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1617
|
+
/* @__PURE__ */ jsx7("span", { className: "gtv-info-panel-mini-dot", style: { background, width: diameter, height: diameter } }),
|
|
1618
|
+
/* @__PURE__ */ jsx7("span", { className: "gtv-info-panel-mini-label", style: { fontSize }, children: target.name })
|
|
1489
1619
|
] });
|
|
1490
1620
|
};
|
|
1491
1621
|
const sortedChildNodes = [...childNodes].sort((a, b) => b.node.itemCount - a.node.itemCount);
|
|
@@ -1498,9 +1628,9 @@ function InfoPanel({
|
|
|
1498
1628
|
document.addEventListener("keydown", onKeyDown);
|
|
1499
1629
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
1500
1630
|
}, [expanded, onExpandedChange]);
|
|
1501
|
-
const dangerZone =
|
|
1502
|
-
const toolbar = actions ? /* @__PURE__ */
|
|
1503
|
-
const ancestors = ancestorNodes.length > 0 ? /* @__PURE__ */
|
|
1631
|
+
const dangerZone = !readOnly && renderDangerZone && /* @__PURE__ */ jsx7("div", { className: "gtv-info-panel-danger-zone", children: renderDangerZone(node) });
|
|
1632
|
+
const toolbar = actions ? /* @__PURE__ */ jsx7(NodeToolbar, { node, className: "gtv-info-panel-toolbar", ...actions }, node.id) : null;
|
|
1633
|
+
const ancestors = ancestorNodes.length > 0 ? /* @__PURE__ */ jsx7(InfoPanelSection, { title: "Ancestors", children: /* @__PURE__ */ jsx7("ul", { className: "gtv-info-panel-children-list gtv-info-panel-ancestors-list", children: ancestorNodes.map(({ node: ancestor, fill: fill2 }) => /* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsx7(
|
|
1504
1634
|
"button",
|
|
1505
1635
|
{
|
|
1506
1636
|
type: "button",
|
|
@@ -1510,76 +1640,85 @@ function InfoPanel({
|
|
|
1510
1640
|
children: miniNodeContent(ancestor, fill2, ancestorRange)
|
|
1511
1641
|
}
|
|
1512
1642
|
) }, ancestor.id)) }) }) : null;
|
|
1513
|
-
const family = /* @__PURE__ */
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1643
|
+
const family = /* @__PURE__ */ jsx7(Fragment2, { children: /* @__PURE__ */ jsx7(InfoPanelSection, { title: "Family", children: /* @__PURE__ */ jsxs6("div", { className: "gtv-info-panel-mini-tree", children: [
|
|
1644
|
+
parentNode && /* @__PURE__ */ jsx7("div", { className: "gtv-info-panel-mini-tree-parent", children: /* @__PURE__ */ jsx7(
|
|
1645
|
+
"button",
|
|
1646
|
+
{
|
|
1647
|
+
type: "button",
|
|
1648
|
+
className: "gtv-info-panel-child",
|
|
1649
|
+
title: parentNode.node.name,
|
|
1650
|
+
onClick: () => onSelectNode(parentNode.node.id),
|
|
1651
|
+
children: miniNodeContent(parentNode.node, parentNode.fill, miniTreeRange)
|
|
1652
|
+
}
|
|
1653
|
+
) }),
|
|
1654
|
+
/* @__PURE__ */ jsx7(
|
|
1655
|
+
"div",
|
|
1656
|
+
{
|
|
1657
|
+
className: `gtv-info-panel-mini-tree-node${childNodes.length === 0 ? " gtv-info-panel-mini-tree-node--leaf" : ""}`,
|
|
1658
|
+
children: /* @__PURE__ */ jsx7(
|
|
1659
|
+
"span",
|
|
1660
|
+
{
|
|
1661
|
+
className: "gtv-info-panel-child gtv-info-panel-mini-tree-current",
|
|
1662
|
+
title: node.name,
|
|
1663
|
+
children: miniNodeContent(node, fill, miniTreeRange)
|
|
1664
|
+
}
|
|
1665
|
+
)
|
|
1666
|
+
}
|
|
1667
|
+
),
|
|
1668
|
+
/* @__PURE__ */ jsxs6("div", { className: "gtv-info-panel-mini-tree-children", children: [
|
|
1669
|
+
/* @__PURE__ */ jsxs6("span", { className: "gtv-info-panel-children-title", children: [
|
|
1670
|
+
childNodes.length,
|
|
1671
|
+
" ",
|
|
1672
|
+
childNodes.length <= 1 ? "child" : "children"
|
|
1673
|
+
] }),
|
|
1674
|
+
childNodes.length > 0 && /* @__PURE__ */ jsx7("ul", { className: "gtv-info-panel-children-list", children: sortedChildNodes.map(({ node: child, fill: fill2 }) => /* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsx7(
|
|
1517
1675
|
"button",
|
|
1518
1676
|
{
|
|
1519
1677
|
type: "button",
|
|
1520
1678
|
className: "gtv-info-panel-child",
|
|
1521
|
-
title:
|
|
1522
|
-
onClick: () => onSelectNode(
|
|
1523
|
-
children: miniNodeContent(
|
|
1524
|
-
}
|
|
1525
|
-
) }),
|
|
1526
|
-
/* @__PURE__ */ jsx5(
|
|
1527
|
-
"div",
|
|
1528
|
-
{
|
|
1529
|
-
className: `gtv-info-panel-mini-tree-node${childNodes.length === 0 ? " gtv-info-panel-mini-tree-node--leaf" : ""}`,
|
|
1530
|
-
children: /* @__PURE__ */ jsx5(
|
|
1531
|
-
"span",
|
|
1532
|
-
{
|
|
1533
|
-
className: "gtv-info-panel-child gtv-info-panel-mini-tree-current",
|
|
1534
|
-
title: node.name,
|
|
1535
|
-
children: miniNodeContent(node, fill, miniTreeRange)
|
|
1536
|
-
}
|
|
1537
|
-
)
|
|
1679
|
+
title: child.name,
|
|
1680
|
+
onClick: () => onSelectNode(child.id),
|
|
1681
|
+
children: miniNodeContent(child, fill2, miniTreeRange)
|
|
1538
1682
|
}
|
|
1539
|
-
),
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
] }),
|
|
1546
|
-
childNodes.length > 0 && /* @__PURE__ */ jsx5("ul", { className: "gtv-info-panel-children-list", children: sortedChildNodes.map(({ node: child, fill: fill2 }) => /* @__PURE__ */ jsx5("li", { children: /* @__PURE__ */ jsx5(
|
|
1547
|
-
"button",
|
|
1548
|
-
{
|
|
1549
|
-
type: "button",
|
|
1550
|
-
className: "gtv-info-panel-child",
|
|
1551
|
-
title: child.name,
|
|
1552
|
-
onClick: () => onSelectNode(child.id),
|
|
1553
|
-
children: miniNodeContent(child, fill2, miniTreeRange)
|
|
1554
|
-
}
|
|
1555
|
-
) }, child.id)) })
|
|
1556
|
-
] })
|
|
1557
|
-
] }) })
|
|
1558
|
-
] });
|
|
1559
|
-
const itemCount = /* @__PURE__ */ jsxs4("dl", { className: "gtv-info-panel-fields", children: [
|
|
1560
|
-
/* @__PURE__ */ jsx5("dt", { children: itemCountLabel }),
|
|
1561
|
-
/* @__PURE__ */ jsx5("dd", { children: node.itemCount })
|
|
1683
|
+
) }, child.id)) })
|
|
1684
|
+
] })
|
|
1685
|
+
] }) }) });
|
|
1686
|
+
const itemCount = /* @__PURE__ */ jsxs6("dl", { className: "gtv-info-panel-fields", children: [
|
|
1687
|
+
/* @__PURE__ */ jsx7("dt", { children: itemCountLabel }),
|
|
1688
|
+
/* @__PURE__ */ jsx7("dd", { children: node.itemCount })
|
|
1562
1689
|
] });
|
|
1563
|
-
const { primary, aside } = renderInfoPanelBody ? renderInfoPanelBody(node, { toolbar, ancestors, family, itemCount }) : { primary: /* @__PURE__ */
|
|
1690
|
+
const { primary, aside } = renderInfoPanelBody ? renderInfoPanelBody(node, { toolbar, ancestors, family, itemCount }) : { primary: /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1564
1691
|
toolbar,
|
|
1565
1692
|
ancestors,
|
|
1566
1693
|
family,
|
|
1567
1694
|
itemCount
|
|
1568
1695
|
] }) };
|
|
1569
1696
|
const hasAside = aside !== void 0 && aside !== null && aside !== false;
|
|
1570
|
-
return /* @__PURE__ */
|
|
1697
|
+
return /* @__PURE__ */ jsxs6(
|
|
1571
1698
|
"div",
|
|
1572
1699
|
{
|
|
1573
|
-
className: `gtv-info-panel gtv-info-panel--${side}${expanded ? " gtv-info-panel--expanded" : ""}${expanded && !hasAside ? " gtv-info-panel--expanded-solo" : ""}${collapsed ? " gtv-info-panel--collapsed" : ""}`,
|
|
1700
|
+
className: `gtv-info-panel gtv-info-panel--sheet${sheetFull ? " gtv-info-panel--sheet-full" : ""} gtv-info-panel--${side}${expanded ? " gtv-info-panel--expanded" : ""}${expanded && !hasAside ? " gtv-info-panel--expanded-solo" : ""}${collapsed ? " gtv-info-panel--collapsed" : ""}`,
|
|
1574
1701
|
ref: panelRef,
|
|
1575
1702
|
children: [
|
|
1576
|
-
/* @__PURE__ */
|
|
1703
|
+
/* @__PURE__ */ jsx7(
|
|
1704
|
+
"button",
|
|
1705
|
+
{
|
|
1706
|
+
type: "button",
|
|
1707
|
+
className: "gtv-info-panel-grabber",
|
|
1708
|
+
"aria-label": sheetFull ? "Lower panel" : "Raise panel",
|
|
1709
|
+
"aria-expanded": sheetFull,
|
|
1710
|
+
onPointerDown: onGrabberPointerDown,
|
|
1711
|
+
onPointerUp: onGrabberPointerUp,
|
|
1712
|
+
onClick: onGrabberClick
|
|
1713
|
+
}
|
|
1714
|
+
),
|
|
1715
|
+
/* @__PURE__ */ jsxs6(
|
|
1577
1716
|
"div",
|
|
1578
1717
|
{
|
|
1579
1718
|
className: "gtv-info-panel-header",
|
|
1580
1719
|
style: { background: fill, color: textColor },
|
|
1581
1720
|
children: [
|
|
1582
|
-
onPrevious && /* @__PURE__ */
|
|
1721
|
+
onPrevious && /* @__PURE__ */ jsx7(
|
|
1583
1722
|
"button",
|
|
1584
1723
|
{
|
|
1585
1724
|
type: "button",
|
|
@@ -1588,21 +1727,21 @@ function InfoPanel({
|
|
|
1588
1727
|
onClick: onPrevious,
|
|
1589
1728
|
"aria-label": previousLabel ? `Previous: ${previousLabel}` : "Previous",
|
|
1590
1729
|
title: previousLabel,
|
|
1591
|
-
children: /* @__PURE__ */
|
|
1730
|
+
children: /* @__PURE__ */ jsx7(MdArrowBack, { className: "gtv-icon", size: 16 })
|
|
1592
1731
|
}
|
|
1593
1732
|
),
|
|
1594
|
-
|
|
1733
|
+
/* @__PURE__ */ jsxs6(
|
|
1595
1734
|
"span",
|
|
1596
1735
|
{
|
|
1597
1736
|
className: `gtv-info-panel-title${hideTitle ? " gtv-info-panel-title--hidden" : ""}`,
|
|
1598
1737
|
style: { color: textColor },
|
|
1599
1738
|
children: [
|
|
1600
1739
|
node.name,
|
|
1601
|
-
node.umbrella && /* @__PURE__ */
|
|
1740
|
+
node.umbrella && /* @__PURE__ */ jsx7("span", { className: "gtv-info-panel-umbrella-badge", children: "umbrella" })
|
|
1602
1741
|
]
|
|
1603
1742
|
}
|
|
1604
1743
|
),
|
|
1605
|
-
onZoomIn && /* @__PURE__ */
|
|
1744
|
+
onZoomIn && /* @__PURE__ */ jsx7(
|
|
1606
1745
|
"button",
|
|
1607
1746
|
{
|
|
1608
1747
|
type: "button",
|
|
@@ -1611,22 +1750,11 @@ function InfoPanel({
|
|
|
1611
1750
|
onClick: onZoomIn,
|
|
1612
1751
|
"aria-label": "Zoom in",
|
|
1613
1752
|
title: "Zoom in",
|
|
1614
|
-
children: /* @__PURE__ */
|
|
1615
|
-
}
|
|
1616
|
-
),
|
|
1617
|
-
onEditModeChange && !readOnly && /* @__PURE__ */ jsx5(
|
|
1618
|
-
"button",
|
|
1619
|
-
{
|
|
1620
|
-
type: "button",
|
|
1621
|
-
className: "gtv-info-panel-edit",
|
|
1622
|
-
style: { color: textColor },
|
|
1623
|
-
onClick: () => onEditModeChange(!editMode),
|
|
1624
|
-
"aria-pressed": editMode,
|
|
1625
|
-
children: editMode ? "Done" : "Edit"
|
|
1753
|
+
children: /* @__PURE__ */ jsx7(MdZoomIn, { className: "gtv-icon", size: 16 })
|
|
1626
1754
|
}
|
|
1627
1755
|
),
|
|
1628
|
-
onExpandedChange && !hideExpandButton && /* @__PURE__ */
|
|
1629
|
-
!hideClose && /* @__PURE__ */
|
|
1756
|
+
onExpandedChange && !hideExpandButton && /* @__PURE__ */ jsx7(InfoPanelExpandButton, { expanded, onExpandedChange, style: { color: textColor } }),
|
|
1757
|
+
!hideClose && /* @__PURE__ */ jsx7(
|
|
1630
1758
|
"button",
|
|
1631
1759
|
{
|
|
1632
1760
|
type: "button",
|
|
@@ -1634,18 +1762,18 @@ function InfoPanel({
|
|
|
1634
1762
|
style: { color: textColor },
|
|
1635
1763
|
onClick: onClose,
|
|
1636
1764
|
"aria-label": "Close",
|
|
1637
|
-
children: /* @__PURE__ */
|
|
1765
|
+
children: /* @__PURE__ */ jsx7(MdClose, { className: "gtv-icon", size: 16 })
|
|
1638
1766
|
}
|
|
1639
1767
|
)
|
|
1640
1768
|
]
|
|
1641
1769
|
}
|
|
1642
1770
|
),
|
|
1643
|
-
/* @__PURE__ */
|
|
1644
|
-
/* @__PURE__ */
|
|
1771
|
+
/* @__PURE__ */ jsxs6("div", { className: "gtv-info-panel-body", children: [
|
|
1772
|
+
/* @__PURE__ */ jsxs6("div", { className: "gtv-info-panel-primary", children: [
|
|
1645
1773
|
primary,
|
|
1646
1774
|
expanded && !hasAside && dangerZone
|
|
1647
1775
|
] }),
|
|
1648
|
-
hasAside && /* @__PURE__ */
|
|
1776
|
+
hasAside && /* @__PURE__ */ jsxs6("div", { className: "gtv-info-panel-aside", children: [
|
|
1649
1777
|
aside,
|
|
1650
1778
|
expanded && dangerZone
|
|
1651
1779
|
] })
|
|
@@ -1659,7 +1787,7 @@ function InfoPanel({
|
|
|
1659
1787
|
// src/OverlayPanel.tsx
|
|
1660
1788
|
import { useEffect as useEffect4, useRef as useRef4 } from "react";
|
|
1661
1789
|
import { MdClose as MdClose2 } from "react-icons/md";
|
|
1662
|
-
import { jsx as
|
|
1790
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1663
1791
|
function OverlayPanel({
|
|
1664
1792
|
title,
|
|
1665
1793
|
content,
|
|
@@ -1694,21 +1822,21 @@ function OverlayPanel({
|
|
|
1694
1822
|
expanded && !extraContent && "gtv-info-panel--expanded-solo",
|
|
1695
1823
|
collapsed && "gtv-info-panel--collapsed"
|
|
1696
1824
|
].filter(Boolean).join(" ");
|
|
1697
|
-
return /* @__PURE__ */
|
|
1698
|
-
/* @__PURE__ */
|
|
1699
|
-
/* @__PURE__ */
|
|
1700
|
-
onExpandedChange && !hideExpandButton && /* @__PURE__ */
|
|
1701
|
-
!hideClose && /* @__PURE__ */
|
|
1825
|
+
return /* @__PURE__ */ jsxs7("div", { className, ref: panelRef, children: [
|
|
1826
|
+
/* @__PURE__ */ jsxs7("div", { className: "gtv-info-panel-header", children: [
|
|
1827
|
+
/* @__PURE__ */ jsx8("span", { className: `gtv-info-panel-title${hideTitle ? " gtv-info-panel-title--hidden" : ""}`, children: title }),
|
|
1828
|
+
onExpandedChange && !hideExpandButton && /* @__PURE__ */ jsx8(InfoPanelExpandButton, { expanded, onExpandedChange }),
|
|
1829
|
+
!hideClose && /* @__PURE__ */ jsx8("button", { type: "button", className: "gtv-info-panel-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx8(MdClose2, { className: "gtv-icon", size: 16 }) })
|
|
1702
1830
|
] }),
|
|
1703
|
-
/* @__PURE__ */
|
|
1704
|
-
/* @__PURE__ */
|
|
1705
|
-
extraContent && /* @__PURE__ */
|
|
1831
|
+
/* @__PURE__ */ jsxs7("div", { className: "gtv-info-panel-body", children: [
|
|
1832
|
+
/* @__PURE__ */ jsx8("div", { className: "gtv-info-panel-aside gtv-overlay-content", children: content }),
|
|
1833
|
+
extraContent && /* @__PURE__ */ jsx8("div", { className: "gtv-info-panel-primary gtv-overlay-content", children: extraContent })
|
|
1706
1834
|
] })
|
|
1707
1835
|
] });
|
|
1708
1836
|
}
|
|
1709
1837
|
|
|
1710
1838
|
// src/GenreTree.tsx
|
|
1711
|
-
import { jsx as
|
|
1839
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1712
1840
|
function GenreTree({
|
|
1713
1841
|
nodes,
|
|
1714
1842
|
className,
|
|
@@ -1735,11 +1863,9 @@ function GenreTree({
|
|
|
1735
1863
|
hideInfoPanelClose = false,
|
|
1736
1864
|
hideInfoPanelTitle = false,
|
|
1737
1865
|
itemCountLabel,
|
|
1866
|
+
itemCountScaleMax,
|
|
1867
|
+
nodeCountForSizing,
|
|
1738
1868
|
readOnly,
|
|
1739
|
-
editMode,
|
|
1740
|
-
onEditModeChange,
|
|
1741
|
-
renderTitleEditor,
|
|
1742
|
-
renderParentsEditor,
|
|
1743
1869
|
renderDangerZone,
|
|
1744
1870
|
expanded,
|
|
1745
1871
|
onExpandedChange,
|
|
@@ -1749,7 +1875,10 @@ function GenreTree({
|
|
|
1749
1875
|
wheelZoom,
|
|
1750
1876
|
defaultViewport,
|
|
1751
1877
|
onViewportChange,
|
|
1752
|
-
controlsOrientation = "vertical"
|
|
1878
|
+
controlsOrientation = "vertical",
|
|
1879
|
+
showZoomControls = "auto",
|
|
1880
|
+
floatingControlsLeading,
|
|
1881
|
+
busy
|
|
1753
1882
|
}) {
|
|
1754
1883
|
const index = useTreeIndex(nodes);
|
|
1755
1884
|
const svgRef = useRef5(null);
|
|
@@ -1757,6 +1886,10 @@ function GenreTree({
|
|
|
1757
1886
|
const stageRef = useRef5(null);
|
|
1758
1887
|
const panZoom = usePanZoom(viewportRef, wheelZoom, stageRef, { defaultViewport, onViewportChange });
|
|
1759
1888
|
const { panel, showNodeInfo, closeNodeInfo } = useNodeInfoPanel({ selectedNodeId: selectedNodeIdProp, onSelectedNodeChange });
|
|
1889
|
+
const itemCountRange = useMemo2(
|
|
1890
|
+
() => getItemCountRange(nodes, { itemCountScaleMax, nodeCountForSizing: nodeCountForSizing ?? nodes.length }),
|
|
1891
|
+
[nodes, itemCountScaleMax, nodeCountForSizing]
|
|
1892
|
+
);
|
|
1760
1893
|
const showNodeInfoRef = useRef5(showNodeInfo);
|
|
1761
1894
|
useEffect5(() => {
|
|
1762
1895
|
showNodeInfoRef.current = showNodeInfo;
|
|
@@ -1771,7 +1904,8 @@ function GenreTree({
|
|
|
1771
1904
|
d3,
|
|
1772
1905
|
root,
|
|
1773
1906
|
orientation,
|
|
1774
|
-
depthSpacingScale
|
|
1907
|
+
depthSpacingScale,
|
|
1908
|
+
itemCountRange
|
|
1775
1909
|
);
|
|
1776
1910
|
const {
|
|
1777
1911
|
svgWidth: width,
|
|
@@ -1783,7 +1917,8 @@ function GenreTree({
|
|
|
1783
1917
|
originalTreeData,
|
|
1784
1918
|
orientation,
|
|
1785
1919
|
hideRoot,
|
|
1786
|
-
depthSpacingScale
|
|
1920
|
+
depthSpacingScale,
|
|
1921
|
+
itemCountRange
|
|
1787
1922
|
);
|
|
1788
1923
|
const reshapedTreeData = setupTreeLayout(
|
|
1789
1924
|
d3,
|
|
@@ -1792,7 +1927,8 @@ function GenreTree({
|
|
|
1792
1927
|
orientation,
|
|
1793
1928
|
rootDepthOffset,
|
|
1794
1929
|
width,
|
|
1795
|
-
depthSpacingScale
|
|
1930
|
+
depthSpacingScale,
|
|
1931
|
+
itemCountRange
|
|
1796
1932
|
);
|
|
1797
1933
|
return {
|
|
1798
1934
|
treeData: reshapedTreeData,
|
|
@@ -1800,7 +1936,7 @@ function GenreTree({
|
|
|
1800
1936
|
svgWidth: width,
|
|
1801
1937
|
svgHeight: height
|
|
1802
1938
|
};
|
|
1803
|
-
}, [nodes, rootColor, orientation, hideRoot, depthSpacingScale]);
|
|
1939
|
+
}, [nodes, rootColor, orientation, hideRoot, depthSpacingScale, itemCountRange]);
|
|
1804
1940
|
const reparentForbiddenIds = useMemo2(() => {
|
|
1805
1941
|
if (!reparentingNodeId) return [];
|
|
1806
1942
|
const reparentingHierarchyNode = treeData.descendants().find((d) => d.data.id === reparentingNodeId);
|
|
@@ -1851,7 +1987,8 @@ function GenreTree({
|
|
|
1851
1987
|
},
|
|
1852
1988
|
orientation,
|
|
1853
1989
|
hideRoot,
|
|
1854
|
-
effectiveSelectedNodeId
|
|
1990
|
+
effectiveSelectedNodeId,
|
|
1991
|
+
itemCountRange
|
|
1855
1992
|
);
|
|
1856
1993
|
}, [
|
|
1857
1994
|
treeData,
|
|
@@ -1872,7 +2009,8 @@ function GenreTree({
|
|
|
1872
2009
|
additionalActions,
|
|
1873
2010
|
orientation,
|
|
1874
2011
|
hideRoot,
|
|
1875
|
-
effectiveSelectedNodeId
|
|
2012
|
+
effectiveSelectedNodeId,
|
|
2013
|
+
itemCountRange
|
|
1876
2014
|
]);
|
|
1877
2015
|
useEffect5(() => {
|
|
1878
2016
|
if (!interactive || !selectedNodeIdProp) return;
|
|
@@ -1905,7 +2043,7 @@ function GenreTree({
|
|
|
1905
2043
|
hasInitialFitRef.current = true;
|
|
1906
2044
|
panZoom.fitToFrame(elements, { silent: true });
|
|
1907
2045
|
});
|
|
1908
|
-
const svg = /* @__PURE__ */
|
|
2046
|
+
const svg = /* @__PURE__ */ jsx9(
|
|
1909
2047
|
"svg",
|
|
1910
2048
|
{
|
|
1911
2049
|
ref: svgRef,
|
|
@@ -1915,13 +2053,14 @@ function GenreTree({
|
|
|
1915
2053
|
}
|
|
1916
2054
|
);
|
|
1917
2055
|
if (!interactive) {
|
|
1918
|
-
return /* @__PURE__ */
|
|
2056
|
+
return /* @__PURE__ */ jsx9("div", { className, children: svg });
|
|
1919
2057
|
}
|
|
1920
|
-
return /* @__PURE__ */
|
|
2058
|
+
return /* @__PURE__ */ jsxs8(
|
|
1921
2059
|
"div",
|
|
1922
2060
|
{
|
|
1923
2061
|
ref: viewportRef,
|
|
1924
2062
|
className,
|
|
2063
|
+
"aria-busy": busy,
|
|
1925
2064
|
style: {
|
|
1926
2065
|
position: "relative",
|
|
1927
2066
|
overflow: "hidden",
|
|
@@ -1944,7 +2083,7 @@ function GenreTree({
|
|
|
1944
2083
|
},
|
|
1945
2084
|
onPointerDown: panZoom.handlePointerDown,
|
|
1946
2085
|
children: [
|
|
1947
|
-
/* @__PURE__ */
|
|
2086
|
+
/* @__PURE__ */ jsx9(
|
|
1948
2087
|
"div",
|
|
1949
2088
|
{
|
|
1950
2089
|
ref: stageRef,
|
|
@@ -1958,7 +2097,7 @@ function GenreTree({
|
|
|
1958
2097
|
children: svg
|
|
1959
2098
|
}
|
|
1960
2099
|
),
|
|
1961
|
-
panel && /* @__PURE__ */
|
|
2100
|
+
panel && /* @__PURE__ */ jsx9(
|
|
1962
2101
|
InfoPanel,
|
|
1963
2102
|
{
|
|
1964
2103
|
node: panel.node,
|
|
@@ -2008,10 +2147,6 @@ function GenreTree({
|
|
|
2008
2147
|
hideTitle: hideInfoPanelTitle,
|
|
2009
2148
|
itemCountLabel,
|
|
2010
2149
|
readOnly,
|
|
2011
|
-
editMode,
|
|
2012
|
-
onEditModeChange,
|
|
2013
|
-
renderTitleEditor,
|
|
2014
|
-
renderParentsEditor,
|
|
2015
2150
|
renderDangerZone,
|
|
2016
2151
|
expanded,
|
|
2017
2152
|
onExpandedChange,
|
|
@@ -2030,54 +2165,16 @@ function GenreTree({
|
|
|
2030
2165
|
} : void 0
|
|
2031
2166
|
}
|
|
2032
2167
|
),
|
|
2033
|
-
overlayPanel && /* @__PURE__ */
|
|
2034
|
-
/* @__PURE__ */
|
|
2035
|
-
|
|
2168
|
+
overlayPanel && /* @__PURE__ */ jsx9(OverlayPanel, { ...overlayPanel }),
|
|
2169
|
+
/* @__PURE__ */ jsx9(
|
|
2170
|
+
FloatingControls,
|
|
2036
2171
|
{
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
"button",
|
|
2044
|
-
{
|
|
2045
|
-
type: "button",
|
|
2046
|
-
className: [
|
|
2047
|
-
"gtv-zoom-btn",
|
|
2048
|
-
!panZoom.canZoomIn && "gtv-zoom-btn--disabled"
|
|
2049
|
-
].filter(Boolean).join(" "),
|
|
2050
|
-
disabled: !panZoom.canZoomIn,
|
|
2051
|
-
onClick: panZoom.zoomIn,
|
|
2052
|
-
"aria-label": "Zoom in",
|
|
2053
|
-
children: /* @__PURE__ */ jsx7(MdZoomIn2, { className: "gtv-icon", size: 18 })
|
|
2054
|
-
}
|
|
2055
|
-
),
|
|
2056
|
-
/* @__PURE__ */ jsx7(
|
|
2057
|
-
"button",
|
|
2058
|
-
{
|
|
2059
|
-
type: "button",
|
|
2060
|
-
className: [
|
|
2061
|
-
"gtv-zoom-btn",
|
|
2062
|
-
!panZoom.canZoomOut && "gtv-zoom-btn--disabled"
|
|
2063
|
-
].filter(Boolean).join(" "),
|
|
2064
|
-
disabled: !panZoom.canZoomOut,
|
|
2065
|
-
onClick: panZoom.zoomOut,
|
|
2066
|
-
"aria-label": "Zoom out",
|
|
2067
|
-
children: /* @__PURE__ */ jsx7(MdZoomOut, { className: "gtv-icon", size: 18 })
|
|
2068
|
-
}
|
|
2069
|
-
),
|
|
2070
|
-
/* @__PURE__ */ jsx7(
|
|
2071
|
-
"button",
|
|
2072
|
-
{
|
|
2073
|
-
type: "button",
|
|
2074
|
-
className: "gtv-zoom-btn",
|
|
2075
|
-
onClick: () => panZoom.fitToFrame(queryTreeContentElements(svgRef.current)),
|
|
2076
|
-
"aria-label": "Fit to frame",
|
|
2077
|
-
children: /* @__PURE__ */ jsx7(MdFitScreen, { className: "gtv-icon", size: 18 })
|
|
2078
|
-
}
|
|
2079
|
-
)
|
|
2080
|
-
] })
|
|
2172
|
+
panZoom,
|
|
2173
|
+
orientation: controlsOrientation,
|
|
2174
|
+
zoomControls: showZoomControls,
|
|
2175
|
+
leading: floatingControlsLeading,
|
|
2176
|
+
busy,
|
|
2177
|
+
onFit: () => panZoom.fitToFrame(queryTreeContentElements(svgRef.current))
|
|
2081
2178
|
}
|
|
2082
2179
|
)
|
|
2083
2180
|
]
|
|
@@ -2086,8 +2183,7 @@ function GenreTree({
|
|
|
2086
2183
|
}
|
|
2087
2184
|
|
|
2088
2185
|
// src/GenreTreeWheelBase.tsx
|
|
2089
|
-
import { useEffect as useEffect6, useMemo as useMemo3, useRef as useRef6, useState as
|
|
2090
|
-
import { MdFitScreen as MdFitScreen2, MdZoomIn as MdZoomIn3, MdZoomOut as MdZoomOut2 } from "react-icons/md";
|
|
2186
|
+
import { useEffect as useEffect6, useMemo as useMemo3, useRef as useRef6, useState as useState6 } from "react";
|
|
2091
2187
|
import * as d32 from "d3";
|
|
2092
2188
|
|
|
2093
2189
|
// src/root-grouping.ts
|
|
@@ -2163,7 +2259,7 @@ function computeRotationForSelection(currentRotationDeg, targetAngle, landingAng
|
|
|
2163
2259
|
}
|
|
2164
2260
|
|
|
2165
2261
|
// src/GenreTreeWheelBase.tsx
|
|
2166
|
-
import { jsx as
|
|
2262
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2167
2263
|
function WheelCore({
|
|
2168
2264
|
nodes,
|
|
2169
2265
|
className,
|
|
@@ -2188,11 +2284,9 @@ function WheelCore({
|
|
|
2188
2284
|
hideInfoPanelClose = false,
|
|
2189
2285
|
hideInfoPanelTitle = false,
|
|
2190
2286
|
itemCountLabel,
|
|
2287
|
+
itemCountScaleMax,
|
|
2288
|
+
nodeCountForSizing,
|
|
2191
2289
|
readOnly,
|
|
2192
|
-
editMode,
|
|
2193
|
-
onEditModeChange,
|
|
2194
|
-
renderTitleEditor,
|
|
2195
|
-
renderParentsEditor,
|
|
2196
2290
|
renderDangerZone,
|
|
2197
2291
|
expanded,
|
|
2198
2292
|
onExpandedChange,
|
|
@@ -2203,8 +2297,16 @@ function WheelCore({
|
|
|
2203
2297
|
defaultViewport,
|
|
2204
2298
|
onViewportChange,
|
|
2205
2299
|
controlsOrientation = "vertical",
|
|
2300
|
+
showZoomControls = "auto",
|
|
2301
|
+
floatingControlsLeading,
|
|
2302
|
+
busy,
|
|
2206
2303
|
selectedNodeId
|
|
2207
2304
|
}) {
|
|
2305
|
+
const fullNodeCountForSizing = nodeCountForSizing ?? nodes.length;
|
|
2306
|
+
const wheelSizeRange = useMemo3(
|
|
2307
|
+
() => getItemCountRange(nodes, { itemCountScaleMax, nodeCountForSizing: fullNodeCountForSizing }),
|
|
2308
|
+
[nodes, itemCountScaleMax, fullNodeCountForSizing]
|
|
2309
|
+
);
|
|
2208
2310
|
const treeOrientation = direction === "left" ? "horizontal-anchored" : "vertical";
|
|
2209
2311
|
const landingAngle = direction === "left" ? 90 : 0;
|
|
2210
2312
|
const chipHalfExtentVar = direction === "left" ? "--gtv-wheel-chip-half-width" : "--gtv-wheel-chip-half-height";
|
|
@@ -2214,18 +2316,18 @@ function WheelCore({
|
|
|
2214
2316
|
return getGenreTreeColor(nodes.find((n) => n.id === rootId)?.wikidataId);
|
|
2215
2317
|
};
|
|
2216
2318
|
const wheelRadius = useMemo3(
|
|
2217
|
-
() => calculateWheelRadius(groups.length, MAX_NODE_WIDTH, WHEEL_RADIUS),
|
|
2218
|
-
[groups.length]
|
|
2319
|
+
() => calculateWheelRadius(groups.length, wheelSizeRange.maxNodeWidth ?? MAX_NODE_WIDTH, WHEEL_RADIUS),
|
|
2320
|
+
[groups.length, wheelSizeRange.maxNodeWidth]
|
|
2219
2321
|
);
|
|
2220
|
-
const wheelViewportHeight = wheelRadius * 2 + MAX_NODE_HEIGHT / 2;
|
|
2322
|
+
const wheelViewportHeight = wheelRadius * 2 + (wheelSizeRange.maxNodeHeight ?? MAX_NODE_HEIGHT) / 2;
|
|
2221
2323
|
const rootItemCountById = useMemo3(
|
|
2222
2324
|
() => new Map(groups.map((group) => [group.root.id, group.root.itemCount])),
|
|
2223
2325
|
[groups]
|
|
2224
2326
|
);
|
|
2225
|
-
const [selectedRootId, setSelectedRootId] =
|
|
2327
|
+
const [selectedRootId, setSelectedRootId] = useState6(
|
|
2226
2328
|
groups[0]?.root.id ?? null
|
|
2227
2329
|
);
|
|
2228
|
-
const [rotationDeg, setRotationDeg] =
|
|
2330
|
+
const [rotationDeg, setRotationDeg] = useState6(
|
|
2229
2331
|
() => groups.length > 0 ? computeRotationForSelection(
|
|
2230
2332
|
0,
|
|
2231
2333
|
getChipAngle(0, groups.length),
|
|
@@ -2264,16 +2366,18 @@ function WheelCore({
|
|
|
2264
2366
|
() => getItemCountRange(
|
|
2265
2367
|
groups.map((group) => ({
|
|
2266
2368
|
itemCount: rootItemCountById.get(group.root.id)
|
|
2267
|
-
}))
|
|
2369
|
+
})),
|
|
2370
|
+
{ itemCountScaleMax, nodeCountForSizing: fullNodeCountForSizing }
|
|
2268
2371
|
),
|
|
2269
|
-
[groups, rootItemCountById]
|
|
2372
|
+
[groups, rootItemCountById, itemCountScaleMax, fullNodeCountForSizing]
|
|
2270
2373
|
);
|
|
2271
2374
|
const rootChipHalfExtent = selectedGroup ? calculateRootAnchorClearance(
|
|
2272
2375
|
d32,
|
|
2273
2376
|
selectedGroup.nodes,
|
|
2274
2377
|
rootItemCountById.get(selectedGroup.root.id),
|
|
2275
2378
|
rootItemCountRange,
|
|
2276
|
-
direction === "left" ? "WIDTH" : "HEIGHT"
|
|
2379
|
+
direction === "left" ? "WIDTH" : "HEIGHT",
|
|
2380
|
+
{ itemCountScaleMax, nodeCountForSizing: fullNodeCountForSizing }
|
|
2277
2381
|
) : 0;
|
|
2278
2382
|
const sectorFillGradient = useMemo3(
|
|
2279
2383
|
() => buildWheelSectorGradient(
|
|
@@ -2291,7 +2395,7 @@ function WheelCore({
|
|
|
2291
2395
|
);
|
|
2292
2396
|
}
|
|
2293
2397
|
};
|
|
2294
|
-
const [appliedSelectedNodeId, setAppliedSelectedNodeId] =
|
|
2398
|
+
const [appliedSelectedNodeId, setAppliedSelectedNodeId] = useState6(selectedNodeId);
|
|
2295
2399
|
if (selectedNodeId !== appliedSelectedNodeId) {
|
|
2296
2400
|
setAppliedSelectedNodeId(selectedNodeId);
|
|
2297
2401
|
const owningGroupIndex = selectedNodeId ? groups.findIndex(
|
|
@@ -2318,10 +2422,11 @@ function WheelCore({
|
|
|
2318
2422
|
);
|
|
2319
2423
|
showNodeInfo(targetNode, element, viewportRef.current, { notify: false });
|
|
2320
2424
|
}, [selectedNodeId, effectiveRootId, nodes, panel, showNodeInfo]);
|
|
2321
|
-
return /* @__PURE__ */
|
|
2425
|
+
return /* @__PURE__ */ jsxs9(
|
|
2322
2426
|
"div",
|
|
2323
2427
|
{
|
|
2324
2428
|
ref: viewportRef,
|
|
2429
|
+
"aria-busy": busy,
|
|
2325
2430
|
className: [
|
|
2326
2431
|
"gtv-wheel-container",
|
|
2327
2432
|
direction === "left" && "gtv-wheel-container--left",
|
|
@@ -2336,7 +2441,7 @@ function WheelCore({
|
|
|
2336
2441
|
},
|
|
2337
2442
|
onPointerDown: panZoom.handlePointerDown,
|
|
2338
2443
|
children: [
|
|
2339
|
-
/* @__PURE__ */
|
|
2444
|
+
/* @__PURE__ */ jsx10(
|
|
2340
2445
|
"div",
|
|
2341
2446
|
{
|
|
2342
2447
|
ref: stageRef,
|
|
@@ -2349,7 +2454,7 @@ function WheelCore({
|
|
|
2349
2454
|
transform: panZoom.transform,
|
|
2350
2455
|
transformOrigin: "0 0"
|
|
2351
2456
|
},
|
|
2352
|
-
children: /* @__PURE__ */
|
|
2457
|
+
children: /* @__PURE__ */ jsxs9(
|
|
2353
2458
|
"div",
|
|
2354
2459
|
{
|
|
2355
2460
|
className: "gtv-wheel-stage",
|
|
@@ -2357,11 +2462,13 @@ function WheelCore({
|
|
|
2357
2462
|
[chipHalfExtentVar]: `${rootChipHalfExtent}px`
|
|
2358
2463
|
},
|
|
2359
2464
|
children: [
|
|
2360
|
-
selectedGroup && /* @__PURE__ */
|
|
2465
|
+
selectedGroup && /* @__PURE__ */ jsx10("div", { className: "gtv-wheel-tree-anchor", ref: treeAnchorRef, children: /* @__PURE__ */ jsx10(
|
|
2361
2466
|
GenreTree,
|
|
2362
2467
|
{
|
|
2363
2468
|
nodes: selectedGroup.nodes,
|
|
2364
2469
|
itemCountLabel,
|
|
2470
|
+
itemCountScaleMax,
|
|
2471
|
+
nodeCountForSizing: fullNodeCountForSizing,
|
|
2365
2472
|
orientation: treeOrientation,
|
|
2366
2473
|
hideRoot: true,
|
|
2367
2474
|
interactive: false,
|
|
@@ -2395,9 +2502,9 @@ function WheelCore({
|
|
|
2395
2502
|
},
|
|
2396
2503
|
selectedGroup.root.id
|
|
2397
2504
|
) }),
|
|
2398
|
-
/* @__PURE__ */
|
|
2399
|
-
centerLabel && /* @__PURE__ */
|
|
2400
|
-
/* @__PURE__ */
|
|
2505
|
+
/* @__PURE__ */ jsx10("div", { className: "gtv-wheel-circle", ref: wheelCircleRef }),
|
|
2506
|
+
centerLabel && /* @__PURE__ */ jsx10("div", { className: "gtv-wheel-center-label", children: centerLabel }),
|
|
2507
|
+
/* @__PURE__ */ jsxs9(
|
|
2401
2508
|
"div",
|
|
2402
2509
|
{
|
|
2403
2510
|
className: "gtv-wheel",
|
|
@@ -2405,7 +2512,7 @@ function WheelCore({
|
|
|
2405
2512
|
"--gtv-wheel-rotation": `${rotationDeg}deg`
|
|
2406
2513
|
},
|
|
2407
2514
|
children: [
|
|
2408
|
-
sectorFillGradient && /* @__PURE__ */
|
|
2515
|
+
sectorFillGradient && /* @__PURE__ */ jsx10(
|
|
2409
2516
|
"div",
|
|
2410
2517
|
{
|
|
2411
2518
|
className: "gtv-wheel-sector-fill",
|
|
@@ -2414,7 +2521,7 @@ function WheelCore({
|
|
|
2414
2521
|
}
|
|
2415
2522
|
}
|
|
2416
2523
|
),
|
|
2417
|
-
groups.length > 1 && groups.map((group, index) => /* @__PURE__ */
|
|
2524
|
+
groups.length > 1 && groups.map((group, index) => /* @__PURE__ */ jsx10(
|
|
2418
2525
|
"div",
|
|
2419
2526
|
{
|
|
2420
2527
|
className: "gtv-wheel-divider",
|
|
@@ -2437,12 +2544,12 @@ function WheelCore({
|
|
|
2437
2544
|
rootItemCount,
|
|
2438
2545
|
rootItemCountRange
|
|
2439
2546
|
);
|
|
2440
|
-
return /* @__PURE__ */
|
|
2547
|
+
return /* @__PURE__ */ jsx10(
|
|
2441
2548
|
"div",
|
|
2442
2549
|
{
|
|
2443
2550
|
className: "gtv-wheel-slot",
|
|
2444
2551
|
style: { "--gtv-chip-angle": `${angle}deg` },
|
|
2445
|
-
children: /* @__PURE__ */
|
|
2552
|
+
children: /* @__PURE__ */ jsx10("div", { className: "gtv-wheel-chip-anchor", children: /* @__PURE__ */ jsxs9(
|
|
2446
2553
|
"button",
|
|
2447
2554
|
{
|
|
2448
2555
|
type: "button",
|
|
@@ -2478,8 +2585,8 @@ function WheelCore({
|
|
|
2478
2585
|
}
|
|
2479
2586
|
},
|
|
2480
2587
|
children: [
|
|
2481
|
-
PER_TREE_ACCENT_DOT && /* @__PURE__ */
|
|
2482
|
-
/* @__PURE__ */
|
|
2588
|
+
PER_TREE_ACCENT_DOT && /* @__PURE__ */ jsx10("span", { className: "gtv-wheel-chip-dot" }),
|
|
2589
|
+
/* @__PURE__ */ jsx10(
|
|
2483
2590
|
"span",
|
|
2484
2591
|
{
|
|
2485
2592
|
className: "gtv-node-label gtv-node-label--root",
|
|
@@ -2502,7 +2609,7 @@ function WheelCore({
|
|
|
2502
2609
|
)
|
|
2503
2610
|
}
|
|
2504
2611
|
),
|
|
2505
|
-
panel && /* @__PURE__ */
|
|
2612
|
+
panel && /* @__PURE__ */ jsx10(
|
|
2506
2613
|
InfoPanel,
|
|
2507
2614
|
{
|
|
2508
2615
|
node: panel.node,
|
|
@@ -2549,10 +2656,6 @@ function WheelCore({
|
|
|
2549
2656
|
hideTitle: hideInfoPanelTitle,
|
|
2550
2657
|
itemCountLabel,
|
|
2551
2658
|
readOnly,
|
|
2552
|
-
editMode,
|
|
2553
|
-
onEditModeChange,
|
|
2554
|
-
renderTitleEditor,
|
|
2555
|
-
renderParentsEditor,
|
|
2556
2659
|
renderDangerZone,
|
|
2557
2660
|
expanded,
|
|
2558
2661
|
onExpandedChange,
|
|
@@ -2571,57 +2674,19 @@ function WheelCore({
|
|
|
2571
2674
|
} : void 0
|
|
2572
2675
|
}
|
|
2573
2676
|
),
|
|
2574
|
-
overlayPanel && /* @__PURE__ */
|
|
2575
|
-
/* @__PURE__ */
|
|
2576
|
-
|
|
2677
|
+
overlayPanel && /* @__PURE__ */ jsx10(OverlayPanel, { ...overlayPanel }),
|
|
2678
|
+
/* @__PURE__ */ jsx10(
|
|
2679
|
+
FloatingControls,
|
|
2577
2680
|
{
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
className: [
|
|
2588
|
-
"gtv-zoom-btn",
|
|
2589
|
-
!panZoom.canZoomIn && "gtv-zoom-btn--disabled"
|
|
2590
|
-
].filter(Boolean).join(" "),
|
|
2591
|
-
disabled: !panZoom.canZoomIn,
|
|
2592
|
-
onClick: panZoom.zoomIn,
|
|
2593
|
-
"aria-label": "Zoom in",
|
|
2594
|
-
children: /* @__PURE__ */ jsx8(MdZoomIn3, { className: "gtv-icon", size: 18 })
|
|
2595
|
-
}
|
|
2596
|
-
),
|
|
2597
|
-
/* @__PURE__ */ jsx8(
|
|
2598
|
-
"button",
|
|
2599
|
-
{
|
|
2600
|
-
type: "button",
|
|
2601
|
-
className: [
|
|
2602
|
-
"gtv-zoom-btn",
|
|
2603
|
-
!panZoom.canZoomOut && "gtv-zoom-btn--disabled"
|
|
2604
|
-
].filter(Boolean).join(" "),
|
|
2605
|
-
disabled: !panZoom.canZoomOut,
|
|
2606
|
-
onClick: panZoom.zoomOut,
|
|
2607
|
-
"aria-label": "Zoom out",
|
|
2608
|
-
children: /* @__PURE__ */ jsx8(MdZoomOut2, { className: "gtv-icon", size: 18 })
|
|
2609
|
-
}
|
|
2610
|
-
),
|
|
2611
|
-
/* @__PURE__ */ jsx8(
|
|
2612
|
-
"button",
|
|
2613
|
-
{
|
|
2614
|
-
type: "button",
|
|
2615
|
-
className: "gtv-zoom-btn",
|
|
2616
|
-
onClick: () => panZoom.fitToFrame([
|
|
2617
|
-
wheelCircleRef.current,
|
|
2618
|
-
...queryTreeContentElements(treeAnchorRef.current)
|
|
2619
|
-
]),
|
|
2620
|
-
"aria-label": "Fit to frame",
|
|
2621
|
-
children: /* @__PURE__ */ jsx8(MdFitScreen2, { className: "gtv-icon", size: 18 })
|
|
2622
|
-
}
|
|
2623
|
-
)
|
|
2624
|
-
] })
|
|
2681
|
+
panZoom,
|
|
2682
|
+
orientation: controlsOrientation,
|
|
2683
|
+
zoomControls: showZoomControls,
|
|
2684
|
+
leading: floatingControlsLeading,
|
|
2685
|
+
busy,
|
|
2686
|
+
onFit: () => panZoom.fitToFrame([
|
|
2687
|
+
wheelCircleRef.current,
|
|
2688
|
+
...queryTreeContentElements(treeAnchorRef.current)
|
|
2689
|
+
])
|
|
2625
2690
|
}
|
|
2626
2691
|
)
|
|
2627
2692
|
]
|
|
@@ -2630,37 +2695,50 @@ function WheelCore({
|
|
|
2630
2695
|
}
|
|
2631
2696
|
|
|
2632
2697
|
// src/GenreTreeWheel.tsx
|
|
2633
|
-
import { jsx as
|
|
2698
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2634
2699
|
function GenreTreeWheel(props) {
|
|
2635
|
-
return /* @__PURE__ */
|
|
2700
|
+
return /* @__PURE__ */ jsx11(WheelCore, { ...props, direction: "bottom" });
|
|
2636
2701
|
}
|
|
2637
2702
|
|
|
2638
2703
|
// src/GenreTreeWheelRight.tsx
|
|
2639
|
-
import { jsx as
|
|
2704
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2640
2705
|
function GenreTreeWheelRight(props) {
|
|
2641
|
-
return /* @__PURE__ */
|
|
2706
|
+
return /* @__PURE__ */ jsx12(WheelCore, { ...props, direction: "left" });
|
|
2642
2707
|
}
|
|
2643
2708
|
|
|
2644
2709
|
// src/GenreTreeWheelRadialBase.tsx
|
|
2645
|
-
import { useCallback as useCallback3, useEffect as useEffect7, useMemo as useMemo4, useRef as useRef7, useState as
|
|
2646
|
-
import { MdFitScreen as MdFitScreen3, MdZoomIn as MdZoomIn4, MdZoomOut as MdZoomOut3 } from "react-icons/md";
|
|
2710
|
+
import { useCallback as useCallback3, useEffect as useEffect7, useMemo as useMemo4, useRef as useRef7, useState as useState7 } from "react";
|
|
2647
2711
|
import * as d33 from "d3";
|
|
2648
2712
|
|
|
2649
2713
|
// src/defer-click.ts
|
|
2650
2714
|
function createDeferredClick() {
|
|
2651
2715
|
let timeoutId = null;
|
|
2716
|
+
let pendingKey = void 0;
|
|
2717
|
+
let doubledAt = -Infinity;
|
|
2652
2718
|
const cancel = () => {
|
|
2653
2719
|
if (timeoutId !== null) clearTimeout(timeoutId);
|
|
2654
2720
|
timeoutId = null;
|
|
2655
2721
|
};
|
|
2656
|
-
const schedule = (action) => {
|
|
2722
|
+
const schedule = (action, onDouble, key) => {
|
|
2723
|
+
if (onDouble && timeoutId !== null && key === pendingKey) {
|
|
2724
|
+
cancel();
|
|
2725
|
+
doubledAt = Date.now();
|
|
2726
|
+
onDouble();
|
|
2727
|
+
return;
|
|
2728
|
+
}
|
|
2657
2729
|
cancel();
|
|
2730
|
+
pendingKey = key;
|
|
2658
2731
|
timeoutId = setTimeout(() => {
|
|
2659
2732
|
timeoutId = null;
|
|
2660
2733
|
action();
|
|
2661
2734
|
}, DOUBLE_CLICK_DELAY_MS);
|
|
2662
2735
|
};
|
|
2663
|
-
|
|
2736
|
+
const doubleClick = (onDouble) => {
|
|
2737
|
+
cancel();
|
|
2738
|
+
if (Date.now() - doubledAt < DOUBLE_CLICK_DELAY_MS) return;
|
|
2739
|
+
onDouble();
|
|
2740
|
+
};
|
|
2741
|
+
return { schedule, cancel, doubleClick };
|
|
2664
2742
|
}
|
|
2665
2743
|
|
|
2666
2744
|
// src/radial-wheel-geometry.ts
|
|
@@ -2827,6 +2905,7 @@ function pickEmptyLabelSpot(area, width, height, obstacles, prefer = () => true)
|
|
|
2827
2905
|
var POP_WEDGE_SPAN_DEGREES = 80;
|
|
2828
2906
|
var POP_SUBTREE_OUTER_MARGIN = 24;
|
|
2829
2907
|
var POP_HIERARCHY_ROOT_ABSOLUTE_DEPTH = 1;
|
|
2908
|
+
var DOT_RADIUS_TRANSITION_MS = 250;
|
|
2830
2909
|
function getRadialDepthRadius(depth, coreRootCircleRadius, depthSpacing) {
|
|
2831
2910
|
return coreRootCircleRadius + depth * depthSpacing;
|
|
2832
2911
|
}
|
|
@@ -2849,14 +2928,15 @@ function calculatePopSubtreeRadialExtent(hierarchy, coreRootCircleRadius = 0) {
|
|
|
2849
2928
|
POP_TREE_DEPTH_RADIAL_SPACING
|
|
2850
2929
|
) + MAX_NODE_WIDTH / 2 + POP_SUBTREE_OUTER_MARGIN;
|
|
2851
2930
|
}
|
|
2852
|
-
function computePopRadialLayout(d3Lib, hierarchy, wedgeCenterAngleDegrees, coreRootCircleRadius, wedgeSpanDegrees = POP_WEDGE_SPAN_DEGREES, depthSpacing = POP_TREE_DEPTH_RADIAL_SPACING,
|
|
2931
|
+
function computePopRadialLayout(d3Lib, hierarchy, wedgeCenterAngleDegrees, coreRootCircleRadius, wedgeSpanDegrees = POP_WEDGE_SPAN_DEGREES, depthSpacing = POP_TREE_DEPTH_RADIAL_SPACING, dotRadius = NODE_LAYOUT_SLOT_RADIUS) {
|
|
2853
2932
|
return layoutWedge(
|
|
2854
2933
|
d3Lib,
|
|
2855
2934
|
hierarchy,
|
|
2856
2935
|
wedgeCenterAngleDegrees,
|
|
2857
2936
|
wedgeSpanDegrees,
|
|
2858
2937
|
popRadiusOfDepth(coreRootCircleRadius, depthSpacing),
|
|
2859
|
-
|
|
2938
|
+
"center",
|
|
2939
|
+
dotRadius
|
|
2860
2940
|
);
|
|
2861
2941
|
}
|
|
2862
2942
|
var MIN_DOT_GAP = 5.6;
|
|
@@ -2866,15 +2946,15 @@ function popRadiusOfDepth(coreRootCircleRadius, depthSpacing) {
|
|
|
2866
2946
|
function coreRadiusOfDepth(coreRootCircleRadius, depthSpacing) {
|
|
2867
2947
|
return (depth) => getRadialDepthRadius(depth + 1, coreRootCircleRadius, depthSpacing);
|
|
2868
2948
|
}
|
|
2869
|
-
function measureWedge(_d3Lib, hierarchy, radiusOfDepth,
|
|
2870
|
-
const
|
|
2949
|
+
function measureWedge(_d3Lib, hierarchy, radiusOfDepth, dotRadius = NODE_LAYOUT_SLOT_RADIUS) {
|
|
2950
|
+
const slotRadius = () => dotRadius;
|
|
2871
2951
|
const offsetFromParent = /* @__PURE__ */ new Map();
|
|
2872
2952
|
const shiftLevel = (level, by) => ({
|
|
2873
2953
|
left: { ...level.left, x: level.left.x + by },
|
|
2874
2954
|
right: { ...level.right, x: level.right.x + by }
|
|
2875
2955
|
});
|
|
2876
2956
|
const pack = (node) => {
|
|
2877
|
-
const own = { x: 0, dotRadius:
|
|
2957
|
+
const own = { x: 0, dotRadius: slotRadius() };
|
|
2878
2958
|
if (!node.children) return [{ left: own, right: own }];
|
|
2879
2959
|
const below = [];
|
|
2880
2960
|
const childOffsets = [];
|
|
@@ -2906,7 +2986,7 @@ function measureWedge(_d3Lib, hierarchy, radiusOfDepth, itemCountRange) {
|
|
|
2906
2986
|
let min = Infinity;
|
|
2907
2987
|
let max = -Infinity;
|
|
2908
2988
|
hierarchy.each((d) => {
|
|
2909
|
-
const inset = (
|
|
2989
|
+
const inset = (slotRadius() + MIN_DOT_GAP / 2) / radiusOfDepth(d.depth);
|
|
2910
2990
|
min = Math.min(min, d.x - inset);
|
|
2911
2991
|
max = Math.max(max, d.x + inset);
|
|
2912
2992
|
});
|
|
@@ -2916,13 +2996,44 @@ function measureWedge(_d3Lib, hierarchy, radiusOfDepth, itemCountRange) {
|
|
|
2916
2996
|
return max - min;
|
|
2917
2997
|
}
|
|
2918
2998
|
var MAX_WEDGE_STRETCH = 1.42;
|
|
2919
|
-
function
|
|
2920
|
-
|
|
2999
|
+
function splitAtBranching(hierarchy) {
|
|
3000
|
+
let branching = hierarchy;
|
|
3001
|
+
const chain = [];
|
|
3002
|
+
while (branching.children?.length === 1) {
|
|
3003
|
+
chain.push(branching);
|
|
3004
|
+
branching = branching.children[0];
|
|
3005
|
+
}
|
|
3006
|
+
const children = branching.children;
|
|
3007
|
+
return children && children.length > 1 ? { chain, branching, children } : null;
|
|
3008
|
+
}
|
|
3009
|
+
function layoutWedge(d3Lib, hierarchy, wedgeCenterAngleDegrees, wedgeSpanDegrees, radiusOfDepth, slack = "center", dotRadius = NODE_LAYOUT_SLOT_RADIUS) {
|
|
3010
|
+
const neededRad = measureWedge(d3Lib, hierarchy, radiusOfDepth, dotRadius);
|
|
2921
3011
|
const wedgeSpanRad = wedgeSpanDegrees * Math.PI / 180;
|
|
2922
3012
|
const scale = Math.min(MAX_WEDGE_STRETCH, wedgeSpanRad / neededRad);
|
|
2923
|
-
const
|
|
3013
|
+
const wedgeCenterRad = wedgeCenterAngleDegrees * Math.PI / 180;
|
|
3014
|
+
const centeredStartRad = wedgeCenterRad - neededRad * scale / 2;
|
|
3015
|
+
const branchingSplit = slack === "between-children" ? splitAtBranching(hierarchy) : null;
|
|
3016
|
+
if (!branchingSplit) {
|
|
3017
|
+
hierarchy.each((d) => {
|
|
3018
|
+
const angleRad = centeredStartRad + d.x * scale;
|
|
3019
|
+
const radius = radiusOfDepth(d.depth);
|
|
3020
|
+
d.x = radius * Math.sin(angleRad);
|
|
3021
|
+
d.y = -radius * Math.cos(angleRad);
|
|
3022
|
+
});
|
|
3023
|
+
return hierarchy;
|
|
3024
|
+
}
|
|
3025
|
+
const { chain, branching, children } = branchingSplit;
|
|
3026
|
+
const gap = Math.max(0, wedgeSpanRad - neededRad * scale) / (children.length - 1);
|
|
3027
|
+
const wedgeStartRad = wedgeCenterRad - wedgeSpanRad / 2;
|
|
3028
|
+
const angleOffsetRad = /* @__PURE__ */ new Map();
|
|
3029
|
+
hierarchy.each((d) => angleOffsetRad.set(d, d.x * scale));
|
|
3030
|
+
children.forEach((child, i) => {
|
|
3031
|
+
child.each((d) => angleOffsetRad.set(d, angleOffsetRad.get(d) + i * gap));
|
|
3032
|
+
});
|
|
3033
|
+
const recenter = gap * (children.length - 1) / 2;
|
|
3034
|
+
[...chain, branching].forEach((d) => angleOffsetRad.set(d, angleOffsetRad.get(d) + recenter));
|
|
2924
3035
|
hierarchy.each((d) => {
|
|
2925
|
-
const angleRad = wedgeStartRad + d
|
|
3036
|
+
const angleRad = wedgeStartRad + angleOffsetRad.get(d);
|
|
2926
3037
|
const radius = radiusOfDepth(d.depth);
|
|
2927
3038
|
d.x = radius * Math.sin(angleRad);
|
|
2928
3039
|
d.y = -radius * Math.cos(angleRad);
|
|
@@ -3009,7 +3120,8 @@ function renderPopSubtree(d3Lib, svg, hierarchy, rootColor, reparentingNodeId, r
|
|
|
3009
3120
|
rootLinkOrigin,
|
|
3010
3121
|
isMainstreamSector = false,
|
|
3011
3122
|
selectedNodeId = null,
|
|
3012
|
-
nodeFillOf
|
|
3123
|
+
nodeFillOf,
|
|
3124
|
+
dotRadiusMemory
|
|
3013
3125
|
} = options;
|
|
3014
3126
|
const { onReparentTargetSelect, onNodeClick, onNodeDoubleClick, onNodeHover } = callbacks;
|
|
3015
3127
|
const isForbidden = (d) => reparentForbiddenIds.includes(d.data.id);
|
|
@@ -3072,13 +3184,18 @@ function renderPopSubtree(d3Lib, svg, hierarchy, rootColor, reparentingNodeId, r
|
|
|
3072
3184
|
);
|
|
3073
3185
|
d3Lib.select(this).attr("x", hitArea.x0).attr("y", hitArea.y0).attr("width", hitArea.x1 - hitArea.x0).attr("height", hitArea.y1 - hitArea.y0);
|
|
3074
3186
|
}).attr("fill", "transparent").attr("pointer-events", "all");
|
|
3075
|
-
|
|
3187
|
+
const targetDotRadius = (d) => calculateNodeDotRadius(d.data.itemCount, itemCountRange);
|
|
3188
|
+
const animateDots = dotRadiusMemory !== void 0 && !(typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches);
|
|
3189
|
+
const startDotRadius = (d) => (animateDots ? dotRadiusMemory?.get(d.data.id) : void 0) ?? targetDotRadius(d);
|
|
3190
|
+
nodes.append("circle").attr("class", "gtv-node-dot").attr("r", startDotRadius).attr("fill", nodeFill).attr(
|
|
3076
3191
|
"stroke",
|
|
3077
3192
|
(d) => isSelected(d) ? ACCENT_COLOR : isMainstreamSector ? TEXT_COLOR : SURFACE_BORDER_COLOR
|
|
3078
3193
|
).attr(
|
|
3079
3194
|
"stroke-width",
|
|
3080
3195
|
(d) => isSelected(d) ? calculateSelectedNodeBorderWidth(calculateNodeDotRadius(d.data.itemCount, itemCountRange)) : calculateNodeBorderWidth(d.data.itemCount, itemCountRange)
|
|
3081
|
-
).style("pointer-events", "none");
|
|
3196
|
+
).style("pointer-events", "none").filter((d) => startDotRadius(d) !== targetDotRadius(d)).transition().duration(DOT_RADIUS_TRANSITION_MS).ease(d3Lib.easeCubicOut).attr("r", targetDotRadius);
|
|
3197
|
+
nodes.each((d) => dotRadiusMemory?.set(d.data.id, targetDotRadius(d)));
|
|
3198
|
+
nodes.sort((a, b) => targetDotRadius(b) - targetDotRadius(a));
|
|
3082
3199
|
nodes.append("text").attr(
|
|
3083
3200
|
"class",
|
|
3084
3201
|
"gtv-node-label"
|
|
@@ -3119,12 +3236,12 @@ function renderPopSubtree(d3Lib, svg, hierarchy, rootColor, reparentingNodeId, r
|
|
|
3119
3236
|
group.on("click", (event) => {
|
|
3120
3237
|
if (reparentingNodeId) return;
|
|
3121
3238
|
const element = event.currentTarget;
|
|
3122
|
-
deferredClick.schedule(
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
onNodeDoubleClick?.(d.data);
|
|
3239
|
+
deferredClick.schedule(
|
|
3240
|
+
() => onNodeClick?.(d.data, event, element),
|
|
3241
|
+
() => onNodeDoubleClick?.(d.data)
|
|
3242
|
+
);
|
|
3127
3243
|
});
|
|
3244
|
+
group.on("dblclick", () => deferredClick.doubleClick(() => onNodeDoubleClick?.(d.data)));
|
|
3128
3245
|
});
|
|
3129
3246
|
}
|
|
3130
3247
|
function hideCollidingLabels(d3Lib, container, itemCountRange, zoomScale) {
|
|
@@ -3201,14 +3318,15 @@ function buildCoreHierarchy(d3Lib, coreNodes) {
|
|
|
3201
3318
|
});
|
|
3202
3319
|
return hierarchy;
|
|
3203
3320
|
}
|
|
3204
|
-
function computeCoreRadialLayout(d3Lib, hierarchy, wedgeCenterAngleDegrees, wedgeSpanDegrees, coreRootCircleRadius, depthSpacing,
|
|
3321
|
+
function computeCoreRadialLayout(d3Lib, hierarchy, wedgeCenterAngleDegrees, wedgeSpanDegrees, coreRootCircleRadius, depthSpacing, dotRadius = NODE_LAYOUT_SLOT_RADIUS) {
|
|
3205
3322
|
return layoutWedge(
|
|
3206
3323
|
d3Lib,
|
|
3207
3324
|
hierarchy,
|
|
3208
3325
|
wedgeCenterAngleDegrees,
|
|
3209
3326
|
wedgeSpanDegrees,
|
|
3210
3327
|
coreRadiusOfDepth(coreRootCircleRadius, depthSpacing),
|
|
3211
|
-
|
|
3328
|
+
"between-children",
|
|
3329
|
+
dotRadius
|
|
3212
3330
|
);
|
|
3213
3331
|
}
|
|
3214
3332
|
function calculateCoreSubtreeRadialExtent(hierarchy, depthSpacing, coreRootCircleRadius = 0) {
|
|
@@ -3248,7 +3366,7 @@ function splitRootGroupBySide(group) {
|
|
|
3248
3366
|
}
|
|
3249
3367
|
|
|
3250
3368
|
// src/GenreTreeWheelRadialBase.tsx
|
|
3251
|
-
import { jsx as
|
|
3369
|
+
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3252
3370
|
var LANDING_ANGLE = 90;
|
|
3253
3371
|
function computeContinuousAngles(groups, layout, previous) {
|
|
3254
3372
|
const angles = /* @__PURE__ */ new Map();
|
|
@@ -3282,11 +3400,9 @@ function WheelRadialCore({
|
|
|
3282
3400
|
hideInfoPanelClose = false,
|
|
3283
3401
|
hideInfoPanelTitle = false,
|
|
3284
3402
|
itemCountLabel,
|
|
3403
|
+
itemCountScaleMax,
|
|
3404
|
+
nodeCountForSizing,
|
|
3285
3405
|
readOnly,
|
|
3286
|
-
editMode,
|
|
3287
|
-
onEditModeChange,
|
|
3288
|
-
renderTitleEditor,
|
|
3289
|
-
renderParentsEditor,
|
|
3290
3406
|
renderDangerZone,
|
|
3291
3407
|
expanded,
|
|
3292
3408
|
onExpandedChange,
|
|
@@ -3297,12 +3413,16 @@ function WheelRadialCore({
|
|
|
3297
3413
|
defaultViewport,
|
|
3298
3414
|
onViewportChange,
|
|
3299
3415
|
controlsOrientation = "vertical",
|
|
3416
|
+
showZoomControls = "auto",
|
|
3417
|
+
floatingControlsLeading,
|
|
3418
|
+
busy,
|
|
3300
3419
|
selectedNodeId
|
|
3301
3420
|
}) {
|
|
3421
|
+
const fullNodeCountForSizing = nodeCountForSizing ?? nodes.length;
|
|
3302
3422
|
const index = useTreeIndex(nodes);
|
|
3303
3423
|
const groups = useMemo4(() => groupNodesByRoot(nodes), [nodes]);
|
|
3304
3424
|
const rootColorOf = (node) => getGenreTreeColor(index.byId.get(index.rootIdById.get(node.id) ?? node.id)?.wikidataId);
|
|
3305
|
-
const [topRootId, setTopRootId] =
|
|
3425
|
+
const [topRootId, setTopRootId] = useState7(
|
|
3306
3426
|
groups[0]?.root.id ?? null
|
|
3307
3427
|
);
|
|
3308
3428
|
const viewportRef = useRef7(null);
|
|
@@ -3332,7 +3452,7 @@ function WheelRadialCore({
|
|
|
3332
3452
|
() => computeRadialLayout(rootWeights, topIndex, LANDING_ANGLE),
|
|
3333
3453
|
[rootWeights, topIndex]
|
|
3334
3454
|
);
|
|
3335
|
-
const [angleMemo, setAngleMemo] =
|
|
3455
|
+
const [angleMemo, setAngleMemo] = useState7(() => ({
|
|
3336
3456
|
layout,
|
|
3337
3457
|
angles: computeContinuousAngles(groups, layout, /* @__PURE__ */ new Map())
|
|
3338
3458
|
}));
|
|
@@ -3351,11 +3471,15 @@ function WheelRadialCore({
|
|
|
3351
3471
|
() => getItemCountRange(
|
|
3352
3472
|
groups.map((group) => ({
|
|
3353
3473
|
itemCount: rootItemCountById.get(group.root.id)
|
|
3354
|
-
}))
|
|
3474
|
+
})),
|
|
3475
|
+
{ itemCountScaleMax, nodeCountForSizing: fullNodeCountForSizing }
|
|
3355
3476
|
),
|
|
3356
|
-
[groups, rootItemCountById]
|
|
3477
|
+
[groups, rootItemCountById, itemCountScaleMax, fullNodeCountForSizing]
|
|
3478
|
+
);
|
|
3479
|
+
const wheelItemCountRange = useMemo4(
|
|
3480
|
+
() => getItemCountRange(nodes, { itemCountScaleMax, nodeCountForSizing: fullNodeCountForSizing }),
|
|
3481
|
+
[nodes, itemCountScaleMax, fullNodeCountForSizing]
|
|
3357
3482
|
);
|
|
3358
|
-
const wheelItemCountRange = useMemo4(() => getItemCountRange(nodes), [nodes]);
|
|
3359
3483
|
const sectorSpanByRootId = useMemo4(() => {
|
|
3360
3484
|
const map = /* @__PURE__ */ new Map();
|
|
3361
3485
|
if (groups.length <= 1) return map;
|
|
@@ -3405,10 +3529,10 @@ function WheelRadialCore({
|
|
|
3405
3529
|
const chipClearanceFloor = useMemo4(
|
|
3406
3530
|
() => calculateWheelRadiusForAngles(
|
|
3407
3531
|
layout.map((slot) => slot.angle),
|
|
3408
|
-
MAX_NODE_WIDTH,
|
|
3532
|
+
wheelItemCountRange.maxNodeWidth ?? MAX_NODE_WIDTH,
|
|
3409
3533
|
WHEEL_RADIUS
|
|
3410
3534
|
),
|
|
3411
|
-
[layout]
|
|
3535
|
+
[layout, wheelItemCountRange.maxNodeWidth]
|
|
3412
3536
|
);
|
|
3413
3537
|
const maxCoreExtentDelta = useMemo4(() => {
|
|
3414
3538
|
let extent = 0;
|
|
@@ -3455,8 +3579,7 @@ function WheelRadialCore({
|
|
|
3455
3579
|
angle,
|
|
3456
3580
|
span,
|
|
3457
3581
|
wheelRadius,
|
|
3458
|
-
POP_TREE_DEPTH_RADIAL_SPACING
|
|
3459
|
-
wheelItemCountRange
|
|
3582
|
+
POP_TREE_DEPTH_RADIAL_SPACING
|
|
3460
3583
|
);
|
|
3461
3584
|
const reparentForbiddenIds = reparentingNodeId ? laidOut.descendants().find((d) => d.data.id === reparentingNodeId)?.descendants().map((d) => d.data.id) ?? [] : [];
|
|
3462
3585
|
const branchGroup = sectorGroup.append("g").attr("class", "gtv-wheel-core-branch").attr("data-gtv-branch-index", branchIndex);
|
|
@@ -3572,10 +3695,11 @@ function WheelRadialCore({
|
|
|
3572
3695
|
};
|
|
3573
3696
|
});
|
|
3574
3697
|
}, [groups, continuousAngleByRootId, sectorSpanByRootId]);
|
|
3575
|
-
return /* @__PURE__ */
|
|
3698
|
+
return /* @__PURE__ */ jsxs10(
|
|
3576
3699
|
"div",
|
|
3577
3700
|
{
|
|
3578
3701
|
ref: viewportRef,
|
|
3702
|
+
"aria-busy": busy,
|
|
3579
3703
|
className: [
|
|
3580
3704
|
"gtv-wheel-container",
|
|
3581
3705
|
"gtv-wheel-container--radial",
|
|
@@ -3589,7 +3713,7 @@ function WheelRadialCore({
|
|
|
3589
3713
|
},
|
|
3590
3714
|
onPointerDown: panZoom.handlePointerDown,
|
|
3591
3715
|
children: [
|
|
3592
|
-
/* @__PURE__ */
|
|
3716
|
+
/* @__PURE__ */ jsx13(
|
|
3593
3717
|
"div",
|
|
3594
3718
|
{
|
|
3595
3719
|
ref: stageRef,
|
|
@@ -3602,9 +3726,9 @@ function WheelRadialCore({
|
|
|
3602
3726
|
transform: panZoom.transform,
|
|
3603
3727
|
transformOrigin: "0 0"
|
|
3604
3728
|
},
|
|
3605
|
-
children: /* @__PURE__ */
|
|
3606
|
-
/* @__PURE__ */
|
|
3607
|
-
/* @__PURE__ */
|
|
3729
|
+
children: /* @__PURE__ */ jsxs10("div", { className: "gtv-wheel-stage", children: [
|
|
3730
|
+
/* @__PURE__ */ jsx13("div", { className: "gtv-wheel-circle", ref: wheelCircleRef }),
|
|
3731
|
+
/* @__PURE__ */ jsx13("div", { className: "gtv-wheel", children: sectorFills.map((sector) => /* @__PURE__ */ jsx13(
|
|
3608
3732
|
"div",
|
|
3609
3733
|
{
|
|
3610
3734
|
className: "gtv-wheel-sector",
|
|
@@ -3616,7 +3740,7 @@ function WheelRadialCore({
|
|
|
3616
3740
|
},
|
|
3617
3741
|
`sector-${sector.rootId}`
|
|
3618
3742
|
)) }),
|
|
3619
|
-
/* @__PURE__ */
|
|
3743
|
+
/* @__PURE__ */ jsx13(
|
|
3620
3744
|
"svg",
|
|
3621
3745
|
{
|
|
3622
3746
|
ref: coreSvgRef,
|
|
@@ -3625,9 +3749,9 @@ function WheelRadialCore({
|
|
|
3625
3749
|
height: wheelRadius * 2
|
|
3626
3750
|
}
|
|
3627
3751
|
),
|
|
3628
|
-
centerLabel && /* @__PURE__ */
|
|
3629
|
-
/* @__PURE__ */
|
|
3630
|
-
dividerAngles.map((angle, index2) => /* @__PURE__ */
|
|
3752
|
+
centerLabel && /* @__PURE__ */ jsx13("div", { className: "gtv-wheel-center-label", children: centerLabel }),
|
|
3753
|
+
/* @__PURE__ */ jsxs10("div", { className: "gtv-wheel", children: [
|
|
3754
|
+
dividerAngles.map((angle, index2) => /* @__PURE__ */ jsx13(
|
|
3631
3755
|
"div",
|
|
3632
3756
|
{
|
|
3633
3757
|
className: "gtv-wheel-divider",
|
|
@@ -3650,12 +3774,12 @@ function WheelRadialCore({
|
|
|
3650
3774
|
rootItemCount,
|
|
3651
3775
|
rootItemCountRange
|
|
3652
3776
|
);
|
|
3653
|
-
return /* @__PURE__ */
|
|
3777
|
+
return /* @__PURE__ */ jsx13(
|
|
3654
3778
|
"div",
|
|
3655
3779
|
{
|
|
3656
3780
|
className: "gtv-wheel-slot",
|
|
3657
3781
|
style: { "--gtv-chip-angle": `${angle}deg` },
|
|
3658
|
-
children: /* @__PURE__ */
|
|
3782
|
+
children: /* @__PURE__ */ jsx13("div", { className: "gtv-wheel-chip-anchor", children: /* @__PURE__ */ jsxs10(
|
|
3659
3783
|
"button",
|
|
3660
3784
|
{
|
|
3661
3785
|
type: "button",
|
|
@@ -3688,8 +3812,8 @@ function WheelRadialCore({
|
|
|
3688
3812
|
}
|
|
3689
3813
|
},
|
|
3690
3814
|
children: [
|
|
3691
|
-
PER_TREE_ACCENT_DOT && /* @__PURE__ */
|
|
3692
|
-
/* @__PURE__ */
|
|
3815
|
+
PER_TREE_ACCENT_DOT && /* @__PURE__ */ jsx13("span", { className: "gtv-wheel-chip-dot" }),
|
|
3816
|
+
/* @__PURE__ */ jsx13(
|
|
3693
3817
|
"span",
|
|
3694
3818
|
{
|
|
3695
3819
|
className: "gtv-node-label gtv-node-label--root",
|
|
@@ -3708,7 +3832,7 @@ function WheelRadialCore({
|
|
|
3708
3832
|
] })
|
|
3709
3833
|
}
|
|
3710
3834
|
),
|
|
3711
|
-
panel && /* @__PURE__ */
|
|
3835
|
+
panel && /* @__PURE__ */ jsx13(
|
|
3712
3836
|
InfoPanel,
|
|
3713
3837
|
{
|
|
3714
3838
|
node: panel.node,
|
|
@@ -3754,10 +3878,6 @@ function WheelRadialCore({
|
|
|
3754
3878
|
hideTitle: hideInfoPanelTitle,
|
|
3755
3879
|
itemCountLabel,
|
|
3756
3880
|
readOnly,
|
|
3757
|
-
editMode,
|
|
3758
|
-
onEditModeChange,
|
|
3759
|
-
renderTitleEditor,
|
|
3760
|
-
renderParentsEditor,
|
|
3761
3881
|
renderDangerZone,
|
|
3762
3882
|
expanded,
|
|
3763
3883
|
onExpandedChange,
|
|
@@ -3776,54 +3896,16 @@ function WheelRadialCore({
|
|
|
3776
3896
|
} : void 0
|
|
3777
3897
|
}
|
|
3778
3898
|
),
|
|
3779
|
-
overlayPanel && /* @__PURE__ */
|
|
3780
|
-
/* @__PURE__ */
|
|
3781
|
-
|
|
3899
|
+
overlayPanel && /* @__PURE__ */ jsx13(OverlayPanel, { ...overlayPanel }),
|
|
3900
|
+
/* @__PURE__ */ jsx13(
|
|
3901
|
+
FloatingControls,
|
|
3782
3902
|
{
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
"button",
|
|
3790
|
-
{
|
|
3791
|
-
type: "button",
|
|
3792
|
-
className: [
|
|
3793
|
-
"gtv-zoom-btn",
|
|
3794
|
-
!panZoom.canZoomIn && "gtv-zoom-btn--disabled"
|
|
3795
|
-
].filter(Boolean).join(" "),
|
|
3796
|
-
disabled: !panZoom.canZoomIn,
|
|
3797
|
-
onClick: panZoom.zoomIn,
|
|
3798
|
-
"aria-label": "Zoom in",
|
|
3799
|
-
children: /* @__PURE__ */ jsx11(MdZoomIn4, { className: "gtv-icon", size: 18 })
|
|
3800
|
-
}
|
|
3801
|
-
),
|
|
3802
|
-
/* @__PURE__ */ jsx11(
|
|
3803
|
-
"button",
|
|
3804
|
-
{
|
|
3805
|
-
type: "button",
|
|
3806
|
-
className: [
|
|
3807
|
-
"gtv-zoom-btn",
|
|
3808
|
-
!panZoom.canZoomOut && "gtv-zoom-btn--disabled"
|
|
3809
|
-
].filter(Boolean).join(" "),
|
|
3810
|
-
disabled: !panZoom.canZoomOut,
|
|
3811
|
-
onClick: panZoom.zoomOut,
|
|
3812
|
-
"aria-label": "Zoom out",
|
|
3813
|
-
children: /* @__PURE__ */ jsx11(MdZoomOut3, { className: "gtv-icon", size: 18 })
|
|
3814
|
-
}
|
|
3815
|
-
),
|
|
3816
|
-
/* @__PURE__ */ jsx11(
|
|
3817
|
-
"button",
|
|
3818
|
-
{
|
|
3819
|
-
type: "button",
|
|
3820
|
-
className: "gtv-zoom-btn",
|
|
3821
|
-
onClick: () => panZoom.fitToFrame([wheelCircleRef.current, coreSvgRef.current]),
|
|
3822
|
-
"aria-label": "Fit to frame",
|
|
3823
|
-
children: /* @__PURE__ */ jsx11(MdFitScreen3, { className: "gtv-icon", size: 18 })
|
|
3824
|
-
}
|
|
3825
|
-
)
|
|
3826
|
-
] })
|
|
3903
|
+
panZoom,
|
|
3904
|
+
orientation: controlsOrientation,
|
|
3905
|
+
zoomControls: showZoomControls,
|
|
3906
|
+
leading: floatingControlsLeading,
|
|
3907
|
+
busy,
|
|
3908
|
+
onFit: () => panZoom.fitToFrame([wheelCircleRef.current, coreSvgRef.current])
|
|
3827
3909
|
}
|
|
3828
3910
|
)
|
|
3829
3911
|
]
|
|
@@ -3832,20 +3914,19 @@ function WheelRadialCore({
|
|
|
3832
3914
|
}
|
|
3833
3915
|
|
|
3834
3916
|
// src/GenreTreeWheelRadial.tsx
|
|
3835
|
-
import { jsx as
|
|
3917
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
3836
3918
|
function GenreTreeWheelRadial(props) {
|
|
3837
|
-
return /* @__PURE__ */
|
|
3919
|
+
return /* @__PURE__ */ jsx14(WheelRadialCore, { ...props });
|
|
3838
3920
|
}
|
|
3839
3921
|
|
|
3840
3922
|
// src/GenreTreeWheelRadialPopCoreBase.tsx
|
|
3841
|
-
import { useCallback as useCallback4, useEffect as useEffect8, useMemo as useMemo5, useRef as useRef8, useState as
|
|
3842
|
-
import { MdFitScreen as MdFitScreen4, MdZoomIn as MdZoomIn5, MdZoomOut as MdZoomOut4 } from "react-icons/md";
|
|
3923
|
+
import { useCallback as useCallback4, useEffect as useEffect8, useMemo as useMemo5, useRef as useRef8, useState as useState10 } from "react";
|
|
3843
3924
|
import * as d34 from "d3";
|
|
3844
3925
|
|
|
3845
3926
|
// src/use-focus-history.ts
|
|
3846
|
-
import { useState as
|
|
3927
|
+
import { useState as useState8 } from "react";
|
|
3847
3928
|
function useFocusHistory(focusNodeId, isFocusable) {
|
|
3848
|
-
const [state, setState] =
|
|
3929
|
+
const [state, setState] = useState8({ seen: focusNodeId, stack: [], pending: void 0 });
|
|
3849
3930
|
if (state.seen !== focusNodeId) {
|
|
3850
3931
|
const popTo = state.pending === focusNodeId ? state.stack.lastIndexOf(focusNodeId) : -1;
|
|
3851
3932
|
setState({
|
|
@@ -3867,18 +3948,18 @@ function useFocusHistory(focusNodeId, isFocusable) {
|
|
|
3867
3948
|
}
|
|
3868
3949
|
|
|
3869
3950
|
// src/WheelBreadcrumb.tsx
|
|
3870
|
-
import { Fragment as Fragment3, useState as
|
|
3951
|
+
import { Fragment as Fragment3, useState as useState9 } from "react";
|
|
3871
3952
|
import { MdHome } from "react-icons/md";
|
|
3872
|
-
import { Fragment as Fragment4, jsx as
|
|
3953
|
+
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3873
3954
|
var MAX_VISIBLE_ANCESTORS = 3;
|
|
3874
3955
|
var ANCESTORS_KEPT_WHEN_COLLAPSED = 2;
|
|
3875
3956
|
function WheelBreadcrumb({ ancestors, currentName, onHome, onAncestor }) {
|
|
3876
|
-
const [expanded, setExpanded] =
|
|
3957
|
+
const [expanded, setExpanded] = useState9(false);
|
|
3877
3958
|
const collapsed = !expanded && ancestors.length > MAX_VISIBLE_ANCESTORS;
|
|
3878
3959
|
const visibleAncestors = collapsed ? ancestors.slice(-ANCESTORS_KEPT_WHEN_COLLAPSED) : ancestors;
|
|
3879
|
-
const separator = /* @__PURE__ */
|
|
3880
|
-
return /* @__PURE__ */
|
|
3881
|
-
/* @__PURE__ */
|
|
3960
|
+
const separator = /* @__PURE__ */ jsx15("span", { "aria-hidden": "true", children: "\u203A" });
|
|
3961
|
+
return /* @__PURE__ */ jsxs11("nav", { className: "gtv-wheel-breadcrumb", "aria-label": "Breadcrumb", children: [
|
|
3962
|
+
/* @__PURE__ */ jsx15(
|
|
3882
3963
|
"button",
|
|
3883
3964
|
{
|
|
3884
3965
|
type: "button",
|
|
@@ -3886,12 +3967,12 @@ function WheelBreadcrumb({ ancestors, currentName, onHome, onAncestor }) {
|
|
|
3886
3967
|
"aria-label": "All genres",
|
|
3887
3968
|
title: "All genres",
|
|
3888
3969
|
onClick: onHome,
|
|
3889
|
-
children: /* @__PURE__ */
|
|
3970
|
+
children: /* @__PURE__ */ jsx15(MdHome, { className: "gtv-icon", size: 14 })
|
|
3890
3971
|
}
|
|
3891
3972
|
),
|
|
3892
3973
|
separator,
|
|
3893
|
-
collapsed && /* @__PURE__ */
|
|
3894
|
-
/* @__PURE__ */
|
|
3974
|
+
collapsed && /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
3975
|
+
/* @__PURE__ */ jsx15(
|
|
3895
3976
|
"button",
|
|
3896
3977
|
{
|
|
3897
3978
|
type: "button",
|
|
@@ -3904,11 +3985,11 @@ function WheelBreadcrumb({ ancestors, currentName, onHome, onAncestor }) {
|
|
|
3904
3985
|
),
|
|
3905
3986
|
separator
|
|
3906
3987
|
] }),
|
|
3907
|
-
visibleAncestors.map((ancestor) => /* @__PURE__ */
|
|
3908
|
-
/* @__PURE__ */
|
|
3988
|
+
visibleAncestors.map((ancestor) => /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
3989
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: "gtv-wheel-breadcrumb-crumb", onClick: () => onAncestor(ancestor.id), children: ancestor.name }),
|
|
3909
3990
|
separator
|
|
3910
3991
|
] }, ancestor.id)),
|
|
3911
|
-
/* @__PURE__ */
|
|
3992
|
+
/* @__PURE__ */ jsx15("span", { className: "gtv-wheel-breadcrumb-current", "aria-current": "page", children: currentName })
|
|
3912
3993
|
] });
|
|
3913
3994
|
}
|
|
3914
3995
|
|
|
@@ -3969,7 +4050,7 @@ function resolvePopCoreFrame(nodes, focusNodeId) {
|
|
|
3969
4050
|
}
|
|
3970
4051
|
|
|
3971
4052
|
// src/GenreTreeWheelRadialPopCoreBase.tsx
|
|
3972
|
-
import { jsx as
|
|
4053
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3973
4054
|
var LANDING_ANGLE2 = 90;
|
|
3974
4055
|
var CHIP_GAP = 16;
|
|
3975
4056
|
var sum = (values) => values.reduce((total, value) => total + value, 0);
|
|
@@ -4005,11 +4086,9 @@ function WheelRadialPopCoreCore({
|
|
|
4005
4086
|
hideInfoPanelClose = false,
|
|
4006
4087
|
hideInfoPanelTitle = false,
|
|
4007
4088
|
itemCountLabel,
|
|
4089
|
+
itemCountScaleMax,
|
|
4090
|
+
nodeCountForSizing,
|
|
4008
4091
|
readOnly,
|
|
4009
|
-
editMode,
|
|
4010
|
-
onEditModeChange,
|
|
4011
|
-
renderTitleEditor,
|
|
4012
|
-
renderParentsEditor,
|
|
4013
4092
|
renderDangerZone,
|
|
4014
4093
|
expanded,
|
|
4015
4094
|
onExpandedChange,
|
|
@@ -4020,11 +4099,15 @@ function WheelRadialPopCoreCore({
|
|
|
4020
4099
|
defaultViewport,
|
|
4021
4100
|
onViewportChange,
|
|
4022
4101
|
controlsOrientation = "vertical",
|
|
4102
|
+
showZoomControls = "auto",
|
|
4103
|
+
floatingControlsLeading,
|
|
4104
|
+
busy,
|
|
4023
4105
|
allowWheelRotation = true,
|
|
4024
4106
|
selectedNodeId,
|
|
4025
4107
|
focusNodeId: requestedFocusNodeId = null,
|
|
4026
4108
|
onFocusChange
|
|
4027
4109
|
}) {
|
|
4110
|
+
const fullNodeCountForSizing = nodeCountForSizing ?? nodes.length;
|
|
4028
4111
|
const index = useTreeIndex(nodes);
|
|
4029
4112
|
const focusNodeId = useMemo5(
|
|
4030
4113
|
() => requestedFocusNodeId !== null && isZoomableNode(nodes, requestedFocusNodeId) ? requestedFocusNodeId : null,
|
|
@@ -4078,13 +4161,13 @@ function WheelRadialPopCoreCore({
|
|
|
4078
4161
|
(node) => getGenreNodeStyle(index, node.id),
|
|
4079
4162
|
[index]
|
|
4080
4163
|
);
|
|
4081
|
-
const [topRootId, setTopRootId] =
|
|
4164
|
+
const [topRootId, setTopRootId] = useState10(
|
|
4082
4165
|
groups[0]?.root.id ?? null
|
|
4083
4166
|
);
|
|
4084
|
-
const [rotationTopRootId, setRotationTopRootId] =
|
|
4167
|
+
const [rotationTopRootId, setRotationTopRootId] = useState10(
|
|
4085
4168
|
groups[0]?.root.id ?? null
|
|
4086
4169
|
);
|
|
4087
|
-
const [renderedFocusNodeId, setRenderedFocusNodeId] =
|
|
4170
|
+
const [renderedFocusNodeId, setRenderedFocusNodeId] = useState10(focusNodeId);
|
|
4088
4171
|
if (renderedFocusNodeId !== focusNodeId) {
|
|
4089
4172
|
setRenderedFocusNodeId(focusNodeId);
|
|
4090
4173
|
setTopRootId(groups[0]?.root.id ?? null);
|
|
@@ -4092,6 +4175,7 @@ function WheelRadialPopCoreCore({
|
|
|
4092
4175
|
}
|
|
4093
4176
|
const viewportRef = useRef8(null);
|
|
4094
4177
|
const stageRef = useRef8(null);
|
|
4178
|
+
const dotRadiusMemoryRef = useRef8(/* @__PURE__ */ new Map());
|
|
4095
4179
|
const panZoom = usePanZoom(viewportRef, wheelZoom, stageRef, { defaultViewport, onViewportChange });
|
|
4096
4180
|
const { panel: openPanel, showNodeInfo, closeNodeInfo } = useNodeInfoPanel({ selectedNodeId, onSelectedNodeChange });
|
|
4097
4181
|
const isInFrame = (id) => id === focusNodeId || centerSubtreeNodeIds.has(id) || ringRootById.has(id);
|
|
@@ -4146,7 +4230,7 @@ function WheelRadialPopCoreCore({
|
|
|
4146
4230
|
const popSvgRef = useRef8(null);
|
|
4147
4231
|
const centerChipRef = useRef8(null);
|
|
4148
4232
|
const regionLabelRef = useRef8(null);
|
|
4149
|
-
const [regionLabel, setRegionLabel] =
|
|
4233
|
+
const [regionLabel, setRegionLabel] = useState10(null);
|
|
4150
4234
|
const effectiveTopRootId = groups.some((group) => group.root.id === topRootId) ? topRootId : groups[0]?.root.id ?? null;
|
|
4151
4235
|
const effectiveRotationTopRootId = groups.some(
|
|
4152
4236
|
(group) => group.root.id === rotationTopRootId
|
|
@@ -4163,8 +4247,8 @@ function WheelRadialPopCoreCore({
|
|
|
4163
4247
|
() => getItemCountRange([
|
|
4164
4248
|
...nodes,
|
|
4165
4249
|
...[...rootItemCountById.values()].map((itemCount) => ({ itemCount }))
|
|
4166
|
-
]),
|
|
4167
|
-
[nodes, rootItemCountById]
|
|
4250
|
+
], { itemCountScaleMax, nodeCountForSizing: fullNodeCountForSizing }),
|
|
4251
|
+
[nodes, rootItemCountById, itemCountScaleMax, fullNodeCountForSizing]
|
|
4168
4252
|
);
|
|
4169
4253
|
const isCenterMainstream = isMainstreamPopLineage(index, centerNode.id);
|
|
4170
4254
|
const centerNodeColor = isCenterMainstream ? "#ffffff" : getGenreNodeStyle(index, centerNode.id).fill;
|
|
@@ -4198,8 +4282,8 @@ function WheelRadialPopCoreCore({
|
|
|
4198
4282
|
centerSubtreeHierarchy,
|
|
4199
4283
|
0,
|
|
4200
4284
|
POP_TREE_DEPTH_RADIAL_SPACING
|
|
4201
|
-
) :
|
|
4202
|
-
[centerSubtreeHierarchy,
|
|
4285
|
+
) : wheelItemCountRange.maxDotRadius ?? NODE_LAYOUT_SLOT_RADIUS,
|
|
4286
|
+
[centerSubtreeHierarchy, wheelItemCountRange.maxDotRadius]
|
|
4203
4287
|
);
|
|
4204
4288
|
const maxCoreExtentDelta = useMemo5(() => {
|
|
4205
4289
|
let extent = 0;
|
|
@@ -4207,11 +4291,7 @@ function WheelRadialPopCoreCore({
|
|
|
4207
4291
|
core.forEach((hierarchy) => {
|
|
4208
4292
|
extent = Math.max(
|
|
4209
4293
|
extent,
|
|
4210
|
-
calculateCoreSubtreeRadialExtent(
|
|
4211
|
-
hierarchy,
|
|
4212
|
-
POP_TREE_DEPTH_RADIAL_SPACING,
|
|
4213
|
-
0
|
|
4214
|
-
)
|
|
4294
|
+
calculateCoreSubtreeRadialExtent(hierarchy, POP_TREE_DEPTH_RADIAL_SPACING, 0)
|
|
4215
4295
|
);
|
|
4216
4296
|
});
|
|
4217
4297
|
});
|
|
@@ -4225,7 +4305,8 @@ function WheelRadialPopCoreCore({
|
|
|
4225
4305
|
(radius) => new Map(
|
|
4226
4306
|
groups.map((group) => {
|
|
4227
4307
|
const { pop, core } = branchHierarchiesByRootId.get(group.root.id);
|
|
4228
|
-
const
|
|
4308
|
+
const dotRadius = wheelItemCountRange.maxDotRadius ?? NODE_LAYOUT_SLOT_RADIUS;
|
|
4309
|
+
const chipWidth = 2 * dotRadius;
|
|
4229
4310
|
return [
|
|
4230
4311
|
group.root.id,
|
|
4231
4312
|
{
|
|
@@ -4234,7 +4315,7 @@ function WheelRadialPopCoreCore({
|
|
|
4234
4315
|
d34,
|
|
4235
4316
|
hierarchy,
|
|
4236
4317
|
popRadiusOfDepth(radius, POP_TREE_DEPTH_RADIAL_SPACING),
|
|
4237
|
-
|
|
4318
|
+
dotRadius
|
|
4238
4319
|
)
|
|
4239
4320
|
),
|
|
4240
4321
|
core: core.map(
|
|
@@ -4242,7 +4323,7 @@ function WheelRadialPopCoreCore({
|
|
|
4242
4323
|
d34,
|
|
4243
4324
|
hierarchy,
|
|
4244
4325
|
coreRadiusOfDepth(radius, POP_TREE_DEPTH_RADIAL_SPACING),
|
|
4245
|
-
|
|
4326
|
+
dotRadius
|
|
4246
4327
|
)
|
|
4247
4328
|
),
|
|
4248
4329
|
chip: 2 * Math.asin(Math.min(1, (chipWidth / 2 + CHIP_GAP) / radius))
|
|
@@ -4250,7 +4331,7 @@ function WheelRadialPopCoreCore({
|
|
|
4250
4331
|
];
|
|
4251
4332
|
})
|
|
4252
4333
|
),
|
|
4253
|
-
[groups, branchHierarchiesByRootId,
|
|
4334
|
+
[groups, branchHierarchiesByRootId, wheelItemCountRange.maxDotRadius]
|
|
4254
4335
|
);
|
|
4255
4336
|
const coreRootCircleRadius = useMemo5(
|
|
4256
4337
|
() => solveRingRadius(
|
|
@@ -4260,11 +4341,11 @@ function WheelRadialPopCoreCore({
|
|
|
4260
4341
|
),
|
|
4261
4342
|
Math.max(
|
|
4262
4343
|
WHEEL_POP_CORE_RADIUS,
|
|
4263
|
-
mainstreamCircleRadius + NODE_DOT_MAX_RADIUS + POP_SUBTREE_OUTER_MARGIN,
|
|
4344
|
+
mainstreamCircleRadius + (wheelItemCountRange.maxDotRadius ?? NODE_DOT_MAX_RADIUS) + POP_SUBTREE_OUTER_MARGIN,
|
|
4264
4345
|
popReachRequiredRadius
|
|
4265
4346
|
)
|
|
4266
4347
|
),
|
|
4267
|
-
[measureBranchNeedsAt, mainstreamCircleRadius, popReachRequiredRadius]
|
|
4348
|
+
[measureBranchNeedsAt, mainstreamCircleRadius, popReachRequiredRadius, wheelItemCountRange.maxDotRadius]
|
|
4268
4349
|
);
|
|
4269
4350
|
const branchNeedsByRootId = useMemo5(
|
|
4270
4351
|
() => measureBranchNeedsAt(coreRootCircleRadius),
|
|
@@ -4281,7 +4362,7 @@ function WheelRadialPopCoreCore({
|
|
|
4281
4362
|
() => computeRadialLayout(rootWeights, topIndex, LANDING_ANGLE2),
|
|
4282
4363
|
[rootWeights, topIndex]
|
|
4283
4364
|
);
|
|
4284
|
-
const [angleMemo, setAngleMemo] =
|
|
4365
|
+
const [angleMemo, setAngleMemo] = useState10(() => ({
|
|
4285
4366
|
layout,
|
|
4286
4367
|
angles: computeContinuousAngles2(groups, layout, /* @__PURE__ */ new Map())
|
|
4287
4368
|
}));
|
|
@@ -4369,7 +4450,7 @@ function WheelRadialPopCoreCore({
|
|
|
4369
4450
|
coreRootCircleRadius,
|
|
4370
4451
|
span,
|
|
4371
4452
|
POP_TREE_DEPTH_RADIAL_SPACING,
|
|
4372
|
-
wheelItemCountRange
|
|
4453
|
+
wheelItemCountRange.maxDotRadius ?? NODE_LAYOUT_SLOT_RADIUS
|
|
4373
4454
|
);
|
|
4374
4455
|
const reparentForbiddenIds = reparentingNodeId ? laidOut.descendants().find((d) => d.data.id === reparentingNodeId)?.descendants().map((d) => d.data.id) ?? [] : [];
|
|
4375
4456
|
const branchGroup = sectorGroup.append("g").attr("class", "gtv-wheel-pop-branch").attr("data-gtv-branch-index", branchIndex);
|
|
@@ -4413,6 +4494,7 @@ function WheelRadialPopCoreCore({
|
|
|
4413
4494
|
{
|
|
4414
4495
|
rootLinkOrigin,
|
|
4415
4496
|
selectedNodeId: panel?.node.id ?? null,
|
|
4497
|
+
dotRadiusMemory: dotRadiusMemoryRef.current,
|
|
4416
4498
|
nodeFillOf: (node) => getGenreNodeStyle(index, node.id).fill
|
|
4417
4499
|
}
|
|
4418
4500
|
);
|
|
@@ -4425,6 +4507,9 @@ function WheelRadialPopCoreCore({
|
|
|
4425
4507
|
);
|
|
4426
4508
|
const sectorGroup = originGroup.append("g").attr("class", "gtv-wheel-core-sector").attr("data-gtv-root-id", rootId);
|
|
4427
4509
|
branches.forEach(({ hierarchy, angle, span }, branchIndex) => {
|
|
4510
|
+
const undergroundIds = new Set(
|
|
4511
|
+
hierarchy.descendants().filter((d) => d.ancestors().some((a) => a.data.scene === "underground")).map((d) => d.data.id)
|
|
4512
|
+
);
|
|
4428
4513
|
const laidOut = computeCoreRadialLayout(
|
|
4429
4514
|
d34,
|
|
4430
4515
|
hierarchy,
|
|
@@ -4432,9 +4517,33 @@ function WheelRadialPopCoreCore({
|
|
|
4432
4517
|
span,
|
|
4433
4518
|
coreRootCircleRadius,
|
|
4434
4519
|
POP_TREE_DEPTH_RADIAL_SPACING,
|
|
4435
|
-
wheelItemCountRange
|
|
4520
|
+
wheelItemCountRange.maxDotRadius ?? NODE_LAYOUT_SLOT_RADIUS
|
|
4436
4521
|
);
|
|
4437
4522
|
const reparentForbiddenIds = reparentingNodeId ? laidOut.descendants().find((d) => d.data.id === reparentingNodeId)?.descendants().map((d) => d.data.id) ?? [] : [];
|
|
4523
|
+
const angleOf = (d) => {
|
|
4524
|
+
const deg = Math.atan2(d.x, -d.y) * 180 / Math.PI;
|
|
4525
|
+
return angle + ((deg - angle + 540) % 360 + 360) % 360 - 180;
|
|
4526
|
+
};
|
|
4527
|
+
const subtreeRange = (d) => {
|
|
4528
|
+
const angles = d.descendants().map(angleOf);
|
|
4529
|
+
return { min: Math.min(...angles), max: Math.max(...angles) };
|
|
4530
|
+
};
|
|
4531
|
+
laidOut.descendants().filter((d) => d.data.scene === "underground" && !d.ancestors().slice(1).some((a) => a.data.scene === "underground")).forEach((ug) => {
|
|
4532
|
+
const mine = subtreeRange(ug);
|
|
4533
|
+
const siblings = ug.parent?.children ?? [];
|
|
4534
|
+
const at = siblings.indexOf(ug);
|
|
4535
|
+
const prev = at > 0 ? siblings[at - 1] : void 0;
|
|
4536
|
+
const next = at >= 0 ? siblings[at + 1] : void 0;
|
|
4537
|
+
const startDeg = prev ? (subtreeRange(prev).max + mine.min) / 2 : angle - span / 2;
|
|
4538
|
+
const endDeg = next ? (mine.max + subtreeRange(next).min) / 2 : angle + span / 2;
|
|
4539
|
+
const arcPath = d34.arc()({
|
|
4540
|
+
innerRadius: coreRootCircleRadius,
|
|
4541
|
+
outerRadius: SCENE_SECTOR_OUTER_RADIUS,
|
|
4542
|
+
startAngle: startDeg * Math.PI / 180,
|
|
4543
|
+
endAngle: endDeg * Math.PI / 180
|
|
4544
|
+
});
|
|
4545
|
+
sectorGroup.append("path").attr("class", "gtv-wheel-scene-sector").attr("d", arcPath).attr("fill", shadeSurface(getGenreNodeColor(index, rootId), UNDERGROUND_DARKEN_RATIO)).attr("fill-opacity", UNDERGROUND_SECTOR_FILL_OPACITY);
|
|
4546
|
+
});
|
|
4438
4547
|
const branchGroup = sectorGroup.append("g").attr("class", "gtv-wheel-core-branch").attr("data-gtv-branch-index", branchIndex);
|
|
4439
4548
|
renderPopSubtree(
|
|
4440
4549
|
d34,
|
|
@@ -4477,7 +4586,11 @@ function WheelRadialPopCoreCore({
|
|
|
4477
4586
|
isCoreSector: true,
|
|
4478
4587
|
rootLinkOrigin,
|
|
4479
4588
|
selectedNodeId: panel?.node.id ?? null,
|
|
4480
|
-
|
|
4589
|
+
dotRadiusMemory: dotRadiusMemoryRef.current,
|
|
4590
|
+
nodeFillOf: (node) => {
|
|
4591
|
+
const fill = getGenreNodeStyle(index, node.id).fill;
|
|
4592
|
+
return undergroundIds.has(node.id) ? shadeSurface(fill, UNDERGROUND_DARKEN_RATIO) : fill;
|
|
4593
|
+
}
|
|
4481
4594
|
}
|
|
4482
4595
|
);
|
|
4483
4596
|
});
|
|
@@ -4532,6 +4645,7 @@ function WheelRadialPopCoreCore({
|
|
|
4532
4645
|
skipRootNode: true,
|
|
4533
4646
|
isMainstreamSector: isCenterMainstream,
|
|
4534
4647
|
selectedNodeId: panel?.node.id ?? null,
|
|
4648
|
+
dotRadiusMemory: dotRadiusMemoryRef.current,
|
|
4535
4649
|
nodeFillOf: (node) => getGenreNodeStyle(index, node.id).fill
|
|
4536
4650
|
}
|
|
4537
4651
|
);
|
|
@@ -4567,7 +4681,7 @@ function WheelRadialPopCoreCore({
|
|
|
4567
4681
|
originGroup.selectAll("g.gtv-root-label").select("text").style("pointer-events", "all").style("cursor", "pointer").on("click", (_event, d) => {
|
|
4568
4682
|
const chip = d.id === centerNode.id ? centerChipRef.current : viewportRef.current?.querySelector(`#group-${CSS.escape(d.id)}`);
|
|
4569
4683
|
chip?.click();
|
|
4570
|
-
}).on("dblclick", (_event, d) => focusOnNodeRef.current(d.id));
|
|
4684
|
+
}).on("dblclick", (_event, d) => chipClickRef.current.doubleClick(() => focusOnNodeRef.current(d.id)));
|
|
4571
4685
|
}, [
|
|
4572
4686
|
centerNode,
|
|
4573
4687
|
centerHasPopDisc,
|
|
@@ -4726,11 +4840,12 @@ function WheelRadialPopCoreCore({
|
|
|
4726
4840
|
)
|
|
4727
4841
|
};
|
|
4728
4842
|
});
|
|
4729
|
-
}, [groups, continuousAngleByRootId, sectorSpanByRootId]);
|
|
4730
|
-
return /* @__PURE__ */
|
|
4843
|
+
}, [groups, continuousAngleByRootId, sectorSpanByRootId, index]);
|
|
4844
|
+
return /* @__PURE__ */ jsxs12(
|
|
4731
4845
|
"div",
|
|
4732
4846
|
{
|
|
4733
4847
|
ref: viewportRef,
|
|
4848
|
+
"aria-busy": busy,
|
|
4734
4849
|
className: [
|
|
4735
4850
|
"gtv-wheel-container",
|
|
4736
4851
|
"gtv-wheel-container--radial",
|
|
@@ -4745,7 +4860,7 @@ function WheelRadialPopCoreCore({
|
|
|
4745
4860
|
},
|
|
4746
4861
|
onPointerDown: panZoom.handlePointerDown,
|
|
4747
4862
|
children: [
|
|
4748
|
-
/* @__PURE__ */
|
|
4863
|
+
/* @__PURE__ */ jsxs12(
|
|
4749
4864
|
"div",
|
|
4750
4865
|
{
|
|
4751
4866
|
ref: stageRef,
|
|
@@ -4759,9 +4874,9 @@ function WheelRadialPopCoreCore({
|
|
|
4759
4874
|
transformOrigin: "0 0"
|
|
4760
4875
|
},
|
|
4761
4876
|
children: [
|
|
4762
|
-
/* @__PURE__ */
|
|
4763
|
-
/* @__PURE__ */
|
|
4764
|
-
isPopExpanded && /* @__PURE__ */
|
|
4877
|
+
/* @__PURE__ */ jsxs12("div", { className: "gtv-wheel-stage", children: [
|
|
4878
|
+
/* @__PURE__ */ jsx16("div", { className: "gtv-wheel-circle", ref: wheelCircleRef }),
|
|
4879
|
+
isPopExpanded && /* @__PURE__ */ jsx16(
|
|
4765
4880
|
"div",
|
|
4766
4881
|
{
|
|
4767
4882
|
className: "gtv-wheel-middle-circle",
|
|
@@ -4770,8 +4885,8 @@ function WheelRadialPopCoreCore({
|
|
|
4770
4885
|
}
|
|
4771
4886
|
}
|
|
4772
4887
|
),
|
|
4773
|
-
/* @__PURE__ */
|
|
4774
|
-
sectorFills.map((sector) => /* @__PURE__ */
|
|
4888
|
+
/* @__PURE__ */ jsxs12("div", { className: "gtv-wheel", children: [
|
|
4889
|
+
sectorFills.map((sector) => /* @__PURE__ */ jsx16(
|
|
4775
4890
|
"div",
|
|
4776
4891
|
{
|
|
4777
4892
|
className: "gtv-wheel-sector",
|
|
@@ -4783,8 +4898,8 @@ function WheelRadialPopCoreCore({
|
|
|
4783
4898
|
},
|
|
4784
4899
|
`sector-${sector.rootId}`
|
|
4785
4900
|
)),
|
|
4786
|
-
/* @__PURE__ */
|
|
4787
|
-
isPopExpanded && /* @__PURE__ */
|
|
4901
|
+
/* @__PURE__ */ jsx16("div", { className: "gtv-wheel-inner-tint" }),
|
|
4902
|
+
isPopExpanded && /* @__PURE__ */ jsx16(
|
|
4788
4903
|
"div",
|
|
4789
4904
|
{
|
|
4790
4905
|
className: "gtv-wheel-middle-tint",
|
|
@@ -4794,7 +4909,7 @@ function WheelRadialPopCoreCore({
|
|
|
4794
4909
|
}
|
|
4795
4910
|
)
|
|
4796
4911
|
] }),
|
|
4797
|
-
/* @__PURE__ */
|
|
4912
|
+
/* @__PURE__ */ jsx16(
|
|
4798
4913
|
"svg",
|
|
4799
4914
|
{
|
|
4800
4915
|
ref: popSvgRef,
|
|
@@ -4803,7 +4918,7 @@ function WheelRadialPopCoreCore({
|
|
|
4803
4918
|
height: svgCanvasRadius * 2
|
|
4804
4919
|
}
|
|
4805
4920
|
),
|
|
4806
|
-
/* @__PURE__ */
|
|
4921
|
+
/* @__PURE__ */ jsx16("div", { className: "gtv-wheel-center-node", children: /* @__PURE__ */ jsx16("div", { className: "gtv-wheel-chip-anchor", children: /* @__PURE__ */ jsx16(
|
|
4807
4922
|
"button",
|
|
4808
4923
|
{
|
|
4809
4924
|
ref: centerChipRef,
|
|
@@ -4835,14 +4950,14 @@ function WheelRadialPopCoreCore({
|
|
|
4835
4950
|
showNodeInfo(centerNode, chip, viewportRef.current);
|
|
4836
4951
|
onNodeClick?.(centerNode, nativeEvent);
|
|
4837
4952
|
}
|
|
4838
|
-
});
|
|
4953
|
+
}, () => focusOnNode(centerNode.id), centerNode.id);
|
|
4839
4954
|
},
|
|
4840
|
-
onDoubleClick: () => focusOnNode(centerNode.id),
|
|
4955
|
+
onDoubleClick: () => chipClickRef.current.doubleClick(() => focusOnNode(centerNode.id)),
|
|
4841
4956
|
"aria-label": centerNode.name
|
|
4842
4957
|
}
|
|
4843
4958
|
) }) }),
|
|
4844
|
-
/* @__PURE__ */
|
|
4845
|
-
dividerAngles.map((angle, index2) => /* @__PURE__ */
|
|
4959
|
+
/* @__PURE__ */ jsxs12("div", { className: "gtv-wheel", children: [
|
|
4960
|
+
dividerAngles.map((angle, index2) => /* @__PURE__ */ jsx16(
|
|
4846
4961
|
"div",
|
|
4847
4962
|
{
|
|
4848
4963
|
className: "gtv-wheel-divider",
|
|
@@ -4861,12 +4976,12 @@ function WheelRadialPopCoreCore({
|
|
|
4861
4976
|
group.root.id
|
|
4862
4977
|
);
|
|
4863
4978
|
const diameter = 2 * calculateNodeDotRadius(rootItemCount, wheelItemCountRange);
|
|
4864
|
-
return /* @__PURE__ */
|
|
4979
|
+
return /* @__PURE__ */ jsx16(
|
|
4865
4980
|
"div",
|
|
4866
4981
|
{
|
|
4867
4982
|
className: "gtv-wheel-slot",
|
|
4868
4983
|
style: { "--gtv-chip-angle": `${angle}deg` },
|
|
4869
|
-
children: /* @__PURE__ */
|
|
4984
|
+
children: /* @__PURE__ */ jsx16("div", { className: "gtv-wheel-chip-anchor", children: /* @__PURE__ */ jsx16(
|
|
4870
4985
|
"button",
|
|
4871
4986
|
{
|
|
4872
4987
|
type: "button",
|
|
@@ -4897,9 +5012,9 @@ function WheelRadialPopCoreCore({
|
|
|
4897
5012
|
showNodeInfo(root, chip, viewportRef.current);
|
|
4898
5013
|
onNodeClick?.(root, nativeEvent);
|
|
4899
5014
|
}
|
|
4900
|
-
});
|
|
5015
|
+
}, () => focusOnNode(group.root.id), group.root.id);
|
|
4901
5016
|
},
|
|
4902
|
-
onDoubleClick: () => focusOnNode(group.root.id)
|
|
5017
|
+
onDoubleClick: () => chipClickRef.current.doubleClick(() => focusOnNode(group.root.id))
|
|
4903
5018
|
}
|
|
4904
5019
|
) })
|
|
4905
5020
|
},
|
|
@@ -4908,7 +5023,7 @@ function WheelRadialPopCoreCore({
|
|
|
4908
5023
|
})
|
|
4909
5024
|
] })
|
|
4910
5025
|
] }),
|
|
4911
|
-
regionLabel && index.byId.has(regionLabel.rootId) && /* @__PURE__ */
|
|
5026
|
+
regionLabel && index.byId.has(regionLabel.rootId) && /* @__PURE__ */ jsx16(
|
|
4912
5027
|
"div",
|
|
4913
5028
|
{
|
|
4914
5029
|
ref: regionLabelRef,
|
|
@@ -4926,7 +5041,7 @@ function WheelRadialPopCoreCore({
|
|
|
4926
5041
|
]
|
|
4927
5042
|
}
|
|
4928
5043
|
),
|
|
4929
|
-
panel && /* @__PURE__ */
|
|
5044
|
+
panel && /* @__PURE__ */ jsx16(
|
|
4930
5045
|
InfoPanel,
|
|
4931
5046
|
{
|
|
4932
5047
|
node: panel.node,
|
|
@@ -4953,10 +5068,6 @@ function WheelRadialPopCoreCore({
|
|
|
4953
5068
|
hideTitle: hideInfoPanelTitle,
|
|
4954
5069
|
itemCountLabel,
|
|
4955
5070
|
readOnly,
|
|
4956
|
-
editMode,
|
|
4957
|
-
onEditModeChange,
|
|
4958
|
-
renderTitleEditor,
|
|
4959
|
-
renderParentsEditor,
|
|
4960
5071
|
renderDangerZone,
|
|
4961
5072
|
expanded,
|
|
4962
5073
|
onExpandedChange,
|
|
@@ -4976,8 +5087,8 @@ function WheelRadialPopCoreCore({
|
|
|
4976
5087
|
onZoomIn: onFocusChange && panel.node.id !== focusNodeId && isZoomableNode(nodes, panel.node.id) ? () => onFocusChange(panel.node.id, "zoom-in") : void 0
|
|
4977
5088
|
}
|
|
4978
5089
|
),
|
|
4979
|
-
overlayPanel && /* @__PURE__ */
|
|
4980
|
-
onFocusChange && focusNodeId !== null && /* @__PURE__ */
|
|
5090
|
+
overlayPanel && /* @__PURE__ */ jsx16(OverlayPanel, { ...overlayPanel }),
|
|
5091
|
+
onFocusChange && focusNodeId !== null && /* @__PURE__ */ jsx16(
|
|
4981
5092
|
WheelBreadcrumb,
|
|
4982
5093
|
{
|
|
4983
5094
|
ancestors: index.ancestorsOf(focusNodeId).filter((ancestor) => isZoomableNode(nodes, ancestor.id)),
|
|
@@ -4993,56 +5104,18 @@ function WheelRadialPopCoreCore({
|
|
|
4993
5104
|
},
|
|
4994
5105
|
focusNodeId
|
|
4995
5106
|
),
|
|
4996
|
-
/* @__PURE__ */
|
|
4997
|
-
|
|
5107
|
+
/* @__PURE__ */ jsx16(
|
|
5108
|
+
FloatingControls,
|
|
4998
5109
|
{
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
className: [
|
|
5009
|
-
"gtv-zoom-btn",
|
|
5010
|
-
!panZoom.canZoomIn && "gtv-zoom-btn--disabled"
|
|
5011
|
-
].filter(Boolean).join(" "),
|
|
5012
|
-
disabled: !panZoom.canZoomIn,
|
|
5013
|
-
onClick: panZoom.zoomIn,
|
|
5014
|
-
"aria-label": "Zoom in",
|
|
5015
|
-
children: /* @__PURE__ */ jsx14(MdZoomIn5, { className: "gtv-icon", size: 18 })
|
|
5016
|
-
}
|
|
5017
|
-
),
|
|
5018
|
-
/* @__PURE__ */ jsx14(
|
|
5019
|
-
"button",
|
|
5020
|
-
{
|
|
5021
|
-
type: "button",
|
|
5022
|
-
className: [
|
|
5023
|
-
"gtv-zoom-btn",
|
|
5024
|
-
!panZoom.canZoomOut && "gtv-zoom-btn--disabled"
|
|
5025
|
-
].filter(Boolean).join(" "),
|
|
5026
|
-
disabled: !panZoom.canZoomOut,
|
|
5027
|
-
onClick: panZoom.zoomOut,
|
|
5028
|
-
"aria-label": "Zoom out",
|
|
5029
|
-
children: /* @__PURE__ */ jsx14(MdZoomOut4, { className: "gtv-icon", size: 18 })
|
|
5030
|
-
}
|
|
5031
|
-
),
|
|
5032
|
-
/* @__PURE__ */ jsx14(
|
|
5033
|
-
"button",
|
|
5034
|
-
{
|
|
5035
|
-
type: "button",
|
|
5036
|
-
className: "gtv-zoom-btn",
|
|
5037
|
-
onClick: () => panZoom.fitToFrame([
|
|
5038
|
-
wheelCircleRef.current,
|
|
5039
|
-
...queryTreeContentElements(popSvgRef.current)
|
|
5040
|
-
]),
|
|
5041
|
-
"aria-label": "Fit to frame",
|
|
5042
|
-
children: /* @__PURE__ */ jsx14(MdFitScreen4, { className: "gtv-icon", size: 18 })
|
|
5043
|
-
}
|
|
5044
|
-
)
|
|
5045
|
-
] })
|
|
5110
|
+
panZoom,
|
|
5111
|
+
orientation: controlsOrientation,
|
|
5112
|
+
zoomControls: showZoomControls,
|
|
5113
|
+
leading: floatingControlsLeading,
|
|
5114
|
+
busy,
|
|
5115
|
+
onFit: () => panZoom.fitToFrame([
|
|
5116
|
+
wheelCircleRef.current,
|
|
5117
|
+
...queryTreeContentElements(popSvgRef.current)
|
|
5118
|
+
])
|
|
5046
5119
|
}
|
|
5047
5120
|
)
|
|
5048
5121
|
]
|
|
@@ -5051,9 +5124,9 @@ function WheelRadialPopCoreCore({
|
|
|
5051
5124
|
}
|
|
5052
5125
|
|
|
5053
5126
|
// src/GenreTreeWheelRadialPopCore.tsx
|
|
5054
|
-
import { jsx as
|
|
5127
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
5055
5128
|
function GenreTreeWheelRadialPopCore(props) {
|
|
5056
|
-
return /* @__PURE__ */
|
|
5129
|
+
return /* @__PURE__ */ jsx17(WheelRadialPopCoreCore, { ...props });
|
|
5057
5130
|
}
|
|
5058
5131
|
|
|
5059
5132
|
// src/GenreTreeOutline.tsx
|
|
@@ -5063,10 +5136,10 @@ import {
|
|
|
5063
5136
|
useEffect as useEffect9,
|
|
5064
5137
|
useMemo as useMemo6,
|
|
5065
5138
|
useRef as useRef9,
|
|
5066
|
-
useState as
|
|
5139
|
+
useState as useState11,
|
|
5067
5140
|
useSyncExternalStore
|
|
5068
5141
|
} from "react";
|
|
5069
|
-
import { Fragment as Fragment5, jsx as
|
|
5142
|
+
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5070
5143
|
function createOutlineStore(initial) {
|
|
5071
5144
|
let state = initial;
|
|
5072
5145
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -5140,9 +5213,9 @@ function OutlineNodeView({
|
|
|
5140
5213
|
const { itemCount } = node;
|
|
5141
5214
|
const children = model.index.childrenByParentId.get(nodeId) ?? [];
|
|
5142
5215
|
const split = isRoot ? model.ringSplitById.get(nodeId) : void 0;
|
|
5143
|
-
const row = /* @__PURE__ */
|
|
5144
|
-
/* @__PURE__ */
|
|
5145
|
-
/* @__PURE__ */
|
|
5216
|
+
const row = /* @__PURE__ */ jsxs13("span", { className: ["gtv-outline-row", isSelected && "gtv-outline-row--selected"].filter(Boolean).join(" "), children: [
|
|
5217
|
+
/* @__PURE__ */ jsx18("span", { className: "gtv-outline-dot", style: { background: model.styleOf(node).fill } }),
|
|
5218
|
+
/* @__PURE__ */ jsx18(
|
|
5146
5219
|
"button",
|
|
5147
5220
|
{
|
|
5148
5221
|
type: "button",
|
|
@@ -5159,16 +5232,16 @@ function OutlineNodeView({
|
|
|
5159
5232
|
children: node.name
|
|
5160
5233
|
}
|
|
5161
5234
|
),
|
|
5162
|
-
/* @__PURE__ */
|
|
5235
|
+
/* @__PURE__ */ jsx18("span", { className: "gtv-outline-count", children: itemCount })
|
|
5163
5236
|
] });
|
|
5164
5237
|
const itemProps = { model, store, callbacks };
|
|
5165
|
-
return /* @__PURE__ */
|
|
5166
|
-
/* @__PURE__ */
|
|
5167
|
-
isOpen && /* @__PURE__ */
|
|
5168
|
-
/* @__PURE__ */
|
|
5169
|
-
/* @__PURE__ */
|
|
5170
|
-
] }) : children.map((child) => /* @__PURE__ */
|
|
5171
|
-
] }) : /* @__PURE__ */
|
|
5238
|
+
return /* @__PURE__ */ jsx18("li", { className: "gtv-outline-item", "data-gtv-node-id": nodeId, children: children.length > 0 ? /* @__PURE__ */ jsxs13("details", { open: isOpen, children: [
|
|
5239
|
+
/* @__PURE__ */ jsx18("summary", { onClick: (event) => handleSummaryClick(event, () => callbacks.toggleOpen(nodeId)), children: row }),
|
|
5240
|
+
isOpen && /* @__PURE__ */ jsx18("ul", { className: "gtv-outline-list", children: split ? /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
5241
|
+
/* @__PURE__ */ jsx18(OutlineSection, { rootId: nodeId, kind: "core", branches: split.coreBranches, ...itemProps }),
|
|
5242
|
+
/* @__PURE__ */ jsx18(OutlineSection, { rootId: nodeId, kind: "pop", branches: split.popBranches, ...itemProps })
|
|
5243
|
+
] }) : children.map((child) => /* @__PURE__ */ jsx18(OutlineNode, { nodeId: child.id, isRoot: false, ...itemProps }, child.id)) })
|
|
5244
|
+
] }) : /* @__PURE__ */ jsx18("div", { className: "gtv-outline-leaf", children: row }) });
|
|
5172
5245
|
}
|
|
5173
5246
|
var OutlineNode = memo(OutlineNodeView);
|
|
5174
5247
|
var OutlineSection = memo(function OutlineSection2({
|
|
@@ -5182,9 +5255,9 @@ var OutlineSection = memo(function OutlineSection2({
|
|
|
5182
5255
|
const key = sectionKey(kind, rootId);
|
|
5183
5256
|
const isOpen = useOutlineState(store, (s) => s.openIds.has(key));
|
|
5184
5257
|
if (branches.length === 0) return null;
|
|
5185
|
-
return /* @__PURE__ */
|
|
5186
|
-
/* @__PURE__ */
|
|
5187
|
-
isOpen && /* @__PURE__ */
|
|
5258
|
+
return /* @__PURE__ */ jsx18("li", { className: "gtv-outline-item", children: /* @__PURE__ */ jsxs13("details", { open: isOpen, children: [
|
|
5259
|
+
/* @__PURE__ */ jsx18("summary", { onClick: (event) => handleSummaryClick(event, () => callbacks.toggleOpen(key)), children: /* @__PURE__ */ jsx18("span", { className: "gtv-outline-section-label", children: kind === "core" ? "Core" : "Pop" }) }),
|
|
5260
|
+
isOpen && /* @__PURE__ */ jsx18("ul", { className: "gtv-outline-list", children: branches.map(({ child }) => /* @__PURE__ */ jsx18(OutlineNode, { nodeId: child.id, isRoot: false, model, store, callbacks }, child.id)) })
|
|
5188
5261
|
] }) });
|
|
5189
5262
|
});
|
|
5190
5263
|
function GenreTreeOutline(props) {
|
|
@@ -5201,10 +5274,6 @@ function GenreTreeOutline(props) {
|
|
|
5201
5274
|
hideInfoPanelTitle = false,
|
|
5202
5275
|
itemCountLabel,
|
|
5203
5276
|
readOnly,
|
|
5204
|
-
editMode,
|
|
5205
|
-
onEditModeChange,
|
|
5206
|
-
renderTitleEditor,
|
|
5207
|
-
renderParentsEditor,
|
|
5208
5277
|
renderDangerZone,
|
|
5209
5278
|
expanded,
|
|
5210
5279
|
onExpandedChange,
|
|
@@ -5225,7 +5294,7 @@ function GenreTreeOutline(props) {
|
|
|
5225
5294
|
}
|
|
5226
5295
|
return ids;
|
|
5227
5296
|
}, [reparentingNodeId, index]);
|
|
5228
|
-
const [store] =
|
|
5297
|
+
const [store] = useState11(
|
|
5229
5298
|
() => createOutlineStore({
|
|
5230
5299
|
selectedId: null,
|
|
5231
5300
|
openIds: /* @__PURE__ */ new Set(),
|
|
@@ -5305,12 +5374,12 @@ function GenreTreeOutline(props) {
|
|
|
5305
5374
|
}, [selectedNodeId, store]);
|
|
5306
5375
|
const selectedNode = selectedId === null ? void 0 : index.byId.get(selectedId);
|
|
5307
5376
|
const itemProps = { model, store, callbacks };
|
|
5308
|
-
return /* @__PURE__ */
|
|
5309
|
-
/* @__PURE__ */
|
|
5310
|
-
/* @__PURE__ */
|
|
5311
|
-
model.detachedRoots.length > 0 && /* @__PURE__ */
|
|
5377
|
+
return /* @__PURE__ */ jsxs13("div", { className: ["gtv-outline", selectedNode && "gtv-outline--panel-open", className].filter(Boolean).join(" "), children: [
|
|
5378
|
+
/* @__PURE__ */ jsxs13("div", { className: "gtv-outline-scroll", ref: scrollRef, children: [
|
|
5379
|
+
/* @__PURE__ */ jsx18("ul", { className: "gtv-outline-list gtv-outline-list--roots", children: [model.centerRoot, ...model.ringRoots].map((root) => /* @__PURE__ */ jsx18(OutlineNode, { nodeId: root.id, isRoot: true, ...itemProps }, root.id)) }),
|
|
5380
|
+
model.detachedRoots.length > 0 && /* @__PURE__ */ jsx18("ul", { className: "gtv-outline-list gtv-outline-list--roots gtv-outline-list--detached", children: model.detachedRoots.map((root) => /* @__PURE__ */ jsx18(OutlineNode, { nodeId: root.id, isRoot: true, ...itemProps }, root.id)) })
|
|
5312
5381
|
] }),
|
|
5313
|
-
selectedNode && /* @__PURE__ */
|
|
5382
|
+
selectedNode && /* @__PURE__ */ jsx18(
|
|
5314
5383
|
InfoPanel,
|
|
5315
5384
|
{
|
|
5316
5385
|
node: selectedNode,
|
|
@@ -5331,10 +5400,6 @@ function GenreTreeOutline(props) {
|
|
|
5331
5400
|
hideTitle: hideInfoPanelTitle,
|
|
5332
5401
|
itemCountLabel,
|
|
5333
5402
|
readOnly,
|
|
5334
|
-
editMode,
|
|
5335
|
-
onEditModeChange,
|
|
5336
|
-
renderTitleEditor,
|
|
5337
|
-
renderParentsEditor,
|
|
5338
5403
|
renderDangerZone,
|
|
5339
5404
|
expanded,
|
|
5340
5405
|
onExpandedChange,
|
|
@@ -5353,13 +5418,13 @@ function GenreTreeOutline(props) {
|
|
|
5353
5418
|
} : void 0
|
|
5354
5419
|
}
|
|
5355
5420
|
),
|
|
5356
|
-
overlayPanel && /* @__PURE__ */
|
|
5421
|
+
overlayPanel && /* @__PURE__ */ jsx18(OverlayPanel, { ...overlayPanel })
|
|
5357
5422
|
] });
|
|
5358
5423
|
}
|
|
5359
5424
|
|
|
5360
5425
|
// src/GenreTreeSkeleton.tsx
|
|
5361
5426
|
import { useId } from "react";
|
|
5362
|
-
import { Fragment as Fragment6, jsx as
|
|
5427
|
+
import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5363
5428
|
var CARD_FILL = "#F4F4F5";
|
|
5364
5429
|
var CARD_BORDER_COLOR = "#E4E4E7";
|
|
5365
5430
|
var CONNECTOR_COLOR2 = "#D4D4D8";
|
|
@@ -5464,8 +5529,8 @@ function SkeletonCard({
|
|
|
5464
5529
|
card,
|
|
5465
5530
|
rootAccent
|
|
5466
5531
|
}) {
|
|
5467
|
-
return /* @__PURE__ */
|
|
5468
|
-
/* @__PURE__ */
|
|
5532
|
+
return /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
5533
|
+
/* @__PURE__ */ jsx19(
|
|
5469
5534
|
"rect",
|
|
5470
5535
|
{
|
|
5471
5536
|
x: card.x,
|
|
@@ -5479,7 +5544,7 @@ function SkeletonCard({
|
|
|
5479
5544
|
strokeWidth: rootAccent ? 1.5 : 1
|
|
5480
5545
|
}
|
|
5481
5546
|
),
|
|
5482
|
-
rootAccent && /* @__PURE__ */
|
|
5547
|
+
rootAccent && /* @__PURE__ */ jsx19(
|
|
5483
5548
|
"circle",
|
|
5484
5549
|
{
|
|
5485
5550
|
cx: card.x + 18,
|
|
@@ -5497,9 +5562,9 @@ function GenreTreeSkeleton() {
|
|
|
5497
5562
|
const animationName = `genre-tree-skeleton-sweep-${uid}`;
|
|
5498
5563
|
const shimmerBandClass = `genre-tree-skeleton-shimmer-band-${uid}`;
|
|
5499
5564
|
const sweepDistance = VIEWBOX_WIDTH + SHIMMER_BAND_WIDTH;
|
|
5500
|
-
return /* @__PURE__ */
|
|
5501
|
-
/* @__PURE__ */
|
|
5502
|
-
/* @__PURE__ */
|
|
5565
|
+
return /* @__PURE__ */ jsxs14("div", { className: "gtv-skeleton", children: [
|
|
5566
|
+
/* @__PURE__ */ jsx19("span", { className: "gtv-skeleton-sr-only", children: "Loading genre tree\u2026" }),
|
|
5567
|
+
/* @__PURE__ */ jsxs14(
|
|
5503
5568
|
"svg",
|
|
5504
5569
|
{
|
|
5505
5570
|
viewBox: `0 0 ${VIEWBOX_WIDTH} ${VIEWBOX_HEIGHT}`,
|
|
@@ -5508,7 +5573,7 @@ function GenreTreeSkeleton() {
|
|
|
5508
5573
|
className: "gtv-skeleton-svg",
|
|
5509
5574
|
"aria-hidden": "true",
|
|
5510
5575
|
children: [
|
|
5511
|
-
/* @__PURE__ */
|
|
5576
|
+
/* @__PURE__ */ jsx19("style", { children: `
|
|
5512
5577
|
@keyframes ${animationName} {
|
|
5513
5578
|
from { transform: translateX(0); }
|
|
5514
5579
|
to { transform: translateX(${sweepDistance}px); }
|
|
@@ -5522,9 +5587,9 @@ function GenreTreeSkeleton() {
|
|
|
5522
5587
|
}
|
|
5523
5588
|
}
|
|
5524
5589
|
` }),
|
|
5525
|
-
/* @__PURE__ */
|
|
5526
|
-
/* @__PURE__ */
|
|
5527
|
-
/* @__PURE__ */
|
|
5590
|
+
/* @__PURE__ */ jsxs14("defs", { children: [
|
|
5591
|
+
/* @__PURE__ */ jsxs14("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "1", y2: "0", children: [
|
|
5592
|
+
/* @__PURE__ */ jsx19(
|
|
5528
5593
|
"stop",
|
|
5529
5594
|
{
|
|
5530
5595
|
offset: "0%",
|
|
@@ -5532,7 +5597,7 @@ function GenreTreeSkeleton() {
|
|
|
5532
5597
|
stopOpacity: 0
|
|
5533
5598
|
}
|
|
5534
5599
|
),
|
|
5535
|
-
/* @__PURE__ */
|
|
5600
|
+
/* @__PURE__ */ jsx19(
|
|
5536
5601
|
"stop",
|
|
5537
5602
|
{
|
|
5538
5603
|
offset: "50%",
|
|
@@ -5540,7 +5605,7 @@ function GenreTreeSkeleton() {
|
|
|
5540
5605
|
stopOpacity: 0.9
|
|
5541
5606
|
}
|
|
5542
5607
|
),
|
|
5543
|
-
/* @__PURE__ */
|
|
5608
|
+
/* @__PURE__ */ jsx19(
|
|
5544
5609
|
"stop",
|
|
5545
5610
|
{
|
|
5546
5611
|
offset: "100%",
|
|
@@ -5549,8 +5614,8 @@ function GenreTreeSkeleton() {
|
|
|
5549
5614
|
}
|
|
5550
5615
|
)
|
|
5551
5616
|
] }),
|
|
5552
|
-
/* @__PURE__ */
|
|
5553
|
-
ALL_LINKS.map((link, i) => /* @__PURE__ */
|
|
5617
|
+
/* @__PURE__ */ jsxs14("mask", { id: maskId, children: [
|
|
5618
|
+
ALL_LINKS.map((link, i) => /* @__PURE__ */ jsx19(
|
|
5554
5619
|
"path",
|
|
5555
5620
|
{
|
|
5556
5621
|
d: connectorPath(link.from, link.to),
|
|
@@ -5560,7 +5625,7 @@ function GenreTreeSkeleton() {
|
|
|
5560
5625
|
},
|
|
5561
5626
|
`link-mask-${i}`
|
|
5562
5627
|
)),
|
|
5563
|
-
ALL_CARDS.map(({ card }, i) => /* @__PURE__ */
|
|
5628
|
+
ALL_CARDS.map(({ card }, i) => /* @__PURE__ */ jsx19(
|
|
5564
5629
|
"rect",
|
|
5565
5630
|
{
|
|
5566
5631
|
x: card.x,
|
|
@@ -5575,7 +5640,7 @@ function GenreTreeSkeleton() {
|
|
|
5575
5640
|
))
|
|
5576
5641
|
] })
|
|
5577
5642
|
] }),
|
|
5578
|
-
ALL_LINKS.map((link, i) => /* @__PURE__ */
|
|
5643
|
+
ALL_LINKS.map((link, i) => /* @__PURE__ */ jsx19(
|
|
5579
5644
|
"path",
|
|
5580
5645
|
{
|
|
5581
5646
|
d: connectorPath(link.from, link.to),
|
|
@@ -5585,8 +5650,8 @@ function GenreTreeSkeleton() {
|
|
|
5585
5650
|
},
|
|
5586
5651
|
`link-${i}`
|
|
5587
5652
|
)),
|
|
5588
|
-
ALL_CARDS.map(({ card, rootAccent }, i) => /* @__PURE__ */
|
|
5589
|
-
/* @__PURE__ */
|
|
5653
|
+
ALL_CARDS.map(({ card, rootAccent }, i) => /* @__PURE__ */ jsx19(SkeletonCard, { card, rootAccent }, `card-${i}`)),
|
|
5654
|
+
/* @__PURE__ */ jsx19("g", { mask: `url(#${maskId})`, children: /* @__PURE__ */ jsx19(
|
|
5590
5655
|
"rect",
|
|
5591
5656
|
{
|
|
5592
5657
|
className: shimmerBandClass,
|
|
@@ -5605,7 +5670,7 @@ function GenreTreeSkeleton() {
|
|
|
5605
5670
|
|
|
5606
5671
|
// src/GenreTreeWheelSkeleton.tsx
|
|
5607
5672
|
import { useId as useId2, useLayoutEffect as useLayoutEffect2, useRef as useRef10 } from "react";
|
|
5608
|
-
import { jsx as
|
|
5673
|
+
import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5609
5674
|
var SHAPE_COLOR = "#D4D4D8";
|
|
5610
5675
|
var SECTOR_FILL_OPACITY = 0.22;
|
|
5611
5676
|
var INNER_TINT_OPACITY = 0.55;
|
|
@@ -5750,8 +5815,8 @@ function GenreTreeWheelSkeleton() {
|
|
|
5750
5815
|
sharedStartTime ??= animation.startTime ?? document.timeline.currentTime;
|
|
5751
5816
|
animation.startTime = sharedStartTime;
|
|
5752
5817
|
}, []);
|
|
5753
|
-
return /* @__PURE__ */
|
|
5754
|
-
/* @__PURE__ */
|
|
5818
|
+
return /* @__PURE__ */ jsxs15("div", { className: "gtv-wheel-skeleton", children: [
|
|
5819
|
+
/* @__PURE__ */ jsx20(
|
|
5755
5820
|
"div",
|
|
5756
5821
|
{
|
|
5757
5822
|
className: "gtv-wheel-skeleton-sector-layer",
|
|
@@ -5759,8 +5824,8 @@ function GenreTreeWheelSkeleton() {
|
|
|
5759
5824
|
"aria-hidden": "true"
|
|
5760
5825
|
}
|
|
5761
5826
|
),
|
|
5762
|
-
/* @__PURE__ */
|
|
5763
|
-
/* @__PURE__ */
|
|
5827
|
+
/* @__PURE__ */ jsx20("span", { className: "gtv-skeleton-sr-only", children: "Loading genre tree\u2026" }),
|
|
5828
|
+
/* @__PURE__ */ jsxs15(
|
|
5764
5829
|
"svg",
|
|
5765
5830
|
{
|
|
5766
5831
|
viewBox: `${CANVAS_ORIGIN} ${CANVAS_ORIGIN} ${CANVAS_SIZE} ${CANVAS_SIZE}`,
|
|
@@ -5768,14 +5833,14 @@ function GenreTreeWheelSkeleton() {
|
|
|
5768
5833
|
className: "gtv-wheel-skeleton-svg",
|
|
5769
5834
|
"aria-hidden": "true",
|
|
5770
5835
|
children: [
|
|
5771
|
-
/* @__PURE__ */
|
|
5772
|
-
/* @__PURE__ */
|
|
5773
|
-
/* @__PURE__ */
|
|
5774
|
-
/* @__PURE__ */
|
|
5775
|
-
/* @__PURE__ */
|
|
5836
|
+
/* @__PURE__ */ jsxs15("defs", { children: [
|
|
5837
|
+
/* @__PURE__ */ jsxs15("radialGradient", { id: mainstreamId, children: [
|
|
5838
|
+
/* @__PURE__ */ jsx20("stop", { offset: "0%", stopColor: "#FFFFFF", stopOpacity: 0.45 }),
|
|
5839
|
+
/* @__PURE__ */ jsx20("stop", { offset: "65%", stopColor: "#FFFFFF", stopOpacity: 0.15 }),
|
|
5840
|
+
/* @__PURE__ */ jsx20("stop", { offset: "100%", stopColor: "#FFFFFF", stopOpacity: 0 })
|
|
5776
5841
|
] }),
|
|
5777
|
-
/* @__PURE__ */
|
|
5778
|
-
LINKS.map((link, i) => /* @__PURE__ */
|
|
5842
|
+
/* @__PURE__ */ jsxs15("g", { id: shapesId, children: [
|
|
5843
|
+
LINKS.map((link, i) => /* @__PURE__ */ jsx20(
|
|
5779
5844
|
"path",
|
|
5780
5845
|
{
|
|
5781
5846
|
d: link.d,
|
|
@@ -5787,21 +5852,21 @@ function GenreTreeWheelSkeleton() {
|
|
|
5787
5852
|
},
|
|
5788
5853
|
`link-${i}`
|
|
5789
5854
|
)),
|
|
5790
|
-
DOTS.map((dot, i) => /* @__PURE__ */
|
|
5855
|
+
DOTS.map((dot, i) => /* @__PURE__ */ jsx20("circle", { cx: dot.point.x, cy: dot.point.y, r: dot.r, fill: "currentColor" }, `dot-${i}`))
|
|
5791
5856
|
] })
|
|
5792
5857
|
] }),
|
|
5793
|
-
/* @__PURE__ */
|
|
5794
|
-
/* @__PURE__ */
|
|
5795
|
-
/* @__PURE__ */
|
|
5858
|
+
/* @__PURE__ */ jsx20("circle", { cx: 0, cy: 0, r: RING_RADIUS, fill: "#FFFFFF", fillOpacity: INNER_TINT_OPACITY }),
|
|
5859
|
+
/* @__PURE__ */ jsx20("circle", { cx: 0, cy: 0, r: MAINSTREAM_RADIUS, fill: `url(#${mainstreamId})` }),
|
|
5860
|
+
/* @__PURE__ */ jsx20("use", { href: `#${shapesId}`, color: SHAPE_COLOR })
|
|
5796
5861
|
]
|
|
5797
5862
|
}
|
|
5798
5863
|
),
|
|
5799
|
-
/* @__PURE__ */
|
|
5864
|
+
/* @__PURE__ */ jsx20("div", { className: "gtv-wheel-skeleton-shimmer", "aria-hidden": "true", children: /* @__PURE__ */ jsx20("div", { ref: wedgeRef, className: "gtv-wheel-skeleton-shimmer-wedge" }) })
|
|
5800
5865
|
] });
|
|
5801
5866
|
}
|
|
5802
5867
|
|
|
5803
5868
|
// src/GenreTreeOutlineSkeleton.tsx
|
|
5804
|
-
import { jsx as
|
|
5869
|
+
import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5805
5870
|
var ROWS = [
|
|
5806
5871
|
{ depth: 0, width: 38 },
|
|
5807
5872
|
{ depth: 0, width: 26 },
|
|
@@ -5813,9 +5878,9 @@ var ROWS = [
|
|
|
5813
5878
|
{ depth: 0, width: 22 }
|
|
5814
5879
|
];
|
|
5815
5880
|
function GenreTreeOutlineSkeleton() {
|
|
5816
|
-
return /* @__PURE__ */
|
|
5817
|
-
/* @__PURE__ */
|
|
5818
|
-
ROWS.map((row, i) => /* @__PURE__ */
|
|
5881
|
+
return /* @__PURE__ */ jsxs16("div", { className: "gtv-skeleton gtv-outline-skeleton", children: [
|
|
5882
|
+
/* @__PURE__ */ jsx21("span", { className: "gtv-skeleton-sr-only", children: "Loading genre tree\u2026" }),
|
|
5883
|
+
ROWS.map((row, i) => /* @__PURE__ */ jsx21(
|
|
5819
5884
|
"div",
|
|
5820
5885
|
{
|
|
5821
5886
|
className: "gtv-outline-skeleton-row",
|
|
@@ -5828,13 +5893,13 @@ function GenreTreeOutlineSkeleton() {
|
|
|
5828
5893
|
}
|
|
5829
5894
|
|
|
5830
5895
|
// src/GenreTreeViewSkeleton.tsx
|
|
5831
|
-
import { jsx as
|
|
5896
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
5832
5897
|
function GenreTreeViewSkeleton({ viewMode }) {
|
|
5833
5898
|
if (viewMode === "wheel" || viewMode === "pop-core") {
|
|
5834
|
-
return /* @__PURE__ */
|
|
5899
|
+
return /* @__PURE__ */ jsx22("div", { className: "gtv-view-skeleton-wheel-wrapper", children: /* @__PURE__ */ jsx22(GenreTreeWheelSkeleton, {}) });
|
|
5835
5900
|
}
|
|
5836
|
-
if (viewMode === "outline") return /* @__PURE__ */
|
|
5837
|
-
return /* @__PURE__ */
|
|
5901
|
+
if (viewMode === "outline") return /* @__PURE__ */ jsx22(GenreTreeOutlineSkeleton, {});
|
|
5902
|
+
return /* @__PURE__ */ jsx22(GenreTreeSkeleton, {});
|
|
5838
5903
|
}
|
|
5839
5904
|
export {
|
|
5840
5905
|
DEFAULT_FRAME_HEIGHT,
|