flexdesk 0.6.2 → 0.6.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/dist/charts.js CHANGED
@@ -39,10 +39,10 @@ import {
39
39
  setPlotlySource,
40
40
  uid,
41
41
  updateChart
42
- } from "./chunk-XYUZF5CD.js";
42
+ } from "./chunk-WAVLVXYV.js";
43
43
  import {
44
44
  createRafResizeObserver
45
- } from "./chunk-CPYBQN3Q.js";
45
+ } from "./chunk-WLASPRGP.js";
46
46
  import {
47
47
  ManagedWindow
48
48
  } from "./chunk-6JSOVNID.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DataTable,
3
3
  createRafResizeObserver
4
- } from "./chunk-CPYBQN3Q.js";
4
+ } from "./chunk-WLASPRGP.js";
5
5
  import {
6
6
  ManagedWindow
7
7
  } from "./chunk-6JSOVNID.js";
@@ -2370,4 +2370,4 @@ export {
2370
2370
  openPlotPopoutWindow,
2371
2371
  openRawTracesWindow
2372
2372
  };
2373
- //# sourceMappingURL=chunk-XYUZF5CD.js.map
2373
+ //# sourceMappingURL=chunk-WAVLVXYV.js.map
@@ -1073,7 +1073,10 @@ var DataTable = class {
1073
1073
  });
1074
1074
  }
1075
1075
  if (this._headerTableEl && this._tableEl) {
1076
- requestAnimationFrame(() => this._syncHeaderWidths());
1076
+ requestAnimationFrame(() => {
1077
+ this._syncHeaderWidths();
1078
+ this._virtRemeasure();
1079
+ });
1077
1080
  if (this._resizeObserver) {
1078
1081
  try {
1079
1082
  this._resizeObserver.disconnect();
@@ -2411,26 +2414,51 @@ var DataTable = class {
2411
2414
  }
2412
2415
  return lo;
2413
2416
  }
2414
- /** Measure one real row. Client pixels, so the zoom is divided back out —
2415
- * `_measureNaturalWidths` explains why — and NOT `offsetHeight`, which is
2416
- * rounded: 21 for a 21.19px row is a 1,100px error over 6,000 rows. */
2417
+ /**
2418
+ * Measure the rows that are DRAWN — the median of up to 64 of them. Client
2419
+ * pixels, so the zoom is divided back out (`_measureNaturalWidths` explains
2420
+ * why), and NOT `offsetHeight`, which is rounded: 21 for a 21.19px row is a
2421
+ * 1,100px error over 6,000 rows.
2422
+ *
2423
+ * 0.6.3: IT USED TO MEASURE ONE ROW, ONCE, AT RENDER, and trust it for the
2424
+ * life of the table. A row measured at a bad moment — a box not yet laid
2425
+ * out at its width, a font not yet loaded — set every row's height: a
2426
+ * Tables grid drawing 22.8px rows was found holding a 134px estimate, so the
2427
+ * window took a 650px viewport for five rows, drew rows 1–35 and left the
2428
+ * rest of the box blank spacer while the reader scrolled. Now it is asked
2429
+ * again on every window update (`_virtUpdate`), on a resize and once the
2430
+ * column widths are fixed, and corrects itself the first time real rows
2431
+ * are on screen. The first measure is exact; after that a change has to be
2432
+ * larger than half a pixel, so rows of mixed heights cannot make the
2433
+ * offsets move under the reader on every scroll.
2434
+ *
2435
+ * @returns {boolean} whether the heights changed (the offsets are recomputed).
2436
+ */
2417
2437
  _virtMeasure() {
2418
2438
  const v = this._virt;
2419
2439
  if (!v) return false;
2440
+ const zoom = this._tableEl?.currentCSSZoom || 1;
2441
+ const heights = [];
2420
2442
  for (const tr of v.map.values()) {
2421
2443
  if (!tr.isConnected || tr.hidden) continue;
2422
- const zoom = this._tableEl?.currentCSSZoom || 1;
2423
- const h = tr.getBoundingClientRect().height / zoom;
2424
- if (!(h > 0)) return false;
2425
- if (Math.abs(h - v.base) > 0.01) {
2426
- v.base = h;
2427
- this._virtBase = h;
2428
- this._virtComputeOffsets();
2429
- return true;
2430
- }
2431
- return false;
2432
- }
2433
- return false;
2444
+ const h2 = tr.getBoundingClientRect().height / zoom;
2445
+ if (h2 > 0) heights.push(h2);
2446
+ if (heights.length >= 64) break;
2447
+ }
2448
+ if (!heights.length) return false;
2449
+ heights.sort((a, b) => a - b);
2450
+ const h = heights[heights.length >> 1];
2451
+ const tolerance = v.measured ? 0.5 : 0.01;
2452
+ v.measured = true;
2453
+ if (Math.abs(h - v.base) <= tolerance) return false;
2454
+ v.base = h;
2455
+ this._virtBase = h;
2456
+ this._virtComputeOffsets();
2457
+ return true;
2458
+ }
2459
+ /** Measure again, and redraw the window when the heights moved. */
2460
+ _virtRemeasure() {
2461
+ if (this._virtMeasure()) this._virtUpdate({ force: true });
2434
2462
  }
2435
2463
  /**
2436
2464
  * Slide the window to wherever the scroll box now is.
@@ -2449,9 +2477,10 @@ var DataTable = class {
2449
2477
  * @param {number} [o.viewport] the viewport height, likewise.
2450
2478
  * @returns {HTMLElement[]} the rows added.
2451
2479
  */
2452
- _virtUpdate({ force = false, notify = true, top = null, viewport = null } = {}) {
2480
+ _virtUpdate({ force = false, notify = true, top = null, viewport = null, measure = true } = {}) {
2453
2481
  const v = this._virt;
2454
2482
  if (!v || !v.offsets) return [];
2483
+ if (measure && this._virtMeasure()) force = true;
2455
2484
  const n = v.rows.length;
2456
2485
  const wrap = this._tableWrapEl;
2457
2486
  const view = viewport || wrap?.clientHeight || VIRTUAL_FALLBACK_VIEWPORT_PX;
@@ -2479,6 +2508,15 @@ var DataTable = class {
2479
2508
  console.error("[DataTable] onRowsRendered threw", err);
2480
2509
  }
2481
2510
  }
2511
+ if (measure && added.length && this._virtMeasure()) {
2512
+ return added.concat(this._virtUpdate({
2513
+ force: true,
2514
+ notify,
2515
+ top,
2516
+ viewport,
2517
+ measure: false
2518
+ }));
2519
+ }
2482
2520
  }
2483
2521
  return added;
2484
2522
  }
@@ -3997,4 +4035,4 @@ export {
3997
4035
  resolvePaging,
3998
4036
  DataTable
3999
4037
  };
4000
- //# sourceMappingURL=chunk-CPYBQN3Q.js.map
4038
+ //# sourceMappingURL=chunk-WLASPRGP.js.map