@react-hive/honey-layout 15.0.0 → 16.1.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.
@@ -2,21 +2,21 @@
2
2
  * The types for handling CSS properties and values, focusing on dimensions, colors, media queries, and other essential CSS concepts.
3
3
  */
4
4
  import * as CSS from 'csstype';
5
- import type { HoneyBreakpointName, HoneyStyledContext, HoneyColor, HoneyCSSSpacingValue, HoneyCSSColorProperty, HoneyCSSSpacingProperty, HoneyCSSShorthandSpacingProperty, HoneyRawCSSSpacingValue } from '@react-hive/honey-style';
5
+ import type { HoneyBreakpointName, HoneyColor, HoneyCssColorProperty, HoneyCssShorthandSpacingProperty, HoneyCssSpacingProperty, HoneyCssSpacingValue, HoneyRawCssSpacingValue, HoneyStyledContext } from '@react-hive/honey-style';
6
6
  /**
7
7
  * @see https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function/steps#step-position
8
8
  */
9
- type HoneyCSSStepFunctionPosition = 'jump-start' | 'jump-end' | 'jump-none' | 'jump-both' | 'start' | 'end';
9
+ type HoneyCssStepFunctionPosition = 'jump-start' | 'jump-end' | 'jump-none' | 'jump-both' | 'start' | 'end';
10
10
  /**
11
11
  * Defining the allowed timing functions for the transition
12
12
  */
13
- export type HoneyCSSTimingFunction = 'ease' | 'linear' | `linear(${string})` | `cubic-bezier(${number}, ${number}, ${number}, ${number})` | 'ease-in' | 'ease-out' | 'ease-in-out' | 'step-start' | 'step-end' | `steps(${number})` | `steps(${number}, ${HoneyCSSStepFunctionPosition})`;
13
+ export type HoneyCssTimingFunction = 'ease' | 'linear' | `linear(${string})` | `cubic-bezier(${number}, ${number}, ${number}, ${number})` | 'ease-in' | 'ease-out' | 'ease-in-out' | 'step-start' | 'step-end' | `steps(${number})` | `steps(${number}, ${HoneyCssStepFunctionPosition})`;
14
14
  /**
15
15
  * A type representing a function that returns a value for a specific CSS property based on the provided theme.
16
16
  *
17
17
  * @template CSSProperty - The CSS property this function will generate a value for.
18
18
  */
19
- type HoneyCSSPropertyValueFn<CSSProperty extends keyof CSS.Properties> = (context: HoneyStyledContext<object>) => CSS.Properties[CSSProperty];
19
+ type HoneyCssPropertyValueFn<CSSProperty extends keyof CSS.Properties> = (context: HoneyStyledContext<object>) => CSS.Properties[CSSProperty];
20
20
  /**
21
21
  * Represents a non-responsive (raw) CSS property value for a specific CSS property.
22
22
  *
@@ -29,7 +29,7 @@ type HoneyCSSPropertyValueFn<CSSProperty extends keyof CSS.Properties> = (contex
29
29
  *
30
30
  * @template CSSProperty - The name of the CSS property.
31
31
  */
32
- type HoneyRawCSSPropertyValue<CSSProperty extends keyof CSS.Properties> = CSSProperty extends HoneyCSSColorProperty ? HoneyColor : CSSProperty extends HoneyCSSShorthandSpacingProperty ? HoneyCSSSpacingValue : CSSProperty extends HoneyCSSSpacingProperty ? HoneyRawCSSSpacingValue : CSS.Properties[CSSProperty];
32
+ type HoneyRawCssPropertyValue<CSSProperty extends keyof CSS.Properties> = CSSProperty extends HoneyCssColorProperty ? HoneyColor : CSSProperty extends HoneyCssShorthandSpacingProperty ? HoneyCssSpacingValue : CSSProperty extends HoneyCssSpacingProperty ? HoneyRawCssSpacingValue : CSS.Properties[CSSProperty];
33
33
  /**
34
34
  * Represents a responsive CSS property value for a specific CSS property.
35
35
  *
@@ -41,8 +41,8 @@ type HoneyRawCSSPropertyValue<CSSProperty extends keyof CSS.Properties> = CSSPro
41
41
  *
42
42
  * @template CSSProperty - The key of a CSS property for which values are defined.
43
43
  */
