simple-table-core 3.8.9 → 3.9.1

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.
@@ -205,6 +205,73 @@ export declare class AnimationCoordinator {
205
205
  * sort/reorder FLIP-from-off-screen behavior is preserved.
206
206
  */
207
207
  hasSnapshotEntryInContainer(cellId: string, currentContainer: HTMLElement): boolean;
208
+ /**
209
+ * Whether a vertical position transition should be animated. Rows that live
210
+ * only in the virtualization padding band (above/below the visible viewport)
211
+ * should teleport rather than FLIP — otherwise a mid-scroll sort animates
212
+ * hundreds of off-screen rows through the viewport at once.
213
+ */
214
+ shouldAnimateVerticalTransition(args: {
215
+ beforeTop: number;
216
+ afterTop: number;
217
+ cellHeight: number;
218
+ container: HTMLElement;
219
+ }): boolean;
220
+ /**
221
+ * Whether a horizontal position transition should be animated. Same viewport
222
+ * gate as {@link shouldAnimateVerticalTransition} but for column slides.
223
+ */
224
+ shouldAnimateHorizontalTransition(args: {
225
+ beforeLeft: number;
226
+ afterLeft: number;
227
+ cellWidth: number;
228
+ container: HTMLElement;
229
+ }): boolean;
230
+ /**
231
+ * Whether a cell's position change should participate in FLIP animation.
232
+ * Only axes that actually moved are checked against the viewport gate —
233
+ * a vertical sort must not inherit "visible" from an unchanged horizontal
234
+ * position (which would retain/mount every column in every padding-band row).
235
+ */
236
+ shouldAnimateTransition(args: {
237
+ beforeTop: number;
238
+ afterTop: number;
239
+ beforeLeft: number;
240
+ afterLeft: number;
241
+ cellHeight: number;
242
+ cellWidth: number;
243
+ container: HTMLElement;
244
+ }): boolean;
245
+ /**
246
+ * Whether an incoming cell (in the snapshot but not previously in the DOM)
247
+ * should be mounted for this sort/reorder render. Padding-band rows that
248
+ * never intersect the visible viewport are deferred to the next scroll
249
+ * render so they do not pop into existence at animation start.
250
+ */
251
+ shouldMountIncomingCell(args: {
252
+ cellId: string;
253
+ afterTop: number;
254
+ afterLeft: number;
255
+ cellHeight: number;
256
+ cellWidth: number;
257
+ container: HTMLElement;
258
+ }): boolean;
259
+ /**
260
+ * Whether the cell currently paints inside the body scrollers' clip rects.
261
+ * Outgoing retain decisions use this as a fallback when {@link shouldAnimateTransition}
262
+ * rejects a cell based on `style.top`/`style.left` alone: virtualization padding
263
+ * rows can sit with their leading edge outside the scroll band while still being
264
+ * partially visible on screen (common at the bottom when scrolled to the end).
265
+ */
266
+ isCellRenderedInScrollerViewport(element: HTMLElement, container: HTMLElement): boolean;
267
+ /**
268
+ * Whether an outgoing DOM cell at a vertical scroll extreme (top or bottom of
269
+ * the dataset) should be retained even when {@link shouldAnimateTransition}
270
+ * rejects it on leading-edge grounds. Virtualization keeps a few overscan
271
+ * rows mounted above/below the strict viewport at max scroll; those rows
272
+ * must still slide out as ghosts when a sort evicts them.
273
+ */
274
+ shouldRetainDomCellAtScrollExtrema(cellId: string, container: HTMLElement): boolean;
208
275
  /**
209
276
  * Hand a cell that the renderer would otherwise remove to the coordinator.
210
277
  * The coordinator updates its absolute positioning to the post-change layout
@@ -21,12 +21,20 @@ export interface DimensionManagerState {
21
21
  contentHeight: number | undefined;
22
22
  }
23
23
  type StateChangeCallback = (state: DimensionManagerState) => void;
24
+ /**
25
+ * Wait this long after the last container-width ResizeObserver tick before
26
+ * notifying subscribers. Coalesces CSS-transition / animated layout shifts
27
+ * (e.g. a collapsible nav) into a single trailing update instead of one full
28
+ * table render per animation frame.
29
+ */
30
+ export declare const CONTAINER_RESIZE_NOTIFY_DEBOUNCE_MS = 50;
24
31
  export declare class DimensionManager {
25
32
  private config;
26
33
  private state;
27
34
  private subscribers;
28
35
  private resizeObserver;
29
36
  private rafId;
37
+ private resizeNotifyDebounceId;
30
38
  /** Set when applyContainerWidthSync updates state before any subscriber exists. */
31
39
  private initialNotifyPending;
32
40
  constructor(config: DimensionManagerConfig);
@@ -35,6 +43,9 @@ export declare class DimensionManager {
35
43
  private calculateHeaderHeight;
36
44
  private convertHeightToPixels;
37
45
  private calculateContentHeight;
46
+ private cancelPendingResizeNotify;
47
+ /** Trailing debounce for animated / continuous container resizes. */
48
+ private scheduleResizeNotify;
38
49
  private observeContainer;
39
50
  private applyContainerWidthSync;
40
51
  updateConfig(config: Partial<DimensionManagerConfig>): void;
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * The animation coordinator runs FLIP-style transitions when cells move between
5
5
  * positions. All fields are optional; omit the prop entirely to use defaults.
6
+ *
7
+ * Row group expand/collapse never animates when `rowGrouping` is configured.
6
8
  */
7
9
  export interface AnimationsConfig {
8
10
  /** Master toggle. Defaults to `true`. When `false`, no other field has effect. */
@@ -34,7 +34,7 @@ export declare const ColumnExpand_IncomingCellsStartAtZeroWidth: {
34
34
  canvasElement: HTMLElement;
35
35
  }) => Promise<void>;
36
36
  };
37
- export declare const RowExpand_AddsAccordionClass: {
37
+ export declare const RowExpand_NoAccordionClass: {
38
38
  tags: string[];
39
39
  render: () => HTMLDivElement & {
40
40
  _table?: import("../../src/index").SimpleTableVanilla | undefined;
@@ -43,7 +43,7 @@ export declare const RowExpand_AddsAccordionClass: {
43
43
  canvasElement: HTMLElement;
44
44
  }) => Promise<void>;
45
45
  };
46
- export declare const RowExpand_IncomingCellsStartAtZeroHeight: {
46
+ export declare const RowExpand_NoAccordionGrow: {
47
47
  tags: string[];
48
48
  render: () => HTMLDivElement & {
49
49
  _table?: import("../../src/index").SimpleTableVanilla | undefined;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * CONTAINER RESIZE PERFORMANCE REPRO
3
+ *
4
+ * Simulates a collapsible global left nav that animates width and squeezes the
5
+ * main content area — the layout pattern reported on Artist/Platform pages.
6
+ *
7
+ * During the CSS transition, the table container's ResizeObserver fires on
8
+ * successive frames. DimensionManager coalesces those ticks (trailing debounce)
9
+ * so subscribers / full renders fire once after the transition settles.
10
+ *
11
+ * Use the HUD while toggling the nav, or run the automated play test.
12
+ * The play test asserts coalesced table relayouts (header width updates), not
13
+ * raw container ResizeObserver ticks — the DOM still resizes every animation frame.
14
+ */
15
+ import type { Meta } from "@storybook/html";
16
+ declare const meta: Meta;
17
+ export default meta;
18
+ interface ContainerResizePerfSnapshot {
19
+ contentWidthChanges: number;
20
+ tableContainerWidthChanges: number;
21
+ /** Batched header relayout passes (one per table render), not per-cell updates. */
22
+ tableRelayouts: number;
23
+ lastContentWidth: number;
24
+ }
25
+ declare global {
26
+ interface Window {
27
+ __containerResizePerf?: ContainerResizePerfSnapshot;
28
+ }
29
+ }
30
+ export declare const resetContainerResizePerf: (lastContentWidth?: number) => void;
31
+ export declare const CollapsibleNavWithTable: {
32
+ tags: string[];
33
+ render: () => HTMLDivElement;
34
+ };
35
+ export declare const CollapsibleNavTableNoAutoExpand: {
36
+ tags: string[];
37
+ render: () => HTMLDivElement;
38
+ };
39
+ export declare const CollapsibleNavBaseline: {
40
+ tags: string[];
41
+ render: () => HTMLDivElement;
42
+ };
43
+ export declare const NavToggleCoalescesTableRelayout: {
44
+ tags: string[];
45
+ render: () => HTMLDivElement;
46
+ play: ({ canvasElement }: {
47
+ canvasElement: HTMLElement;
48
+ }) => Promise<void>;
49
+ };
50
+ export declare const BaselineNavHasNoTableGridChurn: {
51
+ tags: string[];
52
+ render: () => HTMLDivElement;
53
+ play: ({ canvasElement }: {
54
+ canvasElement: HTMLElement;
55
+ }) => Promise<void>;
56
+ };
@@ -0,0 +1,78 @@
1
+ /**
2
+ * ROW GROUP RE-EXPAND REGRESSION TESTS
3
+ *
4
+ * Reproduces bugs when a lazy-loaded grouped row is collapsed and re-expanded:
5
+ *
6
+ * 1. onRowGroupExpand receives a stale `row` snapshot (missing cached children),
7
+ * so consumer guards like `if (row[groupingKey]?.length) return` fail and
8
+ * every re-expand re-triggers setLoading + fetch.
9
+ *
10
+ * 2. Re-expand must not re-enter loading state or spuriously animate sibling
11
+ * rows below the expanded group.
12
+ *
13
+ * Mirrors packages/react/src/__tests__/onRowGroupExpandReExpand.test.tsx.
14
+ * All play tests should FAIL until the stale-row fix lands.
15
+ */
16
+ import type { Meta } from "@storybook/html";
17
+ declare const meta: Meta;
18
+ export default meta;
19
+ interface ReExpandProbe {
20
+ expandSnapshots: Array<{
21
+ childCount: number;
22
+ isExpanded: boolean;
23
+ }>;
24
+ fetchCount: number;
25
+ loadingTrueCount: number;
26
+ }
27
+ declare global {
28
+ interface Window {
29
+ __rowGroupReExpandProbe?: ReExpandProbe;
30
+ }
31
+ }
32
+ export declare const ReExpand_PassesCachedRowSnapshot: {
33
+ tags: string[];
34
+ render: () => HTMLDivElement;
35
+ play: ({ canvasElement }: {
36
+ canvasElement: HTMLElement;
37
+ }) => Promise<void>;
38
+ };
39
+ export declare const ReExpand_SkipsRefetch: {
40
+ tags: string[];
41
+ render: () => HTMLDivElement;
42
+ play: ({ canvasElement }: {
43
+ canvasElement: HTMLElement;
44
+ }) => Promise<void>;
45
+ };
46
+ export declare const ReExpand_SkipsSetLoading: {
47
+ tags: string[];
48
+ render: () => HTMLDivElement;
49
+ play: ({ canvasElement }: {
50
+ canvasElement: HTMLElement;
51
+ }) => Promise<void>;
52
+ };
53
+ /** Manual QA: status panel shows fetch/loading counts while toggling Engineering. */
54
+ export declare const ReExpand_LazyLoad_StatusPanel: {
55
+ tags: string[];
56
+ render: () => HTMLDivElement;
57
+ };
58
+ export declare const ReExpand_NoLoadingSkeletonOnLazyReExpand: {
59
+ tags: string[];
60
+ render: () => HTMLDivElement;
61
+ play: ({ canvasElement }: {
62
+ canvasElement: HTMLElement;
63
+ }) => Promise<void>;
64
+ };
65
+ export declare const ReExpand_SiblingRowsNoAccordionGrow: {
66
+ tags: string[];
67
+ render: () => HTMLDivElement;
68
+ play: ({ canvasElement }: {
69
+ canvasElement: HTMLElement;
70
+ }) => Promise<void>;
71
+ };
72
+ export declare const ReExpand_NoAccordionGrowOnReExpand: {
73
+ tags: string[];
74
+ render: () => HTMLDivElement;
75
+ play: ({ canvasElement }: {
76
+ canvasElement: HTMLElement;
77
+ }) => Promise<void>;
78
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-table-core",
3
- "version": "3.8.9",
3
+ "version": "3.9.1",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "types": "dist/src/index.d.ts",