@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.
Files changed (137) hide show
  1. package/dist/cjs/PivotViewer/PivotViewer.css +70 -21
  2. package/dist/cjs/PivotViewer/PivotViewer.js +15 -5
  3. package/dist/cjs/PivotViewer/PivotViewer.js.map +1 -1
  4. package/dist/cjs/PivotViewer/components/AxisLabels.js +5 -8
  5. package/dist/cjs/PivotViewer/components/AxisLabels.js.map +1 -1
  6. package/dist/cjs/PivotViewer/components/DetailPanel.js +9 -2
  7. package/dist/cjs/PivotViewer/components/DetailPanel.js.map +1 -1
  8. package/dist/cjs/PivotViewer/components/PivotCanvas.js +62 -55
  9. package/dist/cjs/PivotViewer/components/PivotCanvas.js.map +1 -1
  10. package/dist/cjs/PivotViewer/components/PivotViewerMain.js +16 -5
  11. package/dist/cjs/PivotViewer/components/PivotViewerMain.js.map +1 -1
  12. package/dist/cjs/PivotViewer/components/Toolbar.js +34 -2
  13. package/dist/cjs/PivotViewer/components/Toolbar.js.map +1 -1
  14. package/dist/cjs/PivotViewer/components/pivot/animation.js +4 -3
  15. package/dist/cjs/PivotViewer/components/pivot/animation.js.map +1 -1
  16. package/dist/cjs/PivotViewer/components/pivot/constants.js +5 -5
  17. package/dist/cjs/PivotViewer/components/pivot/constants.js.map +1 -1
  18. package/dist/cjs/PivotViewer/components/pivot/groups.js +151 -0
  19. package/dist/cjs/PivotViewer/components/pivot/groups.js.map +1 -0
  20. package/dist/cjs/PivotViewer/components/pivot/sprites.js +11 -42
  21. package/dist/cjs/PivotViewer/components/pivot/sprites.js.map +1 -1
  22. package/dist/cjs/PivotViewer/components/pivot/visibility.js +57 -26
  23. package/dist/cjs/PivotViewer/components/pivot/visibility.js.map +1 -1
  24. package/dist/cjs/PivotViewer/constants.js +0 -2
  25. package/dist/cjs/PivotViewer/constants.js.map +1 -1
  26. package/dist/cjs/PivotViewer/engine/layout.js +11 -7
  27. package/dist/cjs/PivotViewer/engine/layout.js.map +1 -1
  28. package/dist/cjs/PivotViewer/hooks/useCardSelection.js +2 -1
  29. package/dist/cjs/PivotViewer/hooks/useCardSelection.js.map +1 -1
  30. package/dist/cjs/PivotViewer/hooks/useCurrentFilters.js.map +1 -1
  31. package/dist/cjs/PivotViewer/hooks/usePanning.js +8 -4
  32. package/dist/cjs/PivotViewer/hooks/usePanning.js.map +1 -1
  33. package/dist/cjs/PivotViewer/hooks/useViewModeScrollHandling.js +4 -3
  34. package/dist/cjs/PivotViewer/hooks/useViewModeScrollHandling.js.map +1 -1
  35. package/dist/cjs/PivotViewer/hooks/useZoomState.js +4 -0
  36. package/dist/cjs/PivotViewer/hooks/useZoomState.js.map +1 -1
  37. package/dist/cjs/PivotViewer/types.js.map +1 -1
  38. package/dist/cjs/PivotViewer/utils/animations.js +11 -3
  39. package/dist/cjs/PivotViewer/utils/animations.js.map +1 -1
  40. package/dist/cjs/PivotViewer/utils/cardPosition.js +0 -3
  41. package/dist/cjs/PivotViewer/utils/cardPosition.js.map +1 -1
  42. package/dist/cjs/PivotViewer/utils/constants.js +3 -3
  43. package/dist/cjs/PivotViewer/utils/constants.js.map +1 -1
  44. package/dist/cjs/PivotViewer/utils/selection.js +8 -1
  45. package/dist/cjs/PivotViewer/utils/selection.js.map +1 -1
  46. package/dist/esm/PivotViewer/PivotViewer.css +70 -21
  47. package/dist/esm/PivotViewer/PivotViewer.d.ts.map +1 -1
  48. package/dist/esm/PivotViewer/PivotViewer.js +16 -6
  49. package/dist/esm/PivotViewer/PivotViewer.js.map +1 -1
  50. package/dist/esm/PivotViewer/PivotViewer.stories.d.ts +0 -1
  51. package/dist/esm/PivotViewer/PivotViewer.stories.d.ts.map +1 -1
  52. package/dist/esm/PivotViewer/PivotViewer.stories.js +10 -9
  53. package/dist/esm/PivotViewer/PivotViewer.stories.js.map +1 -1
  54. package/dist/esm/PivotViewer/components/AxisLabels.d.ts +2 -1
  55. package/dist/esm/PivotViewer/components/AxisLabels.d.ts.map +1 -1
  56. package/dist/esm/PivotViewer/components/AxisLabels.js +6 -9
  57. package/dist/esm/PivotViewer/components/AxisLabels.js.map +1 -1
  58. package/dist/esm/PivotViewer/components/DetailPanel.d.ts +3 -1
  59. package/dist/esm/PivotViewer/components/DetailPanel.d.ts.map +1 -1
  60. package/dist/esm/PivotViewer/components/DetailPanel.js +10 -3
  61. package/dist/esm/PivotViewer/components/DetailPanel.js.map +1 -1
  62. package/dist/esm/PivotViewer/components/PivotCanvas.d.ts +5 -2
  63. package/dist/esm/PivotViewer/components/PivotCanvas.d.ts.map +1 -1
  64. package/dist/esm/PivotViewer/components/PivotCanvas.js +63 -56
  65. package/dist/esm/PivotViewer/components/PivotCanvas.js.map +1 -1
  66. package/dist/esm/PivotViewer/components/PivotViewerMain.d.ts +5 -1
  67. package/dist/esm/PivotViewer/components/PivotViewerMain.d.ts.map +1 -1
  68. package/dist/esm/PivotViewer/components/PivotViewerMain.js +16 -5
  69. package/dist/esm/PivotViewer/components/PivotViewerMain.js.map +1 -1
  70. package/dist/esm/PivotViewer/components/Toolbar.d.ts +3 -1
  71. package/dist/esm/PivotViewer/components/Toolbar.d.ts.map +1 -1
  72. package/dist/esm/PivotViewer/components/Toolbar.js +34 -2
  73. package/dist/esm/PivotViewer/components/Toolbar.js.map +1 -1
  74. package/dist/esm/PivotViewer/components/pivot/animation.d.ts.map +1 -1
  75. package/dist/esm/PivotViewer/components/pivot/animation.js +4 -3
  76. package/dist/esm/PivotViewer/components/pivot/animation.js.map +1 -1
  77. package/dist/esm/PivotViewer/components/pivot/constants.d.ts.map +1 -1
  78. package/dist/esm/PivotViewer/components/pivot/constants.js +5 -5
  79. package/dist/esm/PivotViewer/components/pivot/constants.js.map +1 -1
  80. package/dist/esm/PivotViewer/components/pivot/groups.d.ts +6 -0
  81. package/dist/esm/PivotViewer/components/pivot/groups.d.ts.map +1 -0
  82. package/dist/esm/PivotViewer/components/pivot/groups.js +129 -0
  83. package/dist/esm/PivotViewer/components/pivot/groups.js.map +1 -0
  84. package/dist/esm/PivotViewer/components/pivot/sprites.d.ts +10 -2
  85. package/dist/esm/PivotViewer/components/pivot/sprites.d.ts.map +1 -1
  86. package/dist/esm/PivotViewer/components/pivot/sprites.js +12 -42
  87. package/dist/esm/PivotViewer/components/pivot/sprites.js.map +1 -1
  88. package/dist/esm/PivotViewer/components/pivot/visibility.d.ts +4 -0
  89. package/dist/esm/PivotViewer/components/pivot/visibility.d.ts.map +1 -1
  90. package/dist/esm/PivotViewer/components/pivot/visibility.js +57 -26
  91. package/dist/esm/PivotViewer/components/pivot/visibility.js.map +1 -1
  92. package/dist/esm/PivotViewer/constants.js +1 -2
  93. package/dist/esm/PivotViewer/constants.js.map +1 -1
  94. package/dist/esm/PivotViewer/engine/layout.js +11 -7
  95. package/dist/esm/PivotViewer/engine/layout.js.map +1 -1
  96. package/dist/esm/PivotViewer/engine/types.d.ts +1 -0
  97. package/dist/esm/PivotViewer/engine/types.d.ts.map +1 -1
  98. package/dist/esm/PivotViewer/hooks/useCardSelection.d.ts.map +1 -1
  99. package/dist/esm/PivotViewer/hooks/useCardSelection.js +2 -1
  100. package/dist/esm/PivotViewer/hooks/useCardSelection.js.map +1 -1
  101. package/dist/esm/PivotViewer/hooks/useCurrentFilters.js.map +1 -1
  102. package/dist/esm/PivotViewer/hooks/useFilteredData.d.ts +1 -1
  103. package/dist/esm/PivotViewer/hooks/useFilteredData.js +4 -4
  104. package/dist/esm/PivotViewer/hooks/useFilteredData.js.map +1 -1
  105. package/dist/esm/PivotViewer/hooks/usePanning.d.ts.map +1 -1
  106. package/dist/esm/PivotViewer/hooks/usePanning.js +8 -4
  107. package/dist/esm/PivotViewer/hooks/usePanning.js.map +1 -1
  108. package/dist/esm/PivotViewer/hooks/useViewModeScrollHandling.d.ts.map +1 -1
  109. package/dist/esm/PivotViewer/hooks/useViewModeScrollHandling.js +4 -3
  110. package/dist/esm/PivotViewer/hooks/useViewModeScrollHandling.js.map +1 -1
  111. package/dist/esm/PivotViewer/hooks/useZoomState.d.ts +1 -0
  112. package/dist/esm/PivotViewer/hooks/useZoomState.d.ts.map +1 -1
  113. package/dist/esm/PivotViewer/hooks/useZoomState.js +4 -0
  114. package/dist/esm/PivotViewer/hooks/useZoomState.js.map +1 -1
  115. package/dist/esm/PivotViewer/types.d.ts +5 -1
  116. package/dist/esm/PivotViewer/types.d.ts.map +1 -1
  117. package/dist/esm/PivotViewer/types.js.map +1 -1
  118. package/dist/esm/PivotViewer/utils/animations.d.ts.map +1 -1
  119. package/dist/esm/PivotViewer/utils/animations.js +11 -3
  120. package/dist/esm/PivotViewer/utils/animations.js.map +1 -1
  121. package/dist/esm/PivotViewer/utils/cardPosition.js +1 -4
  122. package/dist/esm/PivotViewer/utils/cardPosition.js.map +1 -1
  123. package/dist/esm/PivotViewer/utils/constants.d.ts +5 -5
  124. package/dist/esm/PivotViewer/utils/constants.d.ts.map +1 -1
  125. package/dist/esm/PivotViewer/utils/constants.js +3 -3
  126. package/dist/esm/PivotViewer/utils/constants.js.map +1 -1
  127. package/dist/esm/PivotViewer/utils/selection.d.ts.map +1 -1
  128. package/dist/esm/PivotViewer/utils/selection.js +8 -1
  129. package/dist/esm/PivotViewer/utils/selection.js.map +1 -1
  130. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  131. package/package.json +1 -1
  132. package/dist/cjs/PivotViewer/components/pivot/buckets.js +0 -124
  133. package/dist/cjs/PivotViewer/components/pivot/buckets.js.map +0 -1
  134. package/dist/esm/PivotViewer/components/pivot/buckets.d.ts +0 -6
  135. package/dist/esm/PivotViewer/components/pivot/buckets.d.ts.map +0 -1
  136. package/dist/esm/PivotViewer/components/pivot/buckets.js +0 -102
  137. package/dist/esm/PivotViewer/components/pivot/buckets.js.map +0 -1
