@react-hookz/web
Advanced tools
Comparing version 24.0.2 to 24.0.3
{ | ||
"name": "@react-hookz/web", | ||
"version": "24.0.2", | ||
"version": "24.0.3", | ||
"description": "React hooks done right, for browser and SSR.", | ||
@@ -27,5 +27,2 @@ "keywords": [ | ||
"sideEffects": false, | ||
"imports": { | ||
"#root/*": "./src/*" | ||
}, | ||
"exports": { | ||
@@ -82,6 +79,6 @@ ".": "./src/index.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.23.6", | ||
"@babel/core": "^7.23.9", | ||
"@commitlint/cli": "^18.4.3", | ||
"@commitlint/config-conventional": "^18.4.3", | ||
"@commitlint/cz-commitlint": "^18.4.3", | ||
"@commitlint/config-conventional": "^18.6.0", | ||
"@commitlint/cz-commitlint": "^18.6.0", | ||
"@jamesacarr/jest-reporter-github-actions": "^0.0.4", | ||
@@ -92,5 +89,5 @@ "@react-hookz/eslint-config": "^2.1.4", | ||
"@semantic-release/git": "^10.0.1", | ||
"@semantic-release/github": "^9.2.5", | ||
"@swc/core": "^1.3.101", | ||
"@swc/jest": "^0.2.29", | ||
"@semantic-release/github": "^9.2.6", | ||
"@swc/core": "^1.3.105", | ||
"@swc/jest": "^0.2.31", | ||
"@testing-library/react-hooks": "^8.0.1", | ||
@@ -103,7 +100,7 @@ "@types/jest": "^29.5.11", | ||
"commitizen": "^4.3.0", | ||
"commitlint": "^18.4.3", | ||
"commitlint": "^18.5.0", | ||
"concurrently": "^8.2.2", | ||
"eslint": "^8.56.0", | ||
"eslint-plugin-prettier": "^5.1.0", | ||
"husky": "^8.0.3", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"husky": "^9.0.10", | ||
"jest": "^29.7.0", | ||
@@ -117,4 +114,4 @@ "jest-environment-jsdom": "^29.7.0", | ||
"rimraf": "^5.0.5", | ||
"semantic-release": "^22.0.12", | ||
"ts-jest": "^29.1.1", | ||
"semantic-release": "^23.0.0", | ||
"ts-jest": "^29.1.2", | ||
"ts-node": "^10.9.2", | ||
@@ -121,0 +118,0 @@ "typescript": "^5.3.3", |
@@ -243,6 +243,6 @@ <div align="center"> | ||
<td align="center"> | ||
<a href="https://github.com/AndreasNel"> | ||
<img src="https://avatars.githubusercontent.com/u/17763359?v=4" width="100;" alt="AndreasNel"/> | ||
<a href="https://github.com/wesgro"> | ||
<img src="https://avatars.githubusercontent.com/u/595567?v=4" width="100;" alt="wesgro"/> | ||
<br /> | ||
<sub><b>Andreas Nel</b></sub> | ||
<sub><b>Jake Ketcheson</b></sub> | ||
</a> | ||
@@ -258,13 +258,13 @@ </td> | ||
<td align="center"> | ||
<a href="https://github.com/wesgro"> | ||
<img src="https://avatars.githubusercontent.com/u/595567?v=4" width="100;" alt="wesgro"/> | ||
<a href="https://github.com/AndreasNel"> | ||
<img src="https://avatars.githubusercontent.com/u/17763359?v=4" width="100;" alt="AndreasNel"/> | ||
<br /> | ||
<sub><b>Jake Ketcheson</b></sub> | ||
<sub><b>Andreas Nel</b></sub> | ||
</a> | ||
</td> | ||
<td align="center"> | ||
<a href="https://github.com/akd-io"> | ||
<img src="https://avatars.githubusercontent.com/u/30059155?v=4" width="100;" alt="akd-io"/> | ||
<a href="https://github.com/fengkx"> | ||
<img src="https://avatars.githubusercontent.com/u/16515468?v=4" width="100;" alt="fengkx"/> | ||
<br /> | ||
<sub><b>Anders Kjær Damgaard</b></sub> | ||
<sub><b>Fengkx</b></sub> | ||
</a> | ||
@@ -274,55 +274,55 @@ </td></tr> | ||
<td align="center"> | ||
<a href="https://github.com/axelboc"> | ||
<img src="https://avatars.githubusercontent.com/u/2936402?v=4" width="100;" alt="axelboc"/> | ||
<a href="https://github.com/paul-sachs"> | ||
<img src="https://avatars.githubusercontent.com/u/11449728?v=4" width="100;" alt="paul-sachs"/> | ||
<br /> | ||
<sub><b>Axel Bocciarelli</b></sub> | ||
<sub><b>Paul Sachs</b></sub> | ||
</a> | ||
</td> | ||
<td align="center"> | ||
<a href="https://github.com/lensbart"> | ||
<img src="https://avatars.githubusercontent.com/u/20876627?v=4" width="100;" alt="lensbart"/> | ||
<a href="https://github.com/Myzel394"> | ||
<img src="https://avatars.githubusercontent.com/u/50424412?v=4" width="100;" alt="Myzel394"/> | ||
<br /> | ||
<sub><b>Bart Lens</b></sub> | ||
<sub><b>Null</b></sub> | ||
</a> | ||
</td> | ||
<td align="center"> | ||
<a href="https://github.com/birant"> | ||
<img src="https://avatars.githubusercontent.com/u/29652801?v=4" width="100;" alt="birant"/> | ||
<a href="https://github.com/MichalTarasiuk"> | ||
<img src="https://avatars.githubusercontent.com/u/69385846?v=4" width="100;" alt="MichalTarasiuk"/> | ||
<br /> | ||
<sub><b>Birant İyigün</b></sub> | ||
<sub><b>Michał Tarasiuk</b></sub> | ||
</a> | ||
</td> | ||
<td align="center"> | ||
<a href="https://github.com/punkle"> | ||
<img src="https://avatars.githubusercontent.com/u/553697?v=4" width="100;" alt="punkle"/> | ||
<a href="https://github.com/KonradLinkowski"> | ||
<img src="https://avatars.githubusercontent.com/u/26126510?v=4" width="100;" alt="KonradLinkowski"/> | ||
<br /> | ||
<sub><b>Brian Fletcher</b></sub> | ||
<sub><b>Konrad Linkowski</b></sub> | ||
</a> | ||
</td> | ||
<td align="center"> | ||
<a href="https://github.com/ChloeMouret"> | ||
<img src="https://avatars.githubusercontent.com/u/63965373?v=4" width="100;" alt="ChloeMouret"/> | ||
<a href="https://github.com/jpwallace22"> | ||
<img src="https://avatars.githubusercontent.com/u/93415734?v=4" width="100;" alt="jpwallace22"/> | ||
<br /> | ||
<sub><b>Null</b></sub> | ||
<sub><b>Justin Wallace</b></sub> | ||
</a> | ||
</td> | ||
<td align="center"> | ||
<a href="https://github.com/dantman"> | ||
<img src="https://avatars.githubusercontent.com/u/53399?v=4" width="100;" alt="dantman"/> | ||
<a href="https://github.com/JoshuaStewartEntelect"> | ||
<img src="https://avatars.githubusercontent.com/u/92043787?v=4" width="100;" alt="JoshuaStewartEntelect"/> | ||
<br /> | ||
<sub><b>Daniel Friesen</b></sub> | ||
<sub><b>Joshua Stewart</b></sub> | ||
</a> | ||
</td> | ||
<td align="center"> | ||
<a href="https://github.com/JoshuaStewartEntelect"> | ||
<img src="https://avatars.githubusercontent.com/u/92043787?v=4" width="100;" alt="JoshuaStewartEntelect"/> | ||
<a href="https://github.com/dantman"> | ||
<img src="https://avatars.githubusercontent.com/u/53399?v=4" width="100;" alt="dantman"/> | ||
<br /> | ||
<sub><b>Joshua Stewart</b></sub> | ||
<sub><b>Daniel Friesen</b></sub> | ||
</a> | ||
</td> | ||
<td align="center"> | ||
<a href="https://github.com/jpwallace22"> | ||
<img src="https://avatars.githubusercontent.com/u/93415734?v=4" width="100;" alt="jpwallace22"/> | ||
<a href="https://github.com/ChloeMouret"> | ||
<img src="https://avatars.githubusercontent.com/u/63965373?v=4" width="100;" alt="ChloeMouret"/> | ||
<br /> | ||
<sub><b>Justin Wallace</b></sub> | ||
<sub><b>Null</b></sub> | ||
</a> | ||
@@ -332,34 +332,34 @@ </td></tr> | ||
<td align="center"> | ||
<a href="https://github.com/KonradLinkowski"> | ||
<img src="https://avatars.githubusercontent.com/u/26126510?v=4" width="100;" alt="KonradLinkowski"/> | ||
<a href="https://github.com/punkle"> | ||
<img src="https://avatars.githubusercontent.com/u/553697?v=4" width="100;" alt="punkle"/> | ||
<br /> | ||
<sub><b>Konrad Linkowski</b></sub> | ||
<sub><b>Brian Fletcher</b></sub> | ||
</a> | ||
</td> | ||
<td align="center"> | ||
<a href="https://github.com/MichalTarasiuk"> | ||
<img src="https://avatars.githubusercontent.com/u/69385846?v=4" width="100;" alt="MichalTarasiuk"/> | ||
<a href="https://github.com/birant"> | ||
<img src="https://avatars.githubusercontent.com/u/29652801?v=4" width="100;" alt="birant"/> | ||
<br /> | ||
<sub><b>Michał Tarasiuk</b></sub> | ||
<sub><b>Birant İyigün</b></sub> | ||
</a> | ||
</td> | ||
<td align="center"> | ||
<a href="https://github.com/Myzel394"> | ||
<img src="https://avatars.githubusercontent.com/u/50424412?v=4" width="100;" alt="Myzel394"/> | ||
<a href="https://github.com/lensbart"> | ||
<img src="https://avatars.githubusercontent.com/u/20876627?v=4" width="100;" alt="lensbart"/> | ||
<br /> | ||
<sub><b>Null</b></sub> | ||
<sub><b>Bart Lens</b></sub> | ||
</a> | ||
</td> | ||
<td align="center"> | ||
<a href="https://github.com/paul-sachs"> | ||
<img src="https://avatars.githubusercontent.com/u/11449728?v=4" width="100;" alt="paul-sachs"/> | ||
<a href="https://github.com/axelboc"> | ||
<img src="https://avatars.githubusercontent.com/u/2936402?v=4" width="100;" alt="axelboc"/> | ||
<br /> | ||
<sub><b>Paul Sachs</b></sub> | ||
<sub><b>Axel Bocciarelli</b></sub> | ||
</a> | ||
</td> | ||
<td align="center"> | ||
<a href="https://github.com/fengkx"> | ||
<img src="https://avatars.githubusercontent.com/u/16515468?v=4" width="100;" alt="fengkx"/> | ||
<a href="https://github.com/akd-io"> | ||
<img src="https://avatars.githubusercontent.com/u/30059155?v=4" width="100;" alt="akd-io"/> | ||
<br /> | ||
<sub><b>Fengkx</b></sub> | ||
<sub><b>Anders Kjær Damgaard</b></sub> | ||
</a> | ||
@@ -366,0 +366,0 @@ </td></tr> |
import { useMemo, useRef, useState } from 'react'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
export function useAsync(asyncFn, initialValue) { | ||
@@ -4,0 +4,0 @@ const [state, setState] = useState({ |
@@ -1,2 +0,2 @@ | ||
import { type AsyncState, type UseAsyncActions, type UseAsyncMeta } from '#root/useAsync/index.js'; | ||
import { type AsyncState, type UseAsyncActions, type UseAsyncMeta } from '../useAsync/index.js'; | ||
export type UseAsyncAbortableActions<Result, Args extends unknown[] = unknown[]> = { | ||
@@ -3,0 +3,0 @@ abort: () => void; |
import { useMemo, useRef } from 'react'; | ||
import { useAsync, } from '#root/useAsync/index.js'; | ||
import { useAsync, } from '../useAsync/index.js'; | ||
export function useAsyncAbortable(asyncFn, initialValue) { | ||
@@ -4,0 +4,0 @@ const abortController = useRef(); |
import { useEffect } from 'react'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { off, on } from '#root/util/misc.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
import { off, on } from '../util/misc.js'; | ||
const DEFAULT_EVENTS = ['mousedown', 'touchstart']; | ||
@@ -5,0 +5,0 @@ export function useClickOutside(ref, callback, events = DEFAULT_EVENTS) { |
import { type DependencyList } from 'react'; | ||
import { type ConditionsList, type ConditionsPredicate } from '#root/types.js'; | ||
import { type EffectCallback, type EffectHook } from '#root/util/misc.js'; | ||
import { type ConditionsList, type ConditionsPredicate } from '../types.js'; | ||
import { type EffectCallback, type EffectHook } from '../util/misc.js'; | ||
export declare function useConditionalEffect<Cond extends ConditionsList, Callback extends EffectCallback = EffectCallback, Deps extends DependencyList | undefined = DependencyList | undefined, HookRestArgs extends any[] = any[], R extends HookRestArgs = HookRestArgs>(callback: Callback, deps: Deps, conditions: Cond, predicate?: ConditionsPredicate<Cond>, effectHook?: EffectHook<Callback, Deps, HookRestArgs>, ...effectHookRestArgs: R): void; |
import { useEffect } from 'react'; | ||
import { truthyAndArrayPredicate } from '#root/util/const.js'; | ||
import { truthyAndArrayPredicate } from '../util/const.js'; | ||
export function useConditionalEffect(callback, deps, conditions, predicate = truthyAndArrayPredicate, effectHook = useEffect, ...effectHookRestArgs) { | ||
@@ -4,0 +4,0 @@ effectHook((() => { |
import { useCallback, useRef } from 'react'; | ||
import { useFirstMountState } from '#root/useFirstMountState/index.js'; | ||
import { useRerender } from '#root/useRerender/index.js'; | ||
import { resolveHookState } from '#root/util/resolveHookState.js'; | ||
import { useFirstMountState } from '../useFirstMountState/index.js'; | ||
import { useRerender } from '../useRerender/index.js'; | ||
import { resolveHookState } from '../util/resolveHookState.js'; | ||
export function useControlledRerenderState(initialState) { | ||
@@ -6,0 +6,0 @@ const state = useRef(useFirstMountState() ? resolveHookState(initialState) : undefined); |
import Cookies from 'js-cookie'; | ||
import { useCallback, useEffect, useState } from 'react'; | ||
import { useFirstMountState } from '#root/useFirstMountState/index.js'; | ||
import { useMountEffect } from '#root/useMountEffect/index.js'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { isBrowser } from '#root/util/const.js'; | ||
import { useFirstMountState } from '../useFirstMountState/index.js'; | ||
import { useMountEffect } from '../useMountEffect/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
import { isBrowser } from '../util/const.js'; | ||
const cookiesSetters = new Map(); | ||
@@ -8,0 +8,0 @@ const registerSetter = (key, setter) => { |
import { type SetStateAction } from 'react'; | ||
import { type InitialState } from '#root/util/resolveHookState.js'; | ||
import { type InitialState } from '../util/resolveHookState.js'; | ||
export type CounterActions = { | ||
@@ -4,0 +4,0 @@ get: () => number; |
import { useMemo } from 'react'; | ||
import { useMediatedState } from '#root/useMediatedState/index.js'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { resolveHookState } from '#root/util/resolveHookState.js'; | ||
import { useMediatedState } from '../useMediatedState/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
import { resolveHookState } from '../util/resolveHookState.js'; | ||
export function useCounter(initialValue = 0, max, min) { | ||
@@ -6,0 +6,0 @@ const [state, setState] = useMediatedState(initialValue, (v) => { |
import { type DependencyList } from 'react'; | ||
import { type DependenciesComparator } from '#root/types.js'; | ||
import { type EffectCallback, type EffectHook } from '#root/util/misc.js'; | ||
import { type DependenciesComparator } from '../types.js'; | ||
import { type EffectCallback, type EffectHook } from '../util/misc.js'; | ||
export declare function useCustomCompareEffect<Callback extends EffectCallback = EffectCallback, Deps extends DependencyList = DependencyList, HookRestArgs extends any[] = any[], R extends HookRestArgs = HookRestArgs>(callback: Callback, deps: Deps, comparator?: DependenciesComparator<Deps>, effectHook?: EffectHook<Callback, Deps, HookRestArgs>, ...effectHookRestArgs: R): void; |
import { useEffect, useRef } from 'react'; | ||
import { isBrowser } from '#root/util/const.js'; | ||
import { basicDepsComparator } from '#root/util/misc.js'; | ||
import { isBrowser } from '../util/const.js'; | ||
import { basicDepsComparator } from '../util/misc.js'; | ||
export function useCustomCompareEffect(callback, deps, comparator = basicDepsComparator, effectHook = useEffect, ...effectHookRestArgs) { | ||
@@ -5,0 +5,0 @@ const dependencies = useRef(); |
import { type DependencyList } from 'react'; | ||
import { type DependenciesComparator } from '#root/types.js'; | ||
import { type DependenciesComparator } from '../types.js'; | ||
export declare const useCustomCompareMemo: <T, Deps extends DependencyList>(factory: () => T, deps: Deps, comparator: DependenciesComparator<Deps>) => T; |
import { useMemo, useRef } from 'react'; | ||
import { useUnmountEffect } from '#root/useUnmountEffect/index.js'; | ||
import { useUnmountEffect } from '../useUnmountEffect/index.js'; | ||
export function useDebouncedCallback(callback, deps, delay, maxWait = 0) { | ||
@@ -4,0 +4,0 @@ const timeout = useRef(); |
import { useEffect } from 'react'; | ||
import { useDebouncedCallback } from '#root/useDebouncedCallback/index.js'; | ||
import { useDebouncedCallback } from '../useDebouncedCallback/index.js'; | ||
export function useDebouncedEffect(callback, deps, delay, maxWait = 0) { | ||
useEffect(useDebouncedCallback(callback, deps, delay, maxWait), deps); | ||
} |
import { useState } from 'react'; | ||
import { useDebouncedCallback } from '#root/useDebouncedCallback/index.js'; | ||
import { useDebouncedCallback } from '../useDebouncedCallback/index.js'; | ||
export function useDebouncedState(initialState, delay, maxWait = 0) { | ||
@@ -4,0 +4,0 @@ const [state, setState] = useState(initialState); |
import { type DependencyList } from 'react'; | ||
import { type EffectCallback, type EffectHook } from '#root/util/misc.js'; | ||
import { type EffectCallback, type EffectHook } from '../util/misc.js'; | ||
export declare function useDeepCompareEffect<Callback extends EffectCallback = EffectCallback, Deps extends DependencyList = DependencyList, HookRestArgs extends any[] = any[], R extends HookRestArgs = HookRestArgs>(callback: Callback, deps: Deps, effectHook?: EffectHook<Callback, Deps, HookRestArgs>, ...effectHookRestArgs: R): void; |
import { isEqual } from '@react-hookz/deep-equal'; | ||
import { useEffect } from 'react'; | ||
import { useCustomCompareEffect } from '#root/useCustomCompareEffect/index.js'; | ||
import { useCustomCompareEffect } from '../useCustomCompareEffect/index.js'; | ||
export function useDeepCompareEffect(callback, deps, effectHook = useEffect, ...effectHookRestArgs) { | ||
useCustomCompareEffect(callback, deps, isEqual, effectHook, ...effectHookRestArgs); | ||
} |
import { isEqual } from '@react-hookz/deep-equal'; | ||
import { useCustomCompareMemo } from '#root/useCustomCompareMemo/index.js'; | ||
import { useCustomCompareMemo } from '../useCustomCompareMemo/index.js'; | ||
export function useDeepCompareMemo(factory, deps) { | ||
return useCustomCompareMemo(factory, deps, isEqual); | ||
} |
import { useState } from 'react'; | ||
import { useEventListener } from '#root/useEventListener/index.js'; | ||
import { useMountEffect } from '#root/useMountEffect/index.js'; | ||
import { isBrowser } from '#root/util/const.js'; | ||
import { useEventListener } from '../useEventListener/index.js'; | ||
import { useMountEffect } from '../useMountEffect/index.js'; | ||
import { isBrowser } from '../util/const.js'; | ||
const isDocumentVisible = () => document.visibilityState === 'visible'; | ||
@@ -6,0 +6,0 @@ export function useDocumentVisibility(initializeWithValue = true) { |
import { useEffect, useMemo } from 'react'; | ||
import { useIsMounted } from '#root/useIsMounted/index.js'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { hasOwnProperty, off, on } from '#root/util/misc.js'; | ||
import { useIsMounted } from '../useIsMounted/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
import { hasOwnProperty, off, on } from '../util/misc.js'; | ||
export function useEventListener(target, ...params) { | ||
@@ -6,0 +6,0 @@ const isMounted = useIsMounted(); |
import { useCallback, useState } from 'react'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
export function useFunctionalState(initialState) { | ||
@@ -4,0 +4,0 @@ const [state, setState] = useState(initialState); |
import { useMemo } from 'react'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
export function useHookableRef(initialValue, onSet, onGet) { | ||
@@ -4,0 +4,0 @@ const onSetRef = useSyncedRef(onSet); |
import { useEffect } from 'react'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
export function useIntervalEffect(callback, ms) { | ||
@@ -4,0 +4,0 @@ const cbRef = useSyncedRef(callback); |
import { useEffect, useLayoutEffect } from 'react'; | ||
import { isBrowser } from '#root/util/const.js'; | ||
import { isBrowser } from '../util/const.js'; | ||
export const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect; |
import { useMemo } from 'react'; | ||
import { useEventListener } from '#root/useEventListener/index.js'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { isBrowser } from '#root/util/const.js'; | ||
import { yieldFalse, yieldTrue } from '#root/util/misc.js'; | ||
import { useEventListener } from '../useEventListener/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
import { isBrowser } from '../util/const.js'; | ||
import { yieldFalse, yieldTrue } from '../util/misc.js'; | ||
const createKeyPredicate = (keyFilter) => { | ||
@@ -7,0 +7,0 @@ if (typeof keyFilter === 'function') |
import { type SetStateAction } from 'react'; | ||
import { type InitialState } from '#root/util/resolveHookState.js'; | ||
import { type InitialState } from '../util/resolveHookState.js'; | ||
export type ListActions<T> = { | ||
@@ -4,0 +4,0 @@ set: (newList: SetStateAction<T[]>) => void; |
import { useMemo, useRef } from 'react'; | ||
import { useRerender } from '#root/useRerender/index.js'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { resolveHookState } from '#root/util/resolveHookState.js'; | ||
import { useRerender } from '../useRerender/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
import { resolveHookState } from '../util/resolveHookState.js'; | ||
export function useList(initialList) { | ||
@@ -6,0 +6,0 @@ const initial = useSyncedRef(initialList); |
@@ -1,4 +0,4 @@ | ||
import { type UseStorageValueOptions, type UseStorageValueResult } from '#root/useStorageValue/index.js'; | ||
import { type UseStorageValueOptions, type UseStorageValueResult } from '../useStorageValue/index.js'; | ||
type UseLocalStorageValue = <Type, Default extends Type = Type, Initialize extends boolean | undefined = boolean | undefined>(key: string, options?: UseStorageValueOptions<Type, Initialize>) => UseStorageValueResult<Type, Default, Initialize>; | ||
export declare const useLocalStorageValue: UseLocalStorageValue; | ||
export {}; |
@@ -1,3 +0,3 @@ | ||
import { useStorageValue, } from '#root/useStorageValue/index.js'; | ||
import { isBrowser, noop } from '#root/util/const.js'; | ||
import { useStorageValue, } from '../useStorageValue/index.js'; | ||
import { isBrowser, noop } from '../util/const.js'; | ||
let IS_LOCAL_STORAGE_AVAILABLE; | ||
@@ -4,0 +4,0 @@ try { |
import { useRef } from 'react'; | ||
import { useRerender } from '#root/useRerender/index.js'; | ||
import { useRerender } from '../useRerender/index.js'; | ||
const proto = Map.prototype; | ||
@@ -4,0 +4,0 @@ export function useMap(entries) { |
import { useState } from 'react'; | ||
import { useHookableRef } from '#root/useHookableRef/index.js'; | ||
import { useRafCallback } from '#root/useRafCallback/index.js'; | ||
import { useResizeObserver, } from '#root/useResizeObserver/index.js'; | ||
import { useHookableRef } from '../useHookableRef/index.js'; | ||
import { useRafCallback } from '../useRafCallback/index.js'; | ||
import { useResizeObserver } from '../useResizeObserver/index.js'; | ||
export function useMeasure(enabled = true) { | ||
@@ -6,0 +6,0 @@ const [element, setElement] = useState(null); |
import { useEffect, useState } from 'react'; | ||
import { isBrowser } from '#root/util/const.js'; | ||
import { isBrowser } from '../util/const.js'; | ||
const queriesMap = new Map(); | ||
@@ -4,0 +4,0 @@ const createQueryEntry = (query) => { |
import { type Dispatch } from 'react'; | ||
import { type InitialState, type NextState } from '#root/util/resolveHookState.js'; | ||
import { type InitialState, type NextState } from '../util/resolveHookState.js'; | ||
export declare function useMediatedState<State = undefined>(): [ | ||
@@ -4,0 +4,0 @@ State | undefined, |
import { useCallback, useState } from 'react'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { resolveHookState, } from '#root/util/resolveHookState.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
import { resolveHookState } from '../util/resolveHookState.js'; | ||
export function useMediatedState(initialState, mediator) { | ||
@@ -5,0 +5,0 @@ const [state, setState] = useState(() => { |
@@ -1,2 +0,2 @@ | ||
import { type InitialState } from '#root/util/resolveHookState.js'; | ||
import { type InitialState } from '../util/resolveHookState.js'; | ||
export type NetworkInformation = { | ||
@@ -3,0 +3,0 @@ readonly downlink: number; |
import { useEffect, useState } from 'react'; | ||
import { isBrowser } from '#root/util/const.js'; | ||
import { off, on } from '#root/util/misc.js'; | ||
import { isBrowser } from '../util/const.js'; | ||
import { off, on } from '../util/misc.js'; | ||
const navigator = isBrowser ? window.navigator : undefined; | ||
@@ -5,0 +5,0 @@ const conn = navigator && (navigator.connection ?? navigator.mozConnection ?? navigator.webkitConnection); |
import { useEffect, useState } from 'react'; | ||
import { off, on } from '#root/util/misc.js'; | ||
import { off, on } from '../util/misc.js'; | ||
export function usePermission(descriptor) { | ||
@@ -4,0 +4,0 @@ const [state, setState] = useState('not-requested'); |
@@ -1,2 +0,2 @@ | ||
import { type Predicate } from '#root/types.js'; | ||
import { type Predicate } from '../types.js'; | ||
export declare function usePreviousDistinct<T>(value: T, predicate?: Predicate): T | undefined; |
import { useRef, useState } from 'react'; | ||
import { useUpdateEffect } from '#root/useUpdateEffect/index.js'; | ||
import { isStrictEqual } from '#root/util/const.js'; | ||
import { useUpdateEffect } from '../useUpdateEffect/index.js'; | ||
import { isStrictEqual } from '../util/const.js'; | ||
export function usePreviousDistinct(value, predicate = isStrictEqual) { | ||
@@ -5,0 +5,0 @@ const [previousState, setPreviousState] = useState(); |
import { useMemo } from 'react'; | ||
import { useList } from '#root/useList/index.js'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { useList } from '../useList/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
export function useQueue(initialValue = []) { | ||
@@ -5,0 +5,0 @@ const [list, { removeAt, push }] = useList(initialValue); |
import { useCallback, useMemo, useRef } from 'react'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { useUnmountEffect } from '#root/useUnmountEffect/index.js'; | ||
import { isBrowser } from '#root/util/const.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
import { useUnmountEffect } from '../useUnmountEffect/index.js'; | ||
import { isBrowser } from '../util/const.js'; | ||
export function useRafCallback(cb) { | ||
@@ -6,0 +6,0 @@ const cbRef = useSyncedRef(cb); |
import { useEffect } from 'react'; | ||
import { useRafCallback } from '#root/useRafCallback/index.js'; | ||
import { useRafCallback } from '../useRafCallback/index.js'; | ||
export function useRafEffect(callback, deps) { | ||
@@ -4,0 +4,0 @@ const [rafCallback, cancelRaf] = useRafCallback(callback); |
import { useState } from 'react'; | ||
import { useRafCallback } from '#root/useRafCallback/index.js'; | ||
import { useUnmountEffect } from '#root/useUnmountEffect/index.js'; | ||
import { useRafCallback } from '../useRafCallback/index.js'; | ||
import { useUnmountEffect } from '../useUnmountEffect/index.js'; | ||
export function useRafState(initialState) { | ||
@@ -5,0 +5,0 @@ const [state, innerSetState] = useState(initialState); |
import { useEffect } from 'react'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { isBrowser } from '#root/util/const.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
import { isBrowser } from '../util/const.js'; | ||
let observerSingleton; | ||
@@ -5,0 +5,0 @@ function getResizeObserver() { |
@@ -1,2 +0,2 @@ | ||
import { useMediaQuery } from '#root/useMediaQuery/index.js'; | ||
import { useMediaQuery } from '../useMediaQuery/index.js'; | ||
export function useScreenOrientation(options) { | ||
@@ -3,0 +3,0 @@ const matches = useMediaQuery('(orientation: portrait)', { |
@@ -1,4 +0,4 @@ | ||
import { type UseStorageValueOptions, type UseStorageValueResult } from '#root/useStorageValue/index.js'; | ||
import { type UseStorageValueOptions, type UseStorageValueResult } from '../useStorageValue/index.js'; | ||
type UseSessionStorageValue = <Type, Default extends Type = Type, Initialize extends boolean | undefined = boolean | undefined>(key: string, options?: UseStorageValueOptions<Type, Initialize>) => UseStorageValueResult<Type, Default, Initialize>; | ||
export declare const useSessionStorageValue: UseSessionStorageValue; | ||
export {}; |
@@ -1,3 +0,3 @@ | ||
import { useStorageValue, } from '#root/useStorageValue/index.js'; | ||
import { isBrowser, noop } from '#root/util/const.js'; | ||
import { useStorageValue, } from '../useStorageValue/index.js'; | ||
import { isBrowser, noop } from '../util/const.js'; | ||
let IS_SESSION_STORAGE_AVAILABLE; | ||
@@ -4,0 +4,0 @@ try { |
import { useRef } from 'react'; | ||
import { useRerender } from '#root/useRerender/index.js'; | ||
import { useRerender } from '../useRerender/index.js'; | ||
const proto = Set.prototype; | ||
@@ -4,0 +4,0 @@ export function useSet(values) { |
@@ -1,2 +0,2 @@ | ||
import { type NextState } from '#root/util/resolveHookState.js'; | ||
import { type NextState } from '../util/resolveHookState.js'; | ||
export type UseStorageValueOptions<T, InitializeWithValue extends boolean | undefined> = { | ||
@@ -3,0 +3,0 @@ defaultValue?: T; |
import { useEffect, useMemo, useState } from 'react'; | ||
import { useFirstMountState } from '#root/useFirstMountState/index.js'; | ||
import { useIsomorphicLayoutEffect } from '#root/useIsomorphicLayoutEffect/index.js'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { useUpdateEffect } from '#root/useUpdateEffect/index.js'; | ||
import { isBrowser } from '#root/util/const.js'; | ||
import { off, on } from '#root/util/misc.js'; | ||
import { resolveHookState } from '#root/util/resolveHookState.js'; | ||
import { useFirstMountState } from '../useFirstMountState/index.js'; | ||
import { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
import { useUpdateEffect } from '../useUpdateEffect/index.js'; | ||
import { isBrowser } from '../util/const.js'; | ||
import { off, on } from '../util/misc.js'; | ||
import { resolveHookState } from '../util/resolveHookState.js'; | ||
const storageListeners = new Map(); | ||
@@ -10,0 +10,0 @@ const invokeStorageKeyListeners = (s, key, value, skipListener) => { |
import { useMemo, useRef } from 'react'; | ||
import { useUnmountEffect } from '#root/useUnmountEffect/index.js'; | ||
import { useUnmountEffect } from '../useUnmountEffect/index.js'; | ||
export function useThrottledCallback(callback, deps, delay, noTrailing = false) { | ||
@@ -4,0 +4,0 @@ const timeout = useRef(); |
import { useEffect } from 'react'; | ||
import { useThrottledCallback } from '#root/useThrottledCallback/index.js'; | ||
import { useThrottledCallback } from '../useThrottledCallback/index.js'; | ||
export function useThrottledEffect(callback, deps, delay, noTrailing = false) { | ||
useEffect(useThrottledCallback(callback, deps, delay, noTrailing), deps); | ||
} |
import { useState } from 'react'; | ||
import { useThrottledCallback } from '#root/useThrottledCallback/index.js'; | ||
import { useThrottledCallback } from '../useThrottledCallback/index.js'; | ||
export function useThrottledState(initialState, delay, noTrailing = false) { | ||
@@ -4,0 +4,0 @@ const [state, setState] = useState(initialState); |
import { useCallback, useEffect, useRef } from 'react'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
const cancelTimeout = (id) => { | ||
@@ -4,0 +4,0 @@ if (id) { |
import { type BaseSyntheticEvent } from 'react'; | ||
import { type InitialState, type NextState } from '#root/util/resolveHookState.js'; | ||
import { type InitialState, type NextState } from '../util/resolveHookState.js'; | ||
export declare function useToggle(initialState: InitialState<boolean>, ignoreReactEvents: false): [boolean, (nextState?: NextState<boolean>) => void]; | ||
export declare function useToggle(initialState?: InitialState<boolean>, ignoreReactEvents?: true): [boolean, (nextState?: NextState<boolean> | BaseSyntheticEvent) => void]; |
import { useCallback, useState } from 'react'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { resolveHookState, } from '#root/util/resolveHookState.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
import { resolveHookState } from '../util/resolveHookState.js'; | ||
export function useToggle(initialState = false, ignoreReactEvents = true) { | ||
@@ -5,0 +5,0 @@ const [state, setState] = useState(initialState); |
import { useEffect } from 'react'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
export function useUnmountEffect(effect) { | ||
@@ -4,0 +4,0 @@ const effectRef = useSyncedRef(effect); |
import { useEffect } from 'react'; | ||
import { useFirstMountState } from '#root/useFirstMountState/index.js'; | ||
import { noop } from '#root/util/const.js'; | ||
import { useFirstMountState } from '../useFirstMountState/index.js'; | ||
import { noop } from '../util/const.js'; | ||
export function useUpdateEffect(effect, deps) { | ||
@@ -5,0 +5,0 @@ const isFirstMount = useFirstMountState(); |
import { type DependencyList, type Dispatch } from 'react'; | ||
import { type InitialState, type NextState } from '#root/util/resolveHookState.js'; | ||
import { type InitialState, type NextState } from '../util/resolveHookState.js'; | ||
export type ValidityState = { | ||
@@ -4,0 +4,0 @@ isValid: boolean | undefined; |
import { useCallback, useEffect, useState } from 'react'; | ||
import { useSyncedRef } from '#root/useSyncedRef/index.js'; | ||
import { useSyncedRef } from '../useSyncedRef/index.js'; | ||
export function useValidator(validator, deps, initialValidity = { isValid: undefined }) { | ||
@@ -4,0 +4,0 @@ const [validity, setValidity] = useState(initialValidity); |
import { useEffect } from 'react'; | ||
import { isBrowser, noop } from '#root/util/const.js'; | ||
import { isBrowser, noop } from '../util/const.js'; | ||
export const useVibrate = !isBrowser || navigator.vibrate === undefined | ||
@@ -4,0 +4,0 @@ ? noop |
@@ -1,2 +0,2 @@ | ||
import { useRafState } from '#root/useRafState/index.js'; | ||
import { useRafState } from '../useRafState/index.js'; | ||
export type WindowSize = { | ||
@@ -3,0 +3,0 @@ width: number; |
import { useEffect } from 'react'; | ||
import { useFirstMountState } from '#root/useFirstMountState/index.js'; | ||
import { useMountEffect } from '#root/useMountEffect/index.js'; | ||
import { useRafState } from '#root/useRafState/index.js'; | ||
import { isBrowser } from '#root/util/const.js'; | ||
import { useFirstMountState } from '../useFirstMountState/index.js'; | ||
import { useMountEffect } from '../useMountEffect/index.js'; | ||
import { useRafState } from '../useRafState/index.js'; | ||
import { isBrowser } from '../util/const.js'; | ||
const listeners = new Set(); | ||
@@ -7,0 +7,0 @@ const callAllListeners = () => { |
@@ -1,2 +0,2 @@ | ||
import { type Predicate, type ConditionsPredicate } from '#root/types.js'; | ||
import { type Predicate, type ConditionsPredicate } from '../types.js'; | ||
export declare const noop: () => void; | ||
@@ -3,0 +3,0 @@ export declare const isBrowser: boolean; |
import { type DependencyList } from 'react'; | ||
import { type DependenciesComparator } from '#root/types.js'; | ||
import { type DependenciesComparator } from '../types.js'; | ||
export declare function on<T extends EventTarget>(object: T | null, ...args: Parameters<T['addEventListener']> | [string, EventListenerOrEventListenerObject | CallableFunction, ...any]): void; | ||
@@ -4,0 +4,0 @@ export declare function off<T extends EventTarget>(object: T | null, ...args: Parameters<T['removeEventListener']> | [string, EventListenerOrEventListenerObject | CallableFunction, ...any]): void; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102856