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,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/useBooleanState/index.ts
|
|
22
|
-
var useBooleanState_exports = {};
|
|
23
|
-
__export(useBooleanState_exports, {
|
|
24
|
-
useBooleanState: () => useBooleanState
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useBooleanState_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useBooleanState/useBooleanState.ts
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
function useBooleanState(defaultValue = false) {
|
|
31
|
-
const [bool, setBool] = (0, import_react.useState)(defaultValue);
|
|
32
|
-
const setTrue = (0, import_react.useCallback)(() => {
|
|
33
|
-
setBool(true);
|
|
34
|
-
}, []);
|
|
35
|
-
const setFalse = (0, import_react.useCallback)(() => {
|
|
36
|
-
setBool(false);
|
|
37
|
-
}, []);
|
|
38
|
-
const toggle = (0, import_react.useCallback)(() => {
|
|
39
|
-
setBool((prevBool) => !prevBool);
|
|
40
|
-
}, []);
|
|
41
|
-
return [bool, setTrue, setFalse, toggle];
|
|
42
|
-
}
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
useBooleanState
|
|
46
|
-
});
|
|
@@ -1,63 +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/useCallbackOncePerRender/index.ts
|
|
22
|
-
var useCallbackOncePerRender_exports = {};
|
|
23
|
-
__export(useCallbackOncePerRender_exports, {
|
|
24
|
-
useCallbackOncePerRender: () => useCallbackOncePerRender
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useCallbackOncePerRender_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useCallbackOncePerRender/useCallbackOncePerRender.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/useCallbackOncePerRender/useCallbackOncePerRender.ts
|
|
47
|
-
function useCallbackOncePerRender(callback, deps) {
|
|
48
|
-
const hasFired = (0, import_react2.useRef)(false);
|
|
49
|
-
(0, import_react2.useEffect)(() => {
|
|
50
|
-
hasFired.current = false;
|
|
51
|
-
}, deps);
|
|
52
|
-
return usePreservedCallback((...args) => {
|
|
53
|
-
if (hasFired.current) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
callback(...args);
|
|
57
|
-
hasFired.current = true;
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
-
0 && (module.exports = {
|
|
62
|
-
useCallbackOncePerRender
|
|
63
|
-
});
|
|
@@ -1,51 +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/useConditionalEffect/index.ts
|
|
22
|
-
var useConditionalEffect_exports = {};
|
|
23
|
-
__export(useConditionalEffect_exports, {
|
|
24
|
-
useConditionalEffect: () => useConditionalEffect
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useConditionalEffect_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useConditionalEffect/useConditionalEffect.ts
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
function useConditionalEffect(effect, deps, condition) {
|
|
31
|
-
const prevDepsRef = (0, import_react.useRef)(void 0);
|
|
32
|
-
const memoizedCondition = (0, import_react.useCallback)(condition, deps);
|
|
33
|
-
if (deps.length === 0) {
|
|
34
|
-
console.warn(
|
|
35
|
-
"useConditionalEffect received an empty dependency array. This may indicate missing dependencies and could lead to unexpected behavior."
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
const shouldRun = memoizedCondition(prevDepsRef.current, deps);
|
|
39
|
-
(0, import_react.useEffect)(() => {
|
|
40
|
-
if (shouldRun) {
|
|
41
|
-
const cleanup = effect();
|
|
42
|
-
prevDepsRef.current = deps;
|
|
43
|
-
return cleanup;
|
|
44
|
-
}
|
|
45
|
-
prevDepsRef.current = deps;
|
|
46
|
-
}, deps);
|
|
47
|
-
}
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
useConditionalEffect
|
|
51
|
-
});
|
|
@@ -1,57 +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/useControlledState/index.ts
|
|
22
|
-
var useControlledState_exports = {};
|
|
23
|
-
__export(useControlledState_exports, {
|
|
24
|
-
useControlledState: () => useControlledState
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useControlledState_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useControlledState/useControlledState.ts
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
function useControlledState({
|
|
31
|
-
value: valueProp,
|
|
32
|
-
defaultValue,
|
|
33
|
-
onChange,
|
|
34
|
-
equalityFn = Object.is
|
|
35
|
-
}) {
|
|
36
|
-
const [uncontrolledState, setUncontrolledState] = (0, import_react.useState)(defaultValue);
|
|
37
|
-
const controlled = valueProp !== void 0;
|
|
38
|
-
const value = controlled ? valueProp : uncontrolledState;
|
|
39
|
-
const setValue = (0, import_react.useCallback)(
|
|
40
|
-
(next) => {
|
|
41
|
-
const nextValue = isSetStateAction(next) ? next(value) : next;
|
|
42
|
-
if (equalityFn(value, nextValue) === true) return;
|
|
43
|
-
if (controlled === false) setUncontrolledState(nextValue);
|
|
44
|
-
if (controlled === true && nextValue === void 0) setUncontrolledState(nextValue);
|
|
45
|
-
onChange?.(nextValue);
|
|
46
|
-
},
|
|
47
|
-
[controlled, onChange, equalityFn, value]
|
|
48
|
-
);
|
|
49
|
-
return [value, setValue];
|
|
50
|
-
}
|
|
51
|
-
function isSetStateAction(next) {
|
|
52
|
-
return typeof next === "function";
|
|
53
|
-
}
|
|
54
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
-
0 && (module.exports = {
|
|
56
|
-
useControlledState
|
|
57
|
-
});
|
|
@@ -1,70 +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/useCounter/index.ts
|
|
22
|
-
var useCounter_exports = {};
|
|
23
|
-
__export(useCounter_exports, {
|
|
24
|
-
useCounter: () => useCounter
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useCounter_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useCounter/useCounter.ts
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
var validateValue = (value, { min, max }) => {
|
|
31
|
-
if (min !== void 0 && value < min) {
|
|
32
|
-
return min;
|
|
33
|
-
}
|
|
34
|
-
if (max !== void 0 && value > max) {
|
|
35
|
-
return max;
|
|
36
|
-
}
|
|
37
|
-
return value;
|
|
38
|
-
};
|
|
39
|
-
function useCounter(initialValue = 0, { min, max, step = 1 } = {}) {
|
|
40
|
-
const [count, setCountState] = (0, import_react.useState)(() => validateValue(initialValue, { min, max }));
|
|
41
|
-
const setCount = (0, import_react.useCallback)(
|
|
42
|
-
(value) => {
|
|
43
|
-
setCountState((prev) => {
|
|
44
|
-
const nextValue = typeof value === "function" ? value(prev) : value;
|
|
45
|
-
return validateValue(nextValue, { min, max });
|
|
46
|
-
});
|
|
47
|
-
},
|
|
48
|
-
[min, max]
|
|
49
|
-
);
|
|
50
|
-
const increment = (0, import_react.useCallback)(() => {
|
|
51
|
-
setCount((prev) => prev + step);
|
|
52
|
-
}, [setCount, step]);
|
|
53
|
-
const decrement = (0, import_react.useCallback)(() => {
|
|
54
|
-
setCount((prev) => prev - step);
|
|
55
|
-
}, [setCount, step]);
|
|
56
|
-
const reset = (0, import_react.useCallback)(() => {
|
|
57
|
-
setCount(initialValue);
|
|
58
|
-
}, [setCount, initialValue]);
|
|
59
|
-
return {
|
|
60
|
-
count,
|
|
61
|
-
increment,
|
|
62
|
-
decrement,
|
|
63
|
-
reset,
|
|
64
|
-
setCount
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
-
0 && (module.exports = {
|
|
69
|
-
useCounter
|
|
70
|
-
});
|
|
@@ -1,130 +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/useDebounce/index.ts
|
|
22
|
-
var useDebounce_exports = {};
|
|
23
|
-
__export(useDebounce_exports, {
|
|
24
|
-
useDebounce: () => useDebounce
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useDebounce_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useDebounce/useDebounce.ts
|
|
29
|
-
var import_react2 = require("react");
|
|
30
|
-
var import_react3 = require("react");
|
|
31
|
-
|
|
32
|
-
// src/hooks/usePreservedCallback/usePreservedCallback.ts
|
|
33
|
-
var import_react = require("react");
|
|
34
|
-
function usePreservedCallback(callback) {
|
|
35
|
-
const callbackRef = (0, import_react.useRef)(callback);
|
|
36
|
-
(0, import_react.useEffect)(
|
|
37
|
-
function syncCallbackRef() {
|
|
38
|
-
callbackRef.current = callback;
|
|
39
|
-
},
|
|
40
|
-
[callback]
|
|
41
|
-
);
|
|
42
|
-
return (0, import_react.useCallback)((...args) => {
|
|
43
|
-
return callbackRef.current(...args);
|
|
44
|
-
}, []);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// src/hooks/useDebounce/debounce.ts
|
|
48
|
-
function debounce(func, debounceMs, { edges = ["leading", "trailing"] } = {}) {
|
|
49
|
-
let pendingThis = void 0;
|
|
50
|
-
let pendingArgs = null;
|
|
51
|
-
const leading = edges != null && edges.includes("leading");
|
|
52
|
-
const trailing = edges == null || edges.includes("trailing");
|
|
53
|
-
const invoke = () => {
|
|
54
|
-
if (pendingArgs !== null) {
|
|
55
|
-
func.apply(pendingThis, pendingArgs);
|
|
56
|
-
pendingThis = void 0;
|
|
57
|
-
pendingArgs = null;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const onTimerEnd = () => {
|
|
61
|
-
if (trailing) {
|
|
62
|
-
invoke();
|
|
63
|
-
}
|
|
64
|
-
cancel();
|
|
65
|
-
};
|
|
66
|
-
let timeoutId = null;
|
|
67
|
-
const schedule = () => {
|
|
68
|
-
if (timeoutId != null) {
|
|
69
|
-
clearTimeout(timeoutId);
|
|
70
|
-
}
|
|
71
|
-
timeoutId = setTimeout(() => {
|
|
72
|
-
timeoutId = null;
|
|
73
|
-
onTimerEnd();
|
|
74
|
-
}, debounceMs);
|
|
75
|
-
};
|
|
76
|
-
const cancelTimer = () => {
|
|
77
|
-
if (timeoutId !== null) {
|
|
78
|
-
clearTimeout(timeoutId);
|
|
79
|
-
timeoutId = null;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
const cancel = () => {
|
|
83
|
-
cancelTimer();
|
|
84
|
-
pendingThis = void 0;
|
|
85
|
-
pendingArgs = null;
|
|
86
|
-
};
|
|
87
|
-
const debounced = function(...args) {
|
|
88
|
-
pendingThis = this;
|
|
89
|
-
pendingArgs = args;
|
|
90
|
-
const isFirstCall = timeoutId == null;
|
|
91
|
-
schedule();
|
|
92
|
-
if (leading && isFirstCall) {
|
|
93
|
-
invoke();
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
debounced.cancel = cancel;
|
|
97
|
-
return debounced;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// src/hooks/useDebounce/useDebounce.ts
|
|
101
|
-
function useDebounce(callback, wait, options = {}) {
|
|
102
|
-
const preservedCallback = usePreservedCallback(callback);
|
|
103
|
-
const { leading = false, trailing = true } = options;
|
|
104
|
-
const edges = (0, import_react3.useMemo)(() => {
|
|
105
|
-
const _edges = [];
|
|
106
|
-
if (leading) {
|
|
107
|
-
_edges.push("leading");
|
|
108
|
-
}
|
|
109
|
-
if (trailing) {
|
|
110
|
-
_edges.push("trailing");
|
|
111
|
-
}
|
|
112
|
-
return _edges;
|
|
113
|
-
}, [leading, trailing]);
|
|
114
|
-
const debounced = (0, import_react3.useMemo)(() => {
|
|
115
|
-
return debounce(preservedCallback, wait, { edges });
|
|
116
|
-
}, [preservedCallback, wait, edges]);
|
|
117
|
-
(0, import_react2.useEffect)(
|
|
118
|
-
function cancelDebouncedOnUnmount() {
|
|
119
|
-
return () => {
|
|
120
|
-
debounced.cancel();
|
|
121
|
-
};
|
|
122
|
-
},
|
|
123
|
-
[debounced]
|
|
124
|
-
);
|
|
125
|
-
return debounced;
|
|
126
|
-
}
|
|
127
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
128
|
-
0 && (module.exports = {
|
|
129
|
-
useDebounce
|
|
130
|
-
});
|
|
@@ -1,148 +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/useDebouncedCallback/index.ts
|
|
22
|
-
var useDebouncedCallback_exports = {};
|
|
23
|
-
__export(useDebouncedCallback_exports, {
|
|
24
|
-
useDebouncedCallback: () => useDebouncedCallback
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useDebouncedCallback_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useDebouncedCallback/useDebouncedCallback.ts
|
|
29
|
-
var import_react2 = require("react");
|
|
30
|
-
|
|
31
|
-
// src/hooks/useDebounce/debounce.ts
|
|
32
|
-
function debounce(func, debounceMs, { edges = ["leading", "trailing"] } = {}) {
|
|
33
|
-
let pendingThis = void 0;
|
|
34
|
-
let pendingArgs = null;
|
|
35
|
-
const leading = edges != null && edges.includes("leading");
|
|
36
|
-
const trailing = edges == null || edges.includes("trailing");
|
|
37
|
-
const invoke = () => {
|
|
38
|
-
if (pendingArgs !== null) {
|
|
39
|
-
func.apply(pendingThis, pendingArgs);
|
|
40
|
-
pendingThis = void 0;
|
|
41
|
-
pendingArgs = null;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const onTimerEnd = () => {
|
|
45
|
-
if (trailing) {
|
|
46
|
-
invoke();
|
|
47
|
-
}
|
|
48
|
-
cancel();
|
|
49
|
-
};
|
|
50
|
-
let timeoutId = null;
|
|
51
|
-
const schedule = () => {
|
|
52
|
-
if (timeoutId != null) {
|
|
53
|
-
clearTimeout(timeoutId);
|
|
54
|
-
}
|
|
55
|
-
timeoutId = setTimeout(() => {
|
|
56
|
-
timeoutId = null;
|
|
57
|
-
onTimerEnd();
|
|
58
|
-
}, debounceMs);
|
|
59
|
-
};
|
|
60
|
-
const cancelTimer = () => {
|
|
61
|
-
if (timeoutId !== null) {
|
|
62
|
-
clearTimeout(timeoutId);
|
|
63
|
-
timeoutId = null;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const cancel = () => {
|
|
67
|
-
cancelTimer();
|
|
68
|
-
pendingThis = void 0;
|
|
69
|
-
pendingArgs = null;
|
|
70
|
-
};
|
|
71
|
-
const debounced = function(...args) {
|
|
72
|
-
pendingThis = this;
|
|
73
|
-
pendingArgs = args;
|
|
74
|
-
const isFirstCall = timeoutId == null;
|
|
75
|
-
schedule();
|
|
76
|
-
if (leading && isFirstCall) {
|
|
77
|
-
invoke();
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
debounced.cancel = cancel;
|
|
81
|
-
return debounced;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// src/hooks/usePreservedCallback/usePreservedCallback.ts
|
|
85
|
-
var import_react = require("react");
|
|
86
|
-
function usePreservedCallback(callback) {
|
|
87
|
-
const callbackRef = (0, import_react.useRef)(callback);
|
|
88
|
-
(0, import_react.useEffect)(
|
|
89
|
-
function syncCallbackRef() {
|
|
90
|
-
callbackRef.current = callback;
|
|
91
|
-
},
|
|
92
|
-
[callback]
|
|
93
|
-
);
|
|
94
|
-
return (0, import_react.useCallback)((...args) => {
|
|
95
|
-
return callbackRef.current(...args);
|
|
96
|
-
}, []);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// src/hooks/useDebouncedCallback/useDebouncedCallback.ts
|
|
100
|
-
function useDebouncedCallback({
|
|
101
|
-
onChange,
|
|
102
|
-
timeThreshold,
|
|
103
|
-
leading = false,
|
|
104
|
-
trailing = true
|
|
105
|
-
}) {
|
|
106
|
-
const handleChange = usePreservedCallback(onChange);
|
|
107
|
-
const ref = (0, import_react2.useRef)({ value: false, clearPreviousDebounce: () => {
|
|
108
|
-
} });
|
|
109
|
-
(0, import_react2.useEffect)(function clearDebouncedOnUnmount() {
|
|
110
|
-
const current = ref.current;
|
|
111
|
-
return () => {
|
|
112
|
-
current.clearPreviousDebounce();
|
|
113
|
-
};
|
|
114
|
-
}, []);
|
|
115
|
-
const edges = (0, import_react2.useMemo)(() => {
|
|
116
|
-
const _edges = [];
|
|
117
|
-
if (leading) {
|
|
118
|
-
_edges.push("leading");
|
|
119
|
-
}
|
|
120
|
-
if (trailing) {
|
|
121
|
-
_edges.push("trailing");
|
|
122
|
-
}
|
|
123
|
-
return _edges;
|
|
124
|
-
}, [leading, trailing]);
|
|
125
|
-
return (0, import_react2.useCallback)(
|
|
126
|
-
(nextValue) => {
|
|
127
|
-
if (nextValue === ref.current.value) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
const debounced = debounce(
|
|
131
|
-
() => {
|
|
132
|
-
handleChange(nextValue);
|
|
133
|
-
ref.current.value = nextValue;
|
|
134
|
-
},
|
|
135
|
-
timeThreshold,
|
|
136
|
-
{ edges }
|
|
137
|
-
);
|
|
138
|
-
ref.current.clearPreviousDebounce();
|
|
139
|
-
debounced();
|
|
140
|
-
ref.current.clearPreviousDebounce = debounced.cancel;
|
|
141
|
-
},
|
|
142
|
-
[handleChange, timeThreshold, edges]
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
146
|
-
0 && (module.exports = {
|
|
147
|
-
useDebouncedCallback
|
|
148
|
-
});
|
|
@@ -1,79 +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/useDoubleClick/index.ts
|
|
22
|
-
var useDoubleClick_exports = {};
|
|
23
|
-
__export(useDoubleClick_exports, {
|
|
24
|
-
useDoubleClick: () => useDoubleClick
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(useDoubleClick_exports);
|
|
27
|
-
|
|
28
|
-
// src/hooks/useDoubleClick/useDoubleClick.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/useDoubleClick/useDoubleClick.ts
|
|
47
|
-
function useDoubleClick({
|
|
48
|
-
delay = 250,
|
|
49
|
-
click,
|
|
50
|
-
doubleClick
|
|
51
|
-
}) {
|
|
52
|
-
const clickTimeout = (0, import_react2.useRef)(null);
|
|
53
|
-
const clearClickTimeout = usePreservedCallback(() => {
|
|
54
|
-
if (clickTimeout.current != null) {
|
|
55
|
-
window.clearTimeout(clickTimeout.current);
|
|
56
|
-
clickTimeout.current = null;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
(0, import_react2.useEffect)(() => () => clearClickTimeout(), [clearClickTimeout]);
|
|
60
|
-
const handleEvent = (0, import_react2.useCallback)(
|
|
61
|
-
(event) => {
|
|
62
|
-
clearClickTimeout();
|
|
63
|
-
if (click && event.detail === 1) {
|
|
64
|
-
clickTimeout.current = window.setTimeout(() => {
|
|
65
|
-
click(event);
|
|
66
|
-
}, delay);
|
|
67
|
-
}
|
|
68
|
-
if (event.detail === 2) {
|
|
69
|
-
doubleClick(event);
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
[click, doubleClick, delay, clearClickTimeout]
|
|
73
|
-
);
|
|
74
|
-
return handleEvent;
|
|
75
|
-
}
|
|
76
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
-
0 && (module.exports = {
|
|
78
|
-
useDoubleClick
|
|
79
|
-
});
|