@versini/ui-hooks 6.0.0 → 6.0.1

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.
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
@@ -44,10 +44,10 @@ const DEFAULT_EVENTS = [
44
44
  const ref = useRef(null);
45
45
  useEffect(()=>{
46
46
  const listener = (event)=>{
47
- /* v8 ignore next 1 */ const target = event ? event.target : undefined;
47
+ /* v8 ignore start */ const target = event ? event.target : undefined;
48
48
  if (Array.isArray(nodes)) {
49
- /* v8 ignore next 2 */ const shouldIgnore = !document.body.contains(target) && target.tagName !== "HTML";
50
- const shouldTrigger = nodes.every((node)=>!!node && !event.composedPath().includes(node));
49
+ const shouldIgnore = !document.body.contains(target) && target.tagName !== "HTML";
50
+ /* v8 ignore stop */ const shouldTrigger = nodes.every((node)=>!!node && !event.composedPath().includes(node));
51
51
  shouldTrigger && !shouldIgnore && handler();
52
52
  } else if (ref.current && !ref.current.contains(target)) {
53
53
  handler();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
@@ -34,10 +34,10 @@ let refCount = 0;
34
34
  * idempotent - calling it multiple times is safe. Checks DOM directly to handle
35
35
  * React Strict Mode double-mounting.
36
36
  */ const ensureHapticElement = ()=>{
37
- /* c8 ignore next 3 */ if (typeof window === "undefined") {
37
+ /* v8 ignore start - SSR check */ if (typeof window === "undefined") {
38
38
  return;
39
39
  }
40
- // First check: do we have valid references that exist in the DOM?
40
+ /* v8 ignore stop */ // First check: do we have valid references that exist in the DOM?
41
41
  if (sharedLabelElement && document.body.contains(sharedLabelElement)) {
42
42
  return;
43
43
  }
@@ -70,10 +70,10 @@ let refCount = 0;
70
70
  * Removes the shared haptic element from the DOM and clears references. Only
71
71
  * called when the last component using the hook unmounts.
72
72
  */ const cleanupHapticElement = ()=>{
73
- if (sharedLabelElement && document.body && document.body.contains(sharedLabelElement)) {
73
+ /* v8 ignore start - cleanup edge case */ if (sharedLabelElement && document.body && document.body.contains(sharedLabelElement)) {
74
74
  document.body.removeChild(sharedLabelElement);
75
75
  }
76
- sharedLabelElement = null;
76
+ /* v8 ignore stop */ sharedLabelElement = null;
77
77
  };
78
78
  /**
79
79
  * Custom hook providing imperative haptic feedback for mobile devices. Uses
@@ -102,7 +102,7 @@ let refCount = 0;
102
102
  refCount++;
103
103
  try {
104
104
  ensureHapticElement();
105
- } catch (error) {
105
+ /* v8 ignore start - error handling for element creation failure */ } catch (error) {
106
106
  /**
107
107
  * If element creation fails, we need to decrement refCount immediately since
108
108
  * the cleanup function won't be registered. This prevents refCount from
@@ -110,7 +110,7 @@ let refCount = 0;
110
110
  */ refCount--;
111
111
  throw error;
112
112
  }
113
- return ()=>{
113
+ /* v8 ignore stop */ return ()=>{
114
114
  /**
115
115
  * Cleanup function: clear all pending timeouts to prevent haptics from
116
116
  * firing after unmount, and decrement the reference count. Only remove the
@@ -161,10 +161,10 @@ let refCount = 0;
161
161
  * ```
162
162
  *
163
163
  */ const haptic = useCallback((count = 1)=>{
164
- /* c8 ignore next 3 */ if (typeof window === "undefined") {
164
+ /* v8 ignore start - SSR check */ if (typeof window === "undefined") {
165
165
  return;
166
166
  }
167
- if (count < 1) {
167
+ /* v8 ignore stop */ if (count < 1) {
168
168
  return;
169
169
  }
170
170
  if (navigator?.vibrate && count > 1) {
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
@@ -46,10 +46,10 @@ function useHotkeys(hotkeys, tagsToIgnore = [
46
46
  preventDefault: true
47
47
  }])=>{
48
48
  if (getHotkeyMatcher(hotkey)(event) && shouldFireEvent(event, tagsToIgnore, triggerOnContentEditable)) {
49
- if (options.preventDefault) {
49
+ /* v8 ignore start - preventDefault edge case */ if (options.preventDefault) {
50
50
  event.preventDefault();
51
51
  }
52
- handler(event);
52
+ /* v8 ignore stop */ handler(event);
53
53
  }
54
54
  });
55
55
  };
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
@@ -71,7 +71,7 @@ function getHotkeyMatcher(hotkey) {
71
71
  function getHotkeyHandler(hotkeys) {
72
72
  return (event)=>{
73
73
  const _event = "nativeEvent" in event ? event.nativeEvent : event;
74
- hotkeys.forEach(([hotkey, handler, options = {
74
+ /* v8 ignore start - hotkey handler matching */ hotkeys.forEach(([hotkey, handler, options = {
75
75
  preventDefault: true
76
76
  }])=>{
77
77
  if (getHotkeyMatcher(hotkey)(_event)) {
@@ -81,7 +81,7 @@ function getHotkeyHandler(hotkeys) {
81
81
  handler(_event);
82
82
  }
83
83
  });
84
- };
84
+ /* v8 ignore stop */ };
85
85
  }
86
86
 
87
87
  export { getHotkeyHandler, getHotkeyMatcher, parseHotkey };
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
@@ -26,7 +26,7 @@ import { useCallback, useRef, useState } from "react";
26
26
  * @returns
27
27
  * ref: React ref object to attach to the element you want to monitor.
28
28
  * inViewport: Boolean indicating if the element is in the viewport.
29
- */ /* v8 ignore next 24 */ function useInViewport() {
29
+ */ /* v8 ignore start */ function useInViewport() {
30
30
  const observer = useRef(null);
31
31
  const [inViewport, setInViewport] = useState(false);
32
32
  const ref = useCallback((node)=>{
@@ -47,6 +47,6 @@ import { useCallback, useRef, useState } from "react";
47
47
  ref,
48
48
  inViewport
49
49
  };
50
- }
50
+ } /* v8 ignore stop */
51
51
 
52
52
  export { useInViewport };
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
@@ -42,10 +42,10 @@ import { useCallback, useEffect, useRef, useState } from "react";
42
42
  const fnRef = useRef(null);
43
43
  const start = useCallback(()=>{
44
44
  setActive((old)=>{
45
- if (!old && (!intervalRef.current || intervalRef.current === -1)) {
45
+ /* v8 ignore start - interval reactivation edge case */ if (!old && (!intervalRef.current || intervalRef.current === -1)) {
46
46
  intervalRef.current = window.setInterval(fnRef.current, interval);
47
47
  }
48
- return true;
48
+ /* v8 ignore stop */ return true;
49
49
  });
50
50
  }, [
51
51
  interval
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
@@ -177,11 +177,11 @@ import { useCallback, useEffect, useSyncExternalStore } from "react";
177
177
  } else {
178
178
  setLocalStorageItem(key, nextState);
179
179
  }
180
- /* v8 ignore next 4 */ } catch (e) {
180
+ /* v8 ignore start */ } catch (e) {
181
181
  // Log parsing or storage errors without breaking the application.
182
182
  console.warn(e);
183
183
  }
184
- }, [
184
+ /* v8 ignore stop */ }, [
185
185
  key,
186
186
  store
187
187
  ]);
@@ -214,11 +214,11 @@ import { useCallback, useEffect, useSyncExternalStore } from "react";
214
214
  if (getLocalStorageItem(key) === null && typeof initialValue !== "undefined") {
215
215
  setLocalStorageItem(key, initialValue);
216
216
  }
217
- /* v8 ignore next 4 */ } catch (e) {
217
+ /* v8 ignore start */ } catch (e) {
218
218
  // Log initialization errors without breaking the application.
219
219
  console.warn(e);
220
220
  }
221
- }, [
221
+ /* v8 ignore stop */ }, [
222
222
  key,
223
223
  initialValue
224
224
  ]);
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
@@ -42,10 +42,10 @@ import { useMemo } from "react";
42
42
  function useMergeRefs(refs) {
43
43
  // biome-ignore lint/correctness/useExhaustiveDependencies: refs array is used as dependency but spread for proper comparison
44
44
  return useMemo(()=>{
45
- if (refs.every((ref)=>ref == null)) {
45
+ /* v8 ignore start - all refs null edge case */ if (refs.every((ref)=>ref == null)) {
46
46
  return ()=>{};
47
47
  }
48
- return (value)=>{
48
+ /* v8 ignore stop */ /* v8 ignore start - ref assignment handling */ return (value)=>{
49
49
  refs.forEach((ref)=>{
50
50
  if (typeof ref === "function") {
51
51
  ref(value);
@@ -54,7 +54,7 @@ function useMergeRefs(refs) {
54
54
  }
55
55
  });
56
56
  };
57
- }, [
57
+ /* v8 ignore stop */ }, [
58
58
  ...refs
59
59
  ]);
60
60
  }
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
@@ -54,11 +54,11 @@ const defaultState = {
54
54
  const ref = useRef(null);
55
55
  const [rect, setRect] = useState(defaultState);
56
56
  const observer = useMemo(()=>{
57
- /* c8 ignore next 3 */ if (typeof ResizeObserver === "undefined") {
57
+ /* v8 ignore start - SSR check for ResizeObserver */ if (typeof ResizeObserver === "undefined") {
58
58
  return null;
59
59
  }
60
- return new ResizeObserver((entries)=>{
61
- const entry = entries[0];
60
+ /* v8 ignore stop */ return new ResizeObserver((entries)=>{
61
+ /* v8 ignore start - resize entry handling */ const entry = entries[0];
62
62
  if (entry) {
63
63
  cancelAnimationFrame(frameID.current);
64
64
  frameID.current = requestAnimationFrame(()=>{
@@ -67,20 +67,20 @@ const defaultState = {
67
67
  }
68
68
  });
69
69
  }
70
- });
70
+ /* v8 ignore stop */ });
71
71
  }, [
72
72
  isMounted
73
73
  ]);
74
74
  useEffect(()=>{
75
- /* c8 ignore next 3 */ if (ref.current) {
75
+ /* v8 ignore start - ref.current check */ if (ref.current) {
76
76
  observer?.observe(ref.current, options);
77
77
  }
78
- return ()=>{
78
+ /* v8 ignore stop */ return ()=>{
79
79
  observer?.disconnect();
80
- /* c8 ignore next 3 */ if (frameID.current) {
80
+ /* v8 ignore start - frameID cleanup */ if (frameID.current) {
81
81
  cancelAnimationFrame(frameID.current);
82
82
  }
83
- };
83
+ /* v8 ignore stop */ };
84
84
  }, [
85
85
  observer,
86
86
  options
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
@@ -29,13 +29,13 @@ function useUniqueId(options) {
29
29
  if (typeof options === "number" || typeof options === "string") {
30
30
  return `${options}${generatedId}`;
31
31
  }
32
- if (typeof options === "object") {
32
+ /* v8 ignore start - object options edge case */ if (typeof options === "object") {
33
33
  const { id, prefix = "" } = options;
34
34
  if (typeof id === "number" || typeof id === "string") {
35
35
  return `${prefix}${id}`;
36
36
  }
37
37
  return `${prefix}${generatedId}`;
38
38
  }
39
- }
39
+ /* v8 ignore stop */ }
40
40
 
41
41
  export { useUniqueId };
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
@@ -1,12 +1,12 @@
1
1
  /*!
2
- @versini/ui-hooks v6.0.0
2
+ @versini/ui-hooks v6.0.1
3
3
  © 2025 gizmette.com
4
4
  */
5
5
  try {
6
6
  if (!window.__VERSINI_UI_HOOKS__) {
7
7
  window.__VERSINI_UI_HOOKS__ = {
8
- version: "6.0.0",
9
- buildTime: "12/16/2025 06:21 PM EST",
8
+ version: "6.0.1",
9
+ buildTime: "12/24/2025 09:19 AM EST",
10
10
  homepage: "https://www.npmjs.com/package/@versini/ui-hooks",
11
11
  license: "MIT",
12
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-hooks",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -88,5 +88,5 @@
88
88
  "test:watch": "vitest",
89
89
  "test": "vitest run"
90
90
  },
91
- "gitHead": "30d86d13d4369cc841fc267c970cca423d27bf2f"
91
+ "gitHead": "7b2640a0650a4c3aa6ca078888f765cb400f9f13"
92
92
  }