@@ -5,7 +5,7 @@ var PIXI = require('pixi.js');
5
5
  var colorResolver = require('./pivot/colorResolver.js');
6
6
  var sprites = require('./pivot/sprites.js');
7
7
  var visibility = require('./pivot/visibility.js');
8
- var buckets = require('./pivot/buckets.js');
8
+ var groups = require('./pivot/groups.js');
9
9
  var animation = require('./pivot/animation.js');
10
10
  var constants = require('./pivot/constants.js');
11
11
 
@@ -30,11 +30,12 @@ var PIXI__namespace = /*#__PURE__*/_interopNamespaceDefault(PIXI);
30
30
 
31
31
  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, }) {
32
32
  const parentContainerRef = containerRef;
33
+ const resolveId = _resolveId;
33
34
  const canvasRef = React.useRef(null);
34
35
  const spacerRef = React.useRef(null);
35
36
  const appRef = React.useRef(null);
36
37
  const rootRef = React.useRef(null);
37
- const bucketsContainerRef = React.useRef(null);
38
+ const groupsContainerRef = React.useRef(null);
38
39
  const spritesRef = React.useRef(new Map());
39
40
  const animationFrameRef = React.useRef(0);
40
41
  const mountedRef = React.useRef(true);
@@ -47,6 +48,8 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
47
48
  const previousViewModeRef = React.useRef(viewMode);
48
49
  const prevLayoutRef = React.useRef(null);
49
50
  const prevGroupingRef = React.useRef(null);
51
+ const prevScrollTopRef = React.useRef(0);
52
+ const prevScrollLeftRef = React.useRef(0);
50
53
  const cardColorsRef = React.useRef(constants.DEFAULT_COLORS);
51
54
  const cssColorResolver = React.useMemo(() => colorResolver.createCssColorResolver(), []);
52
55
  const onPanStartRef = React.useRef(onPanStart);
@@ -98,9 +101,9 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
98
101
  return;
99
102
  }
