@cratis/components 0.1.16 → 0.1.18
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/cjs/PivotViewer/PivotViewer.css +70 -21
- package/dist/cjs/PivotViewer/PivotViewer.js +15 -5
- package/dist/cjs/PivotViewer/PivotViewer.js.map +1 -1
- package/dist/cjs/PivotViewer/components/AxisLabels.js +5 -8
- package/dist/cjs/PivotViewer/components/AxisLabels.js.map +1 -1
- package/dist/cjs/PivotViewer/components/DetailPanel.js +9 -2
- package/dist/cjs/PivotViewer/components/DetailPanel.js.map +1 -1
- package/dist/cjs/PivotViewer/components/PivotCanvas.js +62 -55
- package/dist/cjs/PivotViewer/components/PivotCanvas.js.map +1 -1
- package/dist/cjs/PivotViewer/components/PivotViewerMain.js +16 -5
- package/dist/cjs/PivotViewer/components/PivotViewerMain.js.map +1 -1
- package/dist/cjs/PivotViewer/components/Toolbar.js +34 -2
- package/dist/cjs/PivotViewer/components/Toolbar.js.map +1 -1
- package/dist/cjs/PivotViewer/components/pivot/animation.js +4 -3
- package/dist/cjs/PivotViewer/components/pivot/animation.js.map +1 -1
- package/dist/cjs/PivotViewer/components/pivot/constants.js +5 -5
- package/dist/cjs/PivotViewer/components/pivot/constants.js.map +1 -1
- package/dist/cjs/PivotViewer/components/pivot/groups.js +151 -0
- package/dist/cjs/PivotViewer/components/pivot/groups.js.map +1 -0
- package/dist/cjs/PivotViewer/components/pivot/sprites.js +11 -42
- package/dist/cjs/PivotViewer/components/pivot/sprites.js.map +1 -1
- package/dist/cjs/PivotViewer/components/pivot/visibility.js +57 -26
- package/dist/cjs/PivotViewer/components/pivot/visibility.js.map +1 -1
- package/dist/cjs/PivotViewer/constants.js +0 -2
- package/dist/cjs/PivotViewer/constants.js.map +1 -1
- package/dist/cjs/PivotViewer/engine/layout.js +11 -7
- package/dist/cjs/PivotViewer/engine/layout.js.map +1 -1
- package/dist/cjs/PivotViewer/hooks/useCardSelection.js +2 -1
- package/dist/cjs/PivotViewer/hooks/useCardSelection.js.map +1 -1
- package/dist/cjs/PivotViewer/hooks/useCurrentFilters.js.map +1 -1
- package/dist/cjs/PivotViewer/hooks/usePanning.js +8 -4
- package/dist/cjs/PivotViewer/hooks/usePanning.js.map +1 -1
- package/dist/cjs/PivotViewer/hooks/useViewModeScrollHandling.js +4 -3
- package/dist/cjs/PivotViewer/hooks/useViewModeScrollHandling.js.map +1 -1
- package/dist/cjs/PivotViewer/hooks/useZoomState.js +4 -0
- package/dist/cjs/PivotViewer/hooks/useZoomState.js.map +1 -1
- package/dist/cjs/PivotViewer/types.js.map +1 -1
- package/dist/cjs/PivotViewer/utils/animations.js +11 -3
- package/dist/cjs/PivotViewer/utils/animations.js.map +1 -1
- package/dist/cjs/PivotViewer/utils/cardPosition.js +0 -3
- package/dist/cjs/PivotViewer/utils/cardPosition.js.map +1 -1
- package/dist/cjs/PivotViewer/utils/constants.js +3 -3
- package/dist/cjs/PivotViewer/utils/constants.js.map +1 -1
- package/dist/cjs/PivotViewer/utils/selection.js +8 -1
- package/dist/cjs/PivotViewer/utils/selection.js.map +1 -1
- package/dist/esm/PivotViewer/PivotViewer.css +70 -21
- package/dist/esm/PivotViewer/PivotViewer.d.ts.map +1 -1
- package/dist/esm/PivotViewer/PivotViewer.js +16 -6
- package/dist/esm/PivotViewer/PivotViewer.js.map +1 -1
- package/dist/esm/PivotViewer/PivotViewer.stories.d.ts +0 -1
- package/dist/esm/PivotViewer/PivotViewer.stories.d.ts.map +1 -1
- package/dist/esm/PivotViewer/PivotViewer.stories.js +10 -9
- package/dist/esm/PivotViewer/PivotViewer.stories.js.map +1 -1
- package/dist/esm/PivotViewer/components/AxisLabels.d.ts +2 -1
- package/dist/esm/PivotViewer/components/AxisLabels.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/AxisLabels.js +6 -9
- package/dist/esm/PivotViewer/components/AxisLabels.js.map +1 -1
- package/dist/esm/PivotViewer/components/DetailPanel.d.ts +3 -1
- package/dist/esm/PivotViewer/components/DetailPanel.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/DetailPanel.js +10 -3
- package/dist/esm/PivotViewer/components/DetailPanel.js.map +1 -1
- package/dist/esm/PivotViewer/components/PivotCanvas.d.ts +5 -2
- package/dist/esm/PivotViewer/components/PivotCanvas.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/PivotCanvas.js +63 -56
- package/dist/esm/PivotViewer/components/PivotCanvas.js.map +1 -1
- package/dist/esm/PivotViewer/components/PivotViewerMain.d.ts +5 -1
- package/dist/esm/PivotViewer/components/PivotViewerMain.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/PivotViewerMain.js +16 -5
- package/dist/esm/PivotViewer/components/PivotViewerMain.js.map +1 -1
- package/dist/esm/PivotViewer/components/Toolbar.d.ts +3 -1
- package/dist/esm/PivotViewer/components/Toolbar.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/Toolbar.js +34 -2
- package/dist/esm/PivotViewer/components/Toolbar.js.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/animation.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/animation.js +4 -3
- package/dist/esm/PivotViewer/components/pivot/animation.js.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/constants.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/constants.js +5 -5
- package/dist/esm/PivotViewer/components/pivot/constants.js.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/groups.d.ts +6 -0
- package/dist/esm/PivotViewer/components/pivot/groups.d.ts.map +1 -0
- package/dist/esm/PivotViewer/components/pivot/groups.js +129 -0
- package/dist/esm/PivotViewer/components/pivot/groups.js.map +1 -0
- package/dist/esm/PivotViewer/components/pivot/sprites.d.ts +10 -2
- package/dist/esm/PivotViewer/components/pivot/sprites.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/sprites.js +12 -42
- package/dist/esm/PivotViewer/components/pivot/sprites.js.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/visibility.d.ts +4 -0
- package/dist/esm/PivotViewer/components/pivot/visibility.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/visibility.js +57 -26
- package/dist/esm/PivotViewer/components/pivot/visibility.js.map +1 -1
- package/dist/esm/PivotViewer/constants.js +1 -2
- package/dist/esm/PivotViewer/constants.js.map +1 -1
- package/dist/esm/PivotViewer/engine/layout.js +11 -7
- package/dist/esm/PivotViewer/engine/layout.js.map +1 -1
- package/dist/esm/PivotViewer/engine/types.d.ts +1 -0
- package/dist/esm/PivotViewer/engine/types.d.ts.map +1 -1
- package/dist/esm/PivotViewer/hooks/useCardSelection.d.ts.map +1 -1
- package/dist/esm/PivotViewer/hooks/useCardSelection.js +2 -1
- package/dist/esm/PivotViewer/hooks/useCardSelection.js.map +1 -1
- package/dist/esm/PivotViewer/hooks/useCurrentFilters.js.map +1 -1
- package/dist/esm/PivotViewer/hooks/useFilteredData.d.ts +1 -1
- package/dist/esm/PivotViewer/hooks/useFilteredData.js +4 -4
- package/dist/esm/PivotViewer/hooks/useFilteredData.js.map +1 -1
- package/dist/esm/PivotViewer/hooks/usePanning.d.ts.map +1 -1
- package/dist/esm/PivotViewer/hooks/usePanning.js +8 -4
- package/dist/esm/PivotViewer/hooks/usePanning.js.map +1 -1
- package/dist/esm/PivotViewer/hooks/useViewModeScrollHandling.d.ts.map +1 -1
- package/dist/esm/PivotViewer/hooks/useViewModeScrollHandling.js +4 -3
- package/dist/esm/PivotViewer/hooks/useViewModeScrollHandling.js.map +1 -1
- package/dist/esm/PivotViewer/hooks/useZoomState.d.ts +1 -0
- package/dist/esm/PivotViewer/hooks/useZoomState.d.ts.map +1 -1
- package/dist/esm/PivotViewer/hooks/useZoomState.js +4 -0
- package/dist/esm/PivotViewer/hooks/useZoomState.js.map +1 -1
- package/dist/esm/PivotViewer/types.d.ts +5 -1
- package/dist/esm/PivotViewer/types.d.ts.map +1 -1
- package/dist/esm/PivotViewer/types.js.map +1 -1
- package/dist/esm/PivotViewer/utils/animations.d.ts.map +1 -1
- package/dist/esm/PivotViewer/utils/animations.js +11 -3
- package/dist/esm/PivotViewer/utils/animations.js.map +1 -1
- package/dist/esm/PivotViewer/utils/cardPosition.js +1 -4
- package/dist/esm/PivotViewer/utils/cardPosition.js.map +1 -1
- package/dist/esm/PivotViewer/utils/constants.d.ts +5 -5
- package/dist/esm/PivotViewer/utils/constants.d.ts.map +1 -1
- package/dist/esm/PivotViewer/utils/constants.js +3 -3
- package/dist/esm/PivotViewer/utils/constants.js.map +1 -1
- package/dist/esm/PivotViewer/utils/selection.d.ts.map +1 -1
- package/dist/esm/PivotViewer/utils/selection.js +8 -1
- package/dist/esm/PivotViewer/utils/selection.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/cjs/PivotViewer/components/pivot/buckets.js +0 -124
- package/dist/cjs/PivotViewer/components/pivot/buckets.js.map +0 -1
- package/dist/esm/PivotViewer/components/pivot/buckets.d.ts +0 -6
- package/dist/esm/PivotViewer/components/pivot/buckets.d.ts.map +0 -1
- package/dist/esm/PivotViewer/components/pivot/buckets.js +0 -102
- package/dist/esm/PivotViewer/components/pivot/buckets.js.map +0 -1
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { useRef, useState, useMemo, useEffect } from 'react';
|
|
2
2
|
import * as PIXI from 'pixi.js';
|
|
3
3
|
import { createCssColorResolver, resolveCardColors } from './pivot/colorResolver.js';
|
|
4
|
-
import {
|
|
4
|
+
import { updateCardContent, createCardSprite } from './pivot/sprites.js';
|
|
5
5
|
import { syncSpritesToViewport } from './pivot/visibility.js';
|
|
6
|
-
import {
|
|
6
|
+
import { updateGroupBackgrounds, updateHighlight } from './pivot/groups.js';
|
|
7
7
|
import { startAnimationLoop } from './pivot/animation.js';
|
|
8
8
|
import { DEFAULT_COLORS } from './pivot/constants.js';
|
|
9
9
|
|
|
10
10
|
function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeight, zoomLevel, panX, panY, viewportWidth, viewportHeight, selectedId, hoveredGroupIndex, isZooming: _isZooming = false, resolveId: _resolveId, onCardClick, onPanStart, onPanMove, onPanEnd, viewMode, cardRenderer, containerRef, }) {
|
|
11
11
|
const parentContainerRef = containerRef;
|
|
12
|
+
const resolveId = _resolveId;
|
|
12
13
|
const canvasRef = useRef(null);
|
|
13
14
|
const spacerRef = useRef(null);
|
|
14
15
|
const appRef = useRef(null);
|
|
15
16
|
const rootRef = useRef(null);
|
|
16
|
-
const
|
|
17
|
+
const groupsContainerRef = useRef(null);
|
|
17
18
|
const spritesRef = useRef(new Map());
|
|
18
19
|
const animationFrameRef = useRef(0);
|
|
19
20
|
const mountedRef = useRef(true);
|
|
@@ -26,6 +27,8 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
|
|
|
26
27
|
const previousViewModeRef = useRef(viewMode);
|
|
27
28
|
const prevLayoutRef = useRef(null);
|
|
28
29
|
const prevGroupingRef = useRef(null);
|
|
30
|
+
const prevScrollTopRef = useRef(0);
|
|
31
|
+
const prevScrollLeftRef = useRef(0);
|
|
29
32
|
const cardColorsRef = useRef(DEFAULT_COLORS);
|
|
30
33
|
const cssColorResolver = useMemo(() => createCssColorResolver(), []);
|
|
31
34
|
const onPanStartRef = useRef(onPanStart);
|
|
@@ -77,9 +80,9 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
|
|
|
77
80
|
return;
|
|
78
81
|
}
|
|
79
82
|
appRef.current = app;
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
app.stage.addChild(
|
|
83
|
+
const groupsContainer = new PIXI.Container();
|
|
84
|
+
groupsContainerRef.current = groupsContainer;
|
|
85
|
+
app.stage.addChild(groupsContainer);
|
|
83
86
|
const root = new PIXI.Container();
|
|
84
87
|
rootRef.current = root;
|
|
85
88
|
app.stage.addChild(root);
|
|
@@ -100,6 +103,9 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
|
|
|
100
103
|
overlayParent.appendChild(c);
|
|
101
104
|
canvasRef.current = c;
|
|
102
105
|
}
|
|
106
|
+
else {
|
|
107
|
+
console.error('PivotCanvas: Could not find canvas element from Pixi application');
|
|
108
|
+
}
|
|
103
109
|
if (canvasRef.current && parentContainerRef.current) {
|
|
104
110
|
const parentBounds = parentContainerRef.current.getBoundingClientRect();
|
|
105
111
|
void parentBounds;
|
|
@@ -153,7 +159,7 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
|
|
|
153
159
|
appRef.current = null;
|
|
154
160
|
rootRef.current = null;
|
|
155
161
|
}
|
|
156
|
-
|
|
162
|
+
spritesRef.current.clear();
|
|
157
163
|
try {
|
|
158
164
|
const parentEl = parentContainerRef.current;
|
|
159
165
|
if (parentEl) {
|
|
@@ -169,7 +175,7 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
|
|
|
169
175
|
catch (e) {
|
|
170
176
|
}
|
|
171
177
|
};
|
|
172
|
-
}, [
|
|
178
|
+
}, []);
|
|
173
179
|
useEffect(() => {
|
|
174
180
|
if (!parentContainerRef || !parentContainerRef.current || !appRef.current || !pixiReady)
|
|
175
181
|
return;
|
|
@@ -201,33 +207,47 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
|
|
|
201
207
|
};
|
|
202
208
|
}, [pixiReady, viewportWidth, viewportHeight]);
|
|
203
209
|
useEffect(() => {
|
|
204
|
-
if (!
|
|
210
|
+
if (!groupsContainerRef.current || !parentContainerRef.current || !pixiReady)
|
|
205
211
|
return;
|
|
206
|
-
|
|
212
|
+
updateGroupBackgrounds(groupsContainerRef.current, parentContainerRef.current, grouping, layout, zoomLevel, cardColorsRef.current, viewMode);
|
|
207
213
|
needsRenderRef.current = true;
|
|
208
214
|
appRef.current?.renderer?.render(appRef.current.stage);
|
|
209
215
|
}, [grouping, layout, zoomLevel, viewMode, pixiReady]);
|
|
216
|
+
useEffect(() => {
|
|
217
|
+
const gc = groupsContainerRef.current;
|
|
218
|
+
const app = appRef.current;
|
|
219
|
+
if (!gc || !app)
|
|
220
|
+
return;
|
|
221
|
+
const target = viewMode === 'grouped' ? 1 : 0;
|
|
222
|
+
const start = typeof gc.alpha === 'number' ? gc.alpha : 1;
|
|
223
|
+
const duration = 200;
|
|
224
|
+
if (Math.abs(start - target) < 0.01) {
|
|
225
|
+
gc.alpha = target;
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const t0 = performance.now();
|
|
229
|
+
const step = () => {
|
|
230
|
+
const u = Math.min(1, (performance.now() - t0) / duration);
|
|
231
|
+
const eased = u * (2 - u);
|
|
232
|
+
gc.alpha = start + (target - start) * eased;
|
|
233
|
+
app.renderer?.render(app.stage);
|
|
234
|
+
if (u < 1)
|
|
235
|
+
requestAnimationFrame(step);
|
|
236
|
+
};
|
|
237
|
+
requestAnimationFrame(step);
|
|
238
|
+
}, [viewMode]);
|
|
210
239
|
useEffect(() => {
|
|
211
240
|
if (!rootRef.current || !parentContainerRef.current || !pixiReady) {
|
|
212
241
|
return;
|
|
213
242
|
}
|
|
214
243
|
const viewModeChanged = previousViewModeRef.current !== viewMode;
|
|
215
244
|
const groupingChanged = prevGroupingRef.current !== grouping;
|
|
216
|
-
|
|
245
|
+
const layoutChanged = prevLayoutRef.current !== layout;
|
|
246
|
+
if (viewModeChanged || groupingChanged || layoutChanged) {
|
|
217
247
|
isViewTransitionRef.current = true;
|
|
218
248
|
lastViewChangeTimeRef.current = Date.now();
|
|
219
249
|
previousViewModeRef.current = viewMode;
|
|
220
250
|
prevGroupingRef.current = grouping;
|
|
221
|
-
for (const sprite of spritesRef.current.values()) {
|
|
222
|
-
try {
|
|
223
|
-
if (sprite.container) {
|
|
224
|
-
sprite.container.visible = false;
|
|
225
|
-
}
|
|
226
|
-
sprite.__lastHiddenAt = Date.now();
|
|
227
|
-
}
|
|
228
|
-
catch (e) {
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
251
|
}
|
|
232
252
|
if (spacerRef.current) {
|
|
233
253
|
const spacer = spacerRef.current;
|
|
@@ -242,8 +262,11 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
|
|
|
242
262
|
const panDeltaX = panX - prevPanRef.current.x;
|
|
243
263
|
const panDeltaY = panY - prevPanRef.current.y;
|
|
244
264
|
prevPanRef.current = { x: panX, y: panY };
|
|
265
|
+
const currentScrollTop = parentContainerRef.current?.scrollTop || 0;
|
|
266
|
+
const currentScrollLeft = parentContainerRef.current?.scrollLeft || 0;
|
|
245
267
|
syncSpritesToViewport({
|
|
246
268
|
root: rootRef.current,
|
|
269
|
+
groupsContainer: groupsContainerRef.current,
|
|
247
270
|
container: parentContainerRef.current,
|
|
248
271
|
sprites: spritesRef.current,
|
|
249
272
|
layout,
|
|
@@ -258,11 +281,16 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
|
|
|
258
281
|
zoomLevel,
|
|
259
282
|
viewportWidth,
|
|
260
283
|
viewportHeight,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
284
|
+
viewMode,
|
|
285
|
+
createCardSprite: (id, x, y) => createCardSprite(id, x, y, items, (item, e, id) => (onCardClickRef.current)(item, e, id), (e) => (onPanStart)(e), cardWidth, cardHeight, cardColorsRef.current, cardRenderer, resolveId),
|
|
286
|
+
updateCardContent: (sprite, item) => updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current, cardRenderer),
|
|
287
|
+
isViewTransition: isViewTransitionRef.current,
|
|
264
288
|
prevLayout: prevLayoutRef.current,
|
|
289
|
+
prevScrollTop: prevScrollTopRef.current,
|
|
290
|
+
prevScrollLeft: prevScrollLeftRef.current,
|
|
265
291
|
});
|
|
292
|
+
prevScrollTopRef.current = currentScrollTop;
|
|
293
|
+
prevScrollLeftRef.current = currentScrollLeft;
|
|
266
294
|
needsRenderRef.current = true;
|
|
267
295
|
if (appRef.current?.renderer && rootRef.current) {
|
|
268
296
|
appRef.current.renderer.render(appRef.current.stage);
|
|
@@ -281,21 +309,6 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
|
|
|
281
309
|
useEffect(() => {
|
|
282
310
|
prevLayoutRef.current = layout;
|
|
283
311
|
}, [layout]);
|
|
284
|
-
useEffect(() => {
|
|
285
|
-
if (!rootRef.current || !bucketsContainerRef.current)
|
|
286
|
-
return;
|
|
287
|
-
const effectivePanX = parentContainerRef.current ? parentContainerRef.current.scrollLeft : panX;
|
|
288
|
-
const effectivePanY = parentContainerRef.current ? parentContainerRef.current.scrollTop : panY;
|
|
289
|
-
if (rootRef.current.scale && bucketsContainerRef.current.scale) {
|
|
290
|
-
rootRef.current.scale.set(zoomLevel);
|
|
291
|
-
bucketsContainerRef.current.scale.set(zoomLevel);
|
|
292
|
-
}
|
|
293
|
-
if (rootRef.current.position && bucketsContainerRef.current.position) {
|
|
294
|
-
rootRef.current.position.set(-effectivePanX, -effectivePanY);
|
|
295
|
-
bucketsContainerRef.current.position.set(-effectivePanX, -effectivePanY);
|
|
296
|
-
}
|
|
297
|
-
appRef.current?.renderer?.render(appRef.current.stage);
|
|
298
|
-
}, [zoomLevel, panX, panY]);
|
|
299
312
|
useEffect(() => {
|
|
300
313
|
if (!rootRef.current)
|
|
301
314
|
return;
|
|
@@ -324,20 +337,9 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
|
|
|
324
337
|
const effectivePanY = container.scrollTop;
|
|
325
338
|
lastScroll.x = effectivePanX;
|
|
326
339
|
lastScroll.y = effectivePanY;
|
|
327
|
-
if (rootRef.current && bucketsContainerRef.current) {
|
|
328
|
-
if (rootRef.current.scale && bucketsContainerRef.current.scale) {
|
|
329
|
-
rootRef.current.scale.set(zoomLevel);
|
|
330
|
-
bucketsContainerRef.current.scale.set(zoomLevel);
|
|
331
|
-
}
|
|
332
|
-
const invScale = zoomLevel && zoomLevel !== 0 ? 1 / zoomLevel : 1;
|
|
333
|
-
void invScale;
|
|
334
|
-
if (rootRef.current.position && bucketsContainerRef.current.position) {
|
|
335
|
-
rootRef.current.position.set(-effectivePanX, -effectivePanY);
|
|
336
|
-
bucketsContainerRef.current.position.set(-effectivePanX, -effectivePanY);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
340
|
syncSpritesToViewport({
|
|
340
341
|
root: rootRef.current,
|
|
342
|
+
groupsContainer: groupsContainerRef.current,
|
|
341
343
|
container: parentContainerRef.current,
|
|
342
344
|
sprites: spritesRef.current,
|
|
343
345
|
layout,
|
|
@@ -350,10 +352,15 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
|
|
|
350
352
|
zoomLevel,
|
|
351
353
|
viewportWidth,
|
|
352
354
|
viewportHeight,
|
|
353
|
-
createCardSprite: (id, x, y) => createCardSprite(id, x, y, items, (item, e, id) => (onCardClickRef.current)(item, e, id), (e) => (onPanStartRef.current)(e), cardWidth, cardHeight, cardColorsRef.current),
|
|
354
|
-
updateCardContent: (sprite, item) => updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current),
|
|
355
|
-
isViewTransition: isViewTransitionRef.current
|
|
355
|
+
createCardSprite: (id, x, y) => createCardSprite(id, x, y, items, (item, e, id) => (onCardClickRef.current)(item, e, id), (e) => (onPanStartRef.current)(e), cardWidth, cardHeight, cardColorsRef.current, cardRenderer, resolveId),
|
|
356
|
+
updateCardContent: (sprite, item) => updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current, cardRenderer),
|
|
357
|
+
isViewTransition: isViewTransitionRef.current,
|
|
358
|
+
viewMode,
|
|
359
|
+
prevScrollTop: prevScrollTopRef.current,
|
|
360
|
+
prevScrollLeft: prevScrollLeftRef.current,
|
|
356
361
|
});
|
|
362
|
+
prevScrollTopRef.current = container.scrollTop || 0;
|
|
363
|
+
prevScrollLeftRef.current = container.scrollLeft || 0;
|
|
357
364
|
needsRenderRef.current = true;
|
|
358
365
|
app.renderer?.render(app.stage);
|
|
359
366
|
}
|
|
@@ -375,7 +382,7 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
|
|
|
375
382
|
};
|
|
376
383
|
}, [pixiReady, layout, visibleIds, items, cardWidth, cardHeight, zoomLevel, viewportWidth, viewportHeight, panX, panY, grouping, viewMode, selectedId, onCardClick, onPanStart]);
|
|
377
384
|
function updateCardContent$1(sprite, item) {
|
|
378
|
-
return updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current);
|
|
385
|
+
return updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current, cardRenderer);
|
|
379
386
|
}
|
|
380
387
|
function updateSelection() {
|
|
381
388
|
const sprites = spritesRef.current;
|
|
@@ -385,7 +392,7 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
|
|
|
385
392
|
}
|
|
386
393
|
}
|
|
387
394
|
function updateHighlight$1() {
|
|
388
|
-
updateHighlight(
|
|
395
|
+
updateHighlight(groupsContainerRef.current, parentContainerRef.current, grouping, layout, hoveredGroupIndex, cardWidth, zoomLevel);
|
|
389
396
|
}
|
|
390
397
|
return null;
|
|
391
398
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PivotCanvas.js","sources":["../../../../PivotViewer/components/PivotCanvas.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport * as PIXI from 'pixi.js';\nimport type { ItemId, LayoutResult, GroupingResult } from '../engine/types';\nimport type { ViewMode } from './Toolbar';\nimport { createCssColorResolver, resolveCardColors } from './pivot/colorResolver';\nimport { createCardSprite as createCardSpriteExternal, updateCardContent as updateCardContentExternal, clearSpritePool } from './pivot/sprites';\nimport { syncSpritesToViewport } from './pivot/visibility';\nimport { updateBucketBackgrounds as updateBucketBackgroundsExternal, updateHighlight as updateHighlightExternal } from './pivot/buckets';\nimport { startAnimationLoop as startAnimationLoopExternal, updatePositions as updatePositionsExternal } from './pivot/animation';\nimport { ANIMATION_SPEED, DEFAULT_COLORS, type CardSprite, type CardColors } from './pivot/constants';\n\nexport interface PivotCanvasProps<TItem extends object> {\n /** Original items array */\n items: TItem[];\n\n /** Layout positions */\n layout: LayoutResult;\n\n /** Grouping information */\n grouping: GroupingResult;\n\n /** Visible item IDs */\n visibleIds: Uint32Array;\n\n /** Card dimensions */\n cardWidth: number;\n cardHeight: number;\n\n /** Zoom level */\n zoomLevel: number;\n\n /** Pan offset */\n panX: number;\n panY: number;\n\n /** Viewport dimensions (visible area) */\n viewportWidth: number;\n viewportHeight: number;\n\n /** Selected item ID */\n selectedId: ItemId | null;\n\n /** Hovered group index */\n hoveredGroupIndex: number | null;\n\n /** Current view mode */\n viewMode: ViewMode;\n\n /** Is zooming animation in progress */\n isZooming?: boolean;\n\n /** Card renderer function */\n cardRenderer?: (item: TItem) => ReactNode;\n\n /** ID resolver */\n resolveId: (item: TItem, index: number) => string | number;\n\n /** Click handler */\n onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void;\n\n /** Pan handlers */\n onPanStart: (e: React.MouseEvent) => void;\n onPanMove: (e: React.MouseEvent) => void;\n onPanEnd: () => void;\n containerRef: React.RefObject<HTMLDivElement | null>;\n}\n\n// `CardSprite` type moved to ./pivot/constants and imported above\n\n// constants and CardColors type moved to ./pivot/constants\n\nexport function PivotCanvas<TItem extends object>({\n items,\n layout,\n grouping,\n visibleIds,\n cardWidth,\n cardHeight,\n zoomLevel,\n panX,\n panY,\n viewportWidth,\n viewportHeight,\n selectedId,\n hoveredGroupIndex,\n isZooming: _isZooming = false,\n resolveId: _resolveId,\n onCardClick,\n onPanStart,\n onPanMove,\n onPanEnd,\n viewMode,\n cardRenderer,\n containerRef,\n}: PivotCanvasProps<TItem>) {\n // Use the containerRef passed from the parent viewport so we append the Pixi\n // canvas and spacer into the actual scrollable element.\n const parentContainerRef = containerRef;\n // Mark intentionally-unused destructured props as used to satisfy lint\n void _isZooming;\n void _resolveId;\n const canvasRef = useRef<HTMLCanvasElement | null>(null);\n const spacerRef = useRef<HTMLDivElement | null>(null);\n const appRef = useRef<PIXI.Application | null>(null);\n const rootRef = useRef<PIXI.Container | null>(null);\n const bucketsContainerRef = useRef<PIXI.Container | null>(null);\n const spritesRef = useRef<Map<ItemId, CardSprite>>(new Map());\n const animationFrameRef = useRef<number>(0);\n const mountedRef = useRef(true);\n const [pixiReady, setPixiReady] = useState(false);\n const isAnimatingRef = useRef(false);\n const needsRenderRef = useRef(false);\n const initializingRef = useRef(false);\n const isViewTransitionRef = useRef(false);\n const lastViewChangeTimeRef = useRef(0);\n const previousViewModeRef = useRef<ViewMode>(viewMode);\n const prevLayoutRef = useRef<LayoutResult | null>(null);\n const prevGroupingRef = useRef<GroupingResult | null>(null);\n const cardColorsRef = useRef<CardColors>(DEFAULT_COLORS);\n void cardRenderer; // unused in Pixi renderer but keep prop compatibility\n\n const cssColorResolver = useMemo(() => createCssColorResolver(), []);\n\n const onPanStartRef = useRef(onPanStart);\n const onPanMoveRef = useRef(onPanMove);\n const onPanEndRef = useRef(onPanEnd);\n const onCardClickRef = useRef(onCardClick);\n const prevPanRef = useRef({ x: panX, y: panY });\n\n // Initialize Pixi Application\n useEffect(() => {\n // ... existing code ...\n onPanMoveRef.current = onPanMove;\n onPanEndRef.current = onPanEnd;\n onCardClickRef.current = onCardClick;\n }, [onPanStart, onPanMove, onPanEnd, onCardClick]);\n\n useEffect(() => {\n cardColorsRef.current = resolveCardColors(cssColorResolver);\n }, [cssColorResolver]);\n\n useEffect(() => {\n // Reset mounted flag\n mountedRef.current = true;\n\n if (!parentContainerRef || !parentContainerRef.current) {\n return;\n }\n\n // Prevent multiple simultaneous initializations\n if (initializingRef.current || appRef.current) {\n return;\n }\n\n initializingRef.current = true;\n let app: PIXI.Application | null = null;\n // Handler references declared here so cleanup can remove them later.\n\n (async () => {\n try {\n // Prefer the new init API (v8+) to avoid deprecation issues. Fall back\n // to the constructor options when `init` is not available.\n const options = {\n backgroundAlpha: 0,\n antialias: false,\n autoStart: false,\n autoDensity: true,\n resolution: window.devicePixelRatio || 1,\n width: viewportWidth > 0 ? viewportWidth : 800,\n height: viewportHeight > 0 ? viewportHeight : 600,\n } as PIXI.ApplicationOptions;\n\n app = new PIXI.Application();\n if ((app as unknown as { init?: unknown }).init && typeof (app as unknown as { init: (...args: unknown[]) => unknown }).init === 'function') {\n // init may return a promise in some builds\n \n // @ts-ignore\n await app.init(options);\n } else {\n // Fall back to constructor that accepts options\n app.destroy?.();\n app = new PIXI.Application(options);\n }\n\n if (!mountedRef.current || !parentContainerRef.current) {\n // Component unmounted during initialization\n if (app && typeof app.destroy === 'function') app.destroy(true, { children: true });\n initializingRef.current = false;\n return;\n }\n\n appRef.current = app;\n\n const bucketsContainer = new PIXI.Container();\n bucketsContainerRef.current = bucketsContainer;\n app.stage.addChild(bucketsContainer);\n\n const root = new PIXI.Container();\n rootRef.current = root;\n app.stage.addChild(root);\n\n // Resolve canvas element (different Pixi builds expose it as `view` or\n // `canvas`).\n const canvasEl = (app.view ?? (app as unknown as { canvas?: HTMLCanvasElement }).canvas ?? app.renderer?.view) as HTMLCanvasElement | undefined;\n\n // Place canvas outside the scrollable content so native scrolling\n // doesn't move the canvas DOM element itself. We overlay the canvas\n // on top of the scroll area by inserting it into the parent element\n // (or the container itself if parent is not available). This ensures\n // the Pixi canvas remains stable while we move the Pixi world inside\n // it to represent camera pan.\n const overlayParent = parentContainerRef.current.parentElement ?? parentContainerRef.current;\n if (canvasEl) {\n if (canvasEl.parentElement) {\n canvasEl.parentElement.removeChild(canvasEl);\n }\n overlayParent.appendChild(canvasEl);\n canvasRef.current = canvasEl;\n } else if ((app as unknown as { canvas?: HTMLCanvasElement }).canvas) {\n const c = (app as unknown as { canvas: HTMLCanvasElement }).canvas;\n if (c.parentElement) {\n c.parentElement.removeChild(c);\n }\n overlayParent.appendChild(c);\n canvasRef.current = c;\n }\n\n // Position the canvas to overlay the scrollable container area.\n if (canvasRef.current && parentContainerRef.current) {\n const parentBounds = parentContainerRef.current.getBoundingClientRect();\n void parentBounds;\n canvasRef.current.style.position = 'absolute';\n // Place canvas relative to the overlayParent's coordinate space.\n // If overlayParent is the immediate parent, top/left 0 aligns it.\n const offsetLeft = parentContainerRef.current.offsetLeft;\n const offsetTop = parentContainerRef.current.offsetTop;\n canvasRef.current.style.left = `${offsetLeft}px`;\n canvasRef.current.style.top = `${offsetTop}px`;\n canvasRef.current.style.width = `${parentContainerRef.current.clientWidth}px`;\n canvasRef.current.style.height = `${parentContainerRef.current.clientHeight}px`;\n // Place canvas behind the scrollable container (which has z-index 1)\n // so scrollbars appear on top.\n canvasRef.current.style.zIndex = '0';\n // Disable pointer events on canvas so they pass through to the viewport if needed,\n // though viewport is on top anyway.\n canvasRef.current.style.pointerEvents = 'none';\n }\n\n // We handle clicks and interactions manually in PivotViewerMain now,\n // so we don't need to configure Pixi events on the container.\n // This avoids z-index conflicts and event propagation issues.\n\n // Make canvas fill container with absolute positioning\n if (canvasRef.current) {\n canvasRef.current.style.display = 'block';\n // Ensure canvas does not capture events so they pass through to the viewport\n canvasRef.current.style.pointerEvents = 'none';\n }\n\n // Setup stage events for background panning\n app.stage.eventMode = 'static';\n app.stage.hitArea = new PIXI.Rectangle(0, 0, viewportWidth, viewportHeight);\n\n app.stage.on('pointerdown', (e) => {\n // Only handle if it reached the stage (background)\n // Sprites stop propagation, so this is safe\n onPanStartRef.current(e.nativeEvent as unknown as React.MouseEvent);\n });\n\n app.stage.on('globalpointermove', (e) => {\n onPanMoveRef.current(e.nativeEvent as unknown as React.MouseEvent);\n });\n\n app.stage.on('globalpointerup', () => {\n onPanEndRef.current();\n });\n\n // We no longer need manual event listeners on parentEl because Pixi\n // is now listening to events on parentEl directly via setTargetElement.\n // This allows Pixi to handle hit testing through the transparent container.\n const parentEl = parentContainerRef.current;\n if (parentEl) {\n // handleMouseDown = (e: Event) => onPanStartRef.current(e as unknown);\n // handleMouseMove = (e: Event) => onPanMoveRef.current(e as unknown);\n // handleMouseUp = () => onPanEndRef.current();\n // parentEl.addEventListener('mousedown', handleMouseDown);\n // parentEl.addEventListener('mousemove', handleMouseMove);\n // parentEl.addEventListener('mouseup', handleMouseUp);\n // parentEl.addEventListener('mouseleave', handleMouseUp);\n // window.addEventListener('mouseup', handleMouseUp);\n // window.addEventListener('pointerup', handleMouseUp);\n }\n\n // Immediately size to container to avoid delay\n if (viewportWidth > 0 && viewportHeight > 0) {\n app.renderer?.resize(viewportWidth, viewportHeight);\n }\n\n setPixiReady(true);\n initializingRef.current = false;\n\n // Trigger initial render\n needsRenderRef.current = true;\n app.renderer?.render(app.stage);\n } catch (error) {\n console.error('Failed to initialize Pixi.js:', error);\n initializingRef.current = false;\n }\n })();\n\n return () => {\n mountedRef.current = false;\n setPixiReady(false);\n cancelAnimationFrame(animationFrameRef.current);\n\n if (appRef.current && typeof appRef.current.destroy === 'function') {\n appRef.current.destroy(true, { children: true });\n appRef.current = null;\n rootRef.current = null;\n }\n\n // Clear sprite pool to avoid holding onto destroyed textures\n clearSpritePool();\n\n // Remove any event listeners we attached to the parent container\n try {\n const parentEl = parentContainerRef.current;\n if (parentEl) {\n // if (handleMouseDown) parentEl.removeEventListener('mousedown', handleMouseDown);\n // if (handleMouseMove) parentEl.removeEventListener('mousemove', handleMouseMove);\n // if (handleMouseUp) parentEl.removeEventListener('mouseup', handleMouseUp);\n // if (handleMouseUp) parentEl.removeEventListener('mouseleave', handleMouseUp);\n // if (handleMouseUp) {\n // window.removeEventListener('mouseup', handleMouseUp);\n // window.removeEventListener('pointerup', handleMouseUp);\n // }\n }\n } catch (e) {\n void e;\n }\n // Remove DOM nodes we appended\n try {\n if (canvasRef.current && canvasRef.current.parentElement) {\n canvasRef.current.parentElement.removeChild(canvasRef.current);\n }\n } catch (e) {\n void e;\n }\n };\n }, [viewportWidth, viewportHeight]);\n\n // Handle canvas resize\n useEffect(() => {\n if (!parentContainerRef || !parentContainerRef.current || !appRef.current || !pixiReady) return;\n\n const container = parentContainerRef.current;\n const app = appRef.current;\n\n let resizeTimeout: ReturnType<typeof setTimeout>;\n\n const handleResize = () => {\n // Size canvas to viewport dimensions from props\n if (viewportWidth > 0 && viewportHeight > 0) {\n app.renderer?.resize(viewportWidth, viewportHeight);\n app.stage.hitArea = new PIXI.Rectangle(0, 0, viewportWidth, viewportHeight);\n\n // Keep canvas DOM size in sync with container\n if (canvasRef.current && parentContainerRef.current) {\n canvasRef.current.style.width = `${parentContainerRef.current.clientWidth}px`;\n canvasRef.current.style.height = `${parentContainerRef.current.clientHeight}px`;\n // Also update left/top in case the container moved\n canvasRef.current.style.left = `${parentContainerRef.current.offsetLeft}px`;\n canvasRef.current.style.top = `${parentContainerRef.current.offsetTop}px`;\n }\n }\n };\n\n const debouncedResize = () => {\n clearTimeout(resizeTimeout);\n resizeTimeout = setTimeout(handleResize, 150);\n };\n\n // Initial resize (immediate)\n handleResize();\n\n // Watch for size changes (debounced)\n const resizeObserver = new ResizeObserver(debouncedResize);\n resizeObserver.observe(container);\n\n return () => {\n clearTimeout(resizeTimeout);\n resizeObserver.disconnect();\n };\n }, [pixiReady, viewportWidth, viewportHeight]);\n\n // Update bucket backgrounds only when layout/grouping changes\n useEffect(() => {\n if (!bucketsContainerRef.current || !parentContainerRef.current || !pixiReady) return;\n updateBucketBackgroundsExternal(bucketsContainerRef.current, parentContainerRef.current, grouping, layout, zoomLevel, cardColorsRef.current, viewMode);\n needsRenderRef.current = true;\n appRef.current?.renderer?.render(appRef.current.stage);\n }, [grouping, layout, zoomLevel, viewMode, pixiReady]);\n\n useEffect(() => {\n if (!rootRef.current || !parentContainerRef.current || !pixiReady) {\n return;\n }\n\n // Check if this is a view mode change (not just pan/scroll)\n const viewModeChanged = previousViewModeRef.current !== viewMode;\n const groupingChanged = prevGroupingRef.current !== grouping;\n\n if (viewModeChanged || groupingChanged) {\n isViewTransitionRef.current = true;\n lastViewChangeTimeRef.current = Date.now();\n previousViewModeRef.current = viewMode;\n prevGroupingRef.current = grouping;\n \n // When switching modes, mark all sprites for cleanup by hiding them\n // The normal sweep logic will remove them after SWEEP_MS delay\n for (const sprite of spritesRef.current.values()) {\n try {\n if (sprite.container) {\n sprite.container.visible = false;\n }\n (sprite as unknown as { __lastHiddenAt?: number }).__lastHiddenAt = Date.now();\n } catch (e) {\n void e;\n }\n }\n }\n\n // Update spacer dimensions to match scaled world size\n if (spacerRef.current) {\n const spacer = spacerRef.current;\n const worldWidth = (layout.totalWidth || viewportWidth) * zoomLevel;\n const worldHeight = (layout.totalHeight || viewportHeight) * zoomLevel;\n spacer.style.width = `${Math.max(worldWidth, viewportWidth)}px`;\n spacer.style.height = `${Math.max(worldHeight, viewportHeight)}px`;\n }\n\n // Ensure scroll spacer matches layout so the container becomes scrollable and\n // native scrollLeft/scrollTop reflect the camera position.\n if (parentContainerRef.current) {\n const spacer = spacerRef.current;\n if (spacer) {\n // Debug: log spacer and layout values to detect mismatches\n }\n }\n\n const panDeltaX = panX - prevPanRef.current.x;\n const panDeltaY = panY - prevPanRef.current.y;\n prevPanRef.current = { x: panX, y: panY };\n\n // Sync sprites into viewport and create/remove as needed\n // Provide wrappers for sprite creation and content update so helpers have required context\n syncSpritesToViewport({\n root: rootRef.current,\n container: parentContainerRef.current,\n sprites: spritesRef.current,\n layout,\n visibleIds,\n items,\n cardWidth,\n cardHeight,\n panX,\n panY,\n panDeltaX,\n panDeltaY,\n zoomLevel,\n viewportWidth,\n viewportHeight,\n createCardSprite: (id: string | number, x: number, y: number) => createCardSpriteExternal(\n id,\n x,\n y,\n items as TItem[],\n (item: TItem, e: MouseEvent, id: string | number) => (onCardClickRef.current)(item, e, id),\n (e: MouseEvent) => (onPanStart)(e as unknown as React.MouseEvent),\n cardWidth,\n cardHeight,\n cardColorsRef.current\n ),\n updateCardContent: (sprite: CardSprite, item: TItem) => updateCardContentExternal(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current),\n isViewTransition: isViewTransitionRef.current || (Date.now() - lastViewChangeTimeRef.current < 1000),\n prevLayout: prevLayoutRef.current,\n });\n needsRenderRef.current = true;\n \n // Force an immediate render after syncing sprites to ensure cards appear\n if (appRef.current?.renderer && rootRef.current) {\n appRef.current.renderer.render(appRef.current.stage);\n needsRenderRef.current = false;\n }\n \n startAnimationLoopExternal({\n mountedRef,\n appRef,\n animationFrameRef,\n isAnimatingRef,\n needsRenderRef,\n spritesRef,\n isViewTransitionRef,\n });\n }, [layout, visibleIds, items, cardWidth, cardHeight, pixiReady, zoomLevel, panX, panY, grouping, viewMode]);\n\n // Update prevLayoutRef after processing layout changes\n useEffect(() => {\n prevLayoutRef.current = layout;\n }, [layout]);\n\n useEffect(() => {\n if (!rootRef.current || !bucketsContainerRef.current) return;\n\n // Camera transform: move world opposite to camera position. Prefer the\n // native container scroll positions where available (they are authoritative\n // during user scrolls) and fall back to the passed pan props.\n const effectivePanX = parentContainerRef.current ? parentContainerRef.current.scrollLeft : panX;\n const effectivePanY = parentContainerRef.current ? parentContainerRef.current.scrollTop : panY;\n\n // Apply zoom and position to root and buckets.\n if (rootRef.current.scale && bucketsContainerRef.current.scale) {\n rootRef.current.scale.set(zoomLevel);\n bucketsContainerRef.current.scale.set(zoomLevel);\n }\n if (rootRef.current.position && bucketsContainerRef.current.position) {\n rootRef.current.position.set(-effectivePanX, -effectivePanY);\n bucketsContainerRef.current.position.set(-effectivePanX, -effectivePanY);\n }\n appRef.current?.renderer?.render(appRef.current.stage);\n }, [zoomLevel, panX, panY]);\n\n useEffect(() => {\n if (!rootRef.current) return;\n updateSelection();\n needsRenderRef.current = true;\n appRef.current?.renderer.render(appRef.current.stage);\n }, [selectedId, items]);\n\n useEffect(() => {\n if (!rootRef.current) return;\n updateHighlight();\n needsRenderRef.current = true;\n appRef.current?.renderer.render(appRef.current.stage);\n }, [hoveredGroupIndex, layout, grouping]);\n\n // Note: animation loop and bucket background updates are delegated to\n // external helpers (`startAnimationLoopExternal` and\n // `updateBucketBackgroundsExternal`) and invoked where needed. We don't\n // expose local wrappers to avoid unused-function lint warnings.\n\n // Listen to native scroll events on the parent container so we update the\n // Pixi world immediately when the user scrolls (native scrollbar or\n // programmatic). This ensures `syncSpritesToViewport` runs on scroll and\n // creates/destroys sprites as the viewport moves.\n useEffect(() => {\n if (!pixiReady || !parentContainerRef || !parentContainerRef.current || !appRef.current || !rootRef.current) return;\n\n const container = parentContainerRef.current;\n const app = appRef.current;\n\n // rAF-batched scroll handling: store the latest scroll values and process\n // them once per animation frame to avoid heavy synchronous work inside\n // the scroll event which causes jank and de-synchronisation between the\n // compositor and Pixi render updates.\n const lastScroll = { x: container.scrollLeft, y: container.scrollTop };\n const pendingRef = { scheduled: false } as { scheduled: boolean };\n\n const processScroll = () => {\n pendingRef.scheduled = false;\n try {\n // Read directly from container to ensure consistency with visibility logic\n // and to handle cases where scroll changes without event (e.g. resize clamping)\n const effectivePanX = container.scrollLeft;\n const effectivePanY = container.scrollTop;\n\n // Update lastScroll to keep it in sync\n lastScroll.x = effectivePanX;\n lastScroll.y = effectivePanY;\n\n if (rootRef.current && bucketsContainerRef.current) {\n if (rootRef.current.scale && bucketsContainerRef.current.scale) {\n rootRef.current.scale.set(zoomLevel);\n bucketsContainerRef.current.scale.set(zoomLevel);\n }\n const invScale = zoomLevel && zoomLevel !== 0 ? 1 / zoomLevel : 1;\n void invScale;\n if (rootRef.current.position && bucketsContainerRef.current.position) {\n rootRef.current.position.set(-effectivePanX, -effectivePanY);\n bucketsContainerRef.current.position.set(-effectivePanX, -effectivePanY);\n }\n }\n\n syncSpritesToViewport({\n root: rootRef.current,\n container: parentContainerRef.current,\n sprites: spritesRef.current,\n layout,\n visibleIds,\n items,\n cardWidth,\n cardHeight,\n panX,\n panY,\n zoomLevel,\n viewportWidth,\n viewportHeight,\n createCardSprite: (id: string | number, x: number, y: number) => createCardSpriteExternal(\n id, x, y, items as TItem[],\n (item, e, id) => (onCardClickRef.current)(item, e, id),\n (e) => (onPanStartRef.current)(e as unknown as React.MouseEvent), // Pixi events to React events\n cardWidth, cardHeight, cardColorsRef.current\n ),\n updateCardContent: (sprite: CardSprite, item: TItem) => updateCardContentExternal(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current),\n isViewTransition: isViewTransitionRef.current || (Date.now() - lastViewChangeTimeRef.current < 1000),\n });\n needsRenderRef.current = true;\n app.renderer?.render(app.stage);\n } catch (e) {\n console.error('[PivotCanvas] processScroll error', e);\n }\n };\n\n const onScroll = () => {\n // capture latest scroll positions quickly and schedule work\n lastScroll.x = container.scrollLeft;\n lastScroll.y = container.scrollTop;\n if (!pendingRef.scheduled) {\n pendingRef.scheduled = true;\n requestAnimationFrame(processScroll);\n }\n };\n\n container.addEventListener('scroll', onScroll, { passive: true });\n\n return () => {\n container.removeEventListener('scroll', onScroll);\n };\n }, [pixiReady, layout, visibleIds, items, cardWidth, cardHeight, zoomLevel, viewportWidth, viewportHeight, panX, panY, grouping, viewMode, selectedId, onCardClick, onPanStart]);\n\n function createCardSprite(id: ItemId, x: number, y: number): CardSprite {\n return createCardSpriteExternal(\n id, x, y, items as TItem[],\n (item, e, id) => (onCardClickRef.current)(item, e, id),\n (e) => (onPanStartRef.current)(e as unknown as React.MouseEvent),\n cardWidth, cardHeight, cardColorsRef.current\n );\n }\n // Mark these helpers as used (they may be referenced externally or via callbacks)\n void createCardSprite;\n\n function updateCardContent(sprite: CardSprite, item: TItem) {\n return updateCardContentExternal(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current);\n }\n\n function updatePositions(): boolean {\n return updatePositionsExternal(spritesRef.current, isViewTransitionRef, ANIMATION_SPEED);\n }\n\n void updatePositions;\n\n function updateSelection() {\n const sprites = spritesRef.current;\n\n for (const sprite of sprites.values()) {\n const val = (items as TItem[])[Number(sprite.itemId)];\n updateCardContent(sprite, val);\n }\n }\n\n function updateHighlight() {\n updateHighlightExternal(bucketsContainerRef.current, parentContainerRef.current, grouping, layout, hoveredGroupIndex, cardWidth, zoomLevel);\n }\n\n void updateHighlight;\n\n // This component renders into the parent `containerRef` (we append Pixi canvas\n // and spacer directly into that DOM node). Return null so we don't replace or\n // reassign the parent's ref which must remain the scrollable viewport element.\n return null;\n}\n"],"names":["updateBucketBackgroundsExternal","createCardSpriteExternal","updateCardContentExternal","startAnimationLoopExternal","updateHighlight","updateCardContent","updateHighlightExternal"],"mappings":";;;;;;;;;AA0EM,SAAU,WAAW,CAAuB,EAChD,KAAK,EACL,MAAM,EACN,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,SAAS,EAAE,UAAU,GAAG,KAAK,EAC7B,SAAS,EAAE,UAAU,EACrB,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,YAAY,GACY,EAAA;IAGxB,MAAM,kBAAkB,GAAG,YAAY;AAIvC,IAAA,MAAM,SAAS,GAAG,MAAM,CAA2B,IAAI,CAAC;AACxD,IAAA,MAAM,SAAS,GAAG,MAAM,CAAwB,IAAI,CAAC;AACrD,IAAA,MAAM,MAAM,GAAG,MAAM,CAA0B,IAAI,CAAC;AACpD,IAAA,MAAM,OAAO,GAAG,MAAM,CAAwB,IAAI,CAAC;AACnD,IAAA,MAAM,mBAAmB,GAAG,MAAM,CAAwB,IAAI,CAAC;IAC/D,MAAM,UAAU,GAAG,MAAM,CAA0B,IAAI,GAAG,EAAE,CAAC;AAC7D,IAAA,MAAM,iBAAiB,GAAG,MAAM,CAAS,CAAC,CAAC;AAC3C,IAAA,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC;IAC/B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;AACjD,IAAA,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC;AACpC,IAAA,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC;AACpC,IAA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AAC,MAAM,EAAE,EAAE;YACrC,MAAM,GAAG,GAAI,KAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACrD,YAAAG,mBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC;QAChC;IACF;AAEA,IAAA,SAASD,iBAAe,GAAA;AACtB,QAAAE,eAAuB,CAAC,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,SAAoB,CAAC;IAC7I;AAOA,IAAA,OAAO,IAAI;AACb;;;;"}
|
|
1
|
+
{"version":3,"file":"PivotCanvas.js","sources":["../../../../PivotViewer/components/PivotCanvas.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport * as PIXI from 'pixi.js';\nimport type { ItemId, LayoutResult, GroupingResult } from '../engine/types';\nimport type { ViewMode } from './Toolbar';\nimport { createCssColorResolver, resolveCardColors } from './pivot/colorResolver';\nimport { createCardSprite as createCardSpriteExternal, updateCardContent as updateCardContentExternal } from './pivot/sprites';\nimport { syncSpritesToViewport } from './pivot/visibility';\nimport { updateGroupBackgrounds as updateGroupBackgroundsExternal, updateHighlight as updateHighlightExternal } from './pivot/groups';\nimport { startAnimationLoop as startAnimationLoopExternal, updatePositions as updatePositionsExternal } from './pivot/animation';\nimport { ANIMATION_SPEED, DEFAULT_COLORS, type CardSprite, type CardColors } from './pivot/constants';\n\nexport interface PivotCanvasProps<TItem extends object> {\n /** Original items array */\n items: TItem[];\n\n /** Layout positions */\n layout: LayoutResult;\n\n /** Grouping information */\n grouping: GroupingResult;\n\n /** Visible item IDs */\n visibleIds: Uint32Array;\n\n /** Card dimensions */\n cardWidth: number;\n cardHeight: number;\n\n /** Zoom level */\n zoomLevel: number;\n\n /** Pan offset */\n panX: number;\n panY: number;\n\n /** Viewport dimensions (visible area) */\n viewportWidth: number;\n viewportHeight: number;\n\n /** Selected item ID */\n selectedId: ItemId | null;\n\n /** Hovered group index */\n hoveredGroupIndex: number | null;\n\n /** Current view mode */\n viewMode: ViewMode;\n\n /** Is zooming animation in progress */\n isZooming?: boolean;\n\n /** Card renderer function - returns structured data for display */\n cardRenderer: (item: TItem) => { title: string; labels: string[]; values: string[] };\n\n /** ID resolver */\n resolveId: (item: TItem, index: number) => string | number;\n\n /** Click handler */\n onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void;\n\n /** Pan handlers */\n onPanStart: (e: React.MouseEvent) => void;\n onPanMove: (e: React.MouseEvent) => void;\n onPanEnd: () => void;\n containerRef: React.RefObject<HTMLDivElement | null>;\n}\n\n// `CardSprite` type moved to ./pivot/constants and imported above\n\n// constants and CardColors type moved to ./pivot/constants\n\nexport function PivotCanvas<TItem extends object>({\n items,\n layout,\n grouping,\n visibleIds,\n cardWidth,\n cardHeight,\n zoomLevel,\n panX,\n panY,\n viewportWidth,\n viewportHeight,\n selectedId,\n hoveredGroupIndex,\n isZooming: _isZooming = false,\n resolveId: _resolveId,\n onCardClick,\n onPanStart,\n onPanMove,\n onPanEnd,\n viewMode,\n cardRenderer,\n containerRef,\n}: PivotCanvasProps<TItem>) {\n // Use the containerRef passed from the parent viewport so we append the Pixi\n // canvas and spacer into the actual scrollable element.\n const parentContainerRef = containerRef;\n // Mark intentionally-unused destructured props as used to satisfy lint\n void _isZooming;\n const resolveId = _resolveId;\n const canvasRef = useRef<HTMLCanvasElement | null>(null);\n const spacerRef = useRef<HTMLDivElement | null>(null);\n const appRef = useRef<PIXI.Application | null>(null);\n const rootRef = useRef<PIXI.Container | null>(null);\n const groupsContainerRef = useRef<PIXI.Container | null>(null);\n const spritesRef = useRef<Map<ItemId, CardSprite>>(new Map());\n const animationFrameRef = useRef<number>(0);\n const mountedRef = useRef(true);\n const [pixiReady, setPixiReady] = useState(false);\n const isAnimatingRef = useRef(false);\n const needsRenderRef = useRef(false);\n const initializingRef = useRef(false);\n const isViewTransitionRef = useRef(false);\n const lastViewChangeTimeRef = useRef(0);\n const previousViewModeRef = useRef<ViewMode>(viewMode);\n const prevLayoutRef = useRef<LayoutResult | null>(null);\n const prevGroupingRef = useRef<GroupingResult | null>(null);\n const prevScrollTopRef = useRef<number>(0);\n const prevScrollLeftRef = useRef<number>(0);\n const cardColorsRef = useRef<CardColors>(DEFAULT_COLORS);\n\n const cssColorResolver = useMemo(() => createCssColorResolver(), []);\n\n const onPanStartRef = useRef(onPanStart);\n const onPanMoveRef = useRef(onPanMove);\n const onPanEndRef = useRef(onPanEnd);\n const onCardClickRef = useRef(onCardClick);\n const prevPanRef = useRef({ x: panX, y: panY });\n\n // Initialize Pixi Application\n useEffect(() => {\n // ... existing code ...\n onPanMoveRef.current = onPanMove;\n onPanEndRef.current = onPanEnd;\n onCardClickRef.current = onCardClick;\n }, [onPanStart, onPanMove, onPanEnd, onCardClick]);\n\n useEffect(() => {\n cardColorsRef.current = resolveCardColors(cssColorResolver);\n }, [cssColorResolver]);\n\n useEffect(() => {\n // Reset mounted flag\n mountedRef.current = true;\n\n if (!parentContainerRef || !parentContainerRef.current) {\n return;\n }\n\n // Prevent multiple simultaneous initializations\n if (initializingRef.current || appRef.current) {\n return;\n }\n\n initializingRef.current = true;\n let app: PIXI.Application | null = null;\n // Handler references declared here so cleanup can remove them later.\n\n (async () => {\n try {\n // Prefer the new init API (v8+) to avoid deprecation issues. Fall back\n // to the constructor options when `init` is not available.\n const options = {\n backgroundAlpha: 0,\n antialias: false,\n autoStart: false,\n autoDensity: true,\n resolution: window.devicePixelRatio || 1,\n width: viewportWidth > 0 ? viewportWidth : 800,\n height: viewportHeight > 0 ? viewportHeight : 600,\n } as PIXI.ApplicationOptions;\n\n app = new PIXI.Application();\n if ((app as unknown as { init?: unknown }).init && typeof (app as unknown as { init: (...args: unknown[]) => unknown }).init === 'function') {\n // init may return a promise in some builds\n \n // @ts-ignore\n await app.init(options);\n } else {\n // Fall back to constructor that accepts options\n app.destroy?.();\n app = new PIXI.Application(options);\n }\n\n if (!mountedRef.current || !parentContainerRef.current) {\n // Component unmounted during initialization\n if (app && typeof app.destroy === 'function') app.destroy(true, { children: true });\n initializingRef.current = false;\n return;\n }\n\n appRef.current = app;\n\n const groupsContainer = new PIXI.Container();\n groupsContainerRef.current = groupsContainer;\n app.stage.addChild(groupsContainer);\n\n const root = new PIXI.Container();\n rootRef.current = root;\n app.stage.addChild(root);\n\n // Resolve canvas element (different Pixi builds expose it as `view` or\n // `canvas`).\n const canvasEl = (app.view ?? (app as unknown as { canvas?: HTMLCanvasElement }).canvas ?? app.renderer?.view) as HTMLCanvasElement | undefined;\n\n // Place canvas outside the scrollable content so native scrolling\n // doesn't move the canvas DOM element itself. We overlay the canvas\n // on top of the scroll area by inserting it into the parent element\n // (or the container itself if parent is not available). This ensures\n // the Pixi canvas remains stable while we move the Pixi world inside\n // it to represent camera pan.\n const overlayParent = parentContainerRef.current.parentElement ?? parentContainerRef.current;\n\n if (canvasEl) {\n if (canvasEl.parentElement) {\n canvasEl.parentElement.removeChild(canvasEl);\n }\n overlayParent.appendChild(canvasEl);\n canvasRef.current = canvasEl;\n } else if ((app as unknown as { canvas?: HTMLCanvasElement }).canvas) {\n const c = (app as unknown as { canvas: HTMLCanvasElement }).canvas;\n if (c.parentElement) {\n c.parentElement.removeChild(c);\n }\n overlayParent.appendChild(c);\n canvasRef.current = c;\n } else {\n console.error('PivotCanvas: Could not find canvas element from Pixi application');\n }\n\n // Position the canvas to overlay the scrollable container area.\n if (canvasRef.current && parentContainerRef.current) {\n const parentBounds = parentContainerRef.current.getBoundingClientRect();\n void parentBounds;\n canvasRef.current.style.position = 'absolute';\n // Place canvas relative to the overlayParent's coordinate space.\n // If overlayParent is the immediate parent, top/left 0 aligns it.\n const offsetLeft = parentContainerRef.current.offsetLeft;\n const offsetTop = parentContainerRef.current.offsetTop;\n canvasRef.current.style.left = `${offsetLeft}px`;\n canvasRef.current.style.top = `${offsetTop}px`;\n canvasRef.current.style.width = `${parentContainerRef.current.clientWidth}px`;\n canvasRef.current.style.height = `${parentContainerRef.current.clientHeight}px`;\n // Place canvas behind the scrollable container (which has z-index 1)\n // so scrollbars appear on top.\n canvasRef.current.style.zIndex = '0';\n // Disable pointer events on canvas so they pass through to the viewport if needed,\n // though viewport is on top anyway.\n canvasRef.current.style.pointerEvents = 'none';\n }\n\n // We handle clicks and interactions manually in PivotViewerMain now,\n // so we don't need to configure Pixi events on the container.\n // This avoids z-index conflicts and event propagation issues.\n\n // Make canvas fill container with absolute positioning\n if (canvasRef.current) {\n canvasRef.current.style.display = 'block';\n // Ensure canvas does not capture events so they pass through to the viewport\n canvasRef.current.style.pointerEvents = 'none';\n }\n\n // Setup stage events for background panning\n app.stage.eventMode = 'static';\n app.stage.hitArea = new PIXI.Rectangle(0, 0, viewportWidth, viewportHeight);\n\n app.stage.on('pointerdown', (e) => {\n // Only handle if it reached the stage (background)\n // Sprites stop propagation, so this is safe\n onPanStartRef.current(e.nativeEvent as unknown as React.MouseEvent);\n });\n\n app.stage.on('globalpointermove', (e) => {\n onPanMoveRef.current(e.nativeEvent as unknown as React.MouseEvent);\n });\n\n app.stage.on('globalpointerup', () => {\n onPanEndRef.current();\n });\n\n // We no longer need manual event listeners on parentEl because Pixi\n // is now listening to events on parentEl directly via setTargetElement.\n // This allows Pixi to handle hit testing through the transparent container.\n const parentEl = parentContainerRef.current;\n if (parentEl) {\n // handleMouseDown = (e: Event) => onPanStartRef.current(e as unknown);\n // handleMouseMove = (e: Event) => onPanMoveRef.current(e as unknown);\n // handleMouseUp = () => onPanEndRef.current();\n // parentEl.addEventListener('mousedown', handleMouseDown);\n // parentEl.addEventListener('mousemove', handleMouseMove);\n // parentEl.addEventListener('mouseup', handleMouseUp);\n // parentEl.addEventListener('mouseleave', handleMouseUp);\n // window.addEventListener('mouseup', handleMouseUp);\n // window.addEventListener('pointerup', handleMouseUp);\n }\n\n // Immediately size to container to avoid delay\n if (viewportWidth > 0 && viewportHeight > 0) {\n app.renderer?.resize(viewportWidth, viewportHeight);\n }\n\n setPixiReady(true);\n initializingRef.current = false;\n\n // Trigger initial render\n needsRenderRef.current = true;\n app.renderer?.render(app.stage);\n } catch (error) {\n console.error('Failed to initialize Pixi.js:', error);\n initializingRef.current = false;\n }\n })();\n\n return () => {\n mountedRef.current = false;\n setPixiReady(false);\n cancelAnimationFrame(animationFrameRef.current);\n\n if (appRef.current && typeof appRef.current.destroy === 'function') {\n appRef.current.destroy(true, { children: true });\n appRef.current = null;\n rootRef.current = null;\n }\n\n // Clear local sprite references to prevent re-use of destroyed sprites\n spritesRef.current.clear();\n\n // Clear sprite pool to avoid holding onto destroyed textures\n // clearSpritePool();\n\n // Remove any event listeners we attached to the parent container\n try {\n const parentEl = parentContainerRef.current;\n if (parentEl) {\n // if (handleMouseDown) parentEl.removeEventListener('mousedown', handleMouseDown);\n // if (handleMouseMove) parentEl.removeEventListener('mousemove', handleMouseMove);\n // if (handleMouseUp) parentEl.removeEventListener('mouseup', handleMouseUp);\n // if (handleMouseUp) parentEl.removeEventListener('mouseleave', handleMouseUp);\n // if (handleMouseUp) {\n // window.removeEventListener('mouseup', handleMouseUp);\n // window.removeEventListener('pointerup', handleMouseUp);\n // }\n }\n } catch (e) {\n void e;\n }\n // Remove DOM nodes we appended\n try {\n if (canvasRef.current && canvasRef.current.parentElement) {\n canvasRef.current.parentElement.removeChild(canvasRef.current);\n }\n } catch (e) {\n void e;\n }\n };\n }, []); // Only initialize once - resizing handled by separate useEffect\n\n // Handle canvas resize\n useEffect(() => {\n if (!parentContainerRef || !parentContainerRef.current || !appRef.current || !pixiReady) return;\n\n const container = parentContainerRef.current;\n const app = appRef.current;\n\n let resizeTimeout: ReturnType<typeof setTimeout>;\n\n const handleResize = () => {\n // Size canvas to viewport dimensions from props\n if (viewportWidth > 0 && viewportHeight > 0) {\n app.renderer?.resize(viewportWidth, viewportHeight);\n app.stage.hitArea = new PIXI.Rectangle(0, 0, viewportWidth, viewportHeight);\n\n // Keep canvas DOM size in sync with container\n if (canvasRef.current && parentContainerRef.current) {\n canvasRef.current.style.width = `${parentContainerRef.current.clientWidth}px`;\n canvasRef.current.style.height = `${parentContainerRef.current.clientHeight}px`;\n // Also update left/top in case the container moved\n canvasRef.current.style.left = `${parentContainerRef.current.offsetLeft}px`;\n canvasRef.current.style.top = `${parentContainerRef.current.offsetTop}px`;\n }\n }\n };\n\n const debouncedResize = () => {\n clearTimeout(resizeTimeout);\n resizeTimeout = setTimeout(handleResize, 150);\n };\n\n // Initial resize (immediate)\n handleResize();\n\n // Watch for size changes (debounced)\n const resizeObserver = new ResizeObserver(debouncedResize);\n resizeObserver.observe(container);\n\n return () => {\n clearTimeout(resizeTimeout);\n resizeObserver.disconnect();\n };\n }, [pixiReady, viewportWidth, viewportHeight]);\n\n // Update group backgrounds only when layout/grouping changes\n useEffect(() => {\n if (!groupsContainerRef.current || !parentContainerRef.current || !pixiReady) return;\n updateGroupBackgroundsExternal(groupsContainerRef.current, parentContainerRef.current, grouping, layout, zoomLevel, cardColorsRef.current, viewMode);\n needsRenderRef.current = true;\n appRef.current?.renderer?.render(appRef.current.stage);\n }, [grouping, layout, zoomLevel, viewMode, pixiReady]);\n\n // Fade buckets background when switching view modes\n useEffect(() => {\n const gc = groupsContainerRef.current;\n const app = appRef.current;\n if (!gc || !app) return;\n const target = viewMode === 'grouped' ? 1 : 0;\n const start = typeof gc.alpha === 'number' ? gc.alpha : 1;\n const duration = 200; // ms\n if (Math.abs(start - target) < 0.01) {\n gc.alpha = target;\n return;\n }\n const t0 = performance.now();\n const step = () => {\n const u = Math.min(1, (performance.now() - t0) / duration);\n const eased = u * (2 - u);\n gc.alpha = start + (target - start) * eased;\n app.renderer?.render(app.stage);\n if (u < 1) requestAnimationFrame(step);\n };\n requestAnimationFrame(step);\n }, [viewMode]);\n\n useEffect(() => {\n if (!rootRef.current || !parentContainerRef.current || !pixiReady) {\n return;\n }\n\n // Check if this is a view mode change (not just pan/scroll)\n const viewModeChanged = previousViewModeRef.current !== viewMode;\n const groupingChanged = prevGroupingRef.current !== grouping;\n const layoutChanged = prevLayoutRef.current !== layout;\n\n if (viewModeChanged || groupingChanged || layoutChanged) {\n isViewTransitionRef.current = true;\n lastViewChangeTimeRef.current = Date.now();\n previousViewModeRef.current = viewMode;\n prevGroupingRef.current = grouping;\n \n // Don't hide sprites here - let visibility.ts handle the transition\n // The syncSpritesToViewport function will properly animate sprites to new positions\n // during view transitions (isViewTransitionRef.current = true), and visibility.ts\n // will handle cleanup of sprites that no longer have positions in the layout.\n // Previously, hiding sprites here caused sorting/transitions to not work because\n // sprites were destroyed before they could animate.\n }\n\n // Update spacer dimensions to match scaled world size\n if (spacerRef.current) {\n const spacer = spacerRef.current;\n const worldWidth = (layout.totalWidth || viewportWidth) * zoomLevel;\n const worldHeight = (layout.totalHeight || viewportHeight) * zoomLevel;\n spacer.style.width = `${Math.max(worldWidth, viewportWidth)}px`;\n spacer.style.height = `${Math.max(worldHeight, viewportHeight)}px`;\n }\n\n // Ensure scroll spacer matches layout so the container becomes scrollable and\n // native scrollLeft/scrollTop reflect the camera position.\n if (parentContainerRef.current) {\n const spacer = spacerRef.current;\n if (spacer) {\n // Debug: log spacer and layout values to detect mismatches\n }\n }\n\n const panDeltaX = panX - prevPanRef.current.x;\n const panDeltaY = panY - prevPanRef.current.y;\n prevPanRef.current = { x: panX, y: panY };\n\n // Sync sprites into viewport and create/remove as needed\n // Provide wrappers for sprite creation and content update so helpers have required context\n const currentScrollTop = parentContainerRef.current?.scrollTop || 0;\n const currentScrollLeft = parentContainerRef.current?.scrollLeft || 0;\n \n syncSpritesToViewport({\n root: rootRef.current,\n groupsContainer: groupsContainerRef.current,\n container: parentContainerRef.current,\n sprites: spritesRef.current,\n layout,\n visibleIds,\n items,\n cardWidth,\n cardHeight,\n panX,\n panY,\n panDeltaX,\n panDeltaY,\n zoomLevel,\n viewportWidth,\n viewportHeight,\n viewMode,\n createCardSprite: (id: string | number, x: number, y: number) => createCardSpriteExternal(\n id,\n x,\n y,\n items as TItem[],\n (item: TItem, e: MouseEvent, id: string | number) => (onCardClickRef.current)(item, e, id),\n (e: MouseEvent) => (onPanStart)(e as unknown as React.MouseEvent),\n cardWidth,\n cardHeight,\n cardColorsRef.current,\n cardRenderer,\n resolveId\n ),\n updateCardContent: (sprite: CardSprite, item: TItem) => updateCardContentExternal(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current, cardRenderer),\n isViewTransition: isViewTransitionRef.current,\n prevLayout: prevLayoutRef.current,\n prevScrollTop: prevScrollTopRef.current,\n prevScrollLeft: prevScrollLeftRef.current,\n });\n \n // Update previous scroll position for next frame\n prevScrollTopRef.current = currentScrollTop;\n prevScrollLeftRef.current = currentScrollLeft;\n needsRenderRef.current = true;\n \n // Force an immediate render after syncing sprites to ensure cards appear\n if (appRef.current?.renderer && rootRef.current) {\n appRef.current.renderer.render(appRef.current.stage);\n needsRenderRef.current = false;\n }\n \n startAnimationLoopExternal({\n mountedRef,\n appRef,\n animationFrameRef,\n isAnimatingRef,\n needsRenderRef,\n spritesRef,\n isViewTransitionRef,\n });\n }, [layout, visibleIds, items, cardWidth, cardHeight, pixiReady, zoomLevel, panX, panY, grouping, viewMode]);\n\n // Update prevLayoutRef after processing layout changes\n useEffect(() => {\n prevLayoutRef.current = layout;\n }, [layout]);\n\n // Duplicate camera position effect removed -- syncSpritesToViewport handles this with correct offsetY logic logic\n /*\n useEffect(() => {\n if (!rootRef.current || !groupsContainerRef.current) return;\n\n // Camera transform: move world opposite to camera position. Prefer the\n // native container scroll positions where available (they are authoritative\n // during user scrolls) and fall back to the passed pan props.\n const effectivePanX = parentContainerRef.current ? parentContainerRef.current.scrollLeft : panX;\n const effectivePanY = parentContainerRef.current ? parentContainerRef.current.scrollTop : panY;\n\n // Apply zoom and position to root and groups.\n if (rootRef.current.scale && groupsContainerRef.current.scale) {\n rootRef.current.scale.set(zoomLevel);\n groupsContainerRef.current.scale.set(zoomLevel);\n }\n if (rootRef.current.position && groupsContainerRef.current.position) {\n rootRef.current.position.set(-effectivePanX, -effectivePanY);\n groupsContainerRef.current.position.set(-effectivePanX, -effectivePanY);\n }\n appRef.current?.renderer?.render(appRef.current.stage);\n }, [zoomLevel, panX, panY]);\n */\n\n useEffect(() => {\n if (!rootRef.current) return;\n updateSelection();\n needsRenderRef.current = true;\n appRef.current?.renderer.render(appRef.current.stage);\n }, [selectedId, items]);\n\n useEffect(() => {\n if (!rootRef.current) return;\n updateHighlight();\n needsRenderRef.current = true;\n appRef.current?.renderer.render(appRef.current.stage);\n }, [hoveredGroupIndex, layout, grouping]);\n\n // Note: animation loop and group background updates are delegated to\n // external helpers (`startAnimationLoopExternal` and\n // `updateGroupBackgroundsExternal`) and invoked where needed. We don't\n // expose local wrappers to avoid unused-function lint warnings.\n\n // Listen to native scroll events on the parent container so we update the\n // Pixi world immediately when the user scrolls (native scrollbar or\n // programmatic). This ensures `syncSpritesToViewport` runs on scroll and\n // creates/destroys sprites as the viewport moves.\n useEffect(() => {\n if (!pixiReady || !parentContainerRef || !parentContainerRef.current || !appRef.current || !rootRef.current) return;\n\n const container = parentContainerRef.current;\n const app = appRef.current;\n\n // rAF-batched scroll handling: store the latest scroll values and process\n // them once per animation frame to avoid heavy synchronous work inside\n // the scroll event which causes jank and de-synchronisation between the\n // compositor and Pixi render updates.\n const lastScroll = { x: container.scrollLeft, y: container.scrollTop };\n const pendingRef = { scheduled: false } as { scheduled: boolean };\n\n const processScroll = () => {\n pendingRef.scheduled = false;\n try {\n // Read directly from container to ensure consistency with visibility logic\n // and to handle cases where scroll changes without event (e.g. resize clamping)\n const effectivePanX = container.scrollLeft;\n const effectivePanY = container.scrollTop;\n\n // Update lastScroll to keep it in sync\n lastScroll.x = effectivePanX;\n lastScroll.y = effectivePanY;\n\n // Note: We delegate root/groups container positioning to syncSpritesToViewport\n // because it encapsulates the logic for conditional vertical alignment (offsetY)\n // in different view modes. Manually setting position here would overwrite that logic.\n\n syncSpritesToViewport({\n root: rootRef.current,\n groupsContainer: groupsContainerRef.current,\n container: parentContainerRef.current,\n sprites: spritesRef.current,\n layout,\n visibleIds,\n items,\n cardWidth,\n cardHeight,\n panX,\n panY,\n zoomLevel,\n viewportWidth,\n viewportHeight,\n createCardSprite: (id: string | number, x: number, y: number) => createCardSpriteExternal(\n id, x, y, items as TItem[],\n (item, e, id) => (onCardClickRef.current)(item, e, id),\n (e) => (onPanStartRef.current)(e as unknown as React.MouseEvent),\n cardWidth, cardHeight, cardColorsRef.current, cardRenderer, resolveId\n ),\n updateCardContent: (sprite: CardSprite, item: TItem) => updateCardContentExternal(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current, cardRenderer),\n isViewTransition: isViewTransitionRef.current,\n viewMode,\n prevScrollTop: prevScrollTopRef.current,\n prevScrollLeft: prevScrollLeftRef.current,\n });\n \n // Update previous scroll position for next frame\n prevScrollTopRef.current = container.scrollTop || 0;\n prevScrollLeftRef.current = container.scrollLeft || 0;\n needsRenderRef.current = true;\n app.renderer?.render(app.stage);\n } catch (e) {\n console.error('[PivotCanvas] processScroll error', e);\n }\n };\n\n const onScroll = () => {\n // capture latest scroll positions quickly and schedule work\n lastScroll.x = container.scrollLeft;\n lastScroll.y = container.scrollTop;\n if (!pendingRef.scheduled) {\n pendingRef.scheduled = true;\n requestAnimationFrame(processScroll);\n }\n };\n\n container.addEventListener('scroll', onScroll, { passive: true });\n\n return () => {\n container.removeEventListener('scroll', onScroll);\n };\n }, [pixiReady, layout, visibleIds, items, cardWidth, cardHeight, zoomLevel, viewportWidth, viewportHeight, panX, panY, grouping, viewMode, selectedId, onCardClick, onPanStart]);\n\n function createCardSprite(id: ItemId, x: number, y: number): CardSprite {\n return createCardSpriteExternal(\n id, x, y, items as TItem[],\n (item, e, id) => (onCardClickRef.current)(item, e, id),\n (e) => (onPanStartRef.current)(e as unknown as React.MouseEvent),\n cardWidth, cardHeight, cardColorsRef.current, cardRenderer, resolveId\n );\n }\n // Mark these helpers as used (they may be referenced externally or via callbacks)\n void createCardSprite;\n\n function updateCardContent(sprite: CardSprite, item: TItem) {\n return updateCardContentExternal(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current, cardRenderer);\n }\n\n function updatePositions(): boolean {\n return updatePositionsExternal(spritesRef.current, isViewTransitionRef, ANIMATION_SPEED);\n }\n\n void updatePositions;\n\n function updateSelection() {\n const sprites = spritesRef.current;\n\n for (const sprite of sprites.values()) {\n const val = (items as TItem[])[Number(sprite.itemId)];\n updateCardContent(sprite, val);\n }\n }\n\n function updateHighlight() {\n updateHighlightExternal(groupsContainerRef.current, parentContainerRef.current, grouping, layout, hoveredGroupIndex, cardWidth, zoomLevel);\n }\n\n void updateHighlight;\n\n // This component renders into the parent `containerRef` (we append Pixi canvas\n // and spacer directly into that DOM node). Return null so we don't replace or\n // reassign the parent's ref which must remain the scrollable viewport element.\n return null;\n}\n"],"names":["updateGroupBackgroundsExternal","createCardSpriteExternal","updateCardContentExternal","startAnimationLoopExternal","updateHighlight","updateCardContent","updateHighlightExternal"],"mappings":";;;;;;;;;AA0EM,SAAU,WAAW,CAAuB,EAChD,KAAK,EACL,MAAM,EACN,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,SAAS,EAAE,UAAU,GAAG,KAAK,EAC7B,SAAS,EAAE,UAAU,EACrB,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,YAAY,GACY,EAAA;IAGxB,MAAM,kBAAkB,GAAG,YAAY;IAGvC,MAAM,SAAS,GAAG,UAAU;AAC5B,IAAA,MAAM,SAAS,GAAG,MAAM,CAA2B,IAAI,CAAC;AACxD,IAAA,MAAM,SAAS,GAAG,MAAM,CAAwB,IAAI,CAAC;AACrD,IAAA,MAAM,MAAM,GAAG,MAAM,CAA0B,IAAI,CAAC;AACpD,IAAA,MAAM,OAAO,GAAG,MAAM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L,IAAA,SAASG,mBAAiB,CAAC,MAAkB,EAAE,IAAW,EAAA;AACxD,QAAA,OAAOH,iBAAyB,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC;IACxH;AAQA,IAAA,SAAS,eAAe,GAAA;AACtB,QAAA,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO;QAElC,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE;YACrC,MAAM,GAAG,GAAI,KAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACrD,YAAAG,mBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC;QAChC;IACF;AAEA,IAAA,SAASD,iBAAe,GAAA;AACtB,QAAAE,eAAuB,CAAC,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,CAAC;IAC5I;AAOA,IAAA,OAAO,IAAI;AACb;;;;"}
|
|
@@ -24,7 +24,11 @@ export interface PivotViewerMainProps<TItem extends object> {
|
|
|
24
24
|
hoveredGroupIndex: number | null;
|
|
25
25
|
isZooming: boolean;
|
|
26
26
|
viewMode: ViewMode;
|
|
27
|
-
cardRenderer
|
|
27
|
+
cardRenderer: (item: TItem) => {
|
|
28
|
+
title: string;
|
|
29
|
+
labels: string[];
|
|
30
|
+
values: string[];
|
|
31
|
+
};
|
|
28
32
|
detailRenderer?: (item: TItem, onClose: () => void) => ReactNode;
|
|
29
33
|
resolveId: (item: TItem, index: number) => ItemId;
|
|
30
34
|
emptyContent?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PivotViewerMain.d.ts","sourceRoot":"","sources":["../../../../PivotViewer/components/PivotViewerMain.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM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S,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,SAAS,EACT,YAAY,EACZ,eAAe,EACf,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,SAAS,GACV,EAAE,oBAAoB,CAAC,KAAK,CAAC,2CAiL7B"}
|
|
@@ -3,8 +3,16 @@ import { Spinner } from './Spinner.js';
|
|
|
3
3
|
import { PivotCanvas } from './PivotCanvas.js';
|
|
4
4
|
import { AxisLabels } from './AxisLabels.js';
|
|
5
5
|
import { DetailPanel } from './DetailPanel.js';
|
|
6
|
+
import { normalizeIdToLayoutKey } from '../utils/idResolution.js';
|
|
6
7
|
|
|
7
8
|
function PivotViewerMain({ data, ready, isLoading, visibleIds, grouping, layout, cardWidth, cardHeight, zoomLevel, scrollPosition, containerDimensions, selectedItem, hoveredGroupIndex, isZooming, viewMode, cardRenderer, detailRenderer, resolveId, emptyContent, dimensionFilter, onCardClick, onPanStart, onPanMove, onPanEnd, onGroupHover, onAxisLabelClick, onCloseDetail, containerRef, axisLabelsRef, spacerRef, }) {
|
|
9
|
+
const selectedLayoutId = selectedItem
|
|
10
|
+
? (() => {
|
|
11
|
+
const index = data.indexOf(selectedItem);
|
|
12
|
+
const rawId = index !== -1 ? index : 0;
|
|
13
|
+
return normalizeIdToLayoutKey(rawId, layout);
|
|
14
|
+
})()
|
|
15
|
+
: null;
|
|
8
16
|
const handleViewportClick = (e) => {
|
|
9
17
|
if (isZooming || !containerRef.current)
|
|
10
18
|
return;
|
|
@@ -30,6 +38,9 @@ function PivotViewerMain({ data, ready, isLoading, visibleIds, grouping, layout,
|
|
|
30
38
|
}
|
|
31
39
|
}
|
|
32
40
|
}
|
|
41
|
+
if (selectedItem) {
|
|
42
|
+
onCloseDetail();
|
|
43
|
+
}
|
|
33
44
|
};
|
|
34
45
|
const handleViewportMouseMove = (e) => {
|
|
35
46
|
if (isZooming || !containerRef.current)
|
|
@@ -63,18 +74,18 @@ function PivotViewerMain({ data, ready, isLoading, visibleIds, grouping, layout,
|
|
|
63
74
|
width: layout.totalWidth * zoomLevel,
|
|
64
75
|
height: layout.totalHeight * zoomLevel,
|
|
65
76
|
pointerEvents: 'none'
|
|
66
|
-
} }), !ready && (jsx("div", { className: "pv-loading", children: "Building indexes..." })), ready && visibleIds.length === 0 && (jsx("div", { className: "pv-empty", children: emptyContent ?? 'No items to display.' })), ready && visibleIds.length > 0 && (jsx(PivotCanvas, { items: data, layout: layout, grouping: grouping, visibleIds: visibleIds, cardWidth: cardWidth, cardHeight: cardHeight, zoomLevel: zoomLevel, panX: scrollPosition.x, panY: scrollPosition.y, viewportWidth: containerDimensions.width, viewportHeight: containerDimensions.height, selectedId:
|
|
67
|
-
? (
|
|
68
|
-
: (jsx(DetailPanel, { selectedItem: selectedItem, onClose: onCloseDetail }))] }),
|
|
77
|
+
} }), !ready && (jsx("div", { className: "pv-loading", children: "Building indexes..." })), ready && visibleIds.length === 0 && (jsx("div", { className: "pv-empty", children: emptyContent ?? 'No items to display.' })), ready && visibleIds.length > 0 && (jsx(PivotCanvas, { items: data, layout: layout, grouping: grouping, visibleIds: visibleIds, cardWidth: cardWidth, cardHeight: cardHeight, zoomLevel: zoomLevel, panX: scrollPosition.x, panY: scrollPosition.y, viewportWidth: containerDimensions.width, viewportHeight: containerDimensions.height, selectedId: selectedLayoutId, hoveredGroupIndex: hoveredGroupIndex, isZooming: isZooming, cardRenderer: cardRenderer, resolveId: resolveId, onCardClick: onCardClick, onPanStart: onPanStart, onPanMove: onPanMove, onPanEnd: onPanEnd, containerRef: containerRef, viewMode: viewMode }))] }), detailRenderer
|
|
78
|
+
? (jsx(DetailPanel, { selectedItem: selectedItem, onClose: onCloseDetail, contentRenderer: detailRenderer }))
|
|
79
|
+
: (jsx(DetailPanel, { selectedItem: selectedItem, onClose: onCloseDetail }))] }), jsx(AxisLabels, { groups: grouping.groups.map((g) => ({
|
|
69
80
|
key: g.key,
|
|
70
81
|
value: g.value,
|
|
71
82
|
label: String(g.value),
|
|
72
83
|
items: [],
|
|
73
84
|
count: g.ids.length,
|
|
74
|
-
})), bucketWidths: layout.bucketWidths || [], zoomLevel: zoomLevel, dimensionFilter: dimensionFilter, hoveredGroup: hoveredGroupIndex !== null ? String(grouping.groups[hoveredGroupIndex]?.value) : null, onHover: (label) => {
|
|
85
|
+
})), bucketWidths: layout.bucketWidths || [], zoomLevel: zoomLevel, dimensionFilter: dimensionFilter, hoveredGroup: hoveredGroupIndex !== null ? String(grouping.groups[hoveredGroupIndex]?.value) : null, visible: viewMode === 'grouped' && grouping.groups.length > 0, onHover: (label) => {
|
|
75
86
|
const index = grouping.groups.findIndex(g => String(g.value) === label);
|
|
76
87
|
onGroupHover(index >= 0 ? index : null);
|
|
77
|
-
}, onClick: onAxisLabelClick, containerRef: axisLabelsRef })
|
|
88
|
+
}, onClick: onAxisLabelClick, containerRef: axisLabelsRef })] }));
|
|
78
89
|
}
|
|
79
90
|
|
|
80
91
|
export { PivotViewerMain };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PivotViewerMain.js","sources":["../../../../PivotViewer/components/PivotViewerMain.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { ReactNode } from 'react';\nimport type { ItemId, LayoutResult, GroupingResult } from '../engine/types';\nimport type { ViewMode } from './Toolbar';\nimport type { PivotDimensionFilter } from '../hooks/useDimensionState';\nimport { Spinner } from './Spinner';\nimport { PivotCanvas } from './PivotCanvas';\nimport { AxisLabels } from './AxisLabels';\nimport { DetailPanel } from './DetailPanel';\n\nexport interface PivotViewerMainProps<TItem extends object> {\n data: TItem[];\n ready: boolean;\n isLoading: boolean;\n visibleIds: Uint32Array;\n grouping: GroupingResult;\n layout: LayoutResult;\n cardWidth: number;\n cardHeight: number;\n zoomLevel: number;\n scrollPosition: { x: number; y: number };\n containerDimensions: { width: number; height: number };\n selectedItem: TItem | null;\n hoveredGroupIndex: number | null;\n isZooming: boolean;\n viewMode: ViewMode;\n cardRenderer?: (item: TItem) => ReactNode;\n /** Optional renderer for a custom details panel when a card is selected */\n detailRenderer?: (item: TItem, onClose: () => void) => ReactNode;\n resolveId: (item: TItem, index: number) => ItemId;\n emptyContent?: ReactNode;\n dimensionFilter: PivotDimensionFilter;\n onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void;\n onPanStart: (e: React.MouseEvent) => void;\n onPanMove: (e: React.MouseEvent) => void;\n onPanEnd: () => void;\n onGroupHover: (index: number | null) => void;\n onAxisLabelClick: (value: string) => void;\n onCloseDetail: () => void;\n containerRef: React.RefObject<HTMLDivElement | null>;\n axisLabelsRef: React.RefObject<HTMLDivElement | null>;\n spacerRef: React.RefObject<HTMLDivElement | null>;\n}\n\nexport function PivotViewerMain<TItem extends object>({\n data,\n ready,\n isLoading,\n visibleIds,\n grouping,\n layout,\n cardWidth,\n cardHeight,\n zoomLevel,\n scrollPosition,\n containerDimensions,\n selectedItem,\n hoveredGroupIndex,\n isZooming,\n viewMode,\n cardRenderer,\n detailRenderer,\n resolveId,\n emptyContent,\n dimensionFilter,\n onCardClick,\n onPanStart,\n onPanMove,\n onPanEnd,\n onGroupHover,\n onAxisLabelClick,\n onCloseDetail,\n containerRef,\n axisLabelsRef,\n spacerRef,\n}: PivotViewerMainProps<TItem>) {\n const handleViewportClick = (e: React.MouseEvent) => {\n if (isZooming || !containerRef.current) return;\n\n const container = containerRef.current;\n const rect = container.getBoundingClientRect();\n // Use live DOM scroll position for accurate hit testing\n const scrollLeft = container.scrollLeft;\n const scrollTop = container.scrollTop;\n\n const clickX = e.clientX - rect.left + scrollLeft;\n const clickY = e.clientY - rect.top + scrollTop;\n\n const worldX = clickX / zoomLevel;\n const worldY = clickY / zoomLevel;\n\n // Check visible items\n for (let i = 0; i < visibleIds.length; i++) {\n const id = visibleIds[i];\n const pos = layout.positions.get(id);\n if (pos) {\n if (worldX >= pos.x && worldX <= pos.x + cardWidth &&\n worldY >= pos.y && worldY <= pos.y + cardHeight) {\n const item = data[id];\n if (item) {\n onCardClick(item, e.nativeEvent as unknown as MouseEvent, id);\n }\n return;\n }\n }\n }\n };\n\n const handleViewportMouseMove = (e: React.MouseEvent) => {\n if (isZooming || !containerRef.current) return;\n\n const container = containerRef.current;\n const rect = container.getBoundingClientRect();\n const scrollLeft = container.scrollLeft;\n const scrollTop = container.scrollTop;\n\n const mouseX = e.clientX - rect.left + scrollLeft;\n const mouseY = e.clientY - rect.top + scrollTop;\n\n const worldX = mouseX / zoomLevel;\n const worldY = mouseY / zoomLevel;\n\n let isOverCard = false;\n for (let i = 0; i < visibleIds.length; i++) {\n const id = visibleIds[i];\n const pos = layout.positions.get(id);\n if (pos) {\n if (worldX >= pos.x && worldX <= pos.x + cardWidth &&\n worldY >= pos.y && worldY <= pos.y + cardHeight) {\n isOverCard = true;\n break;\n }\n }\n }\n\n container.style.cursor = isOverCard ? 'pointer' : 'default';\n };\n\n return isLoading ? (\n <Spinner />\n ) : (\n <div className=\"pv-groups-wrapper\">\n <div style={{ position: 'relative', flex: 1, display: 'flex', flexDirection: 'column', minHeight: 0 }}>\n <div\n className={`pv-viewport ${isZooming ? 'pv-zooming' : ''}`}\n ref={containerRef}\n style={{ overflow: 'auto', position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}\n onClick={handleViewportClick}\n onMouseMove={handleViewportMouseMove}\n >\n {/* Spacer for scrolling - explicitly rendered to allow synchronous updates during animation */}\n <div\n ref={spacerRef}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: layout.totalWidth * zoomLevel,\n height: layout.totalHeight * zoomLevel,\n pointerEvents: 'none'\n }}\n />\n\n {!ready && (\n <div className=\"pv-loading\">Building indexes...</div>\n )}\n\n {ready && visibleIds.length === 0 && (\n <div className=\"pv-empty\">\n {emptyContent ?? 'No items to display.'}\n </div>\n )}\n\n {ready && visibleIds.length > 0 && (\n <PivotCanvas\n items={data}\n layout={layout}\n grouping={grouping}\n visibleIds={visibleIds}\n cardWidth={cardWidth}\n cardHeight={cardHeight}\n zoomLevel={zoomLevel}\n panX={scrollPosition.x}\n panY={scrollPosition.y}\n viewportWidth={containerDimensions.width}\n viewportHeight={containerDimensions.height}\n selectedId={selectedItem ? resolveId(selectedItem, 0) : null}\n hoveredGroupIndex={hoveredGroupIndex}\n isZooming={isZooming}\n cardRenderer={cardRenderer}\n resolveId={resolveId}\n onCardClick={onCardClick}\n onPanStart={onPanStart}\n onPanMove={onPanMove}\n onPanEnd={onPanEnd}\n containerRef={containerRef}\n viewMode={viewMode}\n />\n )}\n </div>\n {detailRenderer\n ? (selectedItem ? detailRenderer(selectedItem, onCloseDetail) : null)\n : (\n <DetailPanel\n selectedItem={selectedItem}\n onClose={onCloseDetail}\n />\n )}\n </div>\n\n {viewMode === 'grouped' && grouping.groups.length > 0 && (\n <AxisLabels\n groups={grouping.groups.map((g) => ({\n key: g.key,\n value: g.value,\n label: String(g.value),\n items: [],\n count: g.ids.length,\n }))}\n bucketWidths={layout.bucketWidths || []}\n zoomLevel={zoomLevel}\n dimensionFilter={dimensionFilter}\n hoveredGroup={hoveredGroupIndex !== null ? String(grouping.groups[hoveredGroupIndex]?.value) : null}\n onHover={(label) => {\n const index = grouping.groups.findIndex(g => String(g.value) === label);\n onGroupHover(index >= 0 ? index : null);\n }}\n onClick={onAxisLabelClick}\n containerRef={axisLabelsRef}\n />\n )}\n </div>\n );\n}\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;AA8CM,SAAU,eAAe,CAAuB,EACpD,IAAI,EACJ,KAAK,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,Y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AAC,CAAC,CAAC,MAAM;oBACpC,GAAG,EAAE,CAAC,CAAC,GAAG;oBACV,KAAK,EAAE,CAAC,CAAC,KAAK;AACd,oBAAA,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;AACtB,oBAAA,KAAK,EAAE,EAAE;AACT,oBAAA,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM;iBACpB,CAAC,CAAC,EACH,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,EAAE,EACvC,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,iBAAiB,KAAK,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,KAAK,CAAC,GAAG,IAAI,EACnG,OAAO,EAAE,CAAC,KAAK,KAAI;oBACjB,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;AACvE,oBAAA,YAAY,CAAC,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC;AACzC,gBAAA,CAAC,EACD,OAAO,EAAE,gBAAgB,EACzB,YAAY,EAAE,aAAa,EAAA,CAC3B,CACH,CAAA,EAAA,CACG,CACP;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"PivotViewerMain.js","sources":["../../../../PivotViewer/components/PivotViewerMain.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { ReactNode } from 'react';\nimport type { ItemId, LayoutResult, GroupingResult } from '../engine/types';\nimport type { ViewMode } from './Toolbar';\nimport type { PivotDimensionFilter } from '../hooks/useDimensionState';\nimport { Spinner } from './Spinner';\nimport { PivotCanvas } from './PivotCanvas';\nimport { AxisLabels } from './AxisLabels';\nimport { DetailPanel } from './DetailPanel';\nimport { normalizeIdToLayoutKey } from '../utils/idResolution';\n\nexport interface PivotViewerMainProps<TItem extends object> {\n data: TItem[];\n ready: boolean;\n isLoading: boolean;\n visibleIds: Uint32Array;\n grouping: GroupingResult;\n layout: LayoutResult;\n cardWidth: number;\n cardHeight: number;\n zoomLevel: number;\n scrollPosition: { x: number; y: number };\n containerDimensions: { width: number; height: number };\n selectedItem: TItem | null;\n hoveredGroupIndex: number | null;\n isZooming: boolean;\n viewMode: ViewMode;\n cardRenderer: (item: TItem) => { title: string; labels: string[]; values: string[] };\n /** Optional renderer for a custom details panel when a card is selected */\n detailRenderer?: (item: TItem, onClose: () => void) => ReactNode;\n resolveId: (item: TItem, index: number) => ItemId;\n emptyContent?: ReactNode;\n dimensionFilter: PivotDimensionFilter;\n onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void;\n onPanStart: (e: React.MouseEvent) => void;\n onPanMove: (e: React.MouseEvent) => void;\n onPanEnd: () => void;\n onGroupHover: (index: number | null) => void;\n onAxisLabelClick: (value: string) => void;\n onCloseDetail: () => void;\n containerRef: React.RefObject<HTMLDivElement | null>;\n axisLabelsRef: React.RefObject<HTMLDivElement | null>;\n spacerRef: React.RefObject<HTMLDivElement | null>;\n}\n\nexport function PivotViewerMain<TItem extends object>({\n data,\n ready,\n isLoading,\n visibleIds,\n grouping,\n layout,\n cardWidth,\n cardHeight,\n zoomLevel,\n scrollPosition,\n containerDimensions,\n selectedItem,\n hoveredGroupIndex,\n isZooming,\n viewMode,\n cardRenderer,\n detailRenderer,\n resolveId,\n emptyContent,\n dimensionFilter,\n onCardClick,\n onPanStart,\n onPanMove,\n onPanEnd,\n onGroupHover,\n onAxisLabelClick,\n onCloseDetail,\n containerRef,\n axisLabelsRef,\n spacerRef,\n}: PivotViewerMainProps<TItem>) {\n const selectedLayoutId: ItemId | null = selectedItem\n ? (() => {\n const index = data.indexOf(selectedItem);\n // Use array index as the canonical layout ID; it aligns with engine/store\n const rawId = index !== -1 ? index : 0;\n return normalizeIdToLayoutKey(rawId, layout) as ItemId;\n })()\n : null;\n\n const handleViewportClick = (e: React.MouseEvent) => {\n if (isZooming || !containerRef.current) return;\n\n const container = containerRef.current;\n const rect = container.getBoundingClientRect();\n // Use live DOM scroll position for accurate hit testing\n const scrollLeft = container.scrollLeft;\n const scrollTop = container.scrollTop;\n\n const clickX = e.clientX - rect.left + scrollLeft;\n const clickY = e.clientY - rect.top + scrollTop;\n\n const worldX = clickX / zoomLevel;\n const worldY = clickY / zoomLevel;\n\n // Check visible items\n for (let i = 0; i < visibleIds.length; i++) {\n const id = visibleIds[i];\n const pos = layout.positions.get(id);\n if (pos) {\n if (worldX >= pos.x && worldX <= pos.x + cardWidth &&\n worldY >= pos.y && worldY <= pos.y + cardHeight) {\n const item = data[id];\n if (item) {\n onCardClick(item, e.nativeEvent as unknown as MouseEvent, id);\n }\n return;\n }\n }\n }\n\n // Clicked background: if a card is selected, close/deselect it\n if (selectedItem) {\n onCloseDetail();\n }\n };\n\n const handleViewportMouseMove = (e: React.MouseEvent) => {\n if (isZooming || !containerRef.current) return;\n\n const container = containerRef.current;\n const rect = container.getBoundingClientRect();\n const scrollLeft = container.scrollLeft;\n const scrollTop = container.scrollTop;\n\n const mouseX = e.clientX - rect.left + scrollLeft;\n const mouseY = e.clientY - rect.top + scrollTop;\n\n const worldX = mouseX / zoomLevel;\n const worldY = mouseY / zoomLevel;\n\n let isOverCard = false;\n for (let i = 0; i < visibleIds.length; i++) {\n const id = visibleIds[i];\n const pos = layout.positions.get(id);\n if (pos) {\n if (worldX >= pos.x && worldX <= pos.x + cardWidth &&\n worldY >= pos.y && worldY <= pos.y + cardHeight) {\n isOverCard = true;\n break;\n }\n }\n }\n\n container.style.cursor = isOverCard ? 'pointer' : 'default';\n };\n\n return isLoading ? (\n <Spinner />\n ) : (\n <div className=\"pv-groups-wrapper\">\n <div style={{ position: 'relative', flex: 1, display: 'flex', flexDirection: 'column', minHeight: 0 }}>\n <div\n className={`pv-viewport ${isZooming ? 'pv-zooming' : ''}`}\n ref={containerRef}\n style={{ overflow: 'auto', position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}\n onClick={handleViewportClick}\n onMouseMove={handleViewportMouseMove}\n >\n {/* Spacer for scrolling - explicitly rendered to allow synchronous updates during animation */}\n <div\n ref={spacerRef}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: layout.totalWidth * zoomLevel,\n height: layout.totalHeight * zoomLevel,\n pointerEvents: 'none'\n }}\n />\n\n {!ready && (\n <div className=\"pv-loading\">Building indexes...</div>\n )}\n\n {ready && visibleIds.length === 0 && (\n <div className=\"pv-empty\">\n {emptyContent ?? 'No items to display.'}\n </div>\n )}\n\n {ready && visibleIds.length > 0 && (\n <PivotCanvas\n items={data}\n layout={layout}\n grouping={grouping}\n visibleIds={visibleIds}\n cardWidth={cardWidth}\n cardHeight={cardHeight}\n zoomLevel={zoomLevel}\n panX={scrollPosition.x}\n panY={scrollPosition.y}\n viewportWidth={containerDimensions.width}\n viewportHeight={containerDimensions.height}\n selectedId={selectedLayoutId}\n hoveredGroupIndex={hoveredGroupIndex}\n isZooming={isZooming}\n cardRenderer={cardRenderer}\n resolveId={resolveId}\n onCardClick={onCardClick}\n onPanStart={onPanStart}\n onPanMove={onPanMove}\n onPanEnd={onPanEnd}\n containerRef={containerRef}\n viewMode={viewMode}\n />\n )}\n </div>\n {detailRenderer\n ? (\n <DetailPanel\n selectedItem={selectedItem}\n onClose={onCloseDetail}\n contentRenderer={detailRenderer}\n />\n )\n : (\n <DetailPanel\n selectedItem={selectedItem}\n onClose={onCloseDetail}\n />\n )}\n </div>\n\n <AxisLabels\n groups={grouping.groups.map((g) => ({\n key: g.key,\n value: g.value,\n label: String(g.value),\n items: [],\n count: g.ids.length,\n }))}\n bucketWidths={layout.bucketWidths || []}\n zoomLevel={zoomLevel}\n dimensionFilter={dimensionFilter}\n hoveredGroup={hoveredGroupIndex !== null ? String(grouping.groups[hoveredGroupIndex]?.value) : null}\n visible={viewMode === 'grouped' && grouping.groups.length > 0}\n onHover={(label) => {\n const index = grouping.groups.findIndex(g => String(g.value) === label);\n onGroupHover(index >= 0 ? index : null);\n }}\n onClick={onAxisLabelClick}\n containerRef={axisLabelsRef}\n />\n </div>\n );\n}\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;AA+CM,SAAU,eAAe,CAAuB,EACpD,IAAI,EACJ,KAAK,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,SAAS,EACT,YAAY,EACZ,eAAe,EACf,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,SAAS,GACmB,EAAA;IAC5B,MAAM,gBAAgB,GAAkB;UACpC,CAAC,MAAK;YACJ,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;AAExC,YAAA,MAAM,KAAK,GAAG,KAAK,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;AACtC,YAAA,OAAO,sBAAsB,CAAC,KAAK,EAAE,MAAM,CAAW;AACxD,QAAA,CAAC;UACD,IAAI;AAER,IAAA,MAAM,mBAAmB,GAAG,CAAC,CAAmB,KAAI;AAClD,QAAA,IAAI,SAAS,IAAI,CAAC,YAAY,CAAC,OAAO;YAAE;AAExC,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO;AACtC,QAAA,MAAM,IAAI,GAAG,SAAS,CAAC,qBAAqB,EAAE;AAE9C,QAAA,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU;AACvC,QAAA,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS;QAErC,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,GAAG,UAAU;QACjD,MAAM,MAAM,GAAG,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