@slango/reazione 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintcache +1 -0
- package/.turbo/turbo-build$colon$check.log +2 -0
- package/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-lint.log +2 -0
- package/.turbo/turbo-test.log +64 -0
- package/CHANGELOG.md +7 -0
- package/LICENSE +201 -0
- package/README.md +51 -0
- package/dist/hooks/useClickOutside.d.ts +3 -0
- package/dist/hooks/useClickOutside.d.ts.map +1 -0
- package/dist/hooks/useClickOutside.js +18 -0
- package/dist/hooks/useClickOutside.js.map +1 -0
- package/dist/hooks/useClientValue.d.ts +7 -0
- package/dist/hooks/useClientValue.d.ts.map +1 -0
- package/dist/hooks/useClientValue.js +11 -0
- package/dist/hooks/useClientValue.js.map +1 -0
- package/dist/hooks/useDebouncedCallback.d.ts +6 -0
- package/dist/hooks/useDebouncedCallback.d.ts.map +1 -0
- package/dist/hooks/useDebouncedCallback.js +15 -0
- package/dist/hooks/useDebouncedCallback.js.map +1 -0
- package/dist/hooks/useMounted.d.ts +2 -0
- package/dist/hooks/useMounted.d.ts.map +1 -0
- package/dist/hooks/useMounted.js +10 -0
- package/dist/hooks/useMounted.js.map +1 -0
- package/dist/hooks/usePreventScrolling.d.ts +3 -0
- package/dist/hooks/usePreventScrolling.d.ts.map +1 -0
- package/dist/hooks/usePreventScrolling.js +24 -0
- package/dist/hooks/usePreventScrolling.js.map +1 -0
- package/dist/hooks/useScrollEdge.d.ts +16 -0
- package/dist/hooks/useScrollEdge.d.ts.map +1 -0
- package/dist/hooks/useScrollEdge.js +34 -0
- package/dist/hooks/useScrollEdge.js.map +1 -0
- package/eslint.config.js +1 -0
- package/lint-staged.config.js +1 -0
- package/package.json +48 -0
- package/src/hooks/useClickOutside.spec.ts +52 -0
- package/src/hooks/useClickOutside.ts +29 -0
- package/src/hooks/useClientValue.spec.ts +39 -0
- package/src/hooks/useClientValue.ts +28 -0
- package/src/hooks/useDebouncedCallback.spec.ts +65 -0
- package/src/hooks/useDebouncedCallback.ts +36 -0
- package/src/hooks/useMounted.spec.ts +20 -0
- package/src/hooks/useMounted.ts +17 -0
- package/src/hooks/usePreventScrolling.spec.ts +76 -0
- package/src/hooks/usePreventScrolling.ts +30 -0
- package/src/hooks/useScrollEdge.spec.ts +110 -0
- package/src/hooks/useScrollEdge.ts +61 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +11 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vitest.config.js +1 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { useClickOutside } from './useClickOutside.js';
|
|
5
|
+
|
|
6
|
+
const mouseDown = (target: Node) => {
|
|
7
|
+
const event = new MouseEvent('mousedown', { bubbles: true });
|
|
8
|
+
target.dispatchEvent(event);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
describe('useClickOutside', () => {
|
|
12
|
+
it('fires when clicking outside the element', () => {
|
|
13
|
+
const element = document.createElement('div');
|
|
14
|
+
document.body.appendChild(element);
|
|
15
|
+
const onOutside = vi.fn();
|
|
16
|
+
|
|
17
|
+
renderHook(() => useClickOutside({ current: element }, onOutside));
|
|
18
|
+
mouseDown(document.body);
|
|
19
|
+
|
|
20
|
+
expect(onOutside).toHaveBeenCalledTimes(1);
|
|
21
|
+
element.remove();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('does not fire when clicking inside the element', () => {
|
|
25
|
+
const element = document.createElement('div');
|
|
26
|
+
const child = document.createElement('span');
|
|
27
|
+
element.appendChild(child);
|
|
28
|
+
document.body.appendChild(element);
|
|
29
|
+
const onOutside = vi.fn();
|
|
30
|
+
|
|
31
|
+
renderHook(() => useClickOutside({ current: element }, onOutside));
|
|
32
|
+
mouseDown(child);
|
|
33
|
+
|
|
34
|
+
expect(onOutside).not.toHaveBeenCalled();
|
|
35
|
+
element.remove();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('does nothing while inactive and unsubscribes on unmount', () => {
|
|
39
|
+
const element = document.createElement('div');
|
|
40
|
+
document.body.appendChild(element);
|
|
41
|
+
const onOutside = vi.fn();
|
|
42
|
+
|
|
43
|
+
const { unmount } = renderHook(() => useClickOutside({ current: element }, onOutside, false));
|
|
44
|
+
mouseDown(document.body);
|
|
45
|
+
expect(onOutside).not.toHaveBeenCalled();
|
|
46
|
+
|
|
47
|
+
unmount();
|
|
48
|
+
mouseDown(document.body);
|
|
49
|
+
expect(onOutside).not.toHaveBeenCalled();
|
|
50
|
+
element.remove();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { RefObject } from 'react';
|
|
4
|
+
|
|
5
|
+
import { useEffect, useRef } from 'react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Invokes `onOutside` when a mousedown lands outside the referenced element.
|
|
9
|
+
* The handler is kept fresh without re-subscribing the document listener.
|
|
10
|
+
*/
|
|
11
|
+
export const useClickOutside = (
|
|
12
|
+
ref: RefObject<HTMLElement | null>,
|
|
13
|
+
onOutside: () => void,
|
|
14
|
+
active = true,
|
|
15
|
+
): void => {
|
|
16
|
+
const onOutsideRef = useRef(onOutside);
|
|
17
|
+
onOutsideRef.current = onOutside;
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!active) return;
|
|
21
|
+
const handleClick = (event: MouseEvent) => {
|
|
22
|
+
if (ref.current && !ref.current.contains(event.target as Node)) {
|
|
23
|
+
onOutsideRef.current();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
document.addEventListener('mousedown', handleClick);
|
|
27
|
+
return () => document.removeEventListener('mousedown', handleClick);
|
|
28
|
+
}, [ref, active]);
|
|
29
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { useClientValue } from './useClientValue.js';
|
|
5
|
+
|
|
6
|
+
describe('useClientValue', () => {
|
|
7
|
+
it('resolves the initializer value after mount', () => {
|
|
8
|
+
const { result } = renderHook(() => useClientValue(() => 'client', { initialValue: 'server' }));
|
|
9
|
+
|
|
10
|
+
expect(result.current).toBe('client');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('re-runs the initializer when deps change', () => {
|
|
14
|
+
const initializer = vi.fn((suffix: string) => `value-${suffix}`);
|
|
15
|
+
const { result, rerender } = renderHook(
|
|
16
|
+
({ suffix }) =>
|
|
17
|
+
useClientValue(() => initializer(suffix), { deps: [suffix], initialValue: '' }),
|
|
18
|
+
{ initialProps: { suffix: 'a' } },
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
expect(result.current).toBe('value-a');
|
|
22
|
+
|
|
23
|
+
rerender({ suffix: 'b' });
|
|
24
|
+
|
|
25
|
+
expect(result.current).toBe('value-b');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('does not re-run the initializer when deps are stable', () => {
|
|
29
|
+
const initializer = vi.fn(() => 42);
|
|
30
|
+
const { rerender } = renderHook(() =>
|
|
31
|
+
useClientValue(initializer, { deps: ['fixed'], initialValue: 0 }),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
rerender();
|
|
35
|
+
rerender();
|
|
36
|
+
|
|
37
|
+
expect(initializer).toHaveBeenCalledTimes(1);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
type Options<T> = {
|
|
6
|
+
deps?: unknown[];
|
|
7
|
+
initialValue: T;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Renders `initialValue` on the server/hydration pass, then resolves the
|
|
12
|
+
* value with `initializer` on the client (re-running when `deps` change).
|
|
13
|
+
* Avoids hydration mismatches for values that only exist client-side.
|
|
14
|
+
*/
|
|
15
|
+
export function useClientValue<T>(
|
|
16
|
+
initializer: () => T,
|
|
17
|
+
{ deps = [], initialValue }: Options<T>,
|
|
18
|
+
): T {
|
|
19
|
+
const [value, setValue] = useState<T>(initialValue);
|
|
20
|
+
|
|
21
|
+
const memoizedInitializer = useMemo(() => initializer, deps);
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
setValue(memoizedInitializer());
|
|
25
|
+
}, [memoizedInitializer]);
|
|
26
|
+
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { useDebouncedCallback } from './useDebouncedCallback.js';
|
|
5
|
+
|
|
6
|
+
describe('useDebouncedCallback', () => {
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
vi.useFakeTimers();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
vi.useRealTimers();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('invokes the callback once after the delay with the last arguments', () => {
|
|
16
|
+
const callback = vi.fn();
|
|
17
|
+
const { result } = renderHook(() => useDebouncedCallback(callback, 100));
|
|
18
|
+
|
|
19
|
+
result.current.run('a');
|
|
20
|
+
result.current.run('b');
|
|
21
|
+
vi.advanceTimersByTime(99);
|
|
22
|
+
expect(callback).not.toHaveBeenCalled();
|
|
23
|
+
|
|
24
|
+
vi.advanceTimersByTime(1);
|
|
25
|
+
expect(callback).toHaveBeenCalledTimes(1);
|
|
26
|
+
expect(callback).toHaveBeenCalledWith('b');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('always invokes the latest callback', () => {
|
|
30
|
+
const first = vi.fn();
|
|
31
|
+
const second = vi.fn();
|
|
32
|
+
const { result, rerender } = renderHook(({ cb }) => useDebouncedCallback(cb, 100), {
|
|
33
|
+
initialProps: { cb: first },
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
result.current.run('a');
|
|
37
|
+
rerender({ cb: second });
|
|
38
|
+
vi.advanceTimersByTime(100);
|
|
39
|
+
|
|
40
|
+
expect(first).not.toHaveBeenCalled();
|
|
41
|
+
expect(second).toHaveBeenCalledWith('a');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('cancel prevents a pending invocation', () => {
|
|
45
|
+
const callback = vi.fn();
|
|
46
|
+
const { result } = renderHook(() => useDebouncedCallback(callback, 100));
|
|
47
|
+
|
|
48
|
+
result.current.run('a');
|
|
49
|
+
result.current.cancel();
|
|
50
|
+
vi.advanceTimersByTime(200);
|
|
51
|
+
|
|
52
|
+
expect(callback).not.toHaveBeenCalled();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('cleans up the timer on unmount', () => {
|
|
56
|
+
const callback = vi.fn();
|
|
57
|
+
const { result, unmount } = renderHook(() => useDebouncedCallback(callback, 100));
|
|
58
|
+
|
|
59
|
+
result.current.run('a');
|
|
60
|
+
unmount();
|
|
61
|
+
vi.advanceTimersByTime(200);
|
|
62
|
+
|
|
63
|
+
expect(callback).not.toHaveBeenCalled();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
4
|
+
|
|
5
|
+
export type DebouncedCallback<Args extends unknown[]> = {
|
|
6
|
+
run: (...args: Args) => void;
|
|
7
|
+
cancel: () => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns a debounced wrapper around the latest `callback` plus a `cancel`
|
|
12
|
+
* for flushing pending invocations (e.g. when clearing an input). The timer
|
|
13
|
+
* is cleaned up on unmount and `run`/`cancel` have stable identities.
|
|
14
|
+
*/
|
|
15
|
+
export const useDebouncedCallback = <Args extends unknown[]>(
|
|
16
|
+
callback: (...args: Args) => void,
|
|
17
|
+
delayMs: number,
|
|
18
|
+
): DebouncedCallback<Args> => {
|
|
19
|
+
const timeoutRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
20
|
+
const callbackRef = useRef(callback);
|
|
21
|
+
callbackRef.current = callback;
|
|
22
|
+
|
|
23
|
+
useEffect(() => () => clearTimeout(timeoutRef.current), []);
|
|
24
|
+
|
|
25
|
+
const cancel = useCallback(() => clearTimeout(timeoutRef.current), []);
|
|
26
|
+
|
|
27
|
+
const run = useCallback(
|
|
28
|
+
(...args: Args) => {
|
|
29
|
+
clearTimeout(timeoutRef.current);
|
|
30
|
+
timeoutRef.current = setTimeout(() => callbackRef.current(...args), delayMs);
|
|
31
|
+
},
|
|
32
|
+
[delayMs],
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return { run, cancel };
|
|
36
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { useMounted } from './useMounted.js';
|
|
5
|
+
|
|
6
|
+
describe('useMounted', () => {
|
|
7
|
+
it('returns true once mounted', () => {
|
|
8
|
+
const { result } = renderHook(() => useMounted());
|
|
9
|
+
|
|
10
|
+
expect(result.current).toBe(true);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('stays true across rerenders', () => {
|
|
14
|
+
const { result, rerender } = renderHook(() => useMounted());
|
|
15
|
+
|
|
16
|
+
rerender();
|
|
17
|
+
|
|
18
|
+
expect(result.current).toBe(true);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns false during SSR/hydration and true after the component mounts.
|
|
7
|
+
* Useful for gating client-only rendering.
|
|
8
|
+
*/
|
|
9
|
+
export const useMounted = (): boolean => {
|
|
10
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
setIsMounted(true);
|
|
14
|
+
}, []);
|
|
15
|
+
|
|
16
|
+
return isMounted;
|
|
17
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { SCROLLBAR_WIDTH_VAR, usePreventScrolling } from './usePreventScrolling.js';
|
|
5
|
+
|
|
6
|
+
describe('usePreventScrolling', () => {
|
|
7
|
+
const html = document.documentElement;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
html.style.overflow = '';
|
|
11
|
+
html.style.paddingRight = '';
|
|
12
|
+
html.style.removeProperty(SCROLLBAR_WIDTH_VAR);
|
|
13
|
+
vi.restoreAllMocks();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('sets html overflow to hidden when active', () => {
|
|
17
|
+
renderHook(() => usePreventScrolling());
|
|
18
|
+
|
|
19
|
+
expect(html.style.overflow).toBe('hidden');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('restores previous overflow on unmount', () => {
|
|
23
|
+
html.style.overflow = 'auto';
|
|
24
|
+
|
|
25
|
+
const { unmount } = renderHook(() => usePreventScrolling());
|
|
26
|
+
|
|
27
|
+
expect(html.style.overflow).toBe('hidden');
|
|
28
|
+
|
|
29
|
+
unmount();
|
|
30
|
+
|
|
31
|
+
expect(html.style.overflow).toBe('auto');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('does not modify overflow when active is false', () => {
|
|
35
|
+
html.style.overflow = 'scroll';
|
|
36
|
+
|
|
37
|
+
renderHook(() => usePreventScrolling(false));
|
|
38
|
+
|
|
39
|
+
expect(html.style.overflow).toBe('scroll');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('compensates for scrollbar width with paddingRight', () => {
|
|
43
|
+
vi.spyOn(html, 'clientWidth', 'get').mockReturnValue(984);
|
|
44
|
+
vi.spyOn(window, 'innerWidth', 'get').mockReturnValue(1000);
|
|
45
|
+
|
|
46
|
+
renderHook(() => usePreventScrolling());
|
|
47
|
+
|
|
48
|
+
expect(html.style.paddingRight).toBe('16px');
|
|
49
|
+
expect(html.style.getPropertyValue(SCROLLBAR_WIDTH_VAR)).toBe('16px');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('restores previous paddingRight and removes the CSS variable on unmount', () => {
|
|
53
|
+
vi.spyOn(html, 'clientWidth', 'get').mockReturnValue(984);
|
|
54
|
+
vi.spyOn(window, 'innerWidth', 'get').mockReturnValue(1000);
|
|
55
|
+
html.style.paddingRight = '8px';
|
|
56
|
+
|
|
57
|
+
const { unmount } = renderHook(() => usePreventScrolling());
|
|
58
|
+
|
|
59
|
+
expect(html.style.paddingRight).toBe('16px');
|
|
60
|
+
|
|
61
|
+
unmount();
|
|
62
|
+
|
|
63
|
+
expect(html.style.paddingRight).toBe('8px');
|
|
64
|
+
expect(html.style.getPropertyValue(SCROLLBAR_WIDTH_VAR)).toBe('');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('does not set paddingRight or the CSS variable when there is no scrollbar', () => {
|
|
68
|
+
vi.spyOn(html, 'clientWidth', 'get').mockReturnValue(1000);
|
|
69
|
+
vi.spyOn(window, 'innerWidth', 'get').mockReturnValue(1000);
|
|
70
|
+
|
|
71
|
+
renderHook(() => usePreventScrolling());
|
|
72
|
+
|
|
73
|
+
expect(html.style.paddingRight).toBe('');
|
|
74
|
+
expect(html.style.getPropertyValue(SCROLLBAR_WIDTH_VAR)).toBe('');
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
|
|
5
|
+
export const SCROLLBAR_WIDTH_VAR = '--scrollbar-width';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Locks background scroll, padding the document to compensate for the removed
|
|
9
|
+
* scrollbar so the layout doesn't shift. The scrollbar width is also exposed
|
|
10
|
+
* as a CSS variable for fixed-position elements that need the same offset.
|
|
11
|
+
*/
|
|
12
|
+
export const usePreventScrolling = (active = true): void => {
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!active) return;
|
|
15
|
+
const html = document.documentElement;
|
|
16
|
+
const scrollbarWidth = window.innerWidth - html.clientWidth;
|
|
17
|
+
const previousOverflow = html.style.overflow;
|
|
18
|
+
const previousPaddingRight = html.style.paddingRight;
|
|
19
|
+
html.style.overflow = 'hidden';
|
|
20
|
+
if (scrollbarWidth > 0) {
|
|
21
|
+
html.style.paddingRight = `${scrollbarWidth}px`;
|
|
22
|
+
html.style.setProperty(SCROLLBAR_WIDTH_VAR, `${scrollbarWidth}px`);
|
|
23
|
+
}
|
|
24
|
+
return () => {
|
|
25
|
+
html.style.overflow = previousOverflow;
|
|
26
|
+
html.style.paddingRight = previousPaddingRight;
|
|
27
|
+
html.style.removeProperty(SCROLLBAR_WIDTH_VAR);
|
|
28
|
+
};
|
|
29
|
+
}, [active]);
|
|
30
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { Edge, useScrollEdge } from './useScrollEdge.js';
|
|
5
|
+
|
|
6
|
+
const makeScrollable = ({
|
|
7
|
+
scrollTop = 0,
|
|
8
|
+
scrollHeight = 1000,
|
|
9
|
+
clientHeight = 500,
|
|
10
|
+
}: Partial<Pick<HTMLElement, 'scrollTop' | 'scrollHeight' | 'clientHeight'>> = {}) => {
|
|
11
|
+
const element = document.createElement('div');
|
|
12
|
+
Object.defineProperties(element, {
|
|
13
|
+
scrollTop: { value: scrollTop, configurable: true },
|
|
14
|
+
scrollHeight: { value: scrollHeight, configurable: true },
|
|
15
|
+
clientHeight: { value: clientHeight, configurable: true },
|
|
16
|
+
scrollLeft: { value: 0, configurable: true },
|
|
17
|
+
scrollWidth: { value: 0, configurable: true },
|
|
18
|
+
clientWidth: { value: 0, configurable: true },
|
|
19
|
+
});
|
|
20
|
+
return element;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
describe('useScrollEdge', () => {
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
vi.useFakeTimers();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
vi.useRealTimers();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('fires onEdgeReached when scrolled within the offset of the bottom', () => {
|
|
33
|
+
const element = makeScrollable({ scrollTop: 450 });
|
|
34
|
+
const onEdgeReached = vi.fn();
|
|
35
|
+
|
|
36
|
+
renderHook(() =>
|
|
37
|
+
useScrollEdge({ onEdgeReached, scrollElement: { current: element }, debounceDelay: 50 }),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
element.dispatchEvent(new Event('scroll'));
|
|
41
|
+
vi.advanceTimersByTime(50);
|
|
42
|
+
|
|
43
|
+
expect(onEdgeReached).toHaveBeenCalledTimes(1);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('does not fire when far from the edge', () => {
|
|
47
|
+
const element = makeScrollable({ scrollTop: 0 });
|
|
48
|
+
const onEdgeReached = vi.fn();
|
|
49
|
+
|
|
50
|
+
renderHook(() =>
|
|
51
|
+
useScrollEdge({ onEdgeReached, scrollElement: { current: element }, debounceDelay: 50 }),
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
element.dispatchEvent(new Event('scroll'));
|
|
55
|
+
vi.advanceTimersByTime(50);
|
|
56
|
+
|
|
57
|
+
expect(onEdgeReached).not.toHaveBeenCalled();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('supports the top edge', () => {
|
|
61
|
+
const element = makeScrollable({ scrollTop: 10 });
|
|
62
|
+
const onEdgeReached = vi.fn();
|
|
63
|
+
|
|
64
|
+
renderHook(() =>
|
|
65
|
+
useScrollEdge({
|
|
66
|
+
edge: Edge.TOP,
|
|
67
|
+
onEdgeReached,
|
|
68
|
+
scrollElement: { current: element },
|
|
69
|
+
debounceDelay: 50,
|
|
70
|
+
}),
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
element.dispatchEvent(new Event('scroll'));
|
|
74
|
+
vi.advanceTimersByTime(50);
|
|
75
|
+
|
|
76
|
+
expect(onEdgeReached).toHaveBeenCalledTimes(1);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('debounces bursts of scroll events into one invocation', () => {
|
|
80
|
+
const element = makeScrollable({ scrollTop: 450 });
|
|
81
|
+
const onEdgeReached = vi.fn();
|
|
82
|
+
|
|
83
|
+
renderHook(() =>
|
|
84
|
+
useScrollEdge({ onEdgeReached, scrollElement: { current: element }, debounceDelay: 50 }),
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
for (let i = 0; i < 5; i++) {
|
|
88
|
+
element.dispatchEvent(new Event('scroll'));
|
|
89
|
+
vi.advanceTimersByTime(10);
|
|
90
|
+
}
|
|
91
|
+
vi.advanceTimersByTime(50);
|
|
92
|
+
|
|
93
|
+
expect(onEdgeReached).toHaveBeenCalledTimes(1);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('stops listening after unmount', () => {
|
|
97
|
+
const element = makeScrollable({ scrollTop: 450 });
|
|
98
|
+
const onEdgeReached = vi.fn();
|
|
99
|
+
|
|
100
|
+
const { unmount } = renderHook(() =>
|
|
101
|
+
useScrollEdge({ onEdgeReached, scrollElement: { current: element }, debounceDelay: 50 }),
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
unmount();
|
|
105
|
+
element.dispatchEvent(new Event('scroll'));
|
|
106
|
+
vi.advanceTimersByTime(100);
|
|
107
|
+
|
|
108
|
+
expect(onEdgeReached).not.toHaveBeenCalled();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { RefObject } from 'react';
|
|
4
|
+
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
|
|
7
|
+
import { useDebouncedCallback } from './useDebouncedCallback.js';
|
|
8
|
+
|
|
9
|
+
export enum Edge {
|
|
10
|
+
BOTTOM = 'bottom',
|
|
11
|
+
LEFT = 'left',
|
|
12
|
+
RIGHT = 'right',
|
|
13
|
+
TOP = 'top',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type UseScrollEdgeOptions = {
|
|
17
|
+
debounceDelay?: number;
|
|
18
|
+
edge?: Edge;
|
|
19
|
+
offset?: number;
|
|
20
|
+
onEdgeReached: () => Promise<void> | void;
|
|
21
|
+
scrollElement?: RefObject<HTMLElement | null>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Invokes `onEdgeReached` (debounced) whenever scrolling comes within
|
|
26
|
+
* `offset` pixels of the given edge of `scrollElement` (or the document).
|
|
27
|
+
*/
|
|
28
|
+
export const useScrollEdge = ({
|
|
29
|
+
debounceDelay = 200,
|
|
30
|
+
edge = Edge.BOTTOM,
|
|
31
|
+
offset = 100,
|
|
32
|
+
onEdgeReached,
|
|
33
|
+
scrollElement,
|
|
34
|
+
}: UseScrollEdgeOptions): void => {
|
|
35
|
+
const { run: handleScroll, cancel } = useDebouncedCallback(() => {
|
|
36
|
+
const container = scrollElement?.current || document.documentElement;
|
|
37
|
+
const { clientHeight, clientWidth, scrollHeight, scrollLeft, scrollTop, scrollWidth } =
|
|
38
|
+
container;
|
|
39
|
+
|
|
40
|
+
const edgeConditions: Record<Edge, () => boolean> = {
|
|
41
|
+
[Edge.BOTTOM]: () => scrollHeight - scrollTop - clientHeight <= offset,
|
|
42
|
+
[Edge.LEFT]: () => scrollLeft <= offset,
|
|
43
|
+
[Edge.RIGHT]: () => scrollWidth - scrollLeft - clientWidth <= offset,
|
|
44
|
+
[Edge.TOP]: () => scrollTop <= offset,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
if (edgeConditions[edge]()) {
|
|
48
|
+
void onEdgeReached();
|
|
49
|
+
}
|
|
50
|
+
}, debounceDelay);
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const container = scrollElement?.current || window;
|
|
54
|
+
container.addEventListener('scroll', handleScroll);
|
|
55
|
+
|
|
56
|
+
return () => {
|
|
57
|
+
container.removeEventListener('scroll', handleScroll);
|
|
58
|
+
cancel();
|
|
59
|
+
};
|
|
60
|
+
}, [handleScroll, cancel, scrollElement]);
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2024.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2025.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2023.collection.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2023.intl.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2024.collection.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2024.object.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2024.promise.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2024.regexp.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2024.string.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2025.collection.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2025.float16.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2025.intl.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2025.iterator.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2025.promise.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2025.regexp.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.esnext.array.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.esnext.collection.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.esnext.date.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.esnext.error.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.esnext.temporal.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.esnext.typedarrays.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/.pnpm/@types+react@19.2.16/node_modules/@types/react/global.d.ts","../../node_modules/.pnpm/csstype@3.2.3/node_modules/csstype/index.d.ts","../../node_modules/.pnpm/@types+react@19.2.16/node_modules/@types/react/index.d.ts","./src/hooks/useclickoutside.ts","./src/hooks/useclientvalue.ts","./src/hooks/usedebouncedcallback.ts","./src/hooks/usemounted.ts","./src/hooks/usepreventscrolling.ts","./src/hooks/usescrolledge.ts"],"fileIdsList":[[90,91],[92],[92,95]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"1e9332c23e9a907175e0ffc6a49e236f97b48838cc8aec9ce7e4cec21e544b65","impliedFormat":1},{"version":"3753fbc1113dc511214802a2342280a8b284ab9094f6420e7aa171e868679f91","impliedFormat":1},{"version":"999ca32883495a866aa5737fe1babc764a469e4cde6ee6b136a4b9ae68853e4b","impliedFormat":1},{"version":"17f13ecb98cbc39243f2eee1f16d45cd8ec4706b03ee314f1915f1a8b42f6984","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"0bd714129fca875f7d4c477a1a392200b0bcd13fb2e80928cd334b63830ea047","affectsGlobalScope":true,"impliedFormat":1},{"version":"e2c9037ae6cd2c52d80ceef0b3c5ffdb488627d71529cf4f63776daf11161c9a","affectsGlobalScope":true,"impliedFormat":1},{"version":"135d5cf4d345f59f1a9caadfafcd858d3d9cc68290db616cc85797224448cccc","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc238c3f81c2984751932b6aab223cd5b830e0ac6cad76389e5e9d2ffc03287d","affectsGlobalScope":true,"impliedFormat":1},{"version":"4a07f9b76d361f572620927e5735b77d6d2101c23cdd94383eb5b706e7b36357","affectsGlobalScope":true,"impliedFormat":1},{"version":"7c4e8dc6ab834cc6baa0227e030606d29e3e8449a9f67cdf5605ea5493c4db29","affectsGlobalScope":true,"impliedFormat":1},{"version":"de7ba0fd02e06cd9a5bd4ab441ed0e122735786e67dde1e849cced1cd8b46b78","affectsGlobalScope":true,"impliedFormat":1},{"version":"6148e4e88d720a06855071c3db02069434142a8332cf9c182cda551adedf3156","affectsGlobalScope":true,"impliedFormat":1},{"version":"d63dba625b108316a40c95a4425f8d4294e0deeccfd6c7e59d819efa19e23409","affectsGlobalScope":true,"impliedFormat":1},{"version":"0568d6befee03dd435bed4fc25c4e46865b24bdcb8c563fdc21f580a2c301904","affectsGlobalScope":true,"impliedFormat":1},{"version":"30d62269b05b584741f19a5369852d5d34895aa2ac4fd948956f886d15f9cc0d","affectsGlobalScope":true,"impliedFormat":1},{"version":"f128dae7c44d8f35ee42e0a437000a57c9f06cc04f8b4fb42eebf44954d53dc8","affectsGlobalScope":true,"impliedFormat":1},{"version":"ffbe6d7b295306b2ba88030f65b74c107d8d99bdcf596ea99c62a02f606108b0","affectsGlobalScope":true,"impliedFormat":1},{"version":"996fb27b15277369c68a4ba46ed138b4e9e839a02fb4ec756f7997629242fd9f","affectsGlobalScope":true,"impliedFormat":1},{"version":"79b712591b270d4778c89706ca2cfc56ddb8c3f895840e477388f1710dc5eda9","affectsGlobalScope":true,"impliedFormat":1},{"version":"20884846cef428b992b9bd032e70a4ef88e349263f63aeddf04dda837a7dba26","affectsGlobalScope":true,"impliedFormat":1},{"version":"5fcab789c73a97cd43828ee3cc94a61264cf24d4c44472ce64ced0e0f148bdb2","affectsGlobalScope":true,"impliedFormat":1},{"version":"db59a81f070c1880ad645b2c0275022baa6a0c4f0acdc58d29d349c6efcf0903","affectsGlobalScope":true,"impliedFormat":1},{"version":"673294292640f5722b700e7d814e17aaf7d93f83a48a2c9b38f33cbc940ad8b0","affectsGlobalScope":true,"impliedFormat":1},{"version":"d786b48f934cbca483b3c6d0a798cb43bbb4ada283e76fb22c28e53ae05b9e69","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ecb8e347cb6b2a8927c09b86263663289418df375f5e68e11a0ae683776978f","affectsGlobalScope":true,"impliedFormat":1},{"version":"142efd4ce210576f777dc34df121777be89eda476942d6d6663b03dcb53be3ff","affectsGlobalScope":true,"impliedFormat":1},{"version":"379bc41580c2d774f82e828c70308f24a005b490c25ba34d679d84bcf05c3d9d","affectsGlobalScope":true,"impliedFormat":1},{"version":"ed484fb2aa8a1a23d0277056ec3336e0a0b52f9b8d6a961f338a642faf43235d","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ffedae1d1c2d53fdbca1c96d3c7dda544281f7d262f99b6880634f8fd8d9820","affectsGlobalScope":true,"impliedFormat":1},{"version":"83a730b125d477dd264df8ba479afab27a3dae7152b005c214ab94dc7ee44fd3","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},{"version":"7e29f41b158de217f94cb9676bf9cbd0cd9b5a46e1985141ed36e075c52bf6ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac51dd7d31333793807a6abaa5ae168512b6131bd41d9c5b98477fc3b7800f9f","impliedFormat":1},{"version":"2577e7e800bdece2956ca027cb5c17aa359abd968eb9355760110c853f4fb9da","impliedFormat":1},{"version":"af88644fdbd4015100f54614b3ffb2ff6dbbcefccc32785790f91d5b2f884d19","signature":"0db100b5d38b543200c24bee511fed543ef6589f93ee8a75af17d162a0b48a2f","impliedFormat":99},{"version":"a827634cb05b79935b9717417d9e7622cbcd0c8639d2b0dceefefeb7cd23be4d","signature":"9a886dd84885dd1dd1ada49af09df449d510b758941122569aca5a4d1f2b931b","impliedFormat":99},{"version":"c8d5754f85637e9eebbb33884f022f98ff75cedb450738241d6a4904bf60ef32","signature":"4f74895b6dbd7ac50be21967e7777533e10a136c0ed27bb4530c825bc10a3d04","impliedFormat":99},{"version":"097249b84530f7f25eacd46cf4f3f0ed1ab5823dc548dd28b75510ffe28efcec","signature":"be1f6ca967aaf476a59af15606f0c176fdf031567586717c825b53cd03f02ad4","impliedFormat":99},{"version":"079c1b55d38214835d60097a688b68383e34de6271f4540bc71c80e47c8fd2cb","signature":"7797a35b9a5fcaeb27a17c24c276a00760ae83905b21e3915c76a4ee16324bb5","impliedFormat":99},{"version":"f68f5937a5f26132c58b014a27fe5e88791066b03308b17ba883af1ce10c2c44","signature":"2e100ac34cd16e6dc00294d5195e289ba5c28fcbe463c6616e64046bc329e460","impliedFormat":99}],"root":[[93,98]],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationMap":true,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"module":199,"noEmitOnError":true,"noFallthroughCasesInSwitch":true,"outDir":"./dist","removeComments":true,"rootDir":"./src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9},"referencedMap":[[92,1],[93,2],[94,2],[95,2],[96,2],[97,2],[98,3]],"latestChangedDtsFile":"./dist/hooks/useScrollEdge.d.ts","version":"6.0.3"}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "@slango.configs/typescript/default.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"noEmit": true,
|
|
6
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
7
|
+
"types": []
|
|
8
|
+
},
|
|
9
|
+
"include": ["**/*.ts"],
|
|
10
|
+
"exclude": ["node_modules", "dist"]
|
|
11
|
+
}
|