react-simplikit 0.0.53 → 0.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.
Files changed (99) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/README.md +2 -2
  3. package/dist/hooks/useAsyncEffect/useAsyncEffect.cjs +1 -0
  4. package/dist/hooks/useAsyncEffect/useAsyncEffect.mjs +1 -0
  5. package/dist/hooks/useCallbackOncePerRender/useCallbackOncePerRender.cjs +1 -0
  6. package/dist/hooks/useCallbackOncePerRender/useCallbackOncePerRender.mjs +1 -0
  7. package/dist/hooks/useConditionalEffect/useConditionalEffect.cjs +1 -0
  8. package/dist/hooks/useConditionalEffect/useConditionalEffect.mjs +1 -0
  9. package/dist/hooks/useInputState/useInputState.cjs +9 -3
  10. package/dist/hooks/useInputState/useInputState.d.cts +11 -4
  11. package/dist/hooks/useInputState/useInputState.d.mts +11 -4
  12. package/dist/hooks/useInputState/useInputState.mjs +9 -3
  13. package/dist/hooks/useLoading/useLoading.cjs +3 -5
  14. package/dist/hooks/useLoading/useLoading.d.cts +2 -5
  15. package/dist/hooks/useLoading/useLoading.d.mts +2 -5
  16. package/dist/hooks/useLoading/useLoading.mjs +3 -5
  17. package/dist/hooks/usePreservedReference/usePreservedReference.cjs +1 -0
  18. package/dist/hooks/usePreservedReference/usePreservedReference.mjs +1 -0
  19. package/dist/hooks/useRefEffect/useRefEffect.cjs +1 -0
  20. package/dist/hooks/useRefEffect/useRefEffect.mjs +1 -0
  21. package/dist/hooks/useStorageState/useStorageState.cjs +1 -0
  22. package/dist/hooks/useStorageState/useStorageState.mjs +1 -0
  23. package/dist/index.cjs +34 -0
  24. package/dist/index.d.cts +19 -1
  25. package/dist/index.d.mts +19 -1
  26. package/dist/index.mjs +18 -1
  27. package/dist/mobile/hooks/useAvoidKeyboard/index.d.cts +3 -0
  28. package/dist/mobile/hooks/useAvoidKeyboard/index.d.mts +3 -0
  29. package/dist/mobile/hooks/useAvoidKeyboard/useAvoidKeyboard.cjs +75 -0
  30. package/dist/mobile/hooks/useAvoidKeyboard/useAvoidKeyboard.d.cts +89 -0
  31. package/dist/mobile/hooks/useAvoidKeyboard/useAvoidKeyboard.d.mts +89 -0
  32. package/dist/mobile/hooks/useAvoidKeyboard/useAvoidKeyboard.mjs +75 -0
  33. package/dist/mobile/hooks/useBodyScrollLock/useBodyScrollLock.cjs +47 -0
  34. package/dist/mobile/hooks/useBodyScrollLock/useBodyScrollLock.d.cts +37 -0
  35. package/dist/mobile/hooks/useBodyScrollLock/useBodyScrollLock.d.mts +37 -0
  36. package/dist/mobile/hooks/useBodyScrollLock/useBodyScrollLock.mjs +47 -0
  37. package/dist/mobile/hooks/useKeyboardHeight/useKeyboardHeight.cjs +41 -0
  38. package/dist/mobile/hooks/useKeyboardHeight/useKeyboardHeight.d.cts +41 -0
  39. package/dist/mobile/hooks/useKeyboardHeight/useKeyboardHeight.d.mts +41 -0
  40. package/dist/mobile/hooks/useKeyboardHeight/useKeyboardHeight.mjs +41 -0
  41. package/dist/mobile/hooks/useNetworkStatus/useNetworkStatus.cjs +88 -0
  42. package/dist/mobile/hooks/useNetworkStatus/useNetworkStatus.d.cts +77 -0
  43. package/dist/mobile/hooks/useNetworkStatus/useNetworkStatus.d.mts +77 -0
  44. package/dist/mobile/hooks/useNetworkStatus/useNetworkStatus.mjs +88 -0
  45. package/dist/mobile/hooks/usePageVisibility/usePageVisibility.cjs +73 -0
  46. package/dist/mobile/hooks/usePageVisibility/usePageVisibility.d.cts +62 -0
  47. package/dist/mobile/hooks/usePageVisibility/usePageVisibility.d.mts +62 -0
  48. package/dist/mobile/hooks/usePageVisibility/usePageVisibility.mjs +73 -0
  49. package/dist/mobile/hooks/useSafeAreaInset/useSafeAreaInset.cjs +74 -0
  50. package/dist/mobile/hooks/useSafeAreaInset/useSafeAreaInset.d.cts +55 -0
  51. package/dist/mobile/hooks/useSafeAreaInset/useSafeAreaInset.d.mts +55 -0
  52. package/dist/mobile/hooks/useSafeAreaInset/useSafeAreaInset.mjs +74 -0
  53. package/dist/mobile/hooks/useScrollDirection/useScrollDirection.cjs +79 -0
  54. package/dist/mobile/hooks/useScrollDirection/useScrollDirection.d.cts +40 -0
  55. package/dist/mobile/hooks/useScrollDirection/useScrollDirection.d.mts +40 -0
  56. package/dist/mobile/hooks/useScrollDirection/useScrollDirection.mjs +79 -0
  57. package/dist/mobile/hooks/useVisualViewport/useVisualViewport.cjs +77 -0
  58. package/dist/mobile/hooks/useVisualViewport/useVisualViewport.d.cts +89 -0
  59. package/dist/mobile/hooks/useVisualViewport/useVisualViewport.d.mts +89 -0
  60. package/dist/mobile/hooks/useVisualViewport/useVisualViewport.mjs +77 -0
  61. package/dist/mobile/utils/disableBodyScrollLock/disableBodyScrollLock.cjs +55 -0
  62. package/dist/mobile/utils/disableBodyScrollLock/disableBodyScrollLock.d.cts +22 -0
  63. package/dist/mobile/utils/disableBodyScrollLock/disableBodyScrollLock.d.mts +22 -0
  64. package/dist/mobile/utils/disableBodyScrollLock/disableBodyScrollLock.mjs +55 -0
  65. package/dist/mobile/utils/enableBodyScrollLock/enableBodyScrollLock.cjs +49 -0
  66. package/dist/mobile/utils/enableBodyScrollLock/enableBodyScrollLock.d.cts +23 -0
  67. package/dist/mobile/utils/enableBodyScrollLock/enableBodyScrollLock.d.mts +23 -0
  68. package/dist/mobile/utils/enableBodyScrollLock/enableBodyScrollLock.mjs +49 -0
  69. package/dist/mobile/utils/getKeyboardHeight/getKeyboardHeight.cjs +35 -0
  70. package/dist/mobile/utils/getKeyboardHeight/getKeyboardHeight.d.cts +28 -0
  71. package/dist/mobile/utils/getKeyboardHeight/getKeyboardHeight.d.mts +28 -0
  72. package/dist/mobile/utils/getKeyboardHeight/getKeyboardHeight.mjs +35 -0
  73. package/dist/mobile/utils/getSafeAreaInset/getSafeAreaInset.cjs +58 -0
  74. package/dist/mobile/utils/getSafeAreaInset/getSafeAreaInset.d.cts +44 -0
  75. package/dist/mobile/utils/getSafeAreaInset/getSafeAreaInset.d.mts +44 -0
  76. package/dist/mobile/utils/getSafeAreaInset/getSafeAreaInset.mjs +58 -0
  77. package/dist/mobile/utils/isAndroid/isAndroid.cjs +32 -0
  78. package/dist/mobile/utils/isAndroid/isAndroid.d.cts +27 -0
  79. package/dist/mobile/utils/isAndroid/isAndroid.d.mts +27 -0
  80. package/dist/mobile/utils/isAndroid/isAndroid.mjs +32 -0
  81. package/dist/mobile/utils/isIOS/isIOS.cjs +37 -0
  82. package/dist/mobile/utils/isIOS/isIOS.d.cts +30 -0
  83. package/dist/mobile/utils/isIOS/isIOS.d.mts +30 -0
  84. package/dist/mobile/utils/isIOS/isIOS.mjs +37 -0
  85. package/dist/mobile/utils/isKeyboardVisible/isKeyboardVisible.cjs +28 -0
  86. package/dist/mobile/utils/isKeyboardVisible/isKeyboardVisible.d.cts +25 -0
  87. package/dist/mobile/utils/isKeyboardVisible/isKeyboardVisible.d.mts +25 -0
  88. package/dist/mobile/utils/isKeyboardVisible/isKeyboardVisible.mjs +28 -0
  89. package/dist/mobile/utils/isServer/isServer.cjs +24 -0
  90. package/dist/mobile/utils/isServer/isServer.d.cts +22 -0
  91. package/dist/mobile/utils/isServer/isServer.d.mts +22 -0
  92. package/dist/mobile/utils/isServer/isServer.mjs +24 -0
  93. package/dist/mobile/utils/subscribeKeyboardHeight/subscribeKeyboardHeight.cjs +71 -0
  94. package/dist/mobile/utils/subscribeKeyboardHeight/subscribeKeyboardHeight.d.cts +64 -0
  95. package/dist/mobile/utils/subscribeKeyboardHeight/subscribeKeyboardHeight.d.mts +64 -0
  96. package/dist/mobile/utils/subscribeKeyboardHeight/subscribeKeyboardHeight.mjs +71 -0
  97. package/dist/utils/buildContext/buildContext.cjs +1 -0
  98. package/dist/utils/buildContext/buildContext.mjs +1 -0
  99. package/package.json +22 -8
