@react-hive/honey-layout 10.7.0 → 10.8.0
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/hooks/use-honey-raf-loop.d.ts +26 -7
- package/dist/hooks/use-honey-timer.d.ts +9 -6
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.dev.cjs +41 -43
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs +17 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ interface HoneyRafOnFrameContext {
|
|
|
10
10
|
* - Animation or transition completion
|
|
11
11
|
* - Time- or state-based termination conditions
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
stop: () => void;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Function invoked on every animation frame while the RAF loop is active.
|
|
@@ -85,12 +85,35 @@ interface UseHoneyRafLoopOptions {
|
|
|
85
85
|
*/
|
|
86
86
|
onError?: (error: unknown) => void;
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Public control API returned by {@link useHoneyRafLoop}.
|
|
90
|
+
*/
|
|
91
|
+
export interface HoneyRafLoopApi {
|
|
92
|
+
/**
|
|
93
|
+
* Indicates whether the RAF loop is currently running.
|
|
94
|
+
*/
|
|
95
|
+
isRunning: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Starts the RAF loop.
|
|
98
|
+
*
|
|
99
|
+
* If the loop is already running, this call is ignored.
|
|
100
|
+
*/
|
|
101
|
+
start: () => void;
|
|
102
|
+
/**
|
|
103
|
+
* Stops the RAF loop immediately.
|
|
104
|
+
*
|
|
105
|
+
* This method is safe to call:
|
|
106
|
+
* - From user code
|
|
107
|
+
* - From within the RAF frame handler
|
|
108
|
+
*/
|
|
109
|
+
stop: () => void;
|
|
110
|
+
}
|
|
88
111
|
/**
|
|
89
112
|
* A hook for running a controlled `requestAnimationFrame` loop.
|
|
90
113
|
*
|
|
91
114
|
* Features:
|
|
92
115
|
* - Explicit RAF lifecycle control (`start` / `stop`)
|
|
93
|
-
* - Delta time
|
|
116
|
+
* - Delta time calculation with frame clamping
|
|
94
117
|
* - Automatic cleanup on unmounting
|
|
95
118
|
* - Conservative handling of tab visibility changes (mobile-safe)
|
|
96
119
|
* - Safe error handling (stops loop on exception)
|
|
@@ -137,9 +160,5 @@ interface UseHoneyRafLoopOptions {
|
|
|
137
160
|
* useHoneyRafLoop(onFrame);
|
|
138
161
|
* ```
|
|
139
162
|
*/
|
|
140
|
-
export declare const useHoneyRafLoop: (onFrame: HoneyRafOnFrameHandler, { autoStart, resumeOnVisibility, maxDeltaMs, onError, }?: UseHoneyRafLoopOptions) =>
|
|
141
|
-
isRafLoopRunning: boolean;
|
|
142
|
-
startRafLoop: () => void;
|
|
143
|
-
stopRafLoop: () => void;
|
|
144
|
-
};
|
|
163
|
+
export declare const useHoneyRafLoop: (onFrame: HoneyRafOnFrameHandler, { autoStart, resumeOnVisibility, maxDeltaMs, onError, }?: UseHoneyRafLoopOptions) => HoneyRafLoopApi;
|
|
145
164
|
export {};
|
|
@@ -42,37 +42,40 @@ export interface UseHoneyTimerOptions {
|
|
|
42
42
|
*/
|
|
43
43
|
onEnd?: UseHoneyTimerOnEndHandler;
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Public control API returned by {@link useHoneyTimer}.
|
|
47
|
+
*/
|
|
45
48
|
export interface UseHoneyTimerApi {
|
|
46
49
|
/**
|
|
47
50
|
* Current timer value in milliseconds.
|
|
48
51
|
*
|
|
49
52
|
* This value updates over time while the timer is running.
|
|
50
53
|
*/
|
|
51
|
-
|
|
54
|
+
timeMs: number;
|
|
52
55
|
/**
|
|
53
56
|
* Indicates whether the timer is currently progressing.
|
|
54
57
|
*/
|
|
55
|
-
|
|
58
|
+
isRunning: boolean;
|
|
56
59
|
/**
|
|
57
60
|
* Starts the timer from `initialTimeMs`, resetting any previous state.
|
|
58
61
|
*/
|
|
59
|
-
|
|
62
|
+
start: () => void;
|
|
60
63
|
/**
|
|
61
64
|
* Pauses the timer while preserving the current time value.
|
|
62
65
|
*/
|
|
63
|
-
|
|
66
|
+
pause: () => void;
|
|
64
67
|
/**
|
|
65
68
|
* Resumes the timer from its current time value.
|
|
66
69
|
*
|
|
67
70
|
* Has no effect if the timer is already running.
|
|
68
71
|
*/
|
|
69
|
-
|
|
72
|
+
resume: () => void;
|
|
70
73
|
/**
|
|
71
74
|
* Resets the timer to a specific time value.
|
|
72
75
|
*
|
|
73
76
|
* @param timeMs - Optional new timer value. Defaults to `initialTimeMs`.
|
|
74
77
|
*/
|
|
75
|
-
|
|
78
|
+
reset: (timeMs?: number) => void;
|
|
76
79
|
}
|
|
77
80
|
/**
|
|
78
81
|
* A high-precision timer hook built on top of {@link useHoneyRafLoop}.
|