react-simplikit 0.0.50 → 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/{esm/hooks/useOutsideClickEffect/index.d.ts → dist/hooks/useOutsideClickEffect/useOutsideClickEffect.d.cts} +4 -2
- package/dist/hooks/useOutsideClickEffect/{index.d.cts → 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 -1382
- 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 -44
- 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 -74
- 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 -18
- 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 -48
- 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 -1320
- 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,37 +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/useToggle/index.ts
|
|
22
|
-
var useToggle_exports = {};
|
|
23
|
-
__export(useToggle_exports, {
|
|
24
|
-
useToggle: () => useToggle
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useToggle_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useToggle/useToggle.ts
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
function useToggle(initialValue = false) {
|
|
31
|
-
return (0, import_react.useReducer)(toggle, initialValue);
|
|
32
|
-
}
|
|
33
|
-
var toggle = (state) => !state;
|
|
34
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
-
0 && (module.exports = {
|
|
36
|
-
useToggle
|
|
37
|
-
});
|
|
@@ -1,47 +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/useVisibilityEvent/index.ts
|
|
22
|
-
var useVisibilityEvent_exports = {};
|
|
23
|
-
__export(useVisibilityEvent_exports, {
|
|
24
|
-
useVisibilityEvent: () => useVisibilityEvent
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useVisibilityEvent_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useVisibilityEvent/useVisibilityEvent.ts
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
function useVisibilityEvent(callback, options = {}) {
|
|
31
|
-
const handleVisibilityChange = (0, import_react.useCallback)(() => {
|
|
32
|
-
callback(document.visibilityState);
|
|
33
|
-
}, [callback]);
|
|
34
|
-
(0, import_react.useEffect)(() => {
|
|
35
|
-
if (options?.immediate ?? false) {
|
|
36
|
-
handleVisibilityChange();
|
|
37
|
-
}
|
|
38
|
-
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
39
|
-
return () => {
|
|
40
|
-
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
41
|
-
};
|
|
42
|
-
}, [handleVisibilityChange, options?.immediate]);
|
|
43
|
-
}
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
useVisibilityEvent
|
|
47
|
-
});
|
|
@@ -1,56 +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/utils/buildContext/index.ts
|
|
22
|
-
var buildContext_exports = {};
|
|
23
|
-
__export(buildContext_exports, {
|
|
24
|
-
buildContext: () => buildContext
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(buildContext_exports);
|
|
27
|
-
|
|
28
|
-
// src/utils/buildContext/buildContext.tsx
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
-
function buildContext(contextName, defaultContextValues) {
|
|
32
|
-
const Context = (0, import_react.createContext)(defaultContextValues ?? void 0);
|
|
33
|
-
function Provider({ children, ...contextValues }) {
|
|
34
|
-
const value = (0, import_react.useMemo)(
|
|
35
|
-
() => Object.keys(contextValues).length > 0 ? contextValues : null,
|
|
36
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
|
-
[...Object.values(contextValues)]
|
|
38
|
-
);
|
|
39
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children });
|
|
40
|
-
}
|
|
41
|
-
function useInnerContext() {
|
|
42
|
-
const context = (0, import_react.useContext)(Context);
|
|
43
|
-
if (context != null) {
|
|
44
|
-
return context;
|
|
45
|
-
}
|
|
46
|
-
if (defaultContextValues != null) {
|
|
47
|
-
return defaultContextValues;
|
|
48
|
-
}
|
|
49
|
-
throw new Error(`\`${contextName}Context\` must be used within \`${contextName}Provider\``);
|
|
50
|
-
}
|
|
51
|
-
return [Provider, useInnerContext];
|
|
52
|
-
}
|
|
53
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
-
0 && (module.exports = {
|
|
55
|
-
buildContext
|
|
56
|
-
});
|
|
@@ -1,71 +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/utils/mergeProps/index.ts
|
|
22
|
-
var mergeProps_exports = {};
|
|
23
|
-
__export(mergeProps_exports, {
|
|
24
|
-
mergeProps: () => mergeProps
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(mergeProps_exports);
|
|
27
|
-
|
|
28
|
-
// src/utils/mergeProps/mergeProps.ts
|
|
29
|
-
function mergeProps(...props) {
|
|
30
|
-
return props.reduce(pushProp, {});
|
|
31
|
-
}
|
|
32
|
-
function pushProp(prev, curr) {
|
|
33
|
-
for (const key in curr) {
|
|
34
|
-
if (curr[key] === void 0) continue;
|
|
35
|
-
switch (key) {
|
|
36
|
-
case "className": {
|
|
37
|
-
prev[key] = [prev[key], curr[key]].join(" ").trim();
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
case "style": {
|
|
41
|
-
prev[key] = mergeStyle(prev[key], curr[key]);
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
default: {
|
|
45
|
-
const mergedFunction = mergeFunction(prev[key], curr[key]);
|
|
46
|
-
if (mergedFunction) {
|
|
47
|
-
prev[key] = mergedFunction;
|
|
48
|
-
} else if (curr[key] !== void 0) {
|
|
49
|
-
prev[key] = curr[key];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return prev;
|
|
55
|
-
}
|
|
56
|
-
function mergeStyle(a, b) {
|
|
57
|
-
if (a == null) return b;
|
|
58
|
-
return { ...a, ...b };
|
|
59
|
-
}
|
|
60
|
-
function mergeFunction(a, b) {
|
|
61
|
-
if (typeof a === "function" && typeof b === "function") {
|
|
62
|
-
return (...args) => {
|
|
63
|
-
a(...args);
|
|
64
|
-
b(...args);
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
-
0 && (module.exports = {
|
|
70
|
-
mergeProps
|
|
71
|
-
});
|
|
@@ -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/utils/mergeRefs/index.ts
|
|
22
|
-
var mergeRefs_exports = {};
|
|
23
|
-
__export(mergeRefs_exports, {
|
|
24
|
-
mergeRefs: () => mergeRefs
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(mergeRefs_exports);
|
|
27
|
-
|
|
28
|
-
// src/utils/mergeRefs/mergeRefs.ts
|
|
29
|
-
function mergeRefs(...refs) {
|
|
30
|
-
return (value) => {
|
|
31
|
-
for (const ref of refs) {
|
|
32
|
-
if (ref == null) {
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (typeof ref === "function") {
|
|
36
|
-
ref(value);
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
ref.current = value;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
mergeRefs
|
|
46
|
-
});
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/components/ImpressionArea/ImpressionArea.tsx
|
|
4
|
-
import { forwardRef } from "react";
|
|
5
|
-
|
|
6
|
-
// src/hooks/useImpressionRef/useImpressionRef.ts
|
|
7
|
-
import { useRef as useRef4 } from "react";
|
|
8
|
-
|
|
9
|
-
// src/hooks/useDebouncedCallback/useDebouncedCallback.ts
|
|
10
|
-
import { useCallback as useCallback2, useEffect as useEffect2, useMemo, useRef as useRef2 } from "react";
|
|
11
|
-
|
|
12
|
-
// src/hooks/useDebounce/debounce.ts
|
|
13
|
-
function debounce(func, debounceMs, { edges = ["leading", "trailing"] } = {}) {
|
|
14
|
-
let pendingThis = void 0;
|
|
15
|
-
let pendingArgs = null;
|
|
16
|
-
const leading = edges != null && edges.includes("leading");
|
|
17
|
-
const trailing = edges == null || edges.includes("trailing");
|
|
18
|
-
const invoke = () => {
|
|
19
|
-
if (pendingArgs !== null) {
|
|
20
|
-
func.apply(pendingThis, pendingArgs);
|
|
21
|
-
pendingThis = void 0;
|
|
22
|
-
pendingArgs = null;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const onTimerEnd = () => {
|
|
26
|
-
if (trailing) {
|
|
27
|
-
invoke();
|
|
28
|
-
}
|
|
29
|
-
cancel();
|
|
30
|
-
};
|
|
31
|
-
let timeoutId = null;
|
|
32
|
-
const schedule = () => {
|
|
33
|
-
if (timeoutId != null) {
|
|
34
|
-
clearTimeout(timeoutId);
|
|
35
|
-
}
|
|
36
|
-
timeoutId = setTimeout(() => {
|
|
37
|
-
timeoutId = null;
|
|
38
|
-
onTimerEnd();
|
|
39
|
-
}, debounceMs);
|
|
40
|
-
};
|
|
41
|
-
const cancelTimer = () => {
|
|
42
|
-
if (timeoutId !== null) {
|
|
43
|
-
clearTimeout(timeoutId);
|
|
44
|
-
timeoutId = null;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const cancel = () => {
|
|
48
|
-
cancelTimer();
|
|
49
|
-
pendingThis = void 0;
|
|
50
|
-
pendingArgs = null;
|
|
51
|
-
};
|
|
52
|
-
const debounced = function(...args) {
|
|
53
|
-
pendingThis = this;
|
|
54
|
-
pendingArgs = args;
|
|
55
|
-
const isFirstCall = timeoutId == null;
|
|
56
|
-
schedule();
|
|
57
|
-
if (leading && isFirstCall) {
|
|
58
|
-
invoke();
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
debounced.cancel = cancel;
|
|
62
|
-
return debounced;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// src/hooks/usePreservedCallback/usePreservedCallback.ts
|
|
66
|
-
import { useCallback, useEffect, useRef } from "react";
|
|
67
|
-
function usePreservedCallback(callback) {
|
|
68
|
-
const callbackRef = useRef(callback);
|
|
69
|
-
useEffect(
|
|
70
|
-
function syncCallbackRef() {
|
|
71
|
-
callbackRef.current = callback;
|
|
72
|
-
},
|
|
73
|
-
[callback]
|
|
74
|
-
);
|
|
75
|
-
return useCallback((...args) => {
|
|
76
|
-
return callbackRef.current(...args);
|
|
77
|
-
}, []);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// src/hooks/useDebouncedCallback/useDebouncedCallback.ts
|
|
81
|
-
function useDebouncedCallback({
|
|
82
|
-
onChange,
|
|
83
|
-
timeThreshold,
|
|
84
|
-
leading = false,
|
|
85
|
-
trailing = true
|
|
86
|
-
}) {
|
|
87
|
-
const handleChange = usePreservedCallback(onChange);
|
|
88
|
-
const ref = useRef2({ value: false, clearPreviousDebounce: () => {
|
|
89
|
-
} });
|
|
90
|
-
useEffect2(function clearDebouncedOnUnmount() {
|
|
91
|
-
const current = ref.current;
|
|
92
|
-
return () => {
|
|
93
|
-
current.clearPreviousDebounce();
|
|
94
|
-
};
|
|
95
|
-
}, []);
|
|
96
|
-
const edges = useMemo(() => {
|
|
97
|
-
const _edges = [];
|
|
98
|
-
if (leading) {
|
|
99
|
-
_edges.push("leading");
|
|
100
|
-
}
|
|
101
|
-
if (trailing) {
|
|
102
|
-
_edges.push("trailing");
|
|
103
|
-
}
|
|
104
|
-
return _edges;
|
|
105
|
-
}, [leading, trailing]);
|
|
106
|
-
return useCallback2(
|
|
107
|
-
(nextValue) => {
|
|
108
|
-
if (nextValue === ref.current.value) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
const debounced = debounce(
|
|
112
|
-
() => {
|
|
113
|
-
handleChange(nextValue);
|
|
114
|
-
ref.current.value = nextValue;
|
|
115
|
-
},
|
|
116
|
-
timeThreshold,
|
|
117
|
-
{ edges }
|
|
118
|
-
);
|
|
119
|
-
ref.current.clearPreviousDebounce();
|
|
120
|
-
debounced();
|
|
121
|
-
ref.current.clearPreviousDebounce = debounced.cancel;
|
|
122
|
-
},
|
|
123
|
-
[handleChange, timeThreshold, edges]
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// src/hooks/useIntersectionObserver/useIntersectionObserver.ts
|
|
128
|
-
import { useMemo as useMemo2 } from "react";
|
|
129
|
-
|
|
130
|
-
// src/hooks/useRefEffect/useRefEffect.ts
|
|
131
|
-
import { useCallback as useCallback3, useRef as useRef3 } from "react";
|
|
132
|
-
function useRefEffect(callback, deps) {
|
|
133
|
-
const preservedCallback = usePreservedCallback(callback);
|
|
134
|
-
const cleanupCallbackRef = useRef3(() => {
|
|
135
|
-
});
|
|
136
|
-
const effect = useCallback3(
|
|
137
|
-
(element) => {
|
|
138
|
-
cleanupCallbackRef.current();
|
|
139
|
-
cleanupCallbackRef.current = () => {
|
|
140
|
-
};
|
|
141
|
-
if (element == null) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
const cleanup = preservedCallback(element);
|
|
145
|
-
if (typeof cleanup === "function") {
|
|
146
|
-
cleanupCallbackRef.current = cleanup;
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
150
|
-
[preservedCallback, ...deps]
|
|
151
|
-
);
|
|
152
|
-
return effect;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// src/hooks/useIntersectionObserver/useIntersectionObserver.ts
|
|
156
|
-
function useIntersectionObserver(callback, options) {
|
|
157
|
-
const preservedCallback = usePreservedCallback(callback);
|
|
158
|
-
const observer = useMemo2(() => {
|
|
159
|
-
if (typeof IntersectionObserver === "undefined") {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
return new IntersectionObserver(([entry]) => {
|
|
163
|
-
preservedCallback(entry);
|
|
164
|
-
}, options);
|
|
165
|
-
}, [preservedCallback, options]);
|
|
166
|
-
return useRefEffect(
|
|
167
|
-
(element) => {
|
|
168
|
-
observer?.observe(element);
|
|
169
|
-
return () => {
|
|
170
|
-
observer?.unobserve(element);
|
|
171
|
-
};
|
|
172
|
-
},
|
|
173
|
-
[preservedCallback, options]
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// src/hooks/useVisibilityEvent/useVisibilityEvent.ts
|
|
178
|
-
import { useCallback as useCallback4, useEffect as useEffect3 } from "react";
|
|
179
|
-
function useVisibilityEvent(callback, options = {}) {
|
|
180
|
-
const handleVisibilityChange = useCallback4(() => {
|
|
181
|
-
callback(document.visibilityState);
|
|
182
|
-
}, [callback]);
|
|
183
|
-
useEffect3(() => {
|
|
184
|
-
if (options?.immediate ?? false) {
|
|
185
|
-
handleVisibilityChange();
|
|
186
|
-
}
|
|
187
|
-
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
188
|
-
return () => {
|
|
189
|
-
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
190
|
-
};
|
|
191
|
-
}, [handleVisibilityChange, options?.immediate]);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// src/hooks/useImpressionRef/useImpressionRef.ts
|
|
195
|
-
function useImpressionRef({
|
|
196
|
-
onImpressionStart = () => {
|
|
197
|
-
},
|
|
198
|
-
onImpressionEnd = () => {
|
|
199
|
-
},
|
|
200
|
-
rootMargin,
|
|
201
|
-
areaThreshold = 0,
|
|
202
|
-
timeThreshold = 0
|
|
203
|
-
}) {
|
|
204
|
-
const impressionStartHandler = usePreservedCallback(onImpressionStart);
|
|
205
|
-
const impressionEndHandler = usePreservedCallback(onImpressionEnd);
|
|
206
|
-
const isIntersectingRef = useRef4(false);
|
|
207
|
-
const impressionEventHandler = useDebouncedCallback({
|
|
208
|
-
timeThreshold,
|
|
209
|
-
onChange: (impressed) => {
|
|
210
|
-
(impressed ? impressionStartHandler : impressionEndHandler)();
|
|
211
|
-
},
|
|
212
|
-
leading: true
|
|
213
|
-
});
|
|
214
|
-
useVisibilityEvent((documentVisible) => {
|
|
215
|
-
if (!isIntersectingRef.current) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
impressionEventHandler(documentVisible === "visible");
|
|
219
|
-
});
|
|
220
|
-
return useIntersectionObserver(
|
|
221
|
-
(entry) => {
|
|
222
|
-
if (document.visibilityState === "hidden") {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
const currentRatio = entry.intersectionRatio;
|
|
226
|
-
const isIntersecting = areaThreshold === 0 ? entry.isIntersecting : currentRatio >= areaThreshold;
|
|
227
|
-
isIntersectingRef.current = isIntersecting;
|
|
228
|
-
impressionEventHandler(isIntersecting);
|
|
229
|
-
},
|
|
230
|
-
{ rootMargin, threshold: areaThreshold }
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// src/utils/mergeRefs/mergeRefs.ts
|
|
235
|
-
function mergeRefs(...refs) {
|
|
236
|
-
return (value) => {
|
|
237
|
-
for (const ref of refs) {
|
|
238
|
-
if (ref == null) {
|
|
239
|
-
continue;
|
|
240
|
-
}
|
|
241
|
-
if (typeof ref === "function") {
|
|
242
|
-
ref(value);
|
|
243
|
-
continue;
|
|
244
|
-
}
|
|
245
|
-
ref.current = value;
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// src/components/ImpressionArea/ImpressionArea.tsx
|
|
251
|
-
import { jsx } from "react/jsx-runtime";
|
|
252
|
-
var ImpressionArea = forwardRef(ImpressionAreaImpl);
|
|
253
|
-
function ImpressionAreaImpl({ as, rootMargin, areaThreshold, timeThreshold, onImpressionStart, onImpressionEnd, ...props }, ref) {
|
|
254
|
-
const Component = as ?? "div";
|
|
255
|
-
const impressionRef = useImpressionRef({
|
|
256
|
-
onImpressionStart,
|
|
257
|
-
onImpressionEnd,
|
|
258
|
-
areaThreshold,
|
|
259
|
-
timeThreshold,
|
|
260
|
-
rootMargin
|
|
261
|
-
});
|
|
262
|
-
return /* @__PURE__ */ jsx(Component, { ref: mergeRefs(ref, impressionRef), ...props });
|
|
263
|
-
}
|
|
264
|
-
Object.assign(ImpressionArea, {
|
|
265
|
-
displayName: "ImpressionArea"
|
|
266
|
-
});
|
|
267
|
-
export {
|
|
268
|
-
ImpressionArea
|
|
269
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/components/Separated/Separated.tsx
|
|
4
|
-
import { Children, Fragment, isValidElement } from "react";
|
|
5
|
-
import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
function Separated({ children, by: separator }) {
|
|
7
|
-
const childrenArray = Children.toArray(children).filter(isValidElement);
|
|
8
|
-
return /* @__PURE__ */ jsx(Fragment2, { children: childrenArray.map((child, i, { length }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9
|
-
child,
|
|
10
|
-
i + 1 !== length && separator
|
|
11
|
-
] }, child.key ?? i)) });
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
Separated
|
|
15
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/components/SwitchCase/SwitchCase.tsx
|
|
4
|
-
function SwitchCase({ value, caseBy, defaultComponent = () => null }) {
|
|
5
|
-
const stringifiedValue = String(value);
|
|
6
|
-
return (caseBy[stringifiedValue] ?? defaultComponent)();
|
|
7
|
-
}
|
|
8
|
-
export {
|
|
9
|
-
SwitchCase
|
|
10
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/hooks/useAsyncEffect/useAsyncEffect.ts
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
-
function useAsyncEffect(effect, deps) {
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
let cleanup;
|
|
8
|
-
effect().then((result) => {
|
|
9
|
-
cleanup = result;
|
|
10
|
-
});
|
|
11
|
-
return () => {
|
|
12
|
-
cleanup?.();
|
|
13
|
-
};
|
|
14
|
-
}, deps);
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
useAsyncEffect
|
|
18
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/hooks/useBooleanState/useBooleanState.ts
|
|
4
|
-
import { useCallback, useState } from "react";
|
|
5
|
-
function useBooleanState(defaultValue = false) {
|
|
6
|
-
const [bool, setBool] = useState(defaultValue);
|
|
7
|
-
const setTrue = useCallback(() => {
|
|
8
|
-
setBool(true);
|
|
9
|
-
}, []);
|
|
10
|
-
const setFalse = useCallback(() => {
|
|
11
|
-
setBool(false);
|
|
12
|
-
}, []);
|
|
13
|
-
const toggle = useCallback(() => {
|
|
14
|
-
setBool((prevBool) => !prevBool);
|
|
15
|
-
}, []);
|
|
16
|
-
return [bool, setTrue, setFalse, toggle];
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
useBooleanState
|
|
20
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/hooks/useCallbackOncePerRender/useCallbackOncePerRender.ts
|
|
4
|
-
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
5
|
-
|
|
6
|
-
// src/hooks/usePreservedCallback/usePreservedCallback.ts
|
|
7
|
-
import { useCallback, useEffect, useRef } from "react";
|
|
8
|
-
function usePreservedCallback(callback) {
|
|
9
|
-
const callbackRef = useRef(callback);
|
|
10
|
-
useEffect(
|
|
11
|
-
function syncCallbackRef() {
|
|
12
|
-
callbackRef.current = callback;
|
|
13
|
-
},
|
|
14
|
-
[callback]
|
|
15
|
-
);
|
|
16
|
-
return useCallback((...args) => {
|
|
17
|
-
return callbackRef.current(...args);
|
|
18
|
-
}, []);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// src/hooks/useCallbackOncePerRender/useCallbackOncePerRender.ts
|
|
22
|
-
function useCallbackOncePerRender(callback, deps) {
|
|
23
|
-
const hasFired = useRef2(false);
|
|
24
|
-
useEffect2(() => {
|
|
25
|
-
hasFired.current = false;
|
|
26
|
-
}, deps);
|
|
27
|
-
return usePreservedCallback((...args) => {
|
|
28
|
-
if (hasFired.current) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
callback(...args);
|
|
32
|
-
hasFired.current = true;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
useCallbackOncePerRender
|
|
37
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/hooks/useConditionalEffect/useConditionalEffect.ts
|
|
4
|
-
import { useCallback, useEffect, useRef } from "react";
|
|
5
|
-
function useConditionalEffect(effect, deps, condition) {
|
|
6
|
-
const prevDepsRef = useRef(void 0);
|
|
7
|
-
const memoizedCondition = useCallback(condition, deps);
|
|
8
|
-
if (deps.length === 0) {
|
|
9
|
-
console.warn(
|
|
10
|
-
"useConditionalEffect received an empty dependency array. This may indicate missing dependencies and could lead to unexpected behavior."
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
const shouldRun = memoizedCondition(prevDepsRef.current, deps);
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
if (shouldRun) {
|
|
16
|
-
const cleanup = effect();
|
|
17
|
-
prevDepsRef.current = deps;
|
|
18
|
-
return cleanup;
|
|
19
|
-
}
|
|
20
|
-
prevDepsRef.current = deps;
|
|
21
|
-
}, deps);
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
useConditionalEffect
|
|
25
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/hooks/useControlledState/useControlledState.ts
|
|
4
|
-
import { useCallback, useState } from "react";
|
|
5
|
-
function useControlledState({
|
|
6
|
-
value: valueProp,
|
|
7
|
-
defaultValue,
|
|
8
|
-
onChange,
|
|
9
|
-
equalityFn = Object.is
|
|
10
|
-
}) {
|
|
11
|
-
const [uncontrolledState, setUncontrolledState] = useState(defaultValue);
|
|
12
|
-
const controlled = valueProp !== void 0;
|
|
13
|
-
const value = controlled ? valueProp : uncontrolledState;
|
|
14
|
-
const setValue = useCallback(
|
|
15
|
-
(next) => {
|
|
16
|
-
const nextValue = isSetStateAction(next) ? next(value) : next;
|
|
17
|
-
if (equalityFn(value, nextValue) === true) return;
|
|
18
|
-
if (controlled === false) setUncontrolledState(nextValue);
|
|
19
|
-
if (controlled === true && nextValue === void 0) setUncontrolledState(nextValue);
|
|
20
|
-
onChange?.(nextValue);
|
|
21
|
-
},
|
|
22
|
-
[controlled, onChange, equalityFn, value]
|
|
23
|
-
);
|
|
24
|
-
return [value, setValue];
|
|
25
|
-
}
|
|
26
|
-
function isSetStateAction(next) {
|
|
27
|
-
return typeof next === "function";
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
useControlledState
|
|
31
|
-
};
|