@human-kit/ui 1.4.4 → 1.4.6
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.
|
@@ -37,6 +37,22 @@ export function getMotionTime(element) {
|
|
|
37
37
|
const animationTime = getMaxTime(styles.animationDuration, styles.animationDelay);
|
|
38
38
|
return Math.max(transitionTime, animationTime);
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Whether the element still has a transition or an animation in progress, at one of its end events.
|
|
42
|
+
*
|
|
43
|
+
* It asks the element, not the clock. The clock starts in a frame callback, and the animation
|
|
44
|
+
* started at the time of that frame, before the callback: when the frame ran late, the time measured
|
|
45
|
+
* at the end event came out short of the duration, and the last end event was ignored. The motion
|
|
46
|
+
* then finished on the fallback timer, 50ms late — long enough to show an exit animation without a
|
|
47
|
+
* fill mode at full opacity again: an overlay that closes, opens and closes. The clock remains only
|
|
48
|
+
* where the browser cannot list the animations.
|
|
49
|
+
*/
|
|
50
|
+
function isStillMoving(element, startTime, total) {
|
|
51
|
+
if (typeof element.getAnimations !== 'function') {
|
|
52
|
+
return performance.now() - startTime < total - 5;
|
|
53
|
+
}
|
|
54
|
+
return element.getAnimations().some((animation) => animation.playState === 'running');
|
|
55
|
+
}
|
|
40
56
|
/**
|
|
41
57
|
* Call `onComplete` once the element's current transition/animation finishes. Resolves on the next
|
|
42
58
|
* frame when there is no motion (e.g. prefers-reduced-motion), listens for animation/transition end
|
|
@@ -73,10 +89,10 @@ export function trackMotionEnd(element, onComplete) {
|
|
|
73
89
|
return;
|
|
74
90
|
// A multi-property transition (e.g. `opacity 150ms, transform 300ms`)
|
|
75
91
|
// fires one end event per property; finishing on the first one cut the
|
|
76
|
-
// motion short (overlays unmounted mid-exit).
|
|
77
|
-
//
|
|
78
|
-
// still covers the case where the final event never fires.
|
|
79
|
-
if (
|
|
92
|
+
// motion short (overlays unmounted mid-exit). So an end event only
|
|
93
|
+
// finishes once nothing else on the element still moves — the timeout
|
|
94
|
+
// below still covers the case where the final event never fires.
|
|
95
|
+
if (isStillMoving(element, startTime, total))
|
|
80
96
|
return;
|
|
81
97
|
finish();
|
|
82
98
|
};
|
|
@@ -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.6",
|
|
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>",
|