react-simplikit 0.0.51 → 0.0.52
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/components/ImpressionArea/ImpressionArea.cjs +57 -0
- package/{esm/components/ImpressionArea/index.d.ts → dist/components/ImpressionArea/ImpressionArea.d.cts} +9 -8
- package/dist/components/ImpressionArea/ImpressionArea.d.mts +48 -0
- package/dist/components/ImpressionArea/ImpressionArea.mjs +57 -0
- package/dist/components/ImpressionArea/index.d.cts +2 -46
- package/dist/components/ImpressionArea/index.d.mts +3 -0
- package/dist/components/Separated/Separated.cjs +38 -0
- package/{esm/components/Separated/index.d.ts → dist/components/Separated/Separated.d.cts} +7 -7
- package/dist/components/Separated/Separated.d.mts +38 -0
- package/dist/components/Separated/Separated.mjs +38 -0
- package/dist/components/Separated/index.d.cts +2 -37
- package/dist/components/Separated/index.d.mts +3 -0
- package/dist/components/SwitchCase/SwitchCase.cjs +40 -0
- package/{esm/components/SwitchCase/index.d.ts → dist/components/SwitchCase/SwitchCase.d.cts} +7 -8
- package/dist/components/SwitchCase/SwitchCase.d.mts +45 -0
- package/dist/components/SwitchCase/SwitchCase.mjs +40 -0
- package/dist/components/SwitchCase/index.d.cts +2 -45
- package/dist/components/SwitchCase/index.d.mts +3 -0
- package/dist/hooks/useAsyncEffect/index.d.cts +2 -24
- package/dist/hooks/useAsyncEffect/index.d.mts +3 -0
- package/dist/hooks/useAsyncEffect/useAsyncEffect.cjs +39 -0
- package/{esm/hooks/useAsyncEffect/index.d.ts → dist/hooks/useAsyncEffect/useAsyncEffect.d.cts} +4 -3
- package/dist/hooks/useAsyncEffect/useAsyncEffect.d.mts +26 -0
- package/dist/hooks/useAsyncEffect/useAsyncEffect.mjs +39 -0
- package/dist/hooks/useBooleanState/useBooleanState.cjs +36 -0
- package/dist/hooks/useBooleanState/{index.d.cts → useBooleanState.d.cts} +4 -2
- package/{esm/hooks/useBooleanState/index.d.ts → dist/hooks/useBooleanState/useBooleanState.d.mts} +4 -2
- package/dist/hooks/useBooleanState/useBooleanState.mjs +36 -0
- package/dist/hooks/useCallbackOncePerRender/index.d.cts +2 -39
- package/dist/hooks/useCallbackOncePerRender/index.d.mts +3 -0
- package/dist/hooks/useCallbackOncePerRender/useCallbackOncePerRender.cjs +52 -0
- package/{esm/hooks/useCallbackOncePerRender/index.d.ts → dist/hooks/useCallbackOncePerRender/useCallbackOncePerRender.d.cts} +4 -3
- package/dist/hooks/useCallbackOncePerRender/useCallbackOncePerRender.d.mts +41 -0
- package/dist/hooks/useCallbackOncePerRender/useCallbackOncePerRender.mjs +52 -0
- package/dist/hooks/useConditionalEffect/index.d.cts +2 -42
- package/dist/hooks/useConditionalEffect/index.d.mts +3 -0
- package/dist/hooks/useConditionalEffect/useConditionalEffect.cjs +57 -0
- package/{esm/hooks/useConditionalEffect/index.d.ts → dist/hooks/useConditionalEffect/useConditionalEffect.d.cts} +4 -3
- package/dist/hooks/useConditionalEffect/useConditionalEffect.d.mts +44 -0
- package/dist/hooks/useConditionalEffect/useConditionalEffect.mjs +57 -0
- package/dist/hooks/useControlledState/index.d.cts +2 -50
- package/dist/hooks/useControlledState/index.d.mts +3 -0
- package/dist/hooks/useControlledState/useControlledState.cjs +60 -0
- package/{esm/hooks/useControlledState/index.d.ts → dist/hooks/useControlledState/useControlledState.d.cts} +11 -10
- package/dist/hooks/useControlledState/useControlledState.d.mts +52 -0
- package/dist/hooks/useControlledState/useControlledState.mjs +60 -0
- package/dist/hooks/useCounter/useCounter.cjs +75 -0
- package/{esm/hooks/useCounter/index.d.ts → dist/hooks/useCounter/useCounter.d.cts} +12 -10
- package/dist/hooks/useCounter/{index.d.cts → useCounter.d.mts} +12 -10
- package/dist/hooks/useCounter/useCounter.mjs +75 -0
- package/dist/hooks/useDebounce/debounce.cjs +49 -0
- package/dist/hooks/useDebounce/debounce.d.cts +8 -0
- package/dist/hooks/useDebounce/debounce.d.mts +8 -0
- package/dist/hooks/useDebounce/debounce.mjs +49 -0
- package/dist/hooks/useDebounce/useDebounce.cjs +66 -0
- package/{esm/hooks/useDebounce/index.d.ts → dist/hooks/useDebounce/useDebounce.d.cts} +6 -8
- package/dist/hooks/useDebounce/{index.d.cts → useDebounce.d.mts} +6 -8
- package/dist/hooks/useDebounce/useDebounce.mjs +66 -0
- package/dist/hooks/useDebouncedCallback/useDebouncedCallback.cjs +62 -0
- package/{esm/hooks/useDebouncedCallback/index.d.ts → dist/hooks/useDebouncedCallback/useDebouncedCallback.d.cts} +9 -7
- package/dist/hooks/useDebouncedCallback/{index.d.cts → useDebouncedCallback.d.mts} +9 -7
- package/dist/hooks/useDebouncedCallback/useDebouncedCallback.mjs +62 -0
- package/dist/hooks/useDoubleClick/index.d.cts +2 -45
- package/dist/hooks/useDoubleClick/index.d.mts +3 -0
- package/dist/hooks/useDoubleClick/useDoubleClick.cjs +64 -0
- package/{esm/hooks/useDoubleClick/index.d.ts → dist/hooks/useDoubleClick/useDoubleClick.d.cts} +8 -7
- package/dist/hooks/useDoubleClick/useDoubleClick.d.mts +47 -0
- package/dist/hooks/useDoubleClick/useDoubleClick.mjs +64 -0
- package/dist/hooks/useGeolocation/useGeolocation.cjs +210 -0
- package/{esm/hooks/useGeolocation/index.d.ts → dist/hooks/useGeolocation/useGeolocation.d.cts} +26 -24
- package/dist/hooks/useGeolocation/{index.d.cts → useGeolocation.d.mts} +26 -24
- package/dist/hooks/useGeolocation/useGeolocation.mjs +209 -0
- package/dist/hooks/useImpressionRef/useImpressionRef.cjs +67 -0
- package/{esm/hooks/useImpressionRef/index.d.ts → dist/hooks/useImpressionRef/useImpressionRef.d.cts} +10 -8
- package/dist/hooks/useImpressionRef/{index.d.cts → useImpressionRef.d.mts} +10 -8
- package/dist/hooks/useImpressionRef/useImpressionRef.mjs +67 -0
- package/dist/hooks/useInputState/index.d.cts +2 -22
- package/dist/hooks/useInputState/index.d.mts +3 -0
- package/dist/hooks/useInputState/useInputState.cjs +32 -0
- package/{esm/hooks/useInputState/index.d.ts → dist/hooks/useInputState/useInputState.d.cts} +4 -3
- package/dist/hooks/useInputState/useInputState.d.mts +24 -0
- package/dist/hooks/useInputState/useInputState.mjs +32 -0
- package/dist/hooks/useIntersectionObserver/useIntersectionObserver.cjs +58 -0
- package/dist/hooks/useIntersectionObserver/{index.d.cts → useIntersectionObserver.d.cts} +4 -2
- package/{esm/hooks/useIntersectionObserver/index.d.ts → dist/hooks/useIntersectionObserver/useIntersectionObserver.d.mts} +4 -2
- package/dist/hooks/useIntersectionObserver/useIntersectionObserver.mjs +58 -0
- package/dist/hooks/useInterval/useInterval.cjs +65 -0
- package/dist/hooks/useInterval/{index.d.cts → useInterval.d.cts} +7 -5
- package/{esm/hooks/useInterval/index.d.ts → dist/hooks/useInterval/useInterval.d.mts} +7 -5
- package/dist/hooks/useInterval/useInterval.mjs +65 -0
- package/dist/hooks/useIsClient/useIsClient.cjs +49 -0
- package/dist/hooks/useIsClient/{index.d.cts → useIsClient.d.cts} +4 -2
- package/{esm/hooks/useIsClient/index.d.ts → dist/hooks/useIsClient/useIsClient.d.mts} +4 -2
- package/dist/hooks/useIsClient/useIsClient.mjs +49 -0
- package/dist/hooks/useIsomorphicLayoutEffect/index.d.cts +2 -24
- package/dist/hooks/useIsomorphicLayoutEffect/index.d.mts +3 -0
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs +25 -0
- package/{esm/hooks/useIsomorphicLayoutEffect/index.d.ts → dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.cts} +4 -3
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.mts +26 -0
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs +25 -0
- package/dist/hooks/useList/useList.cjs +94 -0
- package/{esm/hooks/useList/index.d.ts → dist/hooks/useList/useList.d.cts} +10 -8
- package/dist/hooks/useList/{index.d.cts → useList.d.mts} +10 -8
- package/dist/hooks/useList/useList.mjs +94 -0
- package/dist/hooks/useLoading/useLoading.cjs +61 -0
- package/dist/hooks/useLoading/{index.d.cts → useLoading.d.cts} +4 -2
- package/{esm/hooks/useLoading/index.d.ts → dist/hooks/useLoading/useLoading.d.mts} +4 -2
- package/dist/hooks/useLoading/useLoading.mjs +61 -0
- package/dist/hooks/useLongPress/index.d.cts +2 -73
- package/dist/hooks/useLongPress/index.d.mts +3 -0
- package/dist/hooks/useLongPress/useLongPress.cjs +133 -0
- package/{esm/hooks/useLongPress/index.d.ts → dist/hooks/useLongPress/useLongPress.d.cts} +18 -17
- package/dist/hooks/useLongPress/useLongPress.d.mts +75 -0
- package/dist/hooks/useLongPress/useLongPress.mjs +133 -0
- package/dist/hooks/useMap/useMap.cjs +64 -0
- package/dist/hooks/useMap/{index.d.cts → useMap.d.cts} +12 -10
- package/{esm/hooks/useMap/index.d.ts → dist/hooks/useMap/useMap.d.mts} +12 -10
- package/dist/hooks/useMap/useMap.mjs +64 -0
- package/dist/hooks/useOutsideClickEffect/useOutsideClickEffect.cjs +51 -0
- package/dist/hooks/useOutsideClickEffect/{index.d.cts → useOutsideClickEffect.d.cts} +4 -2
- package/{esm/hooks/useOutsideClickEffect/index.d.ts → dist/hooks/useOutsideClickEffect/useOutsideClickEffect.d.mts} +4 -2
- package/dist/hooks/useOutsideClickEffect/useOutsideClickEffect.mjs +51 -0
- package/dist/hooks/usePreservedCallback/usePreservedCallback.cjs +41 -0
- package/dist/hooks/usePreservedCallback/{index.d.cts → usePreservedCallback.d.cts} +4 -2
- package/{esm/hooks/usePreservedCallback/index.d.ts → dist/hooks/usePreservedCallback/usePreservedCallback.d.mts} +4 -2
- package/dist/hooks/usePreservedCallback/usePreservedCallback.mjs +41 -0
- package/dist/hooks/usePreservedReference/usePreservedReference.cjs +55 -0
- package/dist/hooks/usePreservedReference/{index.d.cts → usePreservedReference.d.cts} +4 -2
- package/{esm/hooks/usePreservedReference/index.d.ts → dist/hooks/usePreservedReference/usePreservedReference.d.mts} +4 -2
- package/dist/hooks/usePreservedReference/usePreservedReference.mjs +55 -0
- package/dist/hooks/usePrevious/usePrevious.cjs +38 -0
- package/{esm/hooks/usePrevious/index.d.ts → dist/hooks/usePrevious/usePrevious.d.cts} +4 -2
- package/dist/hooks/usePrevious/{index.d.cts → usePrevious.d.mts} +4 -2
- package/dist/hooks/usePrevious/usePrevious.mjs +38 -0
- package/dist/hooks/useRefEffect/index.d.cts +2 -30
- package/dist/hooks/useRefEffect/index.d.mts +3 -0
- package/dist/hooks/useRefEffect/useRefEffect.cjs +42 -0
- package/{esm/hooks/useRefEffect/index.d.ts → dist/hooks/useRefEffect/useRefEffect.d.cts} +4 -3
- package/dist/hooks/useRefEffect/useRefEffect.d.mts +32 -0
- package/dist/hooks/useRefEffect/useRefEffect.mjs +42 -0
- package/dist/hooks/useSet/useSet.cjs +79 -0
- package/dist/hooks/useSet/{index.d.cts → useSet.d.cts} +9 -7
- package/{esm/hooks/useSet/index.d.ts → dist/hooks/useSet/useSet.d.mts} +9 -7
- package/dist/hooks/useSet/useSet.mjs +79 -0
- package/dist/hooks/useStorageState/index.d.cts +2 -60
- package/dist/hooks/useStorageState/index.d.mts +3 -0
- package/dist/hooks/useStorageState/storage.cjs +85 -0
- package/dist/hooks/useStorageState/storage.d.cts +10 -0
- package/dist/hooks/useStorageState/storage.d.mts +10 -0
- package/dist/hooks/useStorageState/storage.mjs +80 -0
- package/dist/hooks/useStorageState/useStorageState.cjs +81 -0
- package/{esm/hooks/useStorageState/index.d.ts → dist/hooks/useStorageState/useStorageState.d.cts} +10 -15
- package/dist/hooks/useStorageState/useStorageState.d.mts +56 -0
- package/dist/hooks/useStorageState/useStorageState.mjs +81 -0
- package/dist/hooks/useThrottle/throttle.cjs +19 -0
- package/dist/hooks/useThrottle/throttle.d.cts +19 -0
- package/dist/hooks/useThrottle/throttle.d.mts +19 -0
- package/dist/hooks/useThrottle/throttle.mjs +19 -0
- package/dist/hooks/useThrottle/useThrottle.cjs +49 -0
- package/dist/hooks/useThrottle/{index.d.cts → useThrottle.d.cts} +6 -19
- package/{esm/hooks/useThrottle/index.d.ts → dist/hooks/useThrottle/useThrottle.d.mts} +6 -19
- package/dist/hooks/useThrottle/useThrottle.mjs +49 -0
- package/dist/hooks/useThrottledCallback/useThrottledCallback.cjs +57 -0
- package/{esm/hooks/useThrottledCallback/index.d.ts → dist/hooks/useThrottledCallback/useThrottledCallback.d.cts} +8 -6
- package/dist/hooks/useThrottledCallback/{index.d.cts → useThrottledCallback.d.mts} +8 -6
- package/dist/hooks/useThrottledCallback/useThrottledCallback.mjs +57 -0
- package/dist/hooks/useTimeout/useTimeout.cjs +40 -0
- package/dist/hooks/useTimeout/{index.d.cts → useTimeout.d.cts} +4 -2
- package/{esm/hooks/useTimeout/index.d.ts → dist/hooks/useTimeout/useTimeout.d.mts} +4 -2
- package/dist/hooks/useTimeout/useTimeout.mjs +40 -0
- package/dist/hooks/useToggle/useToggle.cjs +34 -0
- package/dist/hooks/useToggle/{index.d.cts → useToggle.d.cts} +4 -4
- package/{esm/hooks/useToggle/index.d.ts → dist/hooks/useToggle/useToggle.d.mts} +4 -4
- package/dist/hooks/useToggle/useToggle.mjs +34 -0
- package/dist/hooks/useVisibilityEvent/useVisibilityEvent.cjs +42 -0
- package/{esm/hooks/useVisibilityEvent/index.d.ts → dist/hooks/useVisibilityEvent/useVisibilityEvent.d.cts} +5 -3
- package/dist/hooks/useVisibilityEvent/{index.d.cts → useVisibilityEvent.d.mts} +5 -3
- package/dist/hooks/useVisibilityEvent/useVisibilityEvent.mjs +42 -0
- package/dist/index.cjs +77 -1397
- package/dist/index.d.cts +56 -40
- package/dist/index.d.mts +56 -0
- package/dist/index.mjs +40 -0
- package/dist/utils/buildContext/buildContext.cjs +50 -0
- package/{esm/utils/buildContext/index.d.ts → dist/utils/buildContext/buildContext.d.cts} +7 -7
- package/dist/utils/buildContext/buildContext.d.mts +38 -0
- package/dist/utils/buildContext/buildContext.mjs +50 -0
- package/dist/utils/buildContext/index.d.cts +2 -37
- package/dist/utils/buildContext/index.d.mts +3 -0
- package/dist/utils/mergeProps/index.d.cts +2 -25
- package/dist/utils/mergeProps/index.d.mts +3 -0
- package/dist/utils/mergeProps/mergeProps.cjs +53 -0
- package/{esm/utils/mergeProps/index.d.ts → dist/utils/mergeProps/mergeProps.d.cts} +7 -8
- package/dist/utils/mergeProps/mergeProps.d.mts +25 -0
- package/dist/utils/mergeProps/mergeProps.mjs +53 -0
- package/dist/utils/mergeRefs/index.d.cts +2 -38
- package/dist/utils/mergeRefs/index.d.mts +3 -0
- package/dist/utils/mergeRefs/mergeRefs.cjs +50 -0
- package/{esm/utils/mergeRefs/index.d.ts → dist/utils/mergeRefs/mergeRefs.d.cts} +4 -3
- package/dist/utils/mergeRefs/mergeRefs.d.mts +40 -0
- package/dist/utils/mergeRefs/mergeRefs.mjs +50 -0
- package/package.json +9 -11
- package/dist/components/ImpressionArea/index.cjs +0 -295
- package/dist/components/Separated/index.cjs +0 -41
- package/dist/components/SwitchCase/index.cjs +0 -36
- package/dist/hooks/useAsyncEffect/index.cjs +0 -49
- package/dist/hooks/useBooleanState/index.cjs +0 -46
- package/dist/hooks/useCallbackOncePerRender/index.cjs +0 -63
- package/dist/hooks/useConditionalEffect/index.cjs +0 -51
- package/dist/hooks/useControlledState/index.cjs +0 -57
- package/dist/hooks/useCounter/index.cjs +0 -70
- package/dist/hooks/useDebounce/index.cjs +0 -130
- package/dist/hooks/useDebouncedCallback/index.cjs +0 -148
- package/dist/hooks/useDoubleClick/index.cjs +0 -79
- package/dist/hooks/useGeolocation/index.cjs +0 -154
- package/dist/hooks/useImpressionRef/index.cjs +0 -258
- package/dist/hooks/useInputState/index.cjs +0 -46
- package/dist/hooks/useIntersectionObserver/index.cjs +0 -95
- package/dist/hooks/useInterval/index.cjs +0 -84
- package/dist/hooks/useIsClient/index.cjs +0 -40
- package/dist/hooks/useIsomorphicLayoutEffect/index.cjs +0 -35
- package/dist/hooks/useList/index.cjs +0 -104
- package/dist/hooks/useLoading/index.cjs +0 -65
- package/dist/hooks/useLongPress/index.cjs +0 -127
- package/dist/hooks/useMap/index.cjs +0 -78
- package/dist/hooks/useOutsideClickEffect/index.cjs +0 -74
- package/dist/hooks/usePreservedCallback/index.cjs +0 -45
- package/dist/hooks/usePreservedReference/index.cjs +0 -45
- package/dist/hooks/usePrevious/index.cjs +0 -48
- package/dist/hooks/useRefEffect/index.cjs +0 -72
- package/dist/hooks/useSet/index.cjs +0 -105
- package/dist/hooks/useStorageState/index.cjs +0 -196
- package/dist/hooks/useThrottle/index.cjs +0 -151
- package/dist/hooks/useThrottledCallback/index.cjs +0 -172
- package/dist/hooks/useTimeout/index.cjs +0 -57
- package/dist/hooks/useToggle/index.cjs +0 -37
- package/dist/hooks/useVisibilityEvent/index.cjs +0 -47
- package/dist/utils/buildContext/index.cjs +0 -56
- package/dist/utils/mergeProps/index.cjs +0 -71
- package/dist/utils/mergeRefs/index.cjs +0 -46
- package/esm/components/ImpressionArea/index.js +0 -269
- package/esm/components/Separated/index.js +0 -15
- package/esm/components/SwitchCase/index.js +0 -10
- package/esm/hooks/useAsyncEffect/index.js +0 -23
- package/esm/hooks/useBooleanState/index.js +0 -20
- package/esm/hooks/useCallbackOncePerRender/index.js +0 -37
- package/esm/hooks/useConditionalEffect/index.js +0 -25
- package/esm/hooks/useControlledState/index.js +0 -31
- package/esm/hooks/useCounter/index.js +0 -44
- package/esm/hooks/useDebounce/index.js +0 -104
- package/esm/hooks/useDebouncedCallback/index.js +0 -122
- package/esm/hooks/useDoubleClick/index.js +0 -53
- package/esm/hooks/useGeolocation/index.js +0 -128
- package/esm/hooks/useImpressionRef/index.js +0 -232
- package/esm/hooks/useInputState/index.js +0 -20
- package/esm/hooks/useIntersectionObserver/index.js +0 -69
- package/esm/hooks/useInterval/index.js +0 -58
- package/esm/hooks/useIsClient/index.js +0 -14
- package/esm/hooks/useIsomorphicLayoutEffect/index.js +0 -9
- package/esm/hooks/useList/index.js +0 -78
- package/esm/hooks/useLoading/index.js +0 -39
- package/esm/hooks/useLongPress/index.js +0 -101
- package/esm/hooks/useMap/index.js +0 -52
- package/esm/hooks/useOutsideClickEffect/index.js +0 -48
- package/esm/hooks/usePreservedCallback/index.js +0 -19
- package/esm/hooks/usePreservedReference/index.js +0 -19
- package/esm/hooks/usePrevious/index.js +0 -22
- package/esm/hooks/useRefEffect/index.js +0 -46
- package/esm/hooks/useSet/index.js +0 -79
- package/esm/hooks/useStorageState/index.js +0 -170
- package/esm/hooks/useThrottle/index.js +0 -125
- package/esm/hooks/useThrottledCallback/index.js +0 -146
- package/esm/hooks/useTimeout/index.js +0 -31
- package/esm/hooks/useToggle/index.js +0 -11
- package/esm/hooks/useVisibilityEvent/index.js +0 -21
- package/esm/index.d.ts +0 -40
- package/esm/index.js +0 -1335
- package/esm/utils/buildContext/index.js +0 -30
- package/esm/utils/mergeProps/index.js +0 -45
- package/esm/utils/mergeRefs/index.js +0 -20
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/hooks/useGeolocation/index.ts
|
|
22
|
-
var useGeolocation_exports = {};
|
|
23
|
-
__export(useGeolocation_exports, {
|
|
24
|
-
useGeolocation: () => useGeolocation
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useGeolocation_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useGeolocation/useGeolocation.ts
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
var CustomGeoLocationError = class extends Error {
|
|
31
|
-
code;
|
|
32
|
-
constructor({ code, message }) {
|
|
33
|
-
super(message);
|
|
34
|
-
this.name = "CustomGeoLocationError";
|
|
35
|
-
this.code = code;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var GeolocationMountBehavior = {
|
|
39
|
-
GET: "get",
|
|
40
|
-
WATCH: "watch"
|
|
41
|
-
};
|
|
42
|
-
function useGeolocation(options) {
|
|
43
|
-
const [state, setState] = (0, import_react.useState)({
|
|
44
|
-
loading: !!options?.mountBehavior,
|
|
45
|
-
error: null,
|
|
46
|
-
data: null
|
|
47
|
-
});
|
|
48
|
-
const [isTracking, setIsTracking] = (0, import_react.useState)(false);
|
|
49
|
-
const watchIdRef = (0, import_react.useRef)(null);
|
|
50
|
-
const checkGeolocationSupport = (0, import_react.useCallback)(() => {
|
|
51
|
-
if (typeof window === "undefined" || navigator.geolocation === void 0) {
|
|
52
|
-
setState((prev) => ({
|
|
53
|
-
...prev,
|
|
54
|
-
loading: false,
|
|
55
|
-
error: new CustomGeoLocationError({
|
|
56
|
-
code: 0,
|
|
57
|
-
message: "Geolocation is not supported by this environment."
|
|
58
|
-
})
|
|
59
|
-
}));
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
return true;
|
|
63
|
-
}, []);
|
|
64
|
-
const handleSuccess = (0, import_react.useCallback)((position) => {
|
|
65
|
-
const { coords } = position;
|
|
66
|
-
setState((prev) => ({
|
|
67
|
-
...prev,
|
|
68
|
-
loading: false,
|
|
69
|
-
error: null,
|
|
70
|
-
data: {
|
|
71
|
-
latitude: coords.latitude,
|
|
72
|
-
longitude: coords.longitude,
|
|
73
|
-
accuracy: coords.accuracy,
|
|
74
|
-
altitude: coords.altitude,
|
|
75
|
-
altitudeAccuracy: coords.altitudeAccuracy,
|
|
76
|
-
heading: coords.heading,
|
|
77
|
-
speed: coords.speed,
|
|
78
|
-
timestamp: position.timestamp
|
|
79
|
-
}
|
|
80
|
-
}));
|
|
81
|
-
}, []);
|
|
82
|
-
const handleError = (0, import_react.useCallback)((error) => {
|
|
83
|
-
const { code, message } = error;
|
|
84
|
-
setState((prev) => ({
|
|
85
|
-
...prev,
|
|
86
|
-
loading: false,
|
|
87
|
-
error: new CustomGeoLocationError({ code, message })
|
|
88
|
-
}));
|
|
89
|
-
}, []);
|
|
90
|
-
const getGeolocationOptions = (0, import_react.useCallback)(
|
|
91
|
-
() => ({
|
|
92
|
-
enableHighAccuracy: options?.enableHighAccuracy,
|
|
93
|
-
maximumAge: options?.maximumAge,
|
|
94
|
-
timeout: options?.timeout
|
|
95
|
-
}),
|
|
96
|
-
[options?.enableHighAccuracy, options?.maximumAge, options?.timeout]
|
|
97
|
-
);
|
|
98
|
-
const getCurrentPosition = (0, import_react.useCallback)(() => {
|
|
99
|
-
if (!checkGeolocationSupport()) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
setState((prev) => ({ ...prev, loading: true }));
|
|
103
|
-
navigator.geolocation.getCurrentPosition(handleSuccess, handleError, getGeolocationOptions());
|
|
104
|
-
}, [handleSuccess, handleError, getGeolocationOptions, checkGeolocationSupport]);
|
|
105
|
-
const startTracking = (0, import_react.useCallback)(() => {
|
|
106
|
-
if (!checkGeolocationSupport()) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
if (watchIdRef.current !== null) {
|
|
110
|
-
navigator.geolocation.clearWatch(watchIdRef.current);
|
|
111
|
-
}
|
|
112
|
-
setState((prev) => ({ ...prev, loading: true }));
|
|
113
|
-
watchIdRef.current = navigator.geolocation.watchPosition(
|
|
114
|
-
(position) => {
|
|
115
|
-
setIsTracking(true);
|
|
116
|
-
handleSuccess(position);
|
|
117
|
-
},
|
|
118
|
-
handleError,
|
|
119
|
-
getGeolocationOptions()
|
|
120
|
-
);
|
|
121
|
-
}, [handleSuccess, handleError, getGeolocationOptions, checkGeolocationSupport]);
|
|
122
|
-
const stopTracking = (0, import_react.useCallback)(() => {
|
|
123
|
-
if (watchIdRef.current === null) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
navigator.geolocation.clearWatch(watchIdRef.current);
|
|
127
|
-
watchIdRef.current = null;
|
|
128
|
-
setIsTracking(false);
|
|
129
|
-
}, []);
|
|
130
|
-
(0, import_react.useEffect)(() => {
|
|
131
|
-
if (options?.mountBehavior === GeolocationMountBehavior.WATCH) {
|
|
132
|
-
startTracking();
|
|
133
|
-
} else if (options?.mountBehavior === GeolocationMountBehavior.GET) {
|
|
134
|
-
getCurrentPosition();
|
|
135
|
-
}
|
|
136
|
-
return () => {
|
|
137
|
-
if (watchIdRef.current !== null) {
|
|
138
|
-
navigator.geolocation.clearWatch(watchIdRef.current);
|
|
139
|
-
watchIdRef.current = null;
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
}, [options?.mountBehavior, getCurrentPosition, startTracking]);
|
|
143
|
-
return {
|
|
144
|
-
...state,
|
|
145
|
-
getCurrentPosition,
|
|
146
|
-
startTracking,
|
|
147
|
-
stopTracking,
|
|
148
|
-
isTracking
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
152
|
-
0 && (module.exports = {
|
|
153
|
-
useGeolocation
|
|
154
|
-
});
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/hooks/useImpressionRef/index.ts
|
|
22
|
-
var useImpressionRef_exports = {};
|
|
23
|
-
__export(useImpressionRef_exports, {
|
|
24
|
-
useImpressionRef: () => useImpressionRef
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useImpressionRef_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useImpressionRef/useImpressionRef.ts
|
|
29
|
-
var import_react6 = require("react");
|
|
30
|
-
|
|
31
|
-
// src/hooks/useDebouncedCallback/useDebouncedCallback.ts
|
|
32
|
-
var import_react2 = require("react");
|
|
33
|
-
|
|
34
|
-
// src/hooks/useDebounce/debounce.ts
|
|
35
|
-
function debounce(func, debounceMs, { edges = ["leading", "trailing"] } = {}) {
|
|
36
|
-
let pendingThis = void 0;
|
|
37
|
-
let pendingArgs = null;
|
|
38
|
-
const leading = edges != null && edges.includes("leading");
|
|
39
|
-
const trailing = edges == null || edges.includes("trailing");
|
|
40
|
-
const invoke = () => {
|
|
41
|
-
if (pendingArgs !== null) {
|
|
42
|
-
func.apply(pendingThis, pendingArgs);
|
|
43
|
-
pendingThis = void 0;
|
|
44
|
-
pendingArgs = null;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const onTimerEnd = () => {
|
|
48
|
-
if (trailing) {
|
|
49
|
-
invoke();
|
|
50
|
-
}
|
|
51
|
-
cancel();
|
|
52
|
-
};
|
|
53
|
-
let timeoutId = null;
|
|
54
|
-
const schedule = () => {
|
|
55
|
-
if (timeoutId != null) {
|
|
56
|
-
clearTimeout(timeoutId);
|
|
57
|
-
}
|
|
58
|
-
timeoutId = setTimeout(() => {
|
|
59
|
-
timeoutId = null;
|
|
60
|
-
onTimerEnd();
|
|
61
|
-
}, debounceMs);
|
|
62
|
-
};
|
|
63
|
-
const cancelTimer = () => {
|
|
64
|
-
if (timeoutId !== null) {
|
|
65
|
-
clearTimeout(timeoutId);
|
|
66
|
-
timeoutId = null;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
const cancel = () => {
|
|
70
|
-
cancelTimer();
|
|
71
|
-
pendingThis = void 0;
|
|
72
|
-
pendingArgs = null;
|
|
73
|
-
};
|
|
74
|
-
const debounced = function(...args) {
|
|
75
|
-
pendingThis = this;
|
|
76
|
-
pendingArgs = args;
|
|
77
|
-
const isFirstCall = timeoutId == null;
|
|
78
|
-
schedule();
|
|
79
|
-
if (leading && isFirstCall) {
|
|
80
|
-
invoke();
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
debounced.cancel = cancel;
|
|
84
|
-
return debounced;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// src/hooks/usePreservedCallback/usePreservedCallback.ts
|
|
88
|
-
var import_react = require("react");
|
|
89
|
-
function usePreservedCallback(callback) {
|
|
90
|
-
const callbackRef = (0, import_react.useRef)(callback);
|
|
91
|
-
(0, import_react.useEffect)(
|
|
92
|
-
function syncCallbackRef() {
|
|
93
|
-
callbackRef.current = callback;
|
|
94
|
-
},
|
|
95
|
-
[callback]
|
|
96
|
-
);
|
|
97
|
-
return (0, import_react.useCallback)((...args) => {
|
|
98
|
-
return callbackRef.current(...args);
|
|
99
|
-
}, []);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// src/hooks/useDebouncedCallback/useDebouncedCallback.ts
|
|
103
|
-
function useDebouncedCallback({
|
|
104
|
-
onChange,
|
|
105
|
-
timeThreshold,
|
|
106
|
-
leading = false,
|
|
107
|
-
trailing = true
|
|
108
|
-
}) {
|
|
109
|
-
const handleChange = usePreservedCallback(onChange);
|
|
110
|
-
const ref = (0, import_react2.useRef)({ value: false, clearPreviousDebounce: () => {
|
|
111
|
-
} });
|
|
112
|
-
(0, import_react2.useEffect)(function clearDebouncedOnUnmount() {
|
|
113
|
-
const current = ref.current;
|
|
114
|
-
return () => {
|
|
115
|
-
current.clearPreviousDebounce();
|
|
116
|
-
};
|
|
117
|
-
}, []);
|
|
118
|
-
const edges = (0, import_react2.useMemo)(() => {
|
|
119
|
-
const _edges = [];
|
|
120
|
-
if (leading) {
|
|
121
|
-
_edges.push("leading");
|
|
122
|
-
}
|
|
123
|
-
if (trailing) {
|
|
124
|
-
_edges.push("trailing");
|
|
125
|
-
}
|
|
126
|
-
return _edges;
|
|
127
|
-
}, [leading, trailing]);
|
|
128
|
-
return (0, import_react2.useCallback)(
|
|
129
|
-
(nextValue) => {
|
|
130
|
-
if (nextValue === ref.current.value) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
const debounced = debounce(
|
|
134
|
-
() => {
|
|
135
|
-
handleChange(nextValue);
|
|
136
|
-
ref.current.value = nextValue;
|
|
137
|
-
},
|
|
138
|
-
timeThreshold,
|
|
139
|
-
{ edges }
|
|
140
|
-
);
|
|
141
|
-
ref.current.clearPreviousDebounce();
|
|
142
|
-
debounced();
|
|
143
|
-
ref.current.clearPreviousDebounce = debounced.cancel;
|
|
144
|
-
},
|
|
145
|
-
[handleChange, timeThreshold, edges]
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// src/hooks/useIntersectionObserver/useIntersectionObserver.ts
|
|
150
|
-
var import_react4 = require("react");
|
|
151
|
-
|
|
152
|
-
// src/hooks/useRefEffect/useRefEffect.ts
|
|
153
|
-
var import_react3 = require("react");
|
|
154
|
-
function useRefEffect(callback, deps) {
|
|
155
|
-
const preservedCallback = usePreservedCallback(callback);
|
|
156
|
-
const cleanupCallbackRef = (0, import_react3.useRef)(() => {
|
|
157
|
-
});
|
|
158
|
-
const effect = (0, import_react3.useCallback)(
|
|
159
|
-
(element) => {
|
|
160
|
-
cleanupCallbackRef.current();
|
|
161
|
-
cleanupCallbackRef.current = () => {
|
|
162
|
-
};
|
|
163
|
-
if (element == null) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
const cleanup = preservedCallback(element);
|
|
167
|
-
if (typeof cleanup === "function") {
|
|
168
|
-
cleanupCallbackRef.current = cleanup;
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
172
|
-
[preservedCallback, ...deps]
|
|
173
|
-
);
|
|
174
|
-
return effect;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// src/hooks/useIntersectionObserver/useIntersectionObserver.ts
|
|
178
|
-
function useIntersectionObserver(callback, options) {
|
|
179
|
-
const preservedCallback = usePreservedCallback(callback);
|
|
180
|
-
const observer = (0, import_react4.useMemo)(() => {
|
|
181
|
-
if (typeof IntersectionObserver === "undefined") {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
return new IntersectionObserver(([entry]) => {
|
|
185
|
-
preservedCallback(entry);
|
|
186
|
-
}, options);
|
|
187
|
-
}, [preservedCallback, options]);
|
|
188
|
-
return useRefEffect(
|
|
189
|
-
(element) => {
|
|
190
|
-
observer?.observe(element);
|
|
191
|
-
return () => {
|
|
192
|
-
observer?.unobserve(element);
|
|
193
|
-
};
|
|
194
|
-
},
|
|
195
|
-
[preservedCallback, options]
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// src/hooks/useVisibilityEvent/useVisibilityEvent.ts
|
|
200
|
-
var import_react5 = require("react");
|
|
201
|
-
function useVisibilityEvent(callback, options = {}) {
|
|
202
|
-
const handleVisibilityChange = (0, import_react5.useCallback)(() => {
|
|
203
|
-
callback(document.visibilityState);
|
|
204
|
-
}, [callback]);
|
|
205
|
-
(0, import_react5.useEffect)(() => {
|
|
206
|
-
if (options?.immediate ?? false) {
|
|
207
|
-
handleVisibilityChange();
|
|
208
|
-
}
|
|
209
|
-
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
210
|
-
return () => {
|
|
211
|
-
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
212
|
-
};
|
|
213
|
-
}, [handleVisibilityChange, options?.immediate]);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// src/hooks/useImpressionRef/useImpressionRef.ts
|
|
217
|
-
function useImpressionRef({
|
|
218
|
-
onImpressionStart = () => {
|
|
219
|
-
},
|
|
220
|
-
onImpressionEnd = () => {
|
|
221
|
-
},
|
|
222
|
-
rootMargin,
|
|
223
|
-
areaThreshold = 0,
|
|
224
|
-
timeThreshold = 0
|
|
225
|
-
}) {
|
|
226
|
-
const impressionStartHandler = usePreservedCallback(onImpressionStart);
|
|
227
|
-
const impressionEndHandler = usePreservedCallback(onImpressionEnd);
|
|
228
|
-
const isIntersectingRef = (0, import_react6.useRef)(false);
|
|
229
|
-
const impressionEventHandler = useDebouncedCallback({
|
|
230
|
-
timeThreshold,
|
|
231
|
-
onChange: (impressed) => {
|
|
232
|
-
(impressed ? impressionStartHandler : impressionEndHandler)();
|
|
233
|
-
},
|
|
234
|
-
leading: true
|
|
235
|
-
});
|
|
236
|
-
useVisibilityEvent((documentVisible) => {
|
|
237
|
-
if (!isIntersectingRef.current) {
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
impressionEventHandler(documentVisible === "visible");
|
|
241
|
-
});
|
|
242
|
-
return useIntersectionObserver(
|
|
243
|
-
(entry) => {
|
|
244
|
-
if (document.visibilityState === "hidden") {
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
const currentRatio = entry.intersectionRatio;
|
|
248
|
-
const isIntersecting = areaThreshold === 0 ? entry.isIntersecting : currentRatio >= areaThreshold;
|
|
249
|
-
isIntersectingRef.current = isIntersecting;
|
|
250
|
-
impressionEventHandler(isIntersecting);
|
|
251
|
-
},
|
|
252
|
-
{ rootMargin, threshold: areaThreshold }
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
256
|
-
0 && (module.exports = {
|
|
257
|
-
useImpressionRef
|
|
258
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/hooks/useInputState/index.ts
|
|
22
|
-
var useInputState_exports = {};
|
|
23
|
-
__export(useInputState_exports, {
|
|
24
|
-
useInputState: () => useInputState
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useInputState_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useInputState/useInputState.ts
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
function useInputState(initialValue = "", transformValue = echo) {
|
|
31
|
-
const [value, setValue] = (0, import_react.useState)(initialValue);
|
|
32
|
-
const handleValueChange = (0, import_react.useCallback)(
|
|
33
|
-
({ target: { value: value2 } }) => {
|
|
34
|
-
setValue(transformValue(value2));
|
|
35
|
-
},
|
|
36
|
-
[transformValue]
|
|
37
|
-
);
|
|
38
|
-
return [value, handleValueChange];
|
|
39
|
-
}
|
|
40
|
-
function echo(v) {
|
|
41
|
-
return v;
|
|
42
|
-
}
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
useInputState
|
|
46
|
-
});
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/hooks/useIntersectionObserver/index.ts
|
|
22
|
-
var useIntersectionObserver_exports = {};
|
|
23
|
-
__export(useIntersectionObserver_exports, {
|
|
24
|
-
useIntersectionObserver: () => useIntersectionObserver
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useIntersectionObserver_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useIntersectionObserver/useIntersectionObserver.ts
|
|
29
|
-
var import_react3 = require("react");
|
|
30
|
-
|
|
31
|
-
// src/hooks/usePreservedCallback/usePreservedCallback.ts
|
|
32
|
-
var import_react = require("react");
|
|
33
|
-
function usePreservedCallback(callback) {
|
|
34
|
-
const callbackRef = (0, import_react.useRef)(callback);
|
|
35
|
-
(0, import_react.useEffect)(
|
|
36
|
-
function syncCallbackRef() {
|
|
37
|
-
callbackRef.current = callback;
|
|
38
|
-
},
|
|
39
|
-
[callback]
|
|
40
|
-
);
|
|
41
|
-
return (0, import_react.useCallback)((...args) => {
|
|
42
|
-
return callbackRef.current(...args);
|
|
43
|
-
}, []);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// src/hooks/useRefEffect/useRefEffect.ts
|
|
47
|
-
var import_react2 = require("react");
|
|
48
|
-
function useRefEffect(callback, deps) {
|
|
49
|
-
const preservedCallback = usePreservedCallback(callback);
|
|
50
|
-
const cleanupCallbackRef = (0, import_react2.useRef)(() => {
|
|
51
|
-
});
|
|
52
|
-
const effect = (0, import_react2.useCallback)(
|
|
53
|
-
(element) => {
|
|
54
|
-
cleanupCallbackRef.current();
|
|
55
|
-
cleanupCallbackRef.current = () => {
|
|
56
|
-
};
|
|
57
|
-
if (element == null) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const cleanup = preservedCallback(element);
|
|
61
|
-
if (typeof cleanup === "function") {
|
|
62
|
-
cleanupCallbackRef.current = cleanup;
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
66
|
-
[preservedCallback, ...deps]
|
|
67
|
-
);
|
|
68
|
-
return effect;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// src/hooks/useIntersectionObserver/useIntersectionObserver.ts
|
|
72
|
-
function useIntersectionObserver(callback, options) {
|
|
73
|
-
const preservedCallback = usePreservedCallback(callback);
|
|
74
|
-
const observer = (0, import_react3.useMemo)(() => {
|
|
75
|
-
if (typeof IntersectionObserver === "undefined") {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
return new IntersectionObserver(([entry]) => {
|
|
79
|
-
preservedCallback(entry);
|
|
80
|
-
}, options);
|
|
81
|
-
}, [preservedCallback, options]);
|
|
82
|
-
return useRefEffect(
|
|
83
|
-
(element) => {
|
|
84
|
-
observer?.observe(element);
|
|
85
|
-
return () => {
|
|
86
|
-
observer?.unobserve(element);
|
|
87
|
-
};
|
|
88
|
-
},
|
|
89
|
-
[preservedCallback, options]
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
93
|
-
0 && (module.exports = {
|
|
94
|
-
useIntersectionObserver
|
|
95
|
-
});
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/hooks/useInterval/index.ts
|
|
22
|
-
var useInterval_exports = {};
|
|
23
|
-
__export(useInterval_exports, {
|
|
24
|
-
useInterval: () => useInterval
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useInterval_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useInterval/useInterval.ts
|
|
29
|
-
var import_react2 = require("react");
|
|
30
|
-
|
|
31
|
-
// src/hooks/usePreservedCallback/usePreservedCallback.ts
|
|
32
|
-
var import_react = require("react");
|
|
33
|
-
function usePreservedCallback(callback) {
|
|
34
|
-
const callbackRef = (0, import_react.useRef)(callback);
|
|
35
|
-
(0, import_react.useEffect)(
|
|
36
|
-
function syncCallbackRef() {
|
|
37
|
-
callbackRef.current = callback;
|
|
38
|
-
},
|
|
39
|
-
[callback]
|
|
40
|
-
);
|
|
41
|
-
return (0, import_react.useCallback)((...args) => {
|
|
42
|
-
return callbackRef.current(...args);
|
|
43
|
-
}, []);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// src/hooks/useInterval/useInterval.ts
|
|
47
|
-
function useInterval(callback, options) {
|
|
48
|
-
const delay = typeof options === "number" ? options : options.delay;
|
|
49
|
-
const immediate = typeof options === "number" ? false : options.immediate;
|
|
50
|
-
const enabled = typeof options === "number" ? true : options.enabled ?? true;
|
|
51
|
-
const preservedCallback = usePreservedCallback(callback);
|
|
52
|
-
const immediateCalledRef = (0, import_react2.useRef)(false);
|
|
53
|
-
(0, import_react2.useEffect)(
|
|
54
|
-
function runImmediateCallback() {
|
|
55
|
-
if (immediate !== true) {
|
|
56
|
-
immediateCalledRef.current = false;
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (!enabled) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (immediateCalledRef.current) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
immediateCalledRef.current = true;
|
|
66
|
-
preservedCallback();
|
|
67
|
-
},
|
|
68
|
-
[immediate, preservedCallback, enabled]
|
|
69
|
-
);
|
|
70
|
-
(0, import_react2.useEffect)(
|
|
71
|
-
function startInterval() {
|
|
72
|
-
if (!enabled) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const id = setInterval(preservedCallback, delay);
|
|
76
|
-
return () => clearInterval(id);
|
|
77
|
-
},
|
|
78
|
-
[delay, preservedCallback, enabled]
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
-
0 && (module.exports = {
|
|
83
|
-
useInterval
|
|
84
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/hooks/useIsClient/index.ts
|
|
22
|
-
var useIsClient_exports = {};
|
|
23
|
-
__export(useIsClient_exports, {
|
|
24
|
-
useIsClient: () => useIsClient
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useIsClient_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useIsClient/useIsClient.ts
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
function useIsClient() {
|
|
31
|
-
const [isClient, setIsClient] = (0, import_react.useState)(false);
|
|
32
|
-
(0, import_react.useEffect)(function syncClientState() {
|
|
33
|
-
setIsClient(true);
|
|
34
|
-
}, []);
|
|
35
|
-
return isClient;
|
|
36
|
-
}
|
|
37
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
-
0 && (module.exports = {
|
|
39
|
-
useIsClient
|
|
40
|
-
});
|