100
103
  appRef.current = app;
101
- const bucketsContainer = new PIXI__namespace.Container();
102
- bucketsContainerRef.current = bucketsContainer;
103
- app.stage.addChild(bucketsContainer);
104
+ const groupsContainer = new PIXI__namespace.Container();
105
+ groupsContainerRef.current = groupsContainer;
106
+ app.stage.addChild(groupsContainer);
104
107
  const root = new PIXI__namespace.Container();
105
108
  rootRef.current = root;
106
109
  app.stage.addChild(root);
@@ -121,6 +124,9 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
121
124
  overlayParent.appendChild(c);
122
125
  canvasRef.current = c;
123
126
  }
127
+ else {
128
+ console.error('PivotCanvas: Could not find canvas element from Pixi application');
129
+ }
124
130
  if (canvasRef.current && parentContainerRef.current) {
125
131
  const parentBounds = parentContainerRef.current.getBoundingClientRect();
126
132
  void parentBounds;
@@ -174,7 +180,7 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
174
180
  appRef.current = null;
175
181
  rootRef.current = null;
176
182
  }
177
- sprites.clearSpritePool();
183
+ spritesRef.current.clear();
178
184
  try {
179
185
  const parentEl = parentContainerRef.current;
180
186
  if (parentEl) {
@@ -190,7 +196,7 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
190
196
  catch (e) {
191
197
  }
192
198
  };
193
- }, [viewportWidth, viewportHeight]);
199
+ }, []);
194
200
  React.useEffect(() => {
195
201
  if (!parentContainerRef || !parentContainerRef.current || !appRef.current || !pixiReady)
196
202
  return;
@@ -222,33 +228,47 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
222
228
  };
223
229
  }, [pixiReady, viewportWidth, viewportHeight]);
