@human-kit/ui 1.4.5 → 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
|
});
|
|
@@ -174,6 +174,11 @@ export function createTabsContext(options) {
|
|
|
174
174
|
if (valuesMatch(focusedValue, value)) {
|
|
175
175
|
focusedValue = null;
|
|
176
176
|
}
|
|
177
|
+
// The whole strip leaving the page tears its tabs down one by one. Handing the selection
|
|
178
|
+
// to the next tab each time is a choice nobody made, and a page that writes the bound
|
|
179
|
+
// value into its URL navigated back to itself when it was left.
|
|
180
|
+
if (listElement !== null && !listElement.isConnected)
|
|
181
|
+
return;
|
|
177
182
|
if (wasSelected && !isControlled) {
|
|
178
183
|
const candidate = tabOrder[index];
|
|
179
184
|
publishSelectedValue(candidate !== undefined && !isValueDisabled(candidate) ? candidate : getFirstEnabledValue());
|
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>",
|