@human-kit/ui 1.4.6 → 1.4.7
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.
|
@@ -246,24 +246,24 @@
|
|
|
246
246
|
scrollTop = scrollContainer.scrollTop;
|
|
247
247
|
};
|
|
248
248
|
|
|
249
|
+
// Scrolls and resizes flush at once so the window of rows moves in the same frame.
|
|
249
250
|
const updateMetrics = () => {
|
|
250
251
|
flushSync(setMetrics);
|
|
251
252
|
};
|
|
252
253
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
updateMetrics();
|
|
254
|
+
// The first measure is a plain write: `flushSync` is forbidden inside an effect, and
|
|
255
|
+
// outside async mode it doesn't throw — it flushes the batch this effect runs in, and
|
|
256
|
+
// the effects after it in the same pass run without one (`schedule` of null).
|
|
257
|
+
setMetrics();
|
|
258
258
|
|
|
259
259
|
const resizeObserver =
|
|
260
260
|
typeof ResizeObserver !== 'undefined' ? new ResizeObserver(updateMetrics) : null;
|
|
261
261
|
|
|
262
|
-
scrollContainer.addEventListener('scroll',
|
|
262
|
+
scrollContainer.addEventListener('scroll', updateMetrics, { passive: true });
|
|
263
263
|
resizeObserver?.observe(scrollContainer);
|
|
264
264
|
|
|
265
265
|
return () => {
|
|
266
|
-
scrollContainer.removeEventListener('scroll',
|
|
266
|
+
scrollContainer.removeEventListener('scroll', updateMetrics);
|
|
267
267
|
resizeObserver?.disconnect();
|
|
268
268
|
};
|
|
269
269
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@human-kit/ui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.7",
|
|
4
4
|
"description": "Accessible, typed UI components for Svelte 5 — shipped as native ESM with per-component subpath exports so bundlers only include what you import.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Agustin Delgado <agustindariodelgado@gmail.com>",
|