224
230
  React.useEffect(() => {
225
- if (!bucketsContainerRef.current || !parentContainerRef.current || !pixiReady)
231
+ if (!groupsContainerRef.current || !parentContainerRef.current || !pixiReady)
226
232
  return;
227
- buckets.updateBucketBackgrounds(bucketsContainerRef.current, parentContainerRef.current, grouping, layout, zoomLevel, cardColorsRef.current, viewMode);
233
+ groups.updateGroupBackgrounds(groupsContainerRef.current, parentContainerRef.current, grouping, layout, zoomLevel, cardColorsRef.current, viewMode);
228
234
  needsRenderRef.current = true;
229
235
  appRef.current?.renderer?.render(appRef.current.stage);
230
236
  }, [grouping, layout, zoomLevel, viewMode, pixiReady]);
237
+ React.useEffect(() => {
238
+ const gc = groupsContainerRef.current;
239
+ const app = appRef.current;
240
+ if (!gc || !app)
241
+ return;
242
+ const target = viewMode === 'grouped' ? 1 : 0;
243
+ const start = typeof gc.alpha === 'number' ? gc.alpha : 1;
244
+ const duration = 200;
245
+ if (Math.abs(start - target) < 0.01) {
246
+ gc.alpha = target;
247
+ return;
248
+ }
249
+ const t0 = performance.now();
250
+ const step = () => {
251
+ const u = Math.min(1, (performance.now() - t0) / duration);
252
+ const eased = u * (2 - u);
253
+ gc.alpha = start + (target - start) * eased;
254
+ app.renderer?.render(app.stage);
255
+ if (u < 1)
256
+ requestAnimationFrame(step);
257
+ };
258
+ requestAnimationFrame(step);
259
+ }, [viewMode]);
231
260
  React.useEffect(() => {
232
261
  if (!rootRef.current || !parentContainerRef.current || !pixiReady) {
233
262
  return;
234
263
  }
235
264
  const viewModeChanged = previousViewModeRef.current !== viewMode;
236
265
  const groupingChanged = prevGroupingRef.current !== grouping;
237
- if (viewModeChanged || groupingChanged) {
266
+ const layoutChanged = prevLayoutRef.current !== layout;
267
+ if (viewModeChanged || groupingChanged || layoutChanged) {
238
268
  isViewTransitionRef.current = true;
239
269
  lastViewChangeTimeRef.current = Date.now();
240
270
  previousViewModeRef.current = viewMode;
241
271
  prevGroupingRef.current = grouping;
242
- for (const sprite of spritesRef.current.values()) {
243
- try {
244
- if (sprite.container) {
245
- sprite.container.visible = false;
246
- }
247
- sprite.__lastHiddenAt = Date.now();
248
- }
249
- catch (e) {
250
- }
251
- }
252
272
  }
253
273
  if (spacerRef.current) {
254
274
  const spacer = spacerRef.current;
@@ -263,8 +283,11 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
263
283
  const panDeltaX = panX - prevPanRef.current.x;
264
284
  const panDeltaY = panY - prevPanRef.current.y;
265
285
  prevPanRef.current = { x: panX, y: panY };
286
+ const currentScrollTop = parentContainerRef.current?.scrollTop || 0;
287
+ const currentScrollLeft = parentContainerRef.current?.scrollLeft || 0;
266
288
  visibility.syncSpritesToViewport({
267
289
  root: rootRef.current,
290
+ groupsContainer: groupsContainerRef.current,
268
291
  container: parentContainerRef.current,
269
292
  sprites: spritesRef.current,
270
293
  layout,
@@ -279,11 +302,16 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
279
302
  zoomLevel,
280
303
  viewportWidth,
281
304
  viewportHeight,
282
- createCardSprite: (id, x, y) => sprites.createCardSprite(id, x, y, items, (item, e, id) => (onCardClickRef.current)(item, e, id), (e) => (onPanStart)(e), cardWidth, cardHeight, cardColorsRef.current),
283
- updateCardContent: (sprite, item) => sprites.updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current),
284
- isViewTransition: isViewTransitionRef.current || (Date.now() - lastViewChangeTimeRef.current < 1000),
305
+ viewMode,
306
+ createCardSprite: (id, x, y) => sprites.createCardSprite(id, x, y, items, (item, e, id) => (onCardClickRef.current)(item, e, id), (e) => (onPanStart)(e), cardWidth, cardHeight, cardColorsRef.current, cardRenderer, resolveId),
307
+ updateCardContent: (sprite, item) => sprites.updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current, cardRenderer),
308
+ isViewTransition: isViewTransitionRef.current,
285
309
  prevLayout: prevLayoutRef.current,
310
+ prevScrollTop: prevScrollTopRef.current,
311
+ prevScrollLeft: prevScrollLeftRef.current,
286
312
  });
313
+ prevScrollTopRef.current = currentScrollTop;
314
+ prevScrollLeftRef.current = currentScrollLeft;
287
315
  needsRenderRef.current = true;
288
316
  if (appRef.current?.renderer && rootRef.current) {
289
317
  appRef.current.renderer.render(appRef.current.stage);
@@ -302,21 +330,6 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
302
330
  React.useEffect(() => {
303
331
  prevLayoutRef.current = layout;
304
332
  }, [layout]);
305
- React.useEffect(() => {
306
- if (!rootRef.current || !bucketsContainerRef.current)
307
- return;
308
- const effectivePanX = parentContainerRef.current ? parentContainerRef.current.scrollLeft : panX;
309
- const effectivePanY = parentContainerRef.current ? parentContainerRef.current.scrollTop : panY;
310
- if (rootRef.current.scale && bucketsContainerRef.current.scale) {
311
- rootRef.current.scale.set(zoomLevel);
312
- bucketsContainerRef.current.scale.set(zoomLevel);
313
- }
314
- if (rootRef.current.position && bucketsContainerRef.current.position) {
315
- rootRef.current.position.set(-effectivePanX, -effectivePanY);
316
- bucketsContainerRef.current.position.set(-effectivePanX, -effectivePanY);
317
- }
318
- appRef.current?.renderer?.render(appRef.current.stage);
319
- }, [zoomLevel, panX, panY]);
320
333
  React.useEffect(() => {
321
334
  if (!rootRef.current)
322
335
  return;
@@ -345,20 +358,9 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
345
358
  const effectivePanY = container.scrollTop;
346
359
  lastScroll.x = effectivePanX;
347
360
  lastScroll.y = effectivePanY;
348
- if (rootRef.current && bucketsContainerRef.current) {
349
- if (rootRef.current.scale && bucketsContainerRef.current.scale) {
350
- rootRef.current.scale.set(zoomLevel);
351
- bucketsContainerRef.current.scale.set(zoomLevel);
352
- }
353
- const invScale = zoomLevel && zoomLevel !== 0 ? 1 / zoomLevel : 1;
354
- void invScale;
355
- if (rootRef.current.position && bucketsContainerRef.current.position) {
356
- rootRef.current.position.set(-effectivePanX, -effectivePanY);
357
- bucketsContainerRef.current.position.set(-effectivePanX, -effectivePanY);
358
- }
359
- }
360
361
  visibility.syncSpritesToViewport({
361
362
  root: rootRef.current,
363
+ groupsContainer: groupsContainerRef.current,
362
364
  container: parentContainerRef.current,
363
365
  sprites: spritesRef.current,
364
366
  layout,
@@ -371,10 +373,15 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
371
373
  zoomLevel,
372
374
  viewportWidth,
373
375
  viewportHeight,
374
- createCardSprite: (id, x, y) => sprites.createCardSprite(id, x, y, items, (item, e, id) => (onCardClickRef.current)(item, e, id), (e) => (onPanStartRef.current)(e), cardWidth, cardHeight, cardColorsRef.current),
375
- updateCardContent: (sprite, item) => sprites.updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current),
376
- isViewTransition: isViewTransitionRef.current || (Date.now() - lastViewChangeTimeRef.current < 1000),
376
+ createCardSprite: (id, x, y) => sprites.createCardSprite(id, x, y, items, (item, e, id) => (onCardClickRef.current)(item, e, id), (e) => (onPanStartRef.current)(e), cardWidth, cardHeight, cardColorsRef.current, cardRenderer, resolveId),
377
+ updateCardContent: (sprite, item) => sprites.updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current, cardRenderer),
378
+ isViewTransition: isViewTransitionRef.current,
379
+ viewMode,
380
+ prevScrollTop: prevScrollTopRef.current,
381
+ prevScrollLeft: prevScrollLeftRef.current,
377
382
  });
383
+ prevScrollTopRef.current = container.scrollTop || 0;
384
+ prevScrollLeftRef.current = container.scrollLeft || 0;
378
385
  needsRenderRef.current = true;
379
386
  app.renderer?.render(app.stage);
380
387
  }
@@ -396,7 +403,7 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
396
403
  };
397
404
  }, [pixiReady, layout, visibleIds, items, cardWidth, cardHeight, zoomLevel, viewportWidth, viewportHeight, panX, panY, grouping, viewMode, selectedId, onCardClick, onPanStart]);
