@svelte-lean/table 0.15.2 → 0.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @svelte-lean/table
2
2
 
3
+ ## 0.15.3
4
+
5
+ ### Patch Changes
6
+
7
+ - b526e70: A header that follows the page keeps its travel to itself: `--slean-table-travel` is set on the
8
+ `<thead>`, not on the scroll region. On the region every row inherited it, and each section a fast
9
+ scroll drew for the first time changed the table's height, so the travel, so every row already
10
+ drawn was styled again. An admin list of 1000 bets at 4x CPU blocked for 8.2 s in its first fast
11
+ scroll and 2.2 s with the travel on the header (`apps/playground/tests/bench/head-travel.bench.spec.ts`).
12
+
3
13
  ## 0.15.2
4
14
 
5
15
  ### Patch Changes
@@ -840,6 +840,7 @@
840
840
  let fits = $state(false);
841
841
  let scrollsY = $state(true);
842
842
  let travel = $state(0);
843
+ const headFollows = $derived(stickyHeader && !height && !fits && !scrollsY);
843
844
  $effect(() => {
844
845
  if (!stickyHeader || height || typeof ResizeObserver === 'undefined') {
845
846
  fits = false;
@@ -1722,13 +1723,10 @@
1722
1723
  bind:this={viewport}
1723
1724
  class="slean-table-scroll"
1724
1725
  data-page-sticky={fits || undefined}
1725
- data-head-follows={(stickyHeader && !height && !fits && !scrollsY) || undefined}
1726
+ data-head-follows={headFollows || undefined}
1726
1727
  data-pinned={pinning.edges.length > 0 || undefined}
1727
1728
  data-overflows={overflows || undefined}
1728
1729
  style:--slean-table-min-width={tracks?.min}
1729
- style:--slean-table-travel={stickyHeader && !height && !fits && !scrollsY
1730
- ? `${travel}px`
1731
- : undefined}
1732
1730
  style:max-height={height}
1733
1731
  tabindex={height ? 0 : undefined}
1734
1732
  role="region"
@@ -1764,7 +1762,12 @@
1764
1762
  style:width={colWidth(col)}
1765
1763
  />{/each}</colgroup
1766
1764
  >{/if}
1767
- {#if showHeader}<thead role={grid ? 'rowgroup' : undefined}>
1765
+ {#if showHeader}<!-- The travel is the header's own: set on the region, every row under it
1766
+ inherited it, and each section a fast scroll drew changed the table's height,
1767
+ the travel, and so restyled every row already drawn. --><thead
1768
+ role={grid ? 'rowgroup' : undefined}
1769
+ style:--slean-table-travel={headFollows ? `${travel}px` : undefined}
1770
+ >
1768
1771
  {#each headerLevels as row, level}<tr
1769
1772
  role={grid ? 'row' : undefined}
1770
1773
  aria-rowindex={ariaRowCount === undefined ? undefined : level + 1}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svelte-lean/table",
3
- "version": "0.15.2",
3
+ "version": "0.15.3",
4
4
  "description": "A Svelte-native table and data-grid engine that ships only the features you use.",
5
5
  "license": "MIT",
6
6
  "author": "Ömer Say",