Revert "Test upgrade react-hotkeys-hook for the keys fix"

This reverts commit 9285a0ba9a.
This commit is contained in:
Lim Chee Aun 2024-04-16 00:09:53 +08:00
parent 44e910b8c9
commit effbe189e1
18 changed files with 21 additions and 37 deletions

8
package-lock.json generated
View file

@ -31,7 +31,7 @@
"p-throttle": "~6.1.0", "p-throttle": "~6.1.0",
"preact": "~10.20.1", "preact": "~10.20.1",
"punycode": "~2.3.1", "punycode": "~2.3.1",
"react-hotkeys-hook": "~5.0.0-1", "react-hotkeys-hook": "~4.5.0",
"react-intersection-observer": "~9.8.1", "react-intersection-observer": "~9.8.1",
"react-quick-pinch-zoom": "~5.1.0", "react-quick-pinch-zoom": "~5.1.0",
"react-router-dom": "6.6.2", "react-router-dom": "6.6.2",
@ -7221,9 +7221,9 @@
} }
}, },
"node_modules/react-hotkeys-hook": { "node_modules/react-hotkeys-hook": {
"version": "5.0.0-1", "version": "4.5.0",
"resolved": "https://registry.npmjs.org/react-hotkeys-hook/-/react-hotkeys-hook-5.0.0-1.tgz", "resolved": "https://registry.npmjs.org/react-hotkeys-hook/-/react-hotkeys-hook-4.5.0.tgz",
"integrity": "sha512-nb8WD8IBrlEn3O2nlMoaBrWCxg2/vjgK3XFquDMM50qMbRzlOrR/p4PUlvh0rfuOMqEtKTGaL5BwkCh3rZ3T1w==", "integrity": "sha512-Samb85GSgAWFQNvVt3PS90LPPGSf9mkH/r4au81ZP1yOIFayLC3QAvqTgGtJ8YEDMXtPmaVBs6NgipHO6h4Mug==",
"peerDependencies": { "peerDependencies": {
"react": ">=16.8.1", "react": ">=16.8.1",
"react-dom": ">=16.8.1" "react-dom": ">=16.8.1"

View file

@ -33,7 +33,7 @@
"p-throttle": "~6.1.0", "p-throttle": "~6.1.0",
"preact": "~10.20.1", "preact": "~10.20.1",
"punycode": "~2.3.1", "punycode": "~2.3.1",
"react-hotkeys-hook": "~5.0.0-1", "react-hotkeys-hook": "~4.5.0",
"react-intersection-observer": "~9.8.1", "react-intersection-observer": "~9.8.1",
"react-quick-pinch-zoom": "~5.1.0", "react-quick-pinch-zoom": "~5.1.0",
"react-router-dom": "6.6.2", "react-router-dom": "6.6.2",

View file

@ -1,10 +1,10 @@
import { memo } from 'preact/compat'; import { memo } from 'preact/compat';
import { useEffect, useRef, useState } from 'preact/hooks'; import { useEffect, useRef, useState } from 'preact/hooks';
import { useHotkeys } from 'react-hotkeys-hook';
import { api } from '../utils/api'; import { api } from '../utils/api';
import showToast from '../utils/show-toast'; import showToast from '../utils/show-toast';
import states, { saveStatus } from '../utils/states'; import states, { saveStatus } from '../utils/states';
import useHotkeys from '../utils/useHotkeys';
import useInterval from '../utils/useInterval'; import useInterval from '../utils/useInterval';
import usePageVisibility from '../utils/usePageVisibility'; import usePageVisibility from '../utils/usePageVisibility';

View file

@ -1,3 +1,4 @@
import { useHotkeys } from 'react-hotkeys-hook';
import { useSnapshot } from 'valtio'; import { useSnapshot } from 'valtio';
import Bookmarks from '../pages/bookmarks'; import Bookmarks from '../pages/bookmarks';
@ -11,7 +12,6 @@ import Public from '../pages/public';
import Search from '../pages/search'; import Search from '../pages/search';
import Trending from '../pages/trending'; import Trending from '../pages/trending';
import states from '../utils/states'; import states from '../utils/states';
import useHotkeys from '../utils/useHotkeys';
import useTitle from '../utils/useTitle'; import useTitle from '../utils/useTitle';
function Columns() { function Columns() {

View file

@ -1,7 +1,8 @@
import { useHotkeys } from 'react-hotkeys-hook';
import openCompose from '../utils/open-compose'; import openCompose from '../utils/open-compose';
import openOSK from '../utils/open-osk'; import openOSK from '../utils/open-osk';
import states from '../utils/states'; import states from '../utils/states';
import useHotkeys from '../utils/useHotkeys';
import Icon from './icon'; import Icon from './icon';

View file

@ -5,6 +5,7 @@ import { MenuItem } from '@szhsin/react-menu';
import { deepEqual } from 'fast-equals'; import { deepEqual } from 'fast-equals';
import { forwardRef } from 'preact/compat'; import { forwardRef } from 'preact/compat';
import { useEffect, useMemo, useRef, useState } from 'preact/hooks'; import { useEffect, useMemo, useRef, useState } from 'preact/hooks';
import { useHotkeys } from 'react-hotkeys-hook';
import stringLength from 'string-length'; import stringLength from 'string-length';
import { uid } from 'uid/single'; import { uid } from 'uid/single';
import { useDebouncedCallback, useThrottledCallback } from 'use-debounce'; import { useDebouncedCallback, useThrottledCallback } from 'use-debounce';
@ -32,7 +33,6 @@ import {
} from '../utils/store-utils'; } from '../utils/store-utils';
import supports from '../utils/supports'; import supports from '../utils/supports';
import useCloseWatcher from '../utils/useCloseWatcher'; import useCloseWatcher from '../utils/useCloseWatcher';
import useHotkeys from '../utils/useHotkeys';
import useInterval from '../utils/useInterval'; import useInterval from '../utils/useInterval';
import visibilityIconsMap from '../utils/visibility-icons-map'; import visibilityIconsMap from '../utils/visibility-icons-map';

View file

@ -1,10 +1,10 @@
import './keyboard-shortcuts-help.css'; import './keyboard-shortcuts-help.css';
import { memo } from 'preact/compat'; import { memo } from 'preact/compat';
import { useHotkeys } from 'react-hotkeys-hook';
import { useSnapshot } from 'valtio'; import { useSnapshot } from 'valtio';
import states from '../utils/states'; import states from '../utils/states';
import useHotkeys from '../utils/useHotkeys';
import Icon from './icon'; import Icon from './icon';
import Modal from './modal'; import Modal from './modal';

View file

@ -7,11 +7,11 @@ import {
useRef, useRef,
useState, useState,
} from 'preact/hooks'; } from 'preact/hooks';
import { useHotkeys } from 'react-hotkeys-hook';
import { oklab2rgb, rgb2oklab } from '../utils/color-utils'; import { oklab2rgb, rgb2oklab } from '../utils/color-utils';
import showToast from '../utils/show-toast'; import showToast from '../utils/show-toast';
import states from '../utils/states'; import states from '../utils/states';
import useHotkeys from '../utils/useHotkeys';
import Icon from './icon'; import Icon from './icon';
import Link from './link'; import Link from './link';

View file

@ -2,9 +2,9 @@ import './modal.css';
import { createPortal } from 'preact/compat'; import { createPortal } from 'preact/compat';
import { useEffect, useRef } from 'preact/hooks'; import { useEffect, useRef } from 'preact/hooks';
import { useHotkeys } from 'react-hotkeys-hook';
import useCloseWatcher from '../utils/useCloseWatcher'; import useCloseWatcher from '../utils/useCloseWatcher';
import useHotkeys from '../utils/useHotkeys';
const $modalContainer = document.getElementById('modal-container'); const $modalContainer = document.getElementById('modal-container');

View file

@ -2,8 +2,7 @@ import './search-command.css';
import { memo } from 'preact/compat'; import { memo } from 'preact/compat';
import { useRef, useState } from 'preact/hooks'; import { useRef, useState } from 'preact/hooks';
import { useHotkeys } from 'react-hotkeys-hook';
import useHotkeys from '../utils/useHotkeys';
import SearchForm from './search-form'; import SearchForm from './search-form';

View file

@ -3,6 +3,7 @@ import './shortcuts.css';
import { MenuDivider } from '@szhsin/react-menu'; import { MenuDivider } from '@szhsin/react-menu';
import { memo } from 'preact/compat'; import { memo } from 'preact/compat';
import { useRef, useState } from 'preact/hooks'; import { useRef, useState } from 'preact/hooks';
import { useHotkeys } from 'react-hotkeys-hook';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { useSnapshot } from 'valtio'; import { useSnapshot } from 'valtio';
@ -10,7 +11,6 @@ import { SHORTCUTS_META } from '../components/shortcuts-settings';
import { api } from '../utils/api'; import { api } from '../utils/api';
import { getLists } from '../utils/lists'; import { getLists } from '../utils/lists';
import states from '../utils/states'; import states from '../utils/states';
import useHotkeys from '../utils/useHotkeys';
import AsyncText from './AsyncText'; import AsyncText from './AsyncText';
import Icon from './icon'; import Icon from './icon';

View file

@ -22,6 +22,7 @@ import {
useState, useState,
} from 'preact/hooks'; } from 'preact/hooks';
import punycode from 'punycode'; import punycode from 'punycode';
import { useHotkeys } from 'react-hotkeys-hook';
import { useLongPress } from 'use-long-press'; import { useLongPress } from 'use-long-press';
import { useSnapshot } from 'valtio'; import { useSnapshot } from 'valtio';
@ -58,7 +59,6 @@ import store from '../utils/store';
import { getCurrentAccountID } from '../utils/store-utils'; import { getCurrentAccountID } from '../utils/store-utils';
import supports from '../utils/supports'; import supports from '../utils/supports';
import unfurlMastodonLink from '../utils/unfurl-link'; import unfurlMastodonLink from '../utils/unfurl-link';
import useHotkeys from '../utils/useHotkeys';
import useTruncated from '../utils/useTruncated'; import useTruncated from '../utils/useTruncated';
import visibilityIconsMap from '../utils/visibility-icons-map'; import visibilityIconsMap from '../utils/visibility-icons-map';

View file

@ -6,6 +6,7 @@ import {
useRef, useRef,
useState, useState,
} from 'preact/hooks'; } from 'preact/hooks';
import { useHotkeys } from 'react-hotkeys-hook';
import { InView } from 'react-intersection-observer'; import { InView } from 'react-intersection-observer';
import { useDebouncedCallback } from 'use-debounce'; import { useDebouncedCallback } from 'use-debounce';
import { useSnapshot } from 'valtio'; import { useSnapshot } from 'valtio';
@ -16,7 +17,6 @@ import states, { statusKey } from '../utils/states';
import statusPeek from '../utils/status-peek'; import statusPeek from '../utils/status-peek';
import { isMediaFirstInstance } from '../utils/store-utils'; import { isMediaFirstInstance } from '../utils/store-utils';
import { groupBoosts, groupContext } from '../utils/timeline-utils'; import { groupBoosts, groupContext } from '../utils/timeline-utils';
import useHotkeys from '../utils/useHotkeys';
import useInterval from '../utils/useInterval'; import useInterval from '../utils/useInterval';
import usePageVisibility from '../utils/usePageVisibility'; import usePageVisibility from '../utils/usePageVisibility';
import useScroll from '../utils/useScroll'; import useScroll from '../utils/useScroll';

View file

@ -14,6 +14,7 @@ import {
useState, useState,
} from 'preact/hooks'; } from 'preact/hooks';
import punycode from 'punycode'; import punycode from 'punycode';
import { useHotkeys } from 'react-hotkeys-hook';
import { useSearchParams } from 'react-router-dom'; import { useSearchParams } from 'react-router-dom';
import { uid } from 'uid/single'; import { uid } from 'uid/single';
@ -41,7 +42,6 @@ import statusPeek from '../utils/status-peek';
import store from '../utils/store'; import store from '../utils/store';
import { getCurrentAccountID, getCurrentAccountNS } from '../utils/store-utils'; import { getCurrentAccountID, getCurrentAccountNS } from '../utils/store-utils';
import { assignFollowedTags } from '../utils/timeline-utils'; import { assignFollowedTags } from '../utils/timeline-utils';
import useHotkeys from '../utils/useHotkeys';
import useTitle from '../utils/useTitle'; import useTitle from '../utils/useTitle';
const FILTER_CONTEXT = 'home'; const FILTER_CONTEXT = 'home';

View file

@ -3,6 +3,7 @@ import './notifications.css';
import { Fragment } from 'preact'; import { Fragment } from 'preact';
import { memo } from 'preact/compat'; import { memo } from 'preact/compat';
import { useCallback, useEffect, useRef, useState } from 'preact/hooks'; import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
import { useHotkeys } from 'react-hotkeys-hook';
import { InView } from 'react-intersection-observer'; import { InView } from 'react-intersection-observer';
import { useSearchParams } from 'react-router-dom'; import { useSearchParams } from 'react-router-dom';
import { useSnapshot } from 'valtio'; import { useSnapshot } from 'valtio';
@ -28,7 +29,6 @@ import showToast from '../utils/show-toast';
import states, { saveStatus } from '../utils/states'; import states, { saveStatus } from '../utils/states';
import { getCurrentInstance } from '../utils/store-utils'; import { getCurrentInstance } from '../utils/store-utils';
import supports from '../utils/supports'; import supports from '../utils/supports';
import useHotkeys from '../utils/useHotkeys';
import usePageVisibility from '../utils/usePageVisibility'; import usePageVisibility from '../utils/usePageVisibility';
import useScroll from '../utils/useScroll'; import useScroll from '../utils/useScroll';
import useTitle from '../utils/useTitle'; import useTitle from '../utils/useTitle';

View file

@ -2,6 +2,7 @@ import './search.css';
import { useAutoAnimate } from '@formkit/auto-animate/preact'; import { useAutoAnimate } from '@formkit/auto-animate/preact';
import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks'; import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks';
import { useHotkeys } from 'react-hotkeys-hook';
import { InView } from 'react-intersection-observer'; import { InView } from 'react-intersection-observer';
import { useParams, useSearchParams } from 'react-router-dom'; import { useParams, useSearchParams } from 'react-router-dom';
@ -15,7 +16,6 @@ import Status from '../components/status';
import { api } from '../utils/api'; import { api } from '../utils/api';
import { fetchRelationships } from '../utils/relationships'; import { fetchRelationships } from '../utils/relationships';
import shortenNumber from '../utils/shorten-number'; import shortenNumber from '../utils/shorten-number';
import useHotkeys from '../utils/useHotkeys';
import usePageVisibility from '../utils/usePageVisibility'; import usePageVisibility from '../utils/usePageVisibility';
import useTitle from '../utils/useTitle'; import useTitle from '../utils/useTitle';

View file

@ -13,6 +13,7 @@ import {
useState, useState,
} from 'preact/hooks'; } from 'preact/hooks';
import punycode from 'punycode'; import punycode from 'punycode';
import { useHotkeys } from 'react-hotkeys-hook';
import { InView } from 'react-intersection-observer'; import { InView } from 'react-intersection-observer';
import { matchPath, useSearchParams } from 'react-router-dom'; import { matchPath, useSearchParams } from 'react-router-dom';
import { useSnapshot } from 'valtio'; import { useSnapshot } from 'valtio';
@ -37,7 +38,6 @@ import states, {
} from '../utils/states'; } from '../utils/states';
import statusPeek from '../utils/status-peek'; import statusPeek from '../utils/status-peek';
import { getCurrentAccount } from '../utils/store-utils'; import { getCurrentAccount } from '../utils/store-utils';
import useHotkeys from '../utils/useHotkeys';
import useScroll from '../utils/useScroll'; import useScroll from '../utils/useScroll';
import useTitle from '../utils/useTitle'; import useTitle from '../utils/useTitle';

View file

@ -1,16 +0,0 @@
import { useHotkeys } from 'react-hotkeys-hook';
// Patch useHotKeys to add additional option
// E.g. useHotkeys('!', callback, {useKey: true})
export default function (keys, callback, options, deps) {
return useHotkeys(
keys,
callback,
{
useKey: true,
...options,
},
deps,
);
}