398
405
  function updateCardContent(sprite, item) {
399
- return sprites.updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current);
406
+ return sprites.updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColorsRef.current, cardRenderer);
400
407
  }
401
408
  function updateSelection() {
402
409
  const sprites = spritesRef.current;
@@ -406,7 +413,7 @@ function PivotCanvas({ items, layout, grouping, visibleIds, cardWidth, cardHeigh
406
413
  }
407
414
  }
408
415
  function updateHighlight() {
409
- buckets.updateHighlight(bucketsContainerRef.current, parentContainerRef.current, grouping, layout, hoveredGroupIndex, cardWidth);
416
+ groups.updateHighlight(groupsContainerRef.current, parentContainerRef.current, grouping, layout, hoveredGroupIndex, cardWidth, zoomLevel);
410
417
  }
411
418
  return null;
412
419
  }
@@ -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":["useRef","useState","DEFAULT_COLORS","useMemo","createCssColorResolver","useEffect","resolveCardColors","PIXI","clearSpritePool","updateBucketBackgroundsExternal","syncSpritesToViewport","createCardSpriteExternal","updateCardContentExternal","startAnimationLoopExternal","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,SAA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AAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAEjE,QAAA,OAAO,MAAK;AACV,YAAA,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC;AACnD,QAAA,CAAC;AACH,IAAA,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AAahL,IAAA,SAAS,iBAAiB,CAAC,MAAkB,EAAE,IAAW,EAAA;AACxD,QAAA,OAAOA,yBAAyB,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC;IAC1G;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,YAAA,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC;QAChC;IACF;AAEA,IAAA,SAAS,eAAe,GAAA;AACtB,QAAAE,uBAAuB,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":["useRef","useState","DEFAULT_COLORS","useMemo","createCssColorResolver","useEffect","resolveCardColors","PIXI","updateGroupBackgroundsExternal","syncSpritesToViewport","createCardSpriteExternal","updateCardContentExternal","startAnimationLoopExternal","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,GAAGA,YAAM,CAA2B,IAAI,CAAC;AACxD,IAAA,MAAM,SAAS,GAAGA,YAAM,CAAwB,IAAI,CAAC;AACrD,IAAA,MAAM,MAAM,GAAGA,YAAM,CAA0B,IAAI,CAAC;AACpD,IAAA,MAAM,OAAO,GAAGA,YAAM,CAAwB,IAAI,CAAC;AACnD,IAAA,MAAM,kBAAkB,GAAGA,YAAM,CAAwB,IAAI,CAAC;IAC9D,MAAM,UAAU,GAAGA,YAAM,CAA0B,IAAI,GAAG,EAAE,CAAC;AAC7D,IAAA,MAAM,iBAAiB,GAAGA,YAAM,CAAS,CAAC,CAAC;AAC3C,IAAA,MAAM,UAAU,GAAGA,YAAM,CAAC,IAAI,CAAC;IAC/B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC;AACjD,IAAA,MAAM,cAAc,GAAGD,YAAM,CAAC,KAAK,CAAC;AACpC,IAAA,MAAM,cAAc,GAAGA,YAAM,CAAC,KAAK,CAAC;AACpC,IAAA,MAAM,eAAe,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A,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC;QAChC;IACF;AAEA,IAAA,SAAS,eAAe,GAAA;AACtB,QAAAE,sBAAuB,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;;;;"}
@@ -5,8 +5,16 @@ var Spinner = require('./Spinner.js');
5
5
  var PivotCanvas = require('./PivotCanvas.js');