@@ -0,0 +1,44 @@
1
+
2
+ //#region src/mobile/utils/getSafeAreaInset/getSafeAreaInset.d.ts
3
+ type SafeAreaInset = {
4
+ /** Top safe area inset in pixels (notch, Dynamic Island, or status bar) */
5
+ top: number;
6
+ /** Bottom safe area inset in pixels (home indicator on Face ID devices) */
7
+ bottom: number;
8
+ /** Left safe area inset in pixels (rounded corners in landscape mode) */
9
+ left: number;
10
+ /** Right safe area inset in pixels (rounded corners in landscape mode) */
11
+ right: number;
12
+ };
13
+ /**
14
+ * @description
15
+ * `getSafeAreaInset` is a utility function that returns all safe area insets in pixels as an object.
16
+ *
17
+ * This function reads the CSS `env(safe-area-inset-*)` values by creating
18
+ * a temporary DOM element and reading its computed style.
19
+ *
20
+ * Safe area insets account for device-specific UI elements:
21
+ * - **top**: Notch, Dynamic Island, or status bar
22
+ * - **bottom**: Home indicator on Face ID devices
23
+ * - **left/right**: Rounded corners in landscape mode
24
+ *
25
+ * Typical values (iPhone with Face ID, portrait mode):
26
+ * - top: 47-59px (notch/Dynamic Island)
27
+ * - bottom: 34px (home indicator)
28
+ * - left/right: 0px
29
+ *
30
+ * @returns {SafeAreaInset} Object containing safe area insets for all four sides, or all 0 if not available.
31
+ * - top `number` - Top safe area inset in pixels;
32
+ * - bottom `number` - Bottom safe area inset in pixels;
33
+ * - left `number` - Left safe area inset in pixels;
34
+ * - right `number` - Right safe area inset in pixels;
35
+ *
36
+ * @example
37
+ * const { top, bottom, left, right } = getSafeAreaInset();
38
+ *
39
+ * header.style.paddingTop = `${top}px`;
40
+ * footer.style.paddingBottom = `${bottom}px`;
41
+ */
42
+ declare function getSafeAreaInset(): SafeAreaInset;
43
+ //#endregion
44
+ export { SafeAreaInset, getSafeAreaInset };
@@ -0,0 +1,44 @@
1
+
2
+ //#region src/mobile/utils/getSafeAreaInset/getSafeAreaInset.d.ts
3
+ type SafeAreaInset = {
4
+ /** Top safe area inset in pixels (notch, Dynamic Island, or status bar) */
5
+ top: number;
6
+ /** Bottom safe area inset in pixels (home indicator on Face ID devices) */
7
+ bottom: number;
8
+ /** Left safe area inset in pixels (rounded corners in landscape mode) */
9
+ left: number;
10
+ /** Right safe area inset in pixels (rounded corners in landscape mode) */
11
+ right: number;
12
+ };
13
+ /**
14
+ * @description
15
+ * `getSafeAreaInset` is a utility function that returns all safe area insets in pixels as an object.
16
+ *
17
+ * This function reads the CSS `env(safe-area-inset-*)` values by creating
18
+ * a temporary DOM element and reading its computed style.
19
+ *
20
+ * Safe area insets account for device-specific UI elements:
21
+ * - **top**: Notch, Dynamic Island, or status bar
22
+ * - **bottom**: Home indicator on Face ID devices
23
+ * - **left/right**: Rounded corners in landscape mode
24
+ *
25
+ * Typical values (iPhone with Face ID, portrait mode):
26
+ * - top: 47-59px (notch/Dynamic Island)
27
+ * - bottom: 34px (home indicator)
28
+ * - left/right: 0px
29
+ *
30
+ * @returns {SafeAreaInset} Object containing safe area insets for all four sides, or all 0 if not available.
31
+ * - top `number` - Top safe area inset in pixels;
32
+ * - bottom `number` - Bottom safe area inset in pixels;
33
+ * - left `number` - Left safe area inset in pixels;
34
+ * - right `number` - Right safe area inset in pixels;
35
+ *
36
+ * @example
37
+ * const { top, bottom, left, right } = getSafeAreaInset();
38
+ *
39
+ * header.style.paddingTop = `${top}px`;
40
+ * footer.style.paddingBottom = `${bottom}px`;
41
+ */
42
+ declare function getSafeAreaInset(): SafeAreaInset;
43
+ //#endregion
44
+ export { SafeAreaInset, getSafeAreaInset };
@@ -0,0 +1,58 @@
1
+ "use client";
2
+ import { isServer } from "../isServer/isServer.mjs";
3
+ //#region src/mobile/utils/getSafeAreaInset/getSafeAreaInset.ts
4
+ /**
5
+ * @description
6
+ * `getSafeAreaInset` is a utility function that returns all safe area insets in pixels as an object.
7
+ *
8
+ * This function reads the CSS `env(safe-area-inset-*)` values by creating
9
+ * a temporary DOM element and reading its computed style.
10
+ *
11
+ * Safe area insets account for device-specific UI elements:
12
+ * - **top**: Notch, Dynamic Island, or status bar
13
+ * - **bottom**: Home indicator on Face ID devices
14
+ * - **left/right**: Rounded corners in landscape mode
15
+ *
16
+ * Typical values (iPhone with Face ID, portrait mode):
17
+ * - top: 47-59px (notch/Dynamic Island)
18
+ * - bottom: 34px (home indicator)
19
+ * - left/right: 0px
20
+ *
21
+ * @returns {SafeAreaInset} Object containing safe area insets for all four sides, or all 0 if not available.
22
+ * - top `number` - Top safe area inset in pixels;
23
+ * - bottom `number` - Bottom safe area inset in pixels;
24
+ * - left `number` - Left safe area inset in pixels;
25
+ * - right `number` - Right safe area inset in pixels;
26
+ *
27
+ * @example
28
+ * const { top, bottom, left, right } = getSafeAreaInset();
29
+ *
30
+ * header.style.paddingTop = `${top}px`;
31
+ * footer.style.paddingBottom = `${bottom}px`;
32
+ */
33
+ function getSafeAreaInset() {
34
+ if (isServer()) return {
35
+ top: 0,
36
+ bottom: 0,
37
+ left: 0,
38
+ right: 0
39
+ };
40
+ const div = document.createElement("div");
41
+ div.style.position = "fixed";
42
+ div.style.setProperty("padding-top", "env(safe-area-inset-top)");
43
+ div.style.setProperty("padding-bottom", "env(safe-area-inset-bottom)");
44
+ div.style.setProperty("padding-left", "env(safe-area-inset-left)");
45
+ div.style.setProperty("padding-right", "env(safe-area-inset-right)");
46
+ document.body.appendChild(div);
47
+ const computedStyle = window.getComputedStyle(div);
48
+ const inset = {
49
+ top: parseFloat(computedStyle.getPropertyValue("padding-top")) || 0,
50
+ bottom: parseFloat(computedStyle.getPropertyValue("padding-bottom")) || 0,
51
+ left: parseFloat(computedStyle.getPropertyValue("padding-left")) || 0,
52
+ right: parseFloat(computedStyle.getPropertyValue("padding-right")) || 0
53
+ };
54
+ document.body.removeChild(div);
55
+ return inset;
56
+ }
57
+ //#endregion
58
+ export { getSafeAreaInset };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ const require_isServer = require("../isServer/isServer.cjs");
3
+ //#region src/mobile/utils/isAndroid/isAndroid.ts
4
+ /**
5
+ * @description
6
+ * `isAndroid` is a utility function that detects whether the current device is running Android.
7
+ *
8
+ * Notes:
9
+ * - All Android browsers include the token "Android" in the user agent.
10
+ *
11
+ * @param {string} [userAgent] - Optional user agent string to check. Defaults to `navigator.userAgent`.
12
+ *
13
+ * @returns {boolean} `true` if the device is running Android, `false` otherwise.
14
+ * Returns `false` on server-side rendering environments.
15
+ *
16
+ * @example
17
+ * if (isAndroid()) {
18
+ * // Android-specific code
19
+ * enableAndroidOptimizations();
20
+ * }
21
+ *
22
+ * @example
23
+ * // With custom user agent
24
+ * const isAndroidDevice = isAndroid('Mozilla/5.0 (Linux; Android 12; Pixel 6) Chrome/120');
25
+ */
26
+ function isAndroid(userAgent) {
27
+ if (require_isServer.isServer()) return false;
28
+ const ua = userAgent ?? navigator.userAgent;
29
+ return /Android/i.test(ua);
30
+ }
31
+ //#endregion
32
+ exports.isAndroid = isAndroid;
@@ -0,0 +1,27 @@
1
+
2
+ //#region src/mobile/utils/isAndroid/isAndroid.d.ts
3
+ /**
4
+ * @description
5
+ * `isAndroid` is a utility function that detects whether the current device is running Android.
6
+ *
7
+ * Notes:
8
+ * - All Android browsers include the token "Android" in the user agent.
9
+ *
10
+ * @param {string} [userAgent] - Optional user agent string to check. Defaults to `navigator.userAgent`.
11
+ *
12
+ * @returns {boolean} `true` if the device is running Android, `false` otherwise.
13
+ * Returns `false` on server-side rendering environments.
14
+ *
15
+ * @example
16
+ * if (isAndroid()) {
17
+ * // Android-specific code
18
+ * enableAndroidOptimizations();
19
+ * }
20
+ *
21
+ * @example
22
+ * // With custom user agent
23
+ * const isAndroidDevice = isAndroid('Mozilla/5.0 (Linux; Android 12; Pixel 6) Chrome/120');
24
+ */
25
+ declare function isAndroid(userAgent?: string): boolean;
26
+ //#endregion
27
+ export { isAndroid };
@@ -0,0 +1,27 @@
1
+
2
+ //#region src/mobile/utils/isAndroid/isAndroid.d.ts
3
+ /**
4
+ * @description
5
+ * `isAndroid` is a utility function that detects whether the current device is running Android.
6
+ *
7
+ * Notes:
8
+ * - All Android browsers include the token "Android" in the user agent.
9
+ *
10
+ * @param {string} [userAgent] - Optional user agent string to check. Defaults to `navigator.userAgent`.
11
+ *
12
+ * @returns {boolean} `true` if the device is running Android, `false` otherwise.
13
+ * Returns `false` on server-side rendering environments.
14
+ *
15
+ * @example
16
+ * if (isAndroid()) {
17
+ * // Android-specific code
18
+ * enableAndroidOptimizations();
19
+ * }
20
+ *
21
+ * @example
22
+ * // With custom user agent
23
+ * const isAndroidDevice = isAndroid('Mozilla/5.0 (Linux; Android 12; Pixel 6) Chrome/120');
24
+ */
25
+ declare function isAndroid(userAgent?: string): boolean;
26
+ //#endregion
27
+ export { isAndroid };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { isServer } from "../isServer/isServer.mjs";
3
+ //#region src/mobile/utils/isAndroid/isAndroid.ts
4
+ /**
5
+ * @description
6
+ * `isAndroid` is a utility function that detects whether the current device is running Android.
7
+ *
8
+ * Notes:
9
+ * - All Android browsers include the token "Android" in the user agent.
10
+ *
11
+ * @param {string} [userAgent] - Optional user agent string to check. Defaults to `navigator.userAgent`.
12
+ *
13
+ * @returns {boolean} `true` if the device is running Android, `false` otherwise.
14
+ * Returns `false` on server-side rendering environments.
15
+ *
16
+ * @example
17
+ * if (isAndroid()) {
18
+ * // Android-specific code
19
+ * enableAndroidOptimizations();
20
+ * }
21
+ *
22
+ * @example
23
+ * // With custom user agent
24
+ * const isAndroidDevice = isAndroid('Mozilla/5.0 (Linux; Android 12; Pixel 6) Chrome/120');
25
+ */
26
+ function isAndroid(userAgent) {
27
+ if (isServer()) return false;
28
+ const ua = userAgent ?? navigator.userAgent;
29
+ return /Android/i.test(ua);
30
+ }
31
+ //#endregion
32
+ export { isAndroid };
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ const require_isServer = require("../isServer/isServer.cjs");
3
+ //#region src/mobile/utils/isIOS/isIOS.ts
4
+ /**
5
+ * @description
6
+ * `isIOS` is a utility function that detects whether the current device is running iOS or iPadOS.
7
+ *
8
+ * Notes on platform inconsistencies:
9
+ * - Prior to iPadOS 13, iPads reported their platform as "iPad" (or matched /iPad/ in UA).
10
+ * - Starting from iPadOS 13, Apple changed the platform string to "MacIntel"
11
+ * to make websites treat iPadOS as desktop-class Safari.
12
+ * However, these devices still expose multi-touch capabilities.
13
+ *
14
+ * @param {string} [userAgent] - Optional user agent string to check. Defaults to `navigator.userAgent`.
15
+ *
16
+ * @returns {boolean} `true` if the device is running iOS or iPadOS, `false` otherwise.
17
+ * Returns `false` on server-side rendering environments.
18
+ *
19
+ * @example
20
+ * if (isIOS()) {
21
+ * // iOS-specific code
22
+ * enableIOSOptimizations();
23
+ * }
24
+ *
25
+ * @example
26
+ * // With custom user agent
27
+ * const isIOSDevice = isIOS('Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X)');
28
+ */
29
+ function isIOS(userAgent) {
30
+ if (require_isServer.isServer()) return false;
31
+ const ua = userAgent ?? navigator.userAgent;
32
+ const platform = navigator.platform;
33
+ const maxTouchPoints = navigator.maxTouchPoints;
34
+ return /iPhone|iPad|iPod/i.test(ua) || platform === "MacIntel" && typeof maxTouchPoints === "number" && maxTouchPoints > 1;
35
+ }
36
+ //#endregion
37
+ exports.isIOS = isIOS;
@@ -0,0 +1,30 @@
1
+
2
+ //#region src/mobile/utils/isIOS/isIOS.d.ts
3
+ /**
4
+ * @description
5
+ * `isIOS` is a utility function that detects whether the current device is running iOS or iPadOS.
6
+ *
7
+ * Notes on platform inconsistencies:
8
+ * - Prior to iPadOS 13, iPads reported their platform as "iPad" (or matched /iPad/ in UA).
9
+ * - Starting from iPadOS 13, Apple changed the platform string to "MacIntel"
10
+ * to make websites treat iPadOS as desktop-class Safari.
11
+ * However, these devices still expose multi-touch capabilities.
12
+ *
13
+ * @param {string} [userAgent] - Optional user agent string to check. Defaults to `navigator.userAgent`.
14
+ *
15
+ * @returns {boolean} `true` if the device is running iOS or iPadOS, `false` otherwise.
16
+ * Returns `false` on server-side rendering environments.
17
+ *
18
+ * @example
19
+ * if (isIOS()) {
20
+ * // iOS-specific code
21
+ * enableIOSOptimizations();
22
+ * }
23
+ *
24
+ * @example
25
+ * // With custom user agent
26
+ * const isIOSDevice = isIOS('Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X)');
27
+ */
28
+ declare function isIOS(userAgent?: string): boolean;
29
+ //#endregion
30
+ export { isIOS };
@@ -0,0 +1,30 @@
1
+
2
+ //#region src/mobile/utils/isIOS/isIOS.d.ts
3
+ /**
4
+ * @description
5
+ * `isIOS` is a utility function that detects whether the current device is running iOS or iPadOS.
6
+ *
7
+ * Notes on platform inconsistencies:
8
+ * - Prior to iPadOS 13, iPads reported their platform as "iPad" (or matched /iPad/ in UA).
9
+ * - Starting from iPadOS 13, Apple changed the platform string to "MacIntel"
10
+ * to make websites treat iPadOS as desktop-class Safari.
11
+ * However, these devices still expose multi-touch capabilities.
12
+ *
13
+ * @param {string} [userAgent] - Optional user agent string to check. Defaults to `navigator.userAgent`.
14
+ *
15
+ * @returns {boolean} `true` if the device is running iOS or iPadOS, `false` otherwise.
16
+ * Returns `false` on server-side rendering environments.
17
+ *
18
+ * @example
19
+ * if (isIOS()) {
20
+ * // iOS-specific code
21
+ * enableIOSOptimizations();
22
+ * }
23
+ *
24
+ * @example
25
+ * // With custom user agent
26
+ * const isIOSDevice = isIOS('Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X)');
27
+ */
28
+ declare function isIOS(userAgent?: string): boolean;
29
+ //#endregion
30
+ export { isIOS };
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import { isServer } from "../isServer/isServer.mjs";
3
+ //#region src/mobile/utils/isIOS/isIOS.ts
4
+ /**
5
+ * @description
6
+ * `isIOS` is a utility function that detects whether the current device is running iOS or iPadOS.
7
+ *
8
+ * Notes on platform inconsistencies:
9
+ * - Prior to iPadOS 13, iPads reported their platform as "iPad" (or matched /iPad/ in UA).
10
+ * - Starting from iPadOS 13, Apple changed the platform string to "MacIntel"
11
+ * to make websites treat iPadOS as desktop-class Safari.
12
+ * However, these devices still expose multi-touch capabilities.
13
+ *
14
+ * @param {string} [userAgent] - Optional user agent string to check. Defaults to `navigator.userAgent`.
15
+ *
16
+ * @returns {boolean} `true` if the device is running iOS or iPadOS, `false` otherwise.
17
+ * Returns `false` on server-side rendering environments.
18
+ *
19
+ * @example
20
+ * if (isIOS()) {
21
+ * // iOS-specific code
22
+ * enableIOSOptimizations();
23
+ * }
24
+ *
25
+ * @example
26
+ * // With custom user agent
27
+ * const isIOSDevice = isIOS('Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X)');
28
+ */
29
+ function isIOS(userAgent) {
30
+ if (isServer()) return false;
31
+ const ua = userAgent ?? navigator.userAgent;
32
+ const platform = navigator.platform;
33
+ const maxTouchPoints = navigator.maxTouchPoints;
34
+ return /iPhone|iPad|iPod/i.test(ua) || platform === "MacIntel" && typeof maxTouchPoints === "number" && maxTouchPoints > 1;
35
+ }
36
+ //#endregion
37
+ export { isIOS };
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ const require_getKeyboardHeight = require("../getKeyboardHeight/getKeyboardHeight.cjs");
3
+ //#region src/mobile/utils/isKeyboardVisible/isKeyboardVisible.ts
4
+ /**
5
+ * @description
6
+ * `isKeyboardVisible` is a utility function that checks whether the on-screen keyboard is currently visible.
7
+ *
8
+ * This function uses `getKeyboardHeight()` internally and returns `true`
9
+ * if the keyboard height is greater than 0.
10
+ *
11
+ * @returns {boolean} `true` if the keyboard is visible, `false` otherwise.
12
+ *
13
+ * @example
14
+ * if (isKeyboardVisible()) {
15
+ * console.log('Keyboard is open');
16
+ * } else {
17
+ * console.log('Keyboard is closed');
18
+ * }
19
+ *
20
+ * @example
21
+ * // Conditionally show/hide elements based on keyboard visibility
22
+ * const showFloatingButton = !isKeyboardVisible();
23
+ */
24
+ function isKeyboardVisible() {
25
+ return require_getKeyboardHeight.getKeyboardHeight() > 0;
26
+ }
27
+ //#endregion
28
+ exports.isKeyboardVisible = isKeyboardVisible;
@@ -0,0 +1,25 @@
1
+
2
+ //#region src/mobile/utils/isKeyboardVisible/isKeyboardVisible.d.ts
3
+ /**
4
+ * @description
5
+ * `isKeyboardVisible` is a utility function that checks whether the on-screen keyboard is currently visible.
6
+ *
7
+ * This function uses `getKeyboardHeight()` internally and returns `true`
8
+ * if the keyboard height is greater than 0.
9
+ *
10
+ * @returns {boolean} `true` if the keyboard is visible, `false` otherwise.
11
+ *
12
+ * @example
13
+ * if (isKeyboardVisible()) {
14
+ * console.log('Keyboard is open');
15
+ * } else {
16
+ * console.log('Keyboard is closed');
17
+ * }
18
+ *
19
+ * @example
20
+ * // Conditionally show/hide elements based on keyboard visibility
21
+ * const showFloatingButton = !isKeyboardVisible();
22
+ */
23
+ declare function isKeyboardVisible(): boolean;
24
+ //#endregion
25
+ export { isKeyboardVisible };
@@ -0,0 +1,25 @@
1
+
2
+ //#region src/mobile/utils/isKeyboardVisible/isKeyboardVisible.d.ts
3
+ /**
4
+ * @description
5
+ * `isKeyboardVisible` is a utility function that checks whether the on-screen keyboard is currently visible.
6
+ *
7
+ * This function uses `getKeyboardHeight()` internally and returns `true`
8
+ * if the keyboard height is greater than 0.
9
+ *
10
+ * @returns {boolean} `true` if the keyboard is visible, `false` otherwise.
11
+ *
12
+ * @example
13
+ * if (isKeyboardVisible()) {
14
+ * console.log('Keyboard is open');
15
+ * } else {
16
+ * console.log('Keyboard is closed');
17
+ * }
18
+ *
19
+ * @example
20
+ * // Conditionally show/hide elements based on keyboard visibility
21
+ * const showFloatingButton = !isKeyboardVisible();
22
+ */
23
+ declare function isKeyboardVisible(): boolean;
24
+ //#endregion
25
+ export { isKeyboardVisible };
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { getKeyboardHeight } from "../getKeyboardHeight/getKeyboardHeight.mjs";
3
+ //#region src/mobile/utils/isKeyboardVisible/isKeyboardVisible.ts
4
+ /**
5
+ * @description
6
+ * `isKeyboardVisible` is a utility function that checks whether the on-screen keyboard is currently visible.
7
+ *
8
+ * This function uses `getKeyboardHeight()` internally and returns `true`
9
+ * if the keyboard height is greater than 0.
10
+ *
11
+ * @returns {boolean} `true` if the keyboard is visible, `false` otherwise.
12
+ *
13
+ * @example
14
+ * if (isKeyboardVisible()) {
15
+ * console.log('Keyboard is open');
16
+ * } else {
17
+ * console.log('Keyboard is closed');
18
+ * }
19
+ *
20
+ * @example
21
+ * // Conditionally show/hide elements based on keyboard visibility
22
+ * const showFloatingButton = !isKeyboardVisible();
23
+ */
24
+ function isKeyboardVisible() {
25
+ return getKeyboardHeight() > 0;
26
+ }
27
+ //#endregion
28
+ export { isKeyboardVisible };
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ //#region src/mobile/utils/isServer/isServer.ts
3
+ /**
4
+ * @description
5
+ * `isServer` is a utility function that checks if the code is running on the server.
6
+ * It returns `true` in SSR (Server-Side Rendering) environments where `window` is undefined,
7
+ * and `false` in client-side environments.
8
+ *
9
+ * @returns {boolean} `true` if running in a server environment (SSR), `false` otherwise.
10
+ *
11
+ * @example
12
+ * if (isServer()) {
13
+ * // SSR-safe code
14
+ * return null;
15
+ * }
16
+ *
17
+ * // Client-only code
18
+ * window.addEventListener('resize', handleResize);
19
+ */
20
+ function isServer() {
21
+ return typeof window === "undefined";
22
+ }
23
+ //#endregion
24
+ exports.isServer = isServer;
@@ -0,0 +1,22 @@
1
+
2
+ //#region src/mobile/utils/isServer/isServer.d.ts
3
+ /**
4
+ * @description
5
+ * `isServer` is a utility function that checks if the code is running on the server.
6
+ * It returns `true` in SSR (Server-Side Rendering) environments where `window` is undefined,
7
+ * and `false` in client-side environments.
8
+ *
9
+ * @returns {boolean} `true` if running in a server environment (SSR), `false` otherwise.
10
+ *
11
+ * @example
12
+ * if (isServer()) {
13
+ * // SSR-safe code
14
+ * return null;
15
+ * }
16
+ *
17
+ * // Client-only code
18
+ * window.addEventListener('resize', handleResize);
19
+ */
20
+ declare function isServer(): boolean;
21
+ //#endregion
22
+ export { isServer };
@@ -0,0 +1,22 @@
1
+
2
+ //#region src/mobile/utils/isServer/isServer.d.ts
3
+ /**
4
+ * @description
5
+ * `isServer` is a utility function that checks if the code is running on the server.
6
+ * It returns `true` in SSR (Server-Side Rendering) environments where `window` is undefined,
7
+ * and `false` in client-side environments.
8
+ *
9
+ * @returns {boolean} `true` if running in a server environment (SSR), `false` otherwise.
10
+ *
11
+ * @example
12
+ * if (isServer()) {
13
+ * // SSR-safe code
14
+ * return null;
15
+ * }
16
+ *
17
+ * // Client-only code
18
+ * window.addEventListener('resize', handleResize);
19
+ */
20
+ declare function isServer(): boolean;
21
+ //#endregion
22
+ export { isServer };
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ //#region src/mobile/utils/isServer/isServer.ts
3
+ /**
4
+ * @description
5
+ * `isServer` is a utility function that checks if the code is running on the server.
6
+ * It returns `true` in SSR (Server-Side Rendering) environments where `window` is undefined,
7
+ * and `false` in client-side environments.
8
+ *
9
+ * @returns {boolean} `true` if running in a server environment (SSR), `false` otherwise.
10
+ *
11
+ * @example
12
+ * if (isServer()) {
13
+ * // SSR-safe code
14
+ * return null;
15
+ * }
16
+ *
17
+ * // Client-only code
18
+ * window.addEventListener('resize', handleResize);
19
+ */
20
+ function isServer() {
21
+ return typeof window === "undefined";
22
+ }
23
+ //#endregion
24
+ export { isServer };