vueposu
Version:
A hooks library based on Vue Composition-API
935 lines (934 loc) • 26.3 kB
JavaScript
import { watchEffect, unref, ref, onMounted, watch, computed, onUnmounted, onBeforeUnmount, reactive, toRefs, readonly } from "vue-demi";
import { isServer, getTargetElement, isFunction, fullscreen, isHTMLElement, isDef, add, subtract, isArray, isUndef, isUndefined, isObject as isObject$1 } from "@vueposu/utils";
import * as swr from "@vueposu/swr";
export { useSWR, useSWRGlobalConfig } from "@vueposu/swr";
const defaultEvent = "click";
function useClickOutside(target, eventHandler, eventName = defaultEvent) {
const handler = (event) => {
const targets = Array.isArray(target) ? target : [target];
if (targets.some((targetItem) => {
const targetElement = getTargetElement(targetItem);
return !targetElement || targetElement.contains(event == null ? void 0 : event["target"]);
})) {
return;
}
unref(eventHandler)(event);
};
const removeHandler = watchEffect((onInvalidate) => {
if (!isServer) {
const eventNames = Array.isArray(unref(eventName)) ? unref(eventName) : [eventName];
eventNames.map((name) => document.addEventListener(unref(name), handler));
onInvalidate(() => {
eventNames.map(
(name) => document == null ? void 0 : document.removeEventListener(unref(name), handler)
);
});
}
});
return removeHandler;
}
function useClipboard() {
const text = ref("");
const supported = !isServer && "clipboard" in window.navigator;
const getClipboardText = async () => {
if (!isServer) {
text.value = await window.navigator.clipboard.readText();
}
};
getClipboardText();
useEventListener("focus", getClipboardText);
useEventListener("copy", getClipboardText);
const copy = ($text) => {
var _a, _b, _c;
text.value = $text;
return isServer ? new Promise(() => {
}) : (_c = (_b = (_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.clipboard) == null ? void 0 : _b.writeText) == null ? void 0 : _c.call(_b, $text);
};
return { copy, text, supported };
}
function useEventListener(...args) {
let target, type, listener, options;
const serialize = () => {
if (typeof unref(args[0]) === "string") {
target = window;
type = unref(args[0]);
listener = args[1];
options = args[2] || false;
} else {
target = getTargetElement(args[0]);
type = unref(args[1]);
listener = args[2];
options = args[3] || false;
}
};
const register = () => {
if (!isServer && target) {
target.addEventListener(type, listener, options);
}
};
const unregister = () => {
if (!isServer && target) {
target.removeEventListener(type, listener, options);
}
};
onMounted(() => {
watchEffect((onInvalidate) => {
serialize();
register();
onInvalidate(unregister);
});
});
}
function useFavicon(url) {
if (isServer)
return { changeIcon: () => null, restoreIcon: () => null };
let link = document.querySelector("link[rel*='icon']");
let originalIcon = "";
if (link) {
originalIcon = link.href;
} else {
link = document.createElement("link");
link.type = "image/x-icon";
link.rel = "shortcut icon";
document.head.appendChild(link);
}
const changeIcon = ($url) => {
if (link && $url) {
link.href = $url;
document.getElementsByTagName("head")[0].appendChild(link);
}
};
const restoreIcon = () => {
if (originalIcon) {
changeIcon(originalIcon);
}
};
if (url)
changeIcon(url);
return { changeIcon, restoreIcon };
}
function useFullscreen(target, onFullscreenStatusChange) {
const isFullscreen = ref(false);
let element;
watch(target, (_2, __2, onInvalidate) => {
element = unref(isFunction(target) ? target() : target);
const eventListener = () => {
isFullscreen.value = fullscreen.getFullscreenElement() === element;
onFullscreenStatusChange && onFullscreenStatusChange();
};
fullscreen.on("change", eventListener);
onInvalidate(() => {
fullscreen.off("change", eventListener);
});
});
const toggleFullscreen = (status) => {
isFullscreen.value = isDef(status) ? Boolean(unref(status)) : !isFullscreen.value;
};
watch(isFullscreen, (status) => {
if (isHTMLElement(element)) {
status ? fullscreen.request(element) : fullscreen.exit(element);
} else {
throw new Error(
`Invalid assignment: expected a DOM Element but got: ${typeof target}`
);
}
});
return {
isFullscreen: computed({
get: () => isFullscreen.value,
set: (status) => isFullscreen.value = Boolean(unref(status))
}),
enterFullscreen: () => toggleFullscreen(true),
exitFullscreen: () => toggleFullscreen(false),
toggleFullscreen
};
}
const differencePlatformEvents = [
"mozvisibilitychange",
"webkitvisibilitychange",
"msvisibilitychange",
"visibilitychange"
];
function usePageHidden() {
const isHidden = ref(isServer ? false : document.hidden);
const listener = () => setTimeout(() => isHidden.value = isServer ? false : document.hidden);
if (!isServer) {
onMounted(() => {
differencePlatformEvents.forEach((event) => {
document.addEventListener(event, listener);
});
});
onUnmounted(() => {
differencePlatformEvents.forEach((event) => {
document.removeEventListener(event, listener);
});
});
}
return isHidden;
}
function useTitle(overridedTitle, restoreOnUnmount = true) {
const originalTitle = isServer ? "" : document.title;
const title = ref(overridedTitle || originalTitle);
if (!document.querySelector("title")) {
document.head.appendChild(document.createElement("title"));
}
const titleNode = document.querySelector("title");
watch(
title,
() => {
if (!isServer) {
document.title = title.value;
}
},
{
immediate: true,
flush: "sync"
}
);
let observer = null;
if (!isServer) {
observer = new window.MutationObserver(
(m) => title.value = m[0].target.textContent + ""
);
observer.observe(titleNode, {
childList: true
});
}
const restoreTitle = () => {
title.value = originalTitle;
};
onBeforeUnmount(() => {
if (unref(restoreOnUnmount)) {
restoreTitle();
}
if (observer)
observer.disconnect();
});
return { title, restoreTitle };
}
const initialState$1 = {
pageX: 0,
pageY: 0,
screenX: 0,
screenY: 0,
clientX: 0,
clientY: 0
};
function useMouse() {
const state = reactive(initialState$1);
const moveHandler = (event) => {
const { pageX, pageY, screenX, screenY, clientX, clientY } = event;
state.pageX = pageX;
state.pageY = pageY;
state.screenX = screenX;
state.screenY = screenY;
state.clientX = clientX;
state.clientY = clientY;
};
if (!isServer) {
useEventListener(document, "mousemove", moveHandler);
}
return toRefs(readonly(state));
}
const initialState = {
x: 0,
y: 0
};
function useScroll(target) {
const state = reactive(initialState);
const scrollHandler = (event) => {
var _a, _b;
const currentTarget = event.target;
if (currentTarget === document) {
state.x = ((_a = document == null ? void 0 : document.scrollingElement) == null ? void 0 : _a.scrollLeft) || 0;
state.y = ((_b = document == null ? void 0 : document.scrollingElement) == null ? void 0 : _b.scrollTop) || 0;
} else {
state.x = (currentTarget == null ? void 0 : currentTarget.scrollLeft) || 0;
state.y = (currentTarget == null ? void 0 : currentTarget.scrollTop) || 0;
}
};
useEventListener(
() => getTargetElement(target, document),
"scroll",
scrollHandler,
{
passive: true
}
);
return toRefs(readonly(state));
}
const isNumber = (n) => isDef(n) && !isNaN(unref(n));
function useCounter(initialValue, options = {}) {
const { min, max, step } = options;
const initial = () => isNumber(initialValue) ? Number(unref(initialValue)) : 0;
const $step = () => isNumber(step) ? Number(unref(step)) : 1;
const fix = (num) => {
let result = +unref(num);
if (isNumber(max)) {
result = Math.min(Number(unref(max)), result);
}
if (isNumber(min)) {
result = Math.max(Number(unref(min)), result);
}
return result;
};
const current = ref(fix(initial()));
const set = (v) => {
current.value = fix(isFunction(v) ? v(current.value) : v);
};
const inc = (v) => set(
Number(
add(current.value, isNumber(v) ? unref(v) : $step())
)
);
const dec = (v) => set(
subtract(current.value, isNumber(v) ? unref(v) : $step())
);
const reset = () => set(fix(initial()));
const count = computed({
get: () => current.value,
set: (v) => {
if (isNumber(v)) {
set(v);
} else {
throw new TypeError(
`Invalid assignment: expected a number-string or number but got: ${isDef(v) ? typeof v : v}`
);
}
}
});
watchEffect(
() => {
unref(min);
unref(max);
set(current.value);
},
{
flush: "sync"
}
);
return {
count,
inc,
dec,
set,
reset
};
}
function useCounterInterval(options = {}) {
const {
initialValue = 60,
type = "dec",
step = 1,
total = 0,
interval = 1e3,
immediateStart = false
} = options;
const { count, inc, dec } = useCounter(initialValue);
const {
isActive: $isActive,
start,
stop
} = useInterval(
() => {
if (unref(type) === "dec" && count.value > unref(total)) {
dec(step);
} else if (unref(type) === "inc" && count.value < unref(total)) {
inc(step);
}
},
interval,
immediateStart
);
const isActive = ref(unref($isActive));
watch(count, () => {
if (count.value === unref(total))
isActive.value = false;
});
return {
count,
isActive: readonly(isActive),
start: () => {
start();
isActive.value = true;
},
stop: () => {
stop();
isActive.value = false;
}
};
}
function useDynamicList(initValue = []) {
if (isArray(initValue) === false) {
throw new Error("initValue should be a array");
}
const list = ref(initValue);
const actions = {
move(to, from) {
list.value.splice(to, 0, list.value.splice(from, 1)[0]);
},
insert(index, val) {
list.value.splice(index, 0, val);
},
insertBefore(index, val) {
list.value.splice(index, -1, val);
},
insertAfter(index, val) {
list.value.splice(index + 1, 0, val);
},
remove(index) {
list.value.splice(index, 1);
},
replace(to, from) {
actions.move(to, from);
},
unshift(...items) {
list.value.unshift(...items);
},
shift() {
list.value.shift();
},
pop() {
list.value.pop();
},
push(val) {
list.value.push(val);
}
};
return {
list,
...actions
};
}
function useQueue(initialValue = []) {
const state = ref(Array.from(initialValue));
return {
add: (value) => state.value.push(value),
remove: () => state.value.shift(),
empty: () => {
state.value = [];
},
reset: () => {
state.value = Array.from(initialValue);
},
get first() {
return state.value[0];
},
get last() {
return state.value[state.value.length - 1];
},
get size() {
return state.value.length;
}
};
}
function useSet(initialSet) {
const set = ref(new Set(unref(initialSet)));
const actions = {
add: (item) => {
set.value.add(item);
},
remove: (item) => {
set.value.delete(item);
},
has: (item) => set.value.has(item),
reset: () => {
set.value = new Set(unref(initialSet));
},
clear: () => {
set.value.clear();
}
};
return {
set: readonly(set),
...actions
};
}
function useToggle(defaultValue, reverseValue) {
const getDefault = () => isDef(unref(defaultValue)) ? unref(defaultValue) : true;
const getReverse = () => isDef(unref(reverseValue)) ? unref(reverseValue) : !getDefault();
const state = ref(getDefault());
const toggle = (value) => {
state.value = isDef(unref(value)) ? unref(value) : state.value !== getDefault() ? getDefault() : getReverse();
};
const setLeft = () => {
state.value = getDefault();
};
const setRight = () => {
state.value = getReverse();
};
return {
state: computed({
get: () => state.value,
set: (value) => toggle(value)
}),
setLeft,
setRight,
toggle
};
}
function useCookie() {
}
function useLocalStorage(key, defaultValue) {
return useStorage(key, defaultValue);
}
function useSessionStorage(key, defaultValue) {
return useStorage(key, defaultValue, window == null ? void 0 : window.sessionStorage);
}
const getType = (value) => value === null ? "null" : typeof value === "boolean" ? "boolean" : typeof value === "string" || isUndefined(value) ? "string" : isObject$1(value) || isArray(value) ? "object" : !Number.isNaN(value) ? "number" : "any";
const Serializers = {
any: {
read: (v, d) => v != null ? v : d,
write: (v) => String(v)
},
boolean: {
read: (v, d) => isDef(v) ? v === "true" : d,
write: (v) => String(v)
},
number: {
read: (v, d) => isDef(v) ? Number.parseFloat(v) : d,
write: (v) => String(v)
},
object: {
read: (v, d) => v ? JSON.parse(v) : d,
write: (v) => JSON.stringify(v)
},
string: {
read: (v, d) => isDef(v) ? v : d,
write: (v) => String(v)
},
null: {
read: () => null,
write: () => "null"
}
};
const read = (value, defaultValue) => {
let type;
const $value = isUndef(value) ? defaultValue : value;
try {
type = getType(JSON.parse($value));
} catch (err) {
type = getType($value);
}
return Serializers[type].read(value, defaultValue);
};
const write = (value) => Serializers[getType(value)].write(value);
const localStorageMap = {};
const sessionStorageMap = {};
let originalLocalSetItem = () => {
};
let originalSessionSetItem = () => {
};
if (!isServer) {
window.addEventListener(
"storage",
({ key, oldValue, newValue, storageArea }) => {
const storageMap = storageArea === window.localStorage ? localStorageMap : sessionStorageMap;
if (key && storageMap[key]) {
handleSetItem(key, read(newValue, oldValue), storageMap);
}
}
);
originalLocalSetItem = window.localStorage.setItem.bind(localStorage);
originalSessionSetItem = window.sessionStorage.setItem.bind(sessionStorage);
window.localStorage.setItem = (key, value) => {
window.dispatchEvent(
new StorageEvent("storage", {
key,
oldValue: window.localStorage.getItem("key"),
newValue: value,
storageArea: window.localStorage
})
);
originalLocalSetItem(key, value);
};
window.sessionStorage.setItem = (key, value) => {
window.dispatchEvent(
new StorageEvent("storage", {
key,
oldValue: window.sessionStorage.getItem("key"),
newValue: value,
storageArea: window.sessionStorage
})
);
originalSessionSetItem(key, value);
};
const handleSetItem = (key, value, map) => {
if (key in map) {
map[key].value = value;
}
};
}
function useStorage(key, defaultValue, storage = window.localStorage) {
var _a;
if (isServer)
return { value: null };
const storageMap = storage === window.localStorage ? localStorageMap : sessionStorageMap;
const update = (value) => {
storage.setItem(key, write(value));
return value;
};
const item = reactive(
(_a = storageMap[key]) != null ? _a : storageMap[key] = ref(
update(read(storage.getItem(key), defaultValue))
)
);
watch(item, () => update(item.value), {
flush: "post",
deep: true
});
return item;
}
function useDebounce(value, wait = 0) {
const debouncedValue = ref(unref(value));
const debounced = useDebounceFn(
() => debouncedValue.value = unref(value),
wait
);
watch(
value,
() => unref(wait) > 0 ? debounced.value() : debouncedValue.value = unref(value)
);
return readonly(debouncedValue);
}
function useDebounceEffect(listener, deps, wait = 0) {
const debounced = useDebounceFn(listener, wait);
watch(
deps,
(value, oldValue) => unref(wait) > 0 ? debounced.value(value, oldValue) : listener(value, oldValue)
);
}
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
var freeGlobal$1 = freeGlobal;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal$1 || freeSelf || Function("return this")();
var root$1 = root;
var Symbol$1 = root$1.Symbol;
var Symbol$2 = Symbol$1;
var objectProto$1 = Object.prototype;
var hasOwnProperty = objectProto$1.hasOwnProperty;
var nativeObjectToString$1 = objectProto$1.toString;
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag$1), tag = value[symToStringTag$1];
try {
value[symToStringTag$1] = void 0;
var unmasked = true;
} catch (e) {
}
var result = nativeObjectToString$1.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag$1] = tag;
} else {
delete value[symToStringTag$1];
}
}
return result;
}
var objectProto = Object.prototype;
var nativeObjectToString = objectProto.toString;
function objectToString(value) {
return nativeObjectToString.call(value);
}
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
function baseGetTag(value) {
if (value == null) {
return value === void 0 ? undefinedTag : nullTag;
}
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
}
function isObjectLike(value) {
return value != null && typeof value == "object";
}
var symbolTag = "[object Symbol]";
function isSymbol(value) {
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
}
var reWhitespace = /\s/;
function trimmedEndIndex(string) {
var index = string.length;
while (index-- && reWhitespace.test(string.charAt(index))) {
}
return index;
}
var reTrimStart = /^\s+/;
function baseTrim(string) {
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
}
function isObject(value) {
var type = typeof value;
return value != null && (type == "object" || type == "function");
}
var NAN = 0 / 0;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsOctal = /^0o[0-7]+$/i;
var freeParseInt = parseInt;
function toNumber(value) {
if (typeof value == "number") {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject(value)) {
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
value = isObject(other) ? other + "" : other;
}
if (typeof value != "string") {
return value === 0 ? value : +value;
}
value = baseTrim(value);
var isBinary = reIsBinary.test(value);
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
}
var now = function() {
return root$1.Date.now();
};
var now$1 = now;
var FUNC_ERROR_TEXT$1 = "Expected a function";
var nativeMax = Math.max, nativeMin = Math.min;
function debounce(func, wait, options) {
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT$1);
}
wait = toNumber(wait) || 0;
if (isObject(options)) {
leading = !!options.leading;
maxing = "maxWait" in options;
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs, thisArg = lastThis;
lastArgs = lastThis = void 0;
lastInvokeTime = time;
result = func.apply(thisArg, args);
return result;
}
function leadingEdge(time) {
lastInvokeTime = time;
timerId = setTimeout(timerExpired, wait);
return leading ? invokeFunc(time) : result;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
}
function timerExpired() {
var time = now$1();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
timerId = setTimeout(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = void 0;
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = void 0;
return result;
}
function cancel() {
if (timerId !== void 0) {
clearTimeout(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = void 0;
}
function flush() {
return timerId === void 0 ? result : trailingEdge(now$1());
}
function debounced() {
var time = now$1(), isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === void 0) {
return leadingEdge(lastCallTime);
}
if (maxing) {
clearTimeout(timerId);
timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === void 0) {
timerId = setTimeout(timerExpired, wait);
}
return result;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
}
var FUNC_ERROR_TEXT = "Expected a function";
function throttle(func, wait, options) {
var leading = true, trailing = true;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (isObject(options)) {
leading = "leading" in options ? !!options.leading : leading;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
"leading": leading,
"maxWait": wait,
"trailing": trailing
});
}
function useDebounceFn(callback, wait = 0) {
const debounced = ref(() => {
});
const $wait = ref(wait);
watch(
$wait,
() => {
if (isFunction(debounced.value.cancel)) {
debounced.value.cancel();
}
debounced.value = debounce(callback, unref(wait));
},
{
immediate: true
}
);
return readonly(debounced);
}
function useEventEmitter() {
const emitID = ref(0);
const stream = ref([]);
const subscriptions = /* @__PURE__ */ new Set();
const emit = (...args) => {
emitID.value++;
stream.value = args;
};
const on = (listener) => {
if (isFunction(listener)) {
subscriptions.add(listener);
}
};
watch(
emitID,
() => {
for (let listener of subscriptions) {
listener(...stream.value);
}
},
{
flush: "post"
}
);
onUnmounted(() => {
subscriptions.clear();
});
return { emit, on };
}
function useRequest(url, init) {
return fetch(url, init).then((res) => res.json());
}
function useThrottle(value, wait = 0) {
const throttledValue = ref(unref(value));
const throttled = useThrottleFn(
() => throttledValue.value = unref(value),
wait
);
watch(
value,
() => unref(wait) > 0 ? throttled.value() : throttledValue.value = unref(value)
);
return readonly(throttledValue);
}
function useThrottleEffect(listener, deps, wait = 0) {
const throttled = useThrottleFn(listener, wait);
watch(
deps,
(value, oldValue) => unref(wait) > 0 ? throttled.value(value, oldValue) : listener(value, oldValue)
);
}
function useThrottleFn(callback, wait = 0) {
const throttled = ref(() => {
});
const $wait = ref(wait);
watch(
$wait,
() => {
var _a;
if (isFunction((_a = throttled.value) == null ? void 0 : _a.cancel)) {
throttled.value.cancel();
}
throttled.value = throttle(callback, unref(wait));
},
{
immediate: true
}
);
return readonly(throttled);
}
function useInterval(callback, interval = 1e3, immediate = true) {
let timer = null;
const isActive = ref(immediate);
const stop = () => {
isActive.value = false;
if (timer) {
clearInterval(timer);
timer = null;
}
};
const start = () => {
stop();
isActive.value = true;
timer = setInterval(() => {
isFunction(callback) && callback();
}, unref(interval));
};
watchEffect((onInvalidate) => {
unref(immediate) && start();
onInvalidate(stop);
});
return {
isActive: readonly(isActive),
start,
stop
};
}
function useTimeout(callback, timeout = 1e3, immediate = true) {
let timer = null;
const isActive = ref(immediate);
const stop = () => {
isActive.value = false;
if (timer) {
clearTimeout(timer);
timer = null;
}
};
const start = () => {
stop();
isActive.value = true;
timer = setTimeout(() => {
isFunction(callback) && callback();
isActive.value = false;
}, unref(timeout));
};
watchEffect((onInvalidate) => {
unref(immediate) && start();
onInvalidate(stop);
});
return {
isActive: readonly(isActive),
start,
stop
};
}
const { useSWR: _, useSWRGlobalConfig: __, ...swrActions } = swr;
export { swrActions as swr, useClickOutside, useClipboard, useCookie, useCounter, useCounterInterval, useDebounce, useDebounceEffect, useDebounceFn, useDynamicList, useEventEmitter, useEventListener, useFavicon, useFullscreen, useInterval, useLocalStorage, useMouse, usePageHidden, useQueue, useRequest, useScroll, useSessionStorage, useSet, useStorage, useThrottle, useThrottleEffect, useThrottleFn, useTimeout, useTitle, useToggle };