6
6
  var AxisLabels = require('./AxisLabels.js');
7
7
  var DetailPanel = require('./DetailPanel.js');
8
+ var idResolution = require('../utils/idResolution.js');
8
9
 
9
10
  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, }) {
11
+ const selectedLayoutId = selectedItem
12
+ ? (() => {
13
+ const index = data.indexOf(selectedItem);
14
+ const rawId = index !== -1 ? index : 0;
15
+ return idResolution.normalizeIdToLayoutKey(rawId, layout);
16
+ })()
17
+ : null;
10
18
  const handleViewportClick = (e) => {
11
19
  if (isZooming || !containerRef.current)
12
20
  return;
@@ -32,6 +40,9 @@ function PivotViewerMain({ data, ready, isLoading, visibleIds, grouping, layout,
32
40
  }
33
41
  }
34
42
  }
43
+ if (selectedItem) {
44
+ onCloseDetail();
45
+ }
35
46
  };
36
47
  const handleViewportMouseMove = (e) => {
37
48
  if (isZooming || !containerRef.current)
@@ -65,18 +76,18 @@ function PivotViewerMain({ data, ready, isLoading, visibleIds, grouping, layout,
65
76
  width: layout.totalWidth * zoomLevel,
66
77
  height: layout.totalHeight * zoomLevel,
67
78
  pointerEvents: 'none'
68
- } }), !ready && (jsxRuntime.jsx("div", { className: "pv-loading", children: "Building indexes..." })), ready && visibleIds.length === 0 && (jsxRuntime.jsx("div", { className: "pv-empty", children: emptyContent ?? 'No items to display.' })), ready && visibleIds.length > 0 && (jsxRuntime.jsx(PivotCanvas.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: selectedItem ? resolveId(selectedItem, 0) : null, hoveredGroupIndex: hoveredGroupIndex, isZooming: isZooming, cardRenderer: cardRenderer, resolveId: resolveId, onCardClick: onCardClick, onPanStart: onPanStart, onPanMove: onPanMove, onPanEnd: onPanEnd, containerRef: containerRef, viewMode: viewMode }))] }), detailRenderer
69
- ? (selectedItem ? detailRenderer(selectedItem, onCloseDetail) : null)
70
- : (jsxRuntime.jsx(DetailPanel.DetailPanel, { selectedItem: selectedItem, onClose: onCloseDetail }))] }), viewMode === 'grouped' && grouping.groups.length > 0 && (jsxRuntime.jsx(AxisLabels.AxisLabels, { groups: grouping.groups.map((g) => ({
79
+ } }), !ready && (jsxRuntime.jsx("div", { className: "pv-loading", children: "Building indexes..." })), ready && visibleIds.length === 0 && (jsxRuntime.jsx("div", { className: "pv-empty", children: emptyContent ?? 'No items to display.' })), ready && visibleIds.length > 0 && (jsxRuntime.jsx(PivotCanvas.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
80
+ ? (jsxRuntime.jsx(DetailPanel.DetailPanel, { selectedItem: selectedItem, onClose: onCloseDetail, contentRenderer: detailRenderer }))
81
+ : (jsxRuntime.jsx(DetailPanel.DetailPanel, { selectedItem: selectedItem, onClose: onCloseDetail }))] }), jsxRuntime.jsx(AxisLabels.AxisLabels, { groups: grouping.groups.map((g) => ({
71
82
  key: g.key,
72
83
  value: g.value,
73
84
  label: String(g.value),
74
85
  items: [],
75
86
  count: g.ids.length,
76
- })), bucketWidths: layout.bucketWidths || [], zoomLevel: zoomLevel, dimensionFilter: dimensionFilter, hoveredGroup: hoveredGroupIndex !== null ? String(grouping.groups[hoveredGroupIndex]?.value) : null, onHover: (label) => {
87
+ })), 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) => {
77
88
  const index = grouping.groups.findIndex(g => String(g.value) === label);
78
89
  onGroupHover(index >= 0 ? index : null);
79
- }, onClick: onAxisLabelClick, containerRef: axisLabelsRef }))] }));
90
+ }, onClick: onAxisLabelClick, containerRef: axisLabelsRef })] }));
80
91
  }
81
92
 
82
93
  exports.PivotViewerMain = 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","Spinner","_jsxs","PivotCanvas","DetailPanel","AxisLabels"],"mappings":";;;;;;;;AA8CM,SAAU,eAAe,CAAuB,EACpD,IAAI,EACJ,KAAK,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,S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,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,KACnDJ,cAAA,CAACK,qBAAU,IACP,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,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":["normalizeIdToLayoutKey","_jsx","Spinner","_jsxs","PivotCanvas","DetailPanel","AxisLabels"],"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,OAAOA,mCAAsB,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,CA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