44
- type HoneyResponsiveCSSPropertyValue<CSSProperty extends keyof CSS.Properties> = {
45
- [K in HoneyBreakpointName]?: HoneyRawCSSPropertyValue<CSSProperty> | HoneyCSSPropertyValueFn<CSSProperty>;
44
+ type HoneyResponsiveCssPropertyValue<CSSProperty extends keyof CSS.Properties> = {
45
+ [K in HoneyBreakpointName]?: HoneyRawCssPropertyValue<CSSProperty> | HoneyCssPropertyValueFn<CSSProperty>;
46
46
  };
47
47
  /**
48
48
  * Represents a CSS property value that can be either a single value or a responsive value.
@@ -55,13 +55,13 @@ type HoneyResponsiveCSSPropertyValue<CSSProperty extends keyof CSS.Properties> =
55
55
  *
56
56
  * @template CSSProperty - The key of a CSS property to check.
57
57
  */
58
- export type HoneyCSSPropertyValue<CSSProperty extends keyof CSS.Properties> = HoneyRawCSSPropertyValue<CSSProperty> | HoneyCSSPropertyValueFn<CSSProperty> | HoneyResponsiveCSSPropertyValue<CSSProperty>;
58
+ export type HoneyCssPropertyValue<CSSProperty extends keyof CSS.Properties> = HoneyRawCssPropertyValue<CSSProperty> | HoneyCssPropertyValueFn<CSSProperty> | HoneyResponsiveCssPropertyValue<CSSProperty>;
59
59
  /**
60
60
  * A utility type to add a `$` prefix to a given CSS property name.
61
61
  *
62
62
  * @template CSSProperty - The string type representing a CSS property name.
63
63
  */
64
- export type Honey$PrefixedCSSProperty<CSSProperty extends keyof CSS.Properties = keyof CSS.Properties> = `$${CSSProperty}`;
64
+ export type Honey$PrefixedCssProperty<CSSProperty extends keyof CSS.Properties = keyof CSS.Properties> = `$${CSSProperty}`;
65
65
  /**
66
66
  * Represents an object where each key is a prefixed CSS property (with a `$` prefix).
67
67
  *
@@ -73,7 +73,7 @@ export type Honey$PrefixedCSSProperty<CSSProperty extends keyof CSS.Properties =
73
73
  * };
74
74
  * ```
75
75
  */
76
- export type Honey$PrefixedCSSProperties = {
77
- [CSSProperty in keyof CSS.Properties as Honey$PrefixedCSSProperty<CSSProperty>]?: HoneyCSSPropertyValue<CSSProperty>;
76
+ export type Honey$PrefixedCssProperties = {
77
+ [CSSProperty in keyof CSS.Properties as Honey$PrefixedCssProperty<CSSProperty>]?: HoneyCssPropertyValue<CSSProperty>;
78
78
  };
79
79
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-hive/honey-layout",
3
- "version": "15.0.0",
3
+ "version": "16.1.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "react",
@@ -33,14 +33,15 @@
33
33
  "!dist/**/jest*"
34
34
  ],
35
35
  "peerDependencies": {
36
- "@react-hive/honey-style": "^4.0.0",
36
+ "@react-hive/honey-style": "^5.0.0",
37
37
  "react": "^19.0.0",
38
38
  "react-dom": "^19.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "@floating-ui/dom": "1.7.5",
42
- "@floating-ui/react": "0.27.18",
43
- "@react-hive/honey-utils": "3.24.0",
41
+ "@floating-ui/dom": "1.7.6",
42
+ "@floating-ui/react": "0.27.19",
43
+ "@react-hive/honey-hooks": "1.0.0",
44
+ "@react-hive/honey-utils": "3.26.0",
44
45
  "csstype": "3.2.3",
45
46
  "highlight.js": "11.11.1",
46
47
  "lodash.merge": "4.6.2",
@@ -62,7 +63,7 @@
62
63
  "@types/react-dom": "^19.2.3",
63
64
  "copy-webpack-plugin": "13.0.1",
64
65
  "css-loader": "7.1.4",
65
- "eslint": "10.0.2",
66
+ "eslint": "10.0.3",
66
67
  "eslint-plugin-react": "7.37.5",
67
68
  "html-webpack-plugin": "5.6.6",
68
69
  "husky": "9.1.7",
@@ -75,9 +76,9 @@
75
76
  "ts-node": "10.9.2",
76
77
  "tsx": "4.21.0",
77
78
  "typescript": "5.9.3",
78
- "typescript-eslint": "8.56.1",
79
- "webpack": "5.105.3",
80
- "webpack-cli": "6.0.1",
79
+ "typescript-eslint": "8.57.0",
80
+ "webpack": "5.105.4",
81
+ "webpack-cli": "7.0.1",
81
82
  "webpack-dev-server": "5.2.3"
82
83
  },
83
84
  "jest": {
@@ -1,179 +0,0 @@
1
- import type { InertiaOptions } from '@react-hive/honey-utils';
2
- /**
3
- * Configuration options for {@link useHoneyDecay}.
4
- */
5
- export interface UseHoneyDecayOptions extends Pick<InertiaOptions, 'friction' | 'minVelocityPxMs' | 'emaAlpha'> {
6
- /**
7
- * Initial numeric value from which inertial motion starts.
8
- *
9
- * This typically represents a translated position (e.g. scroll offset or `translateX` value),
10
- * but may be any bounded numeric domain.
11
- */
12
- initialValue: number;
13
- /**
14
- * Lower bound for the value (inclusive).
15
- *
16
- * Movement beyond this boundary is not permitted.
17
- */
18
- min: number;
19
- /**
20
- * Upper bound for the value (inclusive).
21
- *
22
- * Movement beyond this boundary is not permitted.
23
- */
24
- max: number;
25
- /**
26
- * Optional callback invoked exactly once when inertial motion terminates.
27
- *
28
- * Triggered when inertia ends due to:
29
- * - velocity decaying below `minVelocityPxMs`
30
- * - movement being blocked by bounds
31
- * - an explicit call to `stop()`
32
- *
33
- * Not invoked if inertia was never started.
34
- */
35
- onStop?: () => void;
36
- }
37
- /**
38
- * Public control API returned by {@link useHoneyDecay}.
39
- *
40
- * Exposes imperative controls for managing velocity-based inertial motion.
41
- */
42
- export interface UseHoneyDecayApi {
43
- /**
44
- * Current value produced by the decay simulation.
45
- *
46
- * This value updates over time while inertia is active
47
- * and always remains within the configured bounds.
48
- */
49
- value: number;
50
- /**
51
- * Indicates whether inertial motion is currently active.
52
- */
53
- isRunning: boolean;
54
- /**
55
- * Updates the hard bounds used by the decay simulation.
56
- *
57
- * This method is safe to call **at any time**, including while inertia is actively running.
58
- *
59
- * ### Behavior
60
- * - If the current value lies **within** the new bounds:
61
- * - bounds are updated
62
- * - inertia (if running) continues uninterrupted
63
- *
64
- * - If the current value lies **outside** the new bounds:
65
- * - the value is immediately clamped to the nearest boundary
66
- * - internal velocity is reset to `0`
67
- * - any active inertia is **terminated immediately**
68
- * - `onStop` is invoked exactly once (if inertia was active)
69
- *
70
- * This deterministic behavior mirrors native scroll engines and ensures:
71
- * - no overshoot
72
- * - no extra inertia frames
73
- * - consistent `onStop` semantics
74
- *
75
- * ### Intended usage
76
- * - Responding to layout or content changes
77
- * - Handling resize / orientation changes
78
- * - Updating overscroll or overflow limits dynamically
79
- *
80
- * ⚠️ This method should **not** be called from inside the RAF frame handler.
81
- *
82
- * @param min - New lower bound (inclusive)
83
- * @param max - New upper bound (inclusive)
84
- */
85
- setBounds: (min: number, max: number) => void;
86
- /**
87
- * Starts inertial motion from the current value using
88
- * the provided initial velocity.
89
- *
90
- * The sign of the velocity determines a direction:
91
- * - Positive → movement toward the upper bound
92
- * - Negative → movement toward the lower bound
93
- *
94
- * @param velocityPxMs - Initial velocity expressed in pixels per millisecond (`px/ms`).
95
- */
96
- start: (velocityPxMs: number) => void;
97
- /**
98
- * Immediately sets the value and starts inertial motion from that value in a single atomic operation.
99
- *
100
- * This is the preferred way to hand off from a gesture (e.g. drag end) to inertia, as it:
101
- * - avoids transient intermediate states
102
- * - guarantees correct value/velocity ordering
103
- * - ensures `onStop` semantics remain consistent
104
- *
105
- * @param value - Starting value for the inertia simulation
106
- * @param velocityPxMs - Initial velocity in pixels per millisecond (`px/ms`)
107
- */
108
- startFrom: (value: number, velocityPxMs: number) => void;
109
- /**
110
- * Immediately stops inertial motion.
111
- *
112
- * If inertia is currently active, this will:
113
- * - cancel the RAF loop
114
- * - reset internal velocity
115
- * - invoke `onStop` exactly once
116
- */
117
- stop: () => void;
118
- }
119
- /**
120
- * A bounded, velocity-based inertia (decay) hook built on top
121
- * of {@link useHoneyRafLoop} and {@link applyInertiaStep}.
122
- *
123
- * This hook models **momentum-driven motion** where:
124
- * - Motion starts with an initial velocity
125
- * - Velocity decays exponentially over time
126
- * - Movement is constrained by hard numeric bounds
127
- * - Inertia stops naturally when velocity becomes negligible
128
- *
129
- * Unlike spring-based motion, this hook has **no target value**.
130
- * Motion continues purely based on momentum until it decays
131
- * or is blocked by a boundary.
132
- *
133
- * ---
134
- *
135
- * ### Key characteristics
136
- * - Frame-rate independent (delta-time based)
137
- * - Deterministic and interruptible
138
- * - Direction-aware and bound-safe (no overshoot or jitter)
139
- * - Closely matches native scroll and drag inertia behavior
140
- *
141
- * ---
142
- *
143
- * ### Visibility behavior
144
- * This hook is a **simulation-based system**:
145
- * - Inertia automatically pauses when the document becomes hidden
146
- * - No time elapses while hidden
147
- * - Motion resumes only when explicitly restarted
148
- *
149
- * This behavior is inherited from {@link useHoneyRafLoop} and is intentional.
150
- *
151
- * ---
152
- *
153
- * ### Common use cases
154
- * - Scroll containers with momentum
155
- * - Drag-to-scroll interactions
156
- * - Carousels and sliders
157
- * - Timelines and scrubbers
158
- * - Kinetic panning and flinging
159
- *
160
- * ---
161
- *
162
- * @example
163
- * ```ts
164
- * const decay = useHoneyDecay({
165
- * initialValue: 0,
166
- * min: -maxOverflow,
167
- * max: 0,
168
- * });
169
- *
170
- * const onRelease = (velocityPxMs: number) => {
171
- * decay.start(velocityPxMs);
172
- * };
173
- *
174
- * return (
175
- * <div style={{ transform: `translateX(${decay.value}px)` }} />
176
- * );
177
- * ```
178
- */
179
- export declare const useHoneyDecay: ({ initialValue, min, max, friction, minVelocityPxMs, emaAlpha, onStop, }: UseHoneyDecayOptions) => UseHoneyDecayApi;
@@ -1,40 +0,0 @@
1
- import type { HoneyKeyboardEventCode } from '../types';
2
- export type UseHoneyDocumentOnKeyUpHandler = (keyCode: HoneyKeyboardEventCode, e: KeyboardEvent) => void;
3
- interface UseHoneyDocumentKeyUpOptions {
4
- /**
5
- * Whether the event listener should be active.
6
- *
7
- * @default true
8
- */
9
- enabled?: boolean;
10
- /**
11
- * Whether to call `preventDefault()` on matching keyup events.
12
- *
13
- * This is useful for suppressing default browser behavior (e.g., scrolling with Space key).
14
- *
15
- * @default true
16
- */
17
- preventDefault?: boolean;
18
- }
19
- /**
20
- * Hook for handling specific key up events on the `document` object.
21
- *
22
- * This hook adds a `keyup` event listener at the document level and triggers the provided `keyUpHandler`
23
- * when one of the specified `listenKeys` is released.
24
- *
25
- * @param onKeyUp - The callback function invoked when a matching key is released.
26
- * @param listenKeys - An array of key codes (`KeyboardEvent.code`) to listen for.
27
- * @param options - Optional configuration to control event behavior and listener activation.
28
- *
29
- * @example
30
- * ```tsx
31
- * useHoneyDocumentKeyUp(
32
- * (keyCode, event) => {
33
- * console.log('Key released:', keyCode);
34
- * },
35
- * ['Escape'],
36
- * );
37
- * ```
38
- */
39
- export declare const useHoneyDocumentKeyUp: (onKeyUp: UseHoneyDocumentOnKeyUpHandler, listenKeys: HoneyKeyboardEventCode[], { enabled, preventDefault }?: UseHoneyDocumentKeyUpOptions) => void;
40
- export {};
@@ -1,200 +0,0 @@
1
- import type { RefObject } from 'react';
2
- import type { Nullable } from '../types';
3
- /**
4
- * Invoked when a drag gesture is about to start.
5
- *
6
- * This handler is called on the initial pointer-down interaction
7
- * (mouse or touch) **before** drag tracking begins.
8
- *
9
- * It can be used to:
10
- * - Conditionally allow or block dragging
11
- * - Capture initial external state
12
- * - Cancel dragging based on application logic
13
- *
14
- * @template Element - The draggable element type.
15
- *
16
- * @param draggableElement - The element that will be dragged.
17
- * @param e - The initiating pointer event.
18
- *
19
- * @returns A promise resolving to:
20
- * - `true` to allow the drag to begin
21
- * - `false` to cancel the drag
22
- */
23
- export type UseHoneyDragOnStartHandler<Element extends HTMLElement> = (draggableElement: Element, e: MouseEvent | TouchEvent) => Promise<boolean>;
24
- /**
25
- * Context describing pointer movement during an active drag gesture.
26
- *
27
- * All values are expressed in **pixels** and are relative
28
- * to the drag start or previous frame as noted.
29
- */
30
- export interface UseHoneyDragOnMoveContext {
31
- /**
32
- * Horizontal delta since the previous move event.
33
- *
34
- * Positive values indicate movement to the right.
35
- */
36
- deltaX: number;
37
- /**
38
- * Vertical delta since the previous move event.
39
- *
40
- * Positive values indicate movement downward.
41
- */
42
- deltaY: number;
43
- /**
44
- * Total horizontal displacement from the drag start position.
45
- */
46
- distanceX: number;
47
- /**
48
- * Total vertical displacement from the drag start position.
49
- */
50
- distanceY: number;
51
- }
52
- /**
53
- * Handler invoked continuously while a drag gesture is active.
54
- *
55
- * This handler:
56
- * - Is created once per drag start
57
- * - Receives incremental movement data on each pointer move
58
- * - Can synchronously or asynchronously decide whether dragging continues
59
- *
60
- * Returning `false` from the move callback immediately terminates the drag.
61
- *
62
- * @template Element - The draggable element type.
63
- *
64
- * @param draggableElement - The element being dragged.
65
- *
66
- * @returns A function invoked on every pointer move, receiving
67
- * {@link UseHoneyDragOnMoveContext}, and resolving to:
68
- * - `true` to continue dragging
69
- * - `false` to stop dragging immediately
70
- */
71
- export type UseHoneyDragOnMoveHandler<Element extends HTMLElement> = (draggableElement: Element) => (context: UseHoneyDragOnMoveContext) => Promise<boolean>;
72
- /**
73
- * Context describing the final state of a completed drag gesture.
74
- *
75
- * This context exposes **release velocity**, which is suitable for
76
- * inertia, momentum, or decay-based motion systems.
77
- */
78
- interface UseHoneyDragOnEndContext {
79
- /**
80
- * Total horizontal displacement from drag start to release.
81
- */
82
- deltaX: number;
83
- /**
84
- * Total vertical displacement from drag start to release.
85
- */
86
- deltaY: number;
87
- /**
88
- * Horizontal release velocity in pixels per millisecond (`px/ms`).
89
- *
90
- * This value represents the **instantaneous velocity at release**
91
- * and is suitable for inertia or momentum-based motion.
92
- */
93
- velocityXPxMs: number;
94
- /**
95
- * Vertical release velocity in pixels per millisecond (`px/ms`).
96
- *
97
- * This value represents the **instantaneous velocity at release**
98
- * and is suitable for inertia or momentum-based motion.
99
- */
100
- velocityYPxMs: number;
101
- }
102
- /**
103
- * Invoked when a drag gesture ends.
104
- *
105
- * This handler is called when:
106
- * - The pointer is released
107
- * - The drag is programmatically terminated (unless explicitly skipped)
108
- *
109
- * It provides final displacement and **release velocity**, making it
110
- * ideal for triggering inertia or decay animations.
111
- *
112
- * @template Element - The draggable element type.
113
- *
114
- * @param context - Final drag metrics, including release velocity.
115
- * @param draggableElement - The element that was dragged.
116
- * @param e - The pointer event that finished the drag.
117
- *
118
- * @returns A promise that resolves when cleanup or follow-up logic completes.
119
- */
120
- export type UseHoneyDragOnEndHandler<Element extends HTMLElement> = (context: UseHoneyDragOnEndContext, draggableElement: Element, e: MouseEvent | TouchEvent) => Promise<void>;
121
- /**
122
- * Collection of handlers controlling the lifecycle of a drag gesture.
123
- *
124
- * Together, these handlers define:
125
- * - Whether dragging is allowed
126
- * - How movement is handled
127
- * - What happens when dragging ends
128
- */
129
- export interface UseHoneyDragHandlers<Element extends HTMLElement> {
130
- /**
131
- * Optional handler triggered when the drag operation starts.
132
- * This is useful for capturing the initial state or performing any setup actions before the drag starts.
133
- *
134
- * @param element - The element being dragged.
135
- *
136
- * @returns A boolean or Promise resolving to a boolean indicating if the drag should proceed.
137
- */
138
- onStartDrag?: UseHoneyDragOnStartHandler<Element>;
139
- /**
140
- * Required handler triggered continuously during the drag operation.
141
- * This handler is responsible for updating the drag state and typically tracks the element's movement.
142
- *
143
- * @param element - The element being dragged.
144
- *
145
- * @returns A boolean or Promise resolving to a boolean indicating whether the drag should continue.
146
- */
147
- onMoveDrag: UseHoneyDragOnMoveHandler<Element>;
148
- /**
149
- * Optional handler triggered when the drag operation ends.
150
- * This is commonly used for cleanup or finalizing the drag process.
151
- *
152
- * @param context - Contains information about the drag operation, such as distance and speed.
153
- * @param element - The element being dragged.
154
- *
155
- * @returns A Promise.
156
- */
157
- onEndDrag?: UseHoneyDragOnEndHandler<Element>;
158
- }
159
- /**
160
- * Configuration options controlling drag behavior.
161
- *
162
- * These options affect lifecycle handling and enable/disable logic,
163
- * but do not influence movement physics directly.
164
- */
165
- export interface UseHoneyDragOptions<Element extends HTMLElement> extends UseHoneyDragHandlers<Element> {
166
- /**
167
- * Controls whether the `onEndDrag` handler is skipped when the drag operation is forcibly stopped.
168
- * This can be useful when dragging is interrupted or terminated early due to movement restrictions.
169
- *
170
- * @default false
171
- */
172
- skipOnEndDragWhenStopped?: boolean;
173
- /**
174
- * Determines if the drag functionality is enabled or disabled.
175
- *
176
- * @default true
177
- */
178
- enabled?: boolean;
179
- }
180
- /**
181
- * Enables high-precision mouse and touch dragging for an element.
182
- *
183
- * This hook:
184
- * - Tracks pointer movement using `performance.now()`
185
- * - Computes **instantaneous release velocity** (px/ms)
186
- * - Emits deterministic drag lifecycle events
187
- * - Supports both mouse and touch input
188
- *
189
- * Architectural notes:
190
- * - Velocity is computed **during movement**, not at drag end
191
- * - Release velocity is suitable for inertia / decay systems
192
- * - No layout reads or writes are performed internally
193
- *
194
- * @template Element - The draggable HTML element type.
195
- *
196
- * @param draggableElementRef - Ref pointing to the draggable element.
197
- * @param options - Drag lifecycle handlers and configuration flags.
198
- */
199
- export declare const useHoneyDrag: <Element extends HTMLElement>(draggableElementRef: RefObject<Nullable<Element>>, { skipOnEndDragWhenStopped, enabled, onMoveDrag, onStartDrag, onEndDrag, }: UseHoneyDragOptions<Element>) => void;
200
- export {};
@@ -1,18 +0,0 @@
1
- import type { RefObject } from 'react';
2
- type UseHoneyLatest = {
3
- <T>(value: T): RefObject<T>;
4
- <T>(value: T | undefined): RefObject<T | undefined>;
5
- };
6
- /**
7
- * Stores the latest value in a stable ref.
8
- *
9
- * Guarantees that:
10
- * - `ref.current` always points to the latest value
11
- * - the ref object identity never changes
12
- *
13
- * Overload behavior:
14
- * - If a non-optional value is provided, `.current` is non-optional
15
- * - If an optional value is provided, `.current` is optional
16
- */
17
- export declare const useHoneyLatest: UseHoneyLatest;
18
- export {};
@@ -1,27 +0,0 @@
1
- import type { EffectCallback } from 'react';
2
- /**
3
- * A hook that invokes a callback function whenever the provided `state` value changes.
4
- *
5
- * This hook stores the previous value internally and performs a shallow comparison with the current value.
6
- * If a change is detected, it executes the `onChange` callback. If the callback returns a cleanup function,
7
- * it will be invoked before the next change or when the component unmounts, similar to standard `useEffect` behavior.
8
- *
9
- * @template T - The type of the state being observed.
10
- *
11
- * @param state - The value to monitor for changes. Can be of any type.
12
- * @param onChange - A function called whenever `state` changes. It may return a cleanup function.
13
- *
14
- * @returns void
15
- *
16
- * @example
17
- * ```ts
18
- * useHoneyOnChange(someValue, (newValue) => {
19
- * console.log('Value changed to:', newValue);
20
- *
21
- * return () => {
22
- * console.log('Cleanup for value:', newValue);
23
- * };
24
- * });
25
- * ```
26
- */
27
- export declare const useHoneyOnChange: <T>(state: T, onChange: (newState: T) => ReturnType<EffectCallback>) => void;