@scrabble-solver/scrabble-solver 2.15.8 → 2.15.10
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +13 -13
- package/.next/cache/.rscinfo +1 -1
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/.next/cache/webpack/edge-server-production/index.pack.old +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack.old +0 -0
- package/.next/diagnostics/framework.json +1 -1
- package/.next/next-minimal-server.js.nft.json +1 -1
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +4 -4
- package/.next/required-server-files.json +1 -2
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/60.js +1 -1
- package/.next/server/chunks/812.js +1 -1
- package/.next/server/chunks/974.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/_app.js +1 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_error.js +1 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/api/dictionary/[locale]/[word].js +2 -2
- package/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
- package/.next/server/pages/api/dictionary/[locale].js +1 -1
- package/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
- package/.next/server/pages/api/solve.js +1 -1
- package/.next/server/pages/api/solve.js.nft.json +1 -1
- package/.next/server/pages/api/verify.js +1 -1
- package/.next/server/pages/api/verify.js.nft.json +1 -1
- package/.next/server/pages/api/visit.js +1 -1
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/index.js +1 -1
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/index.json +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/server/webpack-api-runtime.js +1 -1
- package/.next/static/chunks/{main-b934e2c3dd3b55b5.js → main-016492249b3393e2.js} +1 -1
- package/.next/static/chunks/pages/{404-7451dd58396eaa39.js → 404-590e2a3839c1d9e0.js} +1 -1
- package/.next/static/chunks/pages/_app-ac93a74c390f2ab8.js +1 -0
- package/.next/static/chunks/pages/index-e5f1caa581e6d3b8.js +1 -0
- package/.next/static/chunks/webpack-6224d37324e372cb.js +1 -0
- package/.next/static/{IJuVKnkd8P2us9rVuan82 → ylO_ttKeJTuoqDYywao5A}/_buildManifest.js +1 -1
- package/.next/trace +23 -23
- package/LICENSE +1 -1
- package/next.config.js +3 -0
- package/package.json +11 -10
- package/src/api/getServerLoggingData.ts +1 -3
- package/src/api/index.ts +5 -5
- package/src/api/isBoardValid.ts +3 -5
- package/src/api/isCellValid.ts +4 -6
- package/src/api/isCharacterValid.ts +2 -3
- package/src/api/isRowValid.ts +3 -5
- package/src/components/Alert/Alert.tsx +1 -3
- package/src/components/Alert/index.ts +1 -1
- package/src/components/Badge/Badge.tsx +1 -3
- package/src/components/Badge/index.ts +1 -1
- package/src/components/Board/Board.tsx +3 -5
- package/src/components/Board/BoardPure.tsx +2 -2
- package/src/components/Board/components/Actions/Actions.tsx +3 -5
- package/src/components/Board/components/Actions/index.ts +1 -1
- package/src/components/Board/components/Cell/Cell.tsx +3 -5
- package/src/components/Board/components/Cell/index.ts +1 -1
- package/src/components/Board/components/InputPrompt/InputPrompt.tsx +3 -5
- package/src/components/Board/components/InputPrompt/index.ts +1 -1
- package/src/components/Board/components/ToggleDirectionButton/ToggleDirectionButton.tsx +2 -4
- package/src/components/Board/components/ToggleDirectionButton/index.ts +1 -1
- package/src/components/Board/components/index.ts +4 -4
- package/src/components/Board/hooks/index.ts +6 -6
- package/src/components/Board/hooks/useBackgroundImage.tsx +7 -9
- package/src/components/Board/hooks/useBoardStyle.ts +7 -9
- package/src/components/Board/hooks/useFloatingActions.ts +1 -3
- package/src/components/Board/hooks/useFloatingFocus.ts +1 -3
- package/src/components/Board/hooks/useFloatingInputPrompt.ts +1 -3
- package/src/components/Board/hooks/useGrid.ts +7 -9
- package/src/components/Board/index.ts +1 -1
- package/src/components/Board/lib/getBonusColor.ts +1 -3
- package/src/components/Board/lib/getPositionInGrid.ts +1 -3
- package/src/components/Board/lib/index.ts +2 -2
- package/src/components/Button/Button.tsx +3 -3
- package/src/components/Button/Link.tsx +1 -3
- package/src/components/Button/index.ts +1 -1
- package/src/components/Dictionary/Dictionary.tsx +3 -5
- package/src/components/Dictionary/index.ts +1 -1
- package/src/components/DictionaryInput/DictionaryInput.tsx +1 -3
- package/src/components/DictionaryInput/index.ts +1 -1
- package/src/components/EmptyState/EmptyState.tsx +4 -6
- package/src/components/EmptyState/index.ts +1 -1
- package/src/components/IconButton/IconButton.tsx +3 -3
- package/src/components/IconButton/Link.tsx +1 -3
- package/src/components/IconButton/index.ts +1 -1
- package/src/components/Key/Key.tsx +1 -3
- package/src/components/Key/index.ts +1 -1
- package/src/components/Keys/Arrows/Arrows.tsx +2 -4
- package/src/components/Keys/Arrows/index.ts +1 -1
- package/src/components/{keys.tsx → Keys/index.tsx} +3 -1
- package/src/components/Loading/Loading.tsx +2 -4
- package/src/components/Loading/index.ts +1 -1
- package/src/components/Logo/Logo.tsx +1 -3
- package/src/components/Logo/LogoBlueprint.tsx +2 -4
- package/src/components/Logo/index.ts +1 -1
- package/src/components/Modal/Modal.tsx +3 -3
- package/src/components/Modal/components/Section/Section.tsx +1 -3
- package/src/components/Modal/components/Section/index.ts +1 -1
- package/src/components/Modal/components/index.ts +1 -1
- package/src/components/Modal/index.ts +1 -1
- package/src/components/NavButtons/NavButtons.tsx +3 -3
- package/src/components/NavButtons/index.ts +1 -1
- package/src/components/NotFound/NotFound.tsx +2 -4
- package/src/components/NotFound/index.ts +1 -1
- package/src/components/PlainTiles/PlainTiles.tsx +10 -4
- package/src/components/PlainTiles/Tile.tsx +1 -3
- package/src/components/PlainTiles/index.ts +1 -1
- package/src/components/PlainTiles/lib/createPlainTile.ts +10 -6
- package/src/components/PlainTiles/lib/createPlainTiles.ts +2 -4
- package/src/components/PlainTiles/lib/getViewbox.ts +1 -3
- package/src/components/PlainTiles/lib/getX.ts +1 -3
- package/src/components/PlainTiles/lib/getY.ts +1 -3
- package/src/components/PlainTiles/lib/index.ts +6 -6
- package/src/components/PlainTiles/lib/randomize.ts +1 -3
- package/src/components/Progress/Progress.tsx +1 -3
- package/src/components/Progress/index.ts +1 -1
- package/src/components/Rack/Rack.tsx +9 -11
- package/src/components/Rack/components/InputPrompt/InputPrompt.tsx +3 -5
- package/src/components/Rack/components/InputPrompt/index.ts +1 -1
- package/src/components/Rack/components/RackTile/RackTile.tsx +9 -10
- package/src/components/Rack/components/RackTile/index.ts +1 -1
- package/src/components/Rack/components/index.ts +2 -2
- package/src/components/Rack/index.ts +1 -1
- package/src/components/Radio/Radio.tsx +1 -3
- package/src/components/Radio/index.ts +1 -1
- package/src/components/Results/Cell.tsx +9 -3
- package/src/components/Results/Header.tsx +2 -4
- package/src/components/Results/HeaderButton.tsx +1 -3
- package/src/components/Results/Result.tsx +2 -4
- package/src/components/Results/Results.tsx +7 -9
- package/src/components/Results/SolveButton.tsx +2 -4
- package/src/components/Results/index.ts +1 -1
- package/src/components/ResultsInput/ResultsInput.tsx +1 -3
- package/src/components/ResultsInput/index.ts +1 -1
- package/src/components/SeoMessage/SeoMessage.tsx +4 -6
- package/src/components/SeoMessage/index.ts +1 -1
- package/src/components/Solver/Solver.tsx +8 -8
- package/src/components/Solver/components/InsertButton/InsertButton.tsx +2 -4
- package/src/components/Solver/components/InsertButton/index.ts +1 -1
- package/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.tsx +4 -6
- package/src/components/Solver/components/ResultCandidatePicker/index.ts +1 -1
- package/src/components/Solver/components/index.ts +2 -2
- package/src/components/Solver/index.ts +1 -1
- package/src/components/Spinner/Spinner.tsx +1 -3
- package/src/components/Spinner/index.ts +1 -1
- package/src/components/Tile/Tile.tsx +2 -4
- package/src/components/Tile/TilePure.tsx +2 -2
- package/src/components/Tile/index.ts +1 -1
- package/src/components/Tooltip/TooltipTrigger.tsx +5 -3
- package/src/components/index.ts +24 -25
- package/src/hooks/index.ts +13 -13
- package/src/hooks/useAppLayout.ts +19 -15
- package/src/hooks/useColumns.ts +2 -4
- package/src/hooks/useDirection.ts +1 -3
- package/src/hooks/useEffectOnce.ts +8 -2
- package/src/hooks/useIsTouchDevice.ts +2 -4
- package/src/hooks/useLanguage.ts +1 -3
- package/src/hooks/useLatest.ts +1 -3
- package/src/hooks/useLocalStorage.ts +1 -3
- package/src/hooks/useMedia.ts +1 -3
- package/src/hooks/useMediaQueries.ts +2 -4
- package/src/hooks/useMediaQuery.ts +2 -4
- package/src/hooks/useOnWindowResize.ts +1 -3
- package/src/hooks/useViewportSize.ts +2 -4
- package/src/i18n/i18n.ts +1 -3
- package/src/i18n/index.ts +1 -1
- package/src/lib/arrayEquals.ts +1 -3
- package/src/lib/createArray.ts +1 -3
- package/src/lib/createComparator.ts +3 -5
- package/src/lib/createGridOf.ts +2 -4
- package/src/lib/createKeyComparator.ts +6 -5
- package/src/lib/createKeyboardNavigation.ts +2 -4
- package/src/lib/createNullMovingComparator.test.ts +1 -1
- package/src/lib/createNullMovingComparator.ts +1 -3
- package/src/lib/createRegExp.ts +1 -3
- package/src/lib/createStringComparator.ts +5 -3
- package/src/lib/detectLocale.ts +1 -3
- package/src/lib/extractCharacters.test.ts +3 -2
- package/src/lib/extractCharacters.ts +17 -5
- package/src/lib/extractCharactersByCase.test.ts +1 -1
- package/src/lib/extractCharactersByCase.ts +2 -4
- package/src/lib/extractInputValue.ts +1 -3
- package/src/lib/findCell.ts +1 -3
- package/src/lib/getCellSize.ts +3 -5
- package/src/lib/getCoordinate.ts +1 -3
- package/src/lib/getCoordinates.ts +2 -4
- package/src/lib/getRemainingTiles.ts +8 -5
- package/src/lib/getRemainingTilesCount.ts +1 -3
- package/src/lib/getRemainingTilesGroups.ts +3 -5
- package/src/lib/getTileSizes.ts +1 -3
- package/src/lib/getTotalRemainingTilesCount.ts +1 -3
- package/src/lib/groupResults.ts +3 -5
- package/src/lib/guessLocale.ts +2 -4
- package/src/lib/index.ts +39 -39
- package/src/lib/inverseDirection.ts +1 -3
- package/src/lib/isCtrl.ts +1 -3
- package/src/lib/isMac.ts +3 -4
- package/src/lib/isRegExp.ts +1 -3
- package/src/lib/isStringArray.ts +1 -3
- package/src/lib/isUpperCase.ts +1 -3
- package/src/lib/memoize.ts +18 -20
- package/src/lib/noop.ts +1 -3
- package/src/lib/numberComparator.ts +1 -3
- package/src/lib/resultMatchesCellFilter.ts +1 -3
- package/src/lib/reverseComparator.ts +1 -3
- package/src/lib/sortGroupedResults.ts +2 -4
- package/src/lib/sortResults.ts +5 -7
- package/src/lib/unorderedArraysEqual.ts +2 -4
- package/src/lib/zipCharactersAndTiles.ts +1 -3
- package/src/modals/DictionaryModal/DictionaryModal.tsx +2 -2
- package/src/modals/DictionaryModal/index.ts +1 -1
- package/src/modals/KeyMapModal/KeyMapModal.tsx +2 -2
- package/src/modals/KeyMapModal/components/Mapping/Mapping.tsx +1 -3
- package/src/modals/KeyMapModal/components/Mapping/index.ts +1 -1
- package/src/modals/KeyMapModal/components/index.ts +1 -1
- package/src/modals/KeyMapModal/index.ts +1 -1
- package/src/modals/MenuModal/MenuModal.tsx +2 -2
- package/src/modals/MenuModal/index.ts +1 -1
- package/src/modals/RemainingTilesModal/RemainingTilesModal.tsx +2 -2
- package/src/modals/RemainingTilesModal/components/Character/Character.tsx +1 -3
- package/src/modals/RemainingTilesModal/components/Character/index.ts +1 -1
- package/src/modals/RemainingTilesModal/components/index.ts +1 -1
- package/src/modals/RemainingTilesModal/index.ts +1 -1
- package/src/modals/ResultsModal/ResultsModal.tsx +2 -2
- package/src/modals/ResultsModal/index.ts +1 -1
- package/src/modals/SettingsModal/SettingsModal.tsx +2 -2
- package/src/modals/SettingsModal/components/AutoGroupTilesSetting/AutoGroupTilesSetting.tsx +1 -3
- package/src/modals/SettingsModal/components/AutoGroupTilesSetting/index.ts +1 -1
- package/src/modals/SettingsModal/components/ConfigSetting/ConfigSetting.tsx +4 -10
- package/src/modals/SettingsModal/components/ConfigSetting/index.ts +1 -1
- package/src/modals/SettingsModal/components/ConfigSetting/lib.ts +19 -0
- package/src/modals/SettingsModal/components/InputModeSetting/InputModeSetting.tsx +1 -3
- package/src/modals/SettingsModal/components/InputModeSetting/index.ts +1 -1
- package/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.tsx +1 -3
- package/src/modals/SettingsModal/components/LocaleSetting/index.ts +1 -1
- package/src/modals/SettingsModal/components/ShowCoordinatesSetting/ShowCoordinatesSetting.tsx +1 -3
- package/src/modals/SettingsModal/components/ShowCoordinatesSetting/index.ts +1 -1
- package/src/modals/SettingsModal/components/index.ts +5 -5
- package/src/modals/SettingsModal/index.ts +1 -1
- package/src/modals/WordsModal/WordsModal.tsx +2 -2
- package/src/modals/WordsModal/index.ts +1 -1
- package/src/modals/index.ts +7 -7
- package/src/pages/_app.tsx +2 -1
- package/src/pages/api/dictionary/[locale]/[word].ts +1 -1
- package/src/pages/api/dictionary/[locale]/index.ts +1 -1
- package/src/pages/api/solve.ts +6 -4
- package/src/pages/api/verify.ts +6 -4
- package/src/pages/api/visit.ts +2 -2
- package/src/pages/index.tsx +7 -0
- package/src/sdk/fetch.ts +1 -3
- package/src/sdk/fetchJson.ts +2 -4
- package/src/sdk/findWordDefinitions.ts +2 -4
- package/src/sdk/getDictionary.ts +2 -4
- package/src/sdk/index.ts +4 -4
- package/src/sdk/solve.ts +2 -4
- package/src/sdk/verify.ts +2 -4
- package/src/sdk/visit.ts +1 -3
- package/src/service-worker/average.ts +1 -3
- package/src/service-worker/dictionaries/expirationManager.ts +1 -3
- package/src/service-worker/dictionaries/getDictionary.ts +3 -5
- package/src/service-worker/dictionaries/getDictionaryUrl.ts +1 -3
- package/src/service-worker/dictionaries/index.ts +2 -2
- package/src/service-worker/dictionaries/revalidateDictionary.ts +3 -5
- package/src/service-worker/getTrie.ts +1 -3
- package/src/service-worker/index.ts +4 -2
- package/src/service-worker/routeSolveRequests.ts +17 -11
- package/src/service-worker/routeVerifyRequests.ts +7 -5
- package/src/serviceWorkerManager.ts +4 -4
- package/src/state/index.ts +4 -4
- package/src/state/localStorage.ts +10 -12
- package/src/state/sagas.ts +5 -2
- package/src/state/selectors.ts +2 -5
- package/src/state/slices/boardInitialState.ts +6 -7
- package/src/state/slices/boardSlice.ts +5 -7
- package/src/state/slices/cellFilterInitialState.ts +1 -3
- package/src/state/slices/cellFilterSlice.ts +2 -4
- package/src/state/slices/dictionaryInitialState.ts +2 -4
- package/src/state/slices/dictionarySlice.ts +2 -4
- package/src/state/slices/index.ts +16 -16
- package/src/state/slices/rackInitialState.ts +2 -4
- package/src/state/slices/rackSlice.ts +2 -4
- package/src/state/slices/resultsInitialState.ts +1 -3
- package/src/state/slices/resultsSlice.ts +2 -4
- package/src/state/slices/settingsInitialState.ts +2 -4
- package/src/state/slices/settingsSlice.ts +2 -4
- package/src/state/slices/solveInitialState.ts +3 -5
- package/src/state/slices/solveSlice.ts +2 -4
- package/src/state/slices/verifyInitialState.ts +2 -4
- package/src/state/slices/verifySlice.ts +2 -4
- package/src/state/store.ts +1 -3
- package/src/state/useTranslate.ts +2 -4
- package/src/state/useTypedSelector.ts +1 -3
- package/src/types/api.ts +15 -0
- package/src/types/index.ts +2 -0
- package/tsconfig.json +1 -1
- package/.next/cache/eslint/.cache_8dgz12 +0 -1
- package/.next/static/chunks/pages/_app-34618eeeff128581.js +0 -1
- package/.next/static/chunks/pages/index-d492616d9bc42176.js +0 -1
- package/.next/static/chunks/webpack-4224e970a97a4a86.js +0 -1
- package/src/components/Keys/index.ts +0 -1
- package/tsconfig.jest.json +0 -7
- /package/.next/static/{IJuVKnkd8P2us9rVuan82 → ylO_ttKeJTuoqDYywao5A}/_ssgManifest.js +0 -0
|
@@ -4,7 +4,7 @@ import { ButtonHTMLAttributes, FunctionComponent, ReactNode, SVGAttributes } fro
|
|
|
4
4
|
import { Tooltip } from '../Tooltip';
|
|
5
5
|
|
|
6
6
|
import styles from './Button.module.scss';
|
|
7
|
-
import Link from './Link';
|
|
7
|
+
import { Link } from './Link';
|
|
8
8
|
|
|
9
9
|
interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
10
|
'aria-label': string;
|
|
@@ -15,7 +15,7 @@ interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
15
15
|
wide?: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const ButtonBase: FunctionComponent<Props> = ({
|
|
19
19
|
children,
|
|
20
20
|
className,
|
|
21
21
|
Icon,
|
|
@@ -45,6 +45,6 @@ const Button: FunctionComponent<Props> = ({
|
|
|
45
45
|
);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
export
|
|
48
|
+
export const Button = Object.assign(ButtonBase, {
|
|
49
49
|
Link,
|
|
50
50
|
});
|
|
@@ -15,7 +15,7 @@ interface Props extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
15
15
|
wide?: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const Link: FunctionComponent<Props> = ({
|
|
18
|
+
export const Link: FunctionComponent<Props> = ({
|
|
19
19
|
children,
|
|
20
20
|
className,
|
|
21
21
|
Icon,
|
|
@@ -43,5 +43,3 @@ const Link: FunctionComponent<Props> = ({
|
|
|
43
43
|
</Tooltip>
|
|
44
44
|
);
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
export default Link;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Button } from './Button';
|
|
@@ -4,8 +4,8 @@ import { FunctionComponent } from 'react';
|
|
|
4
4
|
import { useAppLayout } from 'hooks';
|
|
5
5
|
import { selectDictionary, selectDictionaryError, useTranslate, useTypedSelector } from 'state';
|
|
6
6
|
|
|
7
|
-
import EmptyState from '../EmptyState';
|
|
8
|
-
import Loading from '../Loading';
|
|
7
|
+
import { EmptyState } from '../EmptyState';
|
|
8
|
+
import { Loading } from '../Loading';
|
|
9
9
|
|
|
10
10
|
import styles from './Dictionary.module.scss';
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ interface Props {
|
|
|
13
13
|
className?: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const Dictionary: FunctionComponent<Props> = ({ className }) => {
|
|
16
|
+
export const Dictionary: FunctionComponent<Props> = ({ className }) => {
|
|
17
17
|
const translate = useTranslate();
|
|
18
18
|
const { dictionaryResultsHeight } = useAppLayout();
|
|
19
19
|
const { results, isLoading } = useTypedSelector(selectDictionary);
|
|
@@ -78,5 +78,3 @@ const Dictionary: FunctionComponent<Props> = ({ className }) => {
|
|
|
78
78
|
</div>
|
|
79
79
|
);
|
|
80
80
|
};
|
|
81
|
-
|
|
82
|
-
export default Dictionary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Dictionary } from './Dictionary';
|
|
@@ -11,7 +11,7 @@ interface Props {
|
|
|
11
11
|
className?: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const DictionaryInput: FunctionComponent<Props> = ({ className }) => {
|
|
14
|
+
export const DictionaryInput: FunctionComponent<Props> = ({ className }) => {
|
|
15
15
|
const dispatch = useDispatch();
|
|
16
16
|
const translate = useTranslate();
|
|
17
17
|
const locale = useTypedSelector(selectLocale);
|
|
@@ -42,5 +42,3 @@ const DictionaryInput: FunctionComponent<Props> = ({ className }) => {
|
|
|
42
42
|
</form>
|
|
43
43
|
);
|
|
44
44
|
};
|
|
45
|
-
|
|
46
|
-
export default DictionaryInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { DictionaryInput } from './DictionaryInput';
|
|
@@ -6,7 +6,7 @@ import { COLOR_BLUE, COLOR_GREEN, COLOR_RED, COLOR_YELLOW } from 'parameters';
|
|
|
6
6
|
import { selectLocale, useTranslate, useTypedSelector } from 'state';
|
|
7
7
|
import { Translations } from 'types';
|
|
8
8
|
|
|
9
|
-
import PlainTiles from '../PlainTiles';
|
|
9
|
+
import { PlainTiles } from '../PlainTiles';
|
|
10
10
|
|
|
11
11
|
import styles from './EmptyState.module.scss';
|
|
12
12
|
|
|
@@ -30,13 +30,13 @@ const COLORS_PER_TYPE: Record<Props['variant'], string> = {
|
|
|
30
30
|
warning: COLOR_YELLOW,
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const EmptyState: FunctionComponent<Props> = ({ children, className, variant }) => {
|
|
33
|
+
export const EmptyState: FunctionComponent<Props> = ({ children, className, variant }) => {
|
|
34
34
|
const translate = useTranslate();
|
|
35
35
|
const locale = useTypedSelector(selectLocale);
|
|
36
36
|
const { direction } = LOCALE_FEATURES[locale];
|
|
37
|
-
const title = useMemo(() => translate(TITLE_KEY_PER_TYPE[variant]), [translate]);
|
|
37
|
+
const title = useMemo(() => translate(TITLE_KEY_PER_TYPE[variant]), [translate, variant]);
|
|
38
38
|
const message = direction === 'ltr' ? title : title.split('').reverse().join('');
|
|
39
|
-
const content = useMemo(() => [message.toUpperCase().split(' ')], [
|
|
39
|
+
const content = useMemo(() => [message.toUpperCase().split(' ')], [message]);
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<div className={classNames(styles.emptyState, className)}>
|
|
@@ -45,5 +45,3 @@ const EmptyState: FunctionComponent<Props> = ({ children, className, variant })
|
|
|
45
45
|
</div>
|
|
46
46
|
);
|
|
47
47
|
};
|
|
48
|
-
|
|
49
|
-
export default EmptyState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { EmptyState } from './EmptyState';
|
|
@@ -4,7 +4,7 @@ import { ButtonHTMLAttributes, FunctionComponent, MouseEventHandler, SVGAttribut
|
|
|
4
4
|
import { Tooltip } from '../Tooltip';
|
|
5
5
|
|
|
6
6
|
import styles from './IconButton.module.scss';
|
|
7
|
-
import Link from './Link';
|
|
7
|
+
import { Link } from './Link';
|
|
8
8
|
|
|
9
9
|
interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
10
|
'aria-label': string;
|
|
@@ -14,7 +14,7 @@ interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
14
14
|
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const IconButtonBase: FunctionComponent<Props> = ({ className, Icon, tooltip, ...props }) => {
|
|
18
18
|
return (
|
|
19
19
|
<Tooltip tooltip={tooltip}>
|
|
20
20
|
<button className={classNames(styles.iconButton, className)} type="button" {...props}>
|
|
@@ -26,6 +26,6 @@ const IconButton: FunctionComponent<Props> = ({ className, Icon, tooltip, ...pro
|
|
|
26
26
|
);
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export
|
|
29
|
+
export const IconButton = Object.assign(IconButtonBase, {
|
|
30
30
|
Link,
|
|
31
31
|
});
|
|
@@ -13,7 +13,7 @@ interface Props extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
13
13
|
tooltip: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const Link: FunctionComponent<Props> = ({ className, Icon, tooltip, ...props }) => {
|
|
16
|
+
export const Link: FunctionComponent<Props> = ({ className, Icon, tooltip, ...props }) => {
|
|
17
17
|
return (
|
|
18
18
|
<Tooltip tooltip={tooltip}>
|
|
19
19
|
<a className={classNames(styles.iconButton, className)} {...props}>
|
|
@@ -24,5 +24,3 @@ const Link: FunctionComponent<Props> = ({ className, Icon, tooltip, ...props })
|
|
|
24
24
|
</Tooltip>
|
|
25
25
|
);
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
export default Link;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { IconButton } from './IconButton';
|
|
@@ -8,8 +8,6 @@ interface Props {
|
|
|
8
8
|
className?: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const Key: FunctionComponent<Props> = ({ children, className }) => (
|
|
11
|
+
export const Key: FunctionComponent<Props> = ({ children, className }) => (
|
|
12
12
|
<kbd className={classNames(styles.key, className)}>{children}</kbd>
|
|
13
13
|
);
|
|
14
|
-
|
|
15
|
-
export default Key;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Key } from './Key';
|
|
@@ -3,7 +3,7 @@ import { FunctionComponent } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { ArrowDown, ArrowLeft, ArrowRight, ArrowUp } from 'icons';
|
|
5
5
|
|
|
6
|
-
import Key from '../../Key';
|
|
6
|
+
import { Key } from '../../Key';
|
|
7
7
|
|
|
8
8
|
import styles from './Arrows.module.scss';
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ interface Props {
|
|
|
11
11
|
className?: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const Arrows: FunctionComponent<Props> = ({ className }) => (
|
|
14
|
+
export const Arrows: FunctionComponent<Props> = ({ className }) => (
|
|
15
15
|
<div className={classNames(styles.arrows, className)}>
|
|
16
16
|
<Key className={classNames(styles.arrow, styles.left)}>
|
|
17
17
|
<ArrowLeft aria-hidden="true" role="img" />
|
|
@@ -27,5 +27,3 @@ const Arrows: FunctionComponent<Props> = ({ className }) => (
|
|
|
27
27
|
</Key>
|
|
28
28
|
</div>
|
|
29
29
|
);
|
|
30
|
-
|
|
31
|
-
export default Arrows;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Arrows } from './Arrows';
|
|
@@ -3,7 +3,7 @@ import { FunctionComponent } from 'react';
|
|
|
3
3
|
import { isMac } from 'lib';
|
|
4
4
|
import { useTranslate } from 'state';
|
|
5
5
|
|
|
6
|
-
import Key from '
|
|
6
|
+
import { Key } from '../Key';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
9
|
className?: string;
|
|
@@ -24,3 +24,5 @@ export const Space: FunctionComponent<Props> = ({ className }) => {
|
|
|
24
24
|
|
|
25
25
|
return <Key className={className}>{` ${translate('common.space')} `}</Key>;
|
|
26
26
|
};
|
|
27
|
+
|
|
28
|
+
export { Arrows } from './Arrows';
|
|
@@ -4,7 +4,7 @@ import { FunctionComponent, useMemo } from 'react';
|
|
|
4
4
|
import { LOCALE_FEATURES } from 'i18n';
|
|
5
5
|
import { selectLocale, useTranslate, useTypedSelector } from 'state';
|
|
6
6
|
|
|
7
|
-
import PlainTiles from '../PlainTiles';
|
|
7
|
+
import { PlainTiles } from '../PlainTiles';
|
|
8
8
|
|
|
9
9
|
import styles from './Loading.module.scss';
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ const prepareContent = (message: string): string[][] => {
|
|
|
20
20
|
return [parts];
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const Loading: FunctionComponent<Props> = ({ className, wave = true }) => {
|
|
23
|
+
export const Loading: FunctionComponent<Props> = ({ className, wave = true }) => {
|
|
24
24
|
const translate = useTranslate();
|
|
25
25
|
const locale = useTypedSelector(selectLocale);
|
|
26
26
|
const { direction } = LOCALE_FEATURES[locale];
|
|
@@ -37,5 +37,3 @@ const Loading: FunctionComponent<Props> = ({ className, wave = true }) => {
|
|
|
37
37
|
</div>
|
|
38
38
|
);
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
export default Loading;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Loading } from './Loading';
|
|
@@ -8,12 +8,10 @@ interface Props {
|
|
|
8
8
|
className?: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const Logo = forwardRef<HTMLImageElement, Props>((props, ref) => {
|
|
11
|
+
export const Logo = forwardRef<HTMLImageElement, Props>((props, ref) => {
|
|
12
12
|
const { logoHeight, logoWidth } = useAppLayout();
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
15
|
<Image {...props} alt="Scrabble Solver 2" height={logoHeight} priority ref={ref} src={LOGO_SRC} width={logoWidth} />
|
|
16
16
|
);
|
|
17
17
|
});
|
|
18
|
-
|
|
19
|
-
export default Logo;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { CSSProperties, FunctionComponent } from 'react';
|
|
9
9
|
|
|
10
|
-
import PlainTiles from '../PlainTiles';
|
|
10
|
+
import { PlainTiles } from '../PlainTiles';
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
13
|
className?: string;
|
|
@@ -16,8 +16,6 @@ interface Props {
|
|
|
16
16
|
|
|
17
17
|
const CONTENT = [['SCRABBLE'], ['SOLVER', '2']];
|
|
18
18
|
|
|
19
|
-
const LogoBlueprint: FunctionComponent<Props> = ({ className, style }) => (
|
|
19
|
+
export const LogoBlueprint: FunctionComponent<Props> = ({ className, style }) => (
|
|
20
20
|
<PlainTiles className={className} content={CONTENT} style={style} />
|
|
21
21
|
);
|
|
22
|
-
|
|
23
|
-
export default LogoBlueprint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Logo } from './Logo';
|
|
@@ -6,7 +6,7 @@ import { CrossSquareFill } from 'icons';
|
|
|
6
6
|
import { TRANSITION_DURATION_LONG } from 'parameters';
|
|
7
7
|
import { useTranslate } from 'state';
|
|
8
8
|
|
|
9
|
-
import IconButton from '../IconButton';
|
|
9
|
+
import { IconButton } from '../IconButton';
|
|
10
10
|
|
|
11
11
|
import { Section } from './components';
|
|
12
12
|
import styles from './Modal.module.scss';
|
|
@@ -20,7 +20,7 @@ export interface Props {
|
|
|
20
20
|
onClose: () => void;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const ModalBase: FunctionComponent<Props> = ({ children, className, footer, isOpen, title, onClose }) => {
|
|
24
24
|
const translate = useTranslate();
|
|
25
25
|
const [shouldReturnFocusAfterClose, setShouldReturnFocusAfterClose] = useState(true);
|
|
26
26
|
|
|
@@ -83,6 +83,6 @@ const Modal: FunctionComponent<Props> = ({ children, className, footer, isOpen,
|
|
|
83
83
|
);
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
export
|
|
86
|
+
export const Modal = Object.assign(ModalBase, {
|
|
87
87
|
Section,
|
|
88
88
|
});
|
|
@@ -10,11 +10,9 @@ interface Props {
|
|
|
10
10
|
title: ReactNode;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const Section: FunctionComponent<Props> = ({ children, className, label, title }) => (
|
|
13
|
+
export const Section: FunctionComponent<Props> = ({ children, className, label, title }) => (
|
|
14
14
|
<section aria-label={label} className={classNames(styles.section, className)}>
|
|
15
15
|
<h2 className={styles.heading}>{title}</h2>
|
|
16
16
|
<div>{children}</div>
|
|
17
17
|
</section>
|
|
18
18
|
);
|
|
19
|
-
|
|
20
|
-
export default Section;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Section } from './Section';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Section } from './Section';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Modal } from './Modal';
|
|
@@ -6,7 +6,7 @@ import { CardChecklist, Cog, Eraser, Github, KeyboardFill, List, Sack } from 'ic
|
|
|
6
6
|
import { GITHUB_PROJECT_URL } from 'parameters';
|
|
7
7
|
import { selectHasInvalidWords, selectHasOverusedTiles, useTranslate, useTypedSelector } from 'state';
|
|
8
8
|
|
|
9
|
-
import IconButton from '../IconButton';
|
|
9
|
+
import { IconButton } from '../IconButton';
|
|
10
10
|
|
|
11
11
|
import styles from './NavButtons.module.scss';
|
|
12
12
|
|
|
@@ -19,7 +19,7 @@ interface Props {
|
|
|
19
19
|
onShowWords: () => void;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const NavButtonsBase: FunctionComponent<Props> = ({
|
|
23
23
|
onClear,
|
|
24
24
|
onShowKeyMap,
|
|
25
25
|
onShowMenu,
|
|
@@ -136,4 +136,4 @@ const NavButtons: FunctionComponent<Props> = ({
|
|
|
136
136
|
);
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
-
export
|
|
139
|
+
export const NavButtons = memo(NavButtonsBase);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { NavButtons } from './NavButtons';
|
|
@@ -2,13 +2,13 @@ import { FunctionComponent } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { DashCircleFill } from 'icons';
|
|
4
4
|
|
|
5
|
-
import PlainTiles from '../PlainTiles';
|
|
5
|
+
import { PlainTiles } from '../PlainTiles';
|
|
6
6
|
|
|
7
7
|
import styles from './NotFound.module.scss';
|
|
8
8
|
|
|
9
9
|
const CONTENT = [['HTTP', '404']];
|
|
10
10
|
|
|
11
|
-
const NotFound: FunctionComponent = () => (
|
|
11
|
+
export const NotFound: FunctionComponent = () => (
|
|
12
12
|
<div className={styles.notFound}>
|
|
13
13
|
<a className={styles.link} href="/">
|
|
14
14
|
<DashCircleFill aria-hidden="true" className={styles.icon} role="img" />
|
|
@@ -16,5 +16,3 @@ const NotFound: FunctionComponent = () => (
|
|
|
16
16
|
</a>
|
|
17
17
|
</div>
|
|
18
18
|
);
|
|
19
|
-
|
|
20
|
-
export default NotFound;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { NotFound } from './NotFound';
|
|
@@ -3,7 +3,7 @@ import { CSSProperties, FunctionComponent, useMemo } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { createPlainTiles, getViewbox } from './lib';
|
|
5
5
|
import styles from './PlainTiles.module.scss';
|
|
6
|
-
import Tile from './Tile';
|
|
6
|
+
import { Tile } from './Tile';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
9
|
className?: string;
|
|
@@ -15,7 +15,15 @@ interface Props {
|
|
|
15
15
|
wave?: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const PlainTiles: FunctionComponent<Props> = ({
|
|
18
|
+
export const PlainTiles: FunctionComponent<Props> = ({
|
|
19
|
+
className,
|
|
20
|
+
color,
|
|
21
|
+
content,
|
|
22
|
+
dropShadow,
|
|
23
|
+
showPoints,
|
|
24
|
+
style,
|
|
25
|
+
wave,
|
|
26
|
+
}) => {
|
|
19
27
|
const tiles = useMemo(() => createPlainTiles({ color, content, showPoints }), [color, content, showPoints]);
|
|
20
28
|
|
|
21
29
|
return (
|
|
@@ -44,5 +52,3 @@ const PlainTiles: FunctionComponent<Props> = ({ className, color, content, dropS
|
|
|
44
52
|
</svg>
|
|
45
53
|
);
|
|
46
54
|
};
|
|
47
|
-
|
|
48
|
-
export default PlainTiles;
|
|
@@ -11,7 +11,7 @@ interface Props {
|
|
|
11
11
|
y: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const Tile: FunctionComponent<Props> = ({ character, className, color, points, size, transform, x, y }) => (
|
|
14
|
+
export const Tile: FunctionComponent<Props> = ({ character, className, color, points, size, transform, x, y }) => (
|
|
15
15
|
<g className={className} fill="#222" transform={transform}>
|
|
16
16
|
<rect fill={color} height={size} rx={size * 0.15} width={size} x={x} y={y} />
|
|
17
17
|
|
|
@@ -40,5 +40,3 @@ const Tile: FunctionComponent<Props> = ({ character, className, color, points, s
|
|
|
40
40
|
)}
|
|
41
41
|
</g>
|
|
42
42
|
);
|
|
43
|
-
|
|
44
|
-
export default Tile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { PlainTiles } from './PlainTiles';
|
|
@@ -11,11 +11,17 @@ import {
|
|
|
11
11
|
|
|
12
12
|
import { CreatePlainTileOptions, PlainTile } from '../types';
|
|
13
13
|
|
|
14
|
-
import getX from './getX';
|
|
15
|
-
import getY from './getY';
|
|
16
|
-
import randomize from './randomize';
|
|
14
|
+
import { getX } from './getX';
|
|
15
|
+
import { getY } from './getY';
|
|
16
|
+
import { randomize } from './randomize';
|
|
17
17
|
|
|
18
|
-
const createPlainTile = ({
|
|
18
|
+
export const createPlainTile = ({
|
|
19
|
+
cellIndex,
|
|
20
|
+
character,
|
|
21
|
+
color,
|
|
22
|
+
rowIndex,
|
|
23
|
+
showPoints,
|
|
24
|
+
}: CreatePlainTileOptions): PlainTile => {
|
|
19
25
|
const configPoints = getConfig(Game.Literaki, Locale.EN_US).getCharacterPoints(character.toLowerCase());
|
|
20
26
|
const points = showPoints ? configPoints : undefined;
|
|
21
27
|
const defaultColor =
|
|
@@ -33,5 +39,3 @@ const createPlainTile = ({ cellIndex, character, color, rowIndex, showPoints }:
|
|
|
33
39
|
y: randomize(getY(rowIndex), PLAIN_TILES_TILE_MAX_SCATTER),
|
|
34
40
|
};
|
|
35
41
|
};
|
|
36
|
-
|
|
37
|
-
export default createPlainTile;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CreatePlainTilesOptions, PlainTile } from '../types';
|
|
2
2
|
|
|
3
|
-
import createPlainTile from './createPlainTile';
|
|
3
|
+
import { createPlainTile } from './createPlainTile';
|
|
4
4
|
|
|
5
|
-
const createPlainTiles = ({ color, content, showPoints }: CreatePlainTilesOptions): PlainTile[] => {
|
|
5
|
+
export const createPlainTiles = ({ color, content, showPoints }: CreatePlainTilesOptions): PlainTile[] => {
|
|
6
6
|
const rows = content.map((words, rowIndex) => {
|
|
7
7
|
return words.map((word, wordIndex) => {
|
|
8
8
|
const cellOffset = words.slice(0, wordIndex).reduce((result, { length }) => result + length + ' '.length, 0);
|
|
@@ -23,5 +23,3 @@ const createPlainTiles = ({ color, content, showPoints }: CreatePlainTilesOption
|
|
|
23
23
|
const tiles = rows.flat(2);
|
|
24
24
|
return tiles;
|
|
25
25
|
};
|
|
26
|
-
|
|
27
|
-
export default createPlainTiles;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PLAIN_TILES_TILE_MARGIN, PLAIN_TILES_TILE_SIZE } from 'parameters';
|
|
2
2
|
|
|
3
|
-
const getViewbox = (content: string[][]): string => {
|
|
3
|
+
export const getViewbox = (content: string[][]): string => {
|
|
4
4
|
const longestRowLength = content.reduce((result, words) => {
|
|
5
5
|
const wordsLength = words.reduce((sum, word) => sum + word.length, 0);
|
|
6
6
|
const rowLength = wordsLength + Math.max(words.length - 1, 0);
|
|
@@ -15,5 +15,3 @@ const getViewbox = (content: string[][]): string => {
|
|
|
15
15
|
|
|
16
16
|
return `0 0 ${width} ${height}`;
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
export default getViewbox;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { PLAIN_TILES_PADDING_HORIZONTAL, PLAIN_TILES_TILE_MARGIN, PLAIN_TILES_TILE_SIZE } from 'parameters';
|
|
2
2
|
|
|
3
|
-
const getX = (index: number): number => {
|
|
3
|
+
export const getX = (index: number): number => {
|
|
4
4
|
return PLAIN_TILES_PADDING_HORIZONTAL + index * (PLAIN_TILES_TILE_SIZE + PLAIN_TILES_TILE_MARGIN);
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
export default getX;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { PLAIN_TILES_PADDING_VERTICAL, PLAIN_TILES_TILE_MARGIN, PLAIN_TILES_TILE_SIZE } from 'parameters';
|
|
2
2
|
|
|
3
|
-
const getY = (index: number): number => {
|
|
3
|
+
export const getY = (index: number): number => {
|
|
4
4
|
return PLAIN_TILES_PADDING_VERTICAL + index * (PLAIN_TILES_TILE_SIZE + PLAIN_TILES_TILE_MARGIN);
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
export default getY;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
1
|
+
export { createPlainTile } from './createPlainTile';
|
|
2
|
+
export { createPlainTiles } from './createPlainTiles';
|
|
3
|
+
export { getViewbox } from './getViewbox';
|
|
4
|
+
export { getX } from './getX';
|
|
5
|
+
export { getY } from './getY';
|
|
6
|
+
export { randomize } from './randomize';
|
|
@@ -17,7 +17,7 @@ const getGradient = (progress: number, color: string, background: string) => {
|
|
|
17
17
|
return `linear-gradient(90deg, ${color} 0%, ${color} ${percent}%, ${background} ${percent}%, ${background} 100%)`;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const Progress: FunctionComponent<Props> = ({ className, max, min = 0, style, value, ...props }) => {
|
|
20
|
+
export const Progress: FunctionComponent<Props> = ({ className, max, min = 0, style, value, ...props }) => {
|
|
21
21
|
const locale = useTypedSelector(selectLocale);
|
|
22
22
|
const progress = value / (max - min);
|
|
23
23
|
const percent = Math.round(100 * progress);
|
|
@@ -34,5 +34,3 @@ const Progress: FunctionComponent<Props> = ({ className, max, min = 0, style, va
|
|
|
34
34
|
/>
|
|
35
35
|
);
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
export default Progress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Progress } from './Progress';
|
|
@@ -45,7 +45,7 @@ interface Props {
|
|
|
45
45
|
tileSize: number;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const Rack: FunctionComponent<Props> = ({ className, tileSize }) => {
|
|
48
|
+
export const Rack: FunctionComponent<Props> = ({ className, tileSize }) => {
|
|
49
49
|
const dispatch = useDispatch();
|
|
50
50
|
const config = useTypedSelector(selectConfig);
|
|
51
51
|
const locale = useTypedSelector(selectLocale);
|
|
@@ -67,6 +67,11 @@ const Rack: FunctionComponent<Props> = ({ className, tileSize }) => {
|
|
|
67
67
|
const showInputPrompt = inputMode === 'touchscreen' && hasFocus;
|
|
68
68
|
const ref = useRef<HTMLDivElement>(null);
|
|
69
69
|
|
|
70
|
+
const floatingInputPrompt = useFloating({
|
|
71
|
+
placement: 'bottom-start',
|
|
72
|
+
whileElementsMounted: autoUpdate,
|
|
73
|
+
});
|
|
74
|
+
|
|
70
75
|
useOnclickOutside(() => setHasFocus(false), {
|
|
71
76
|
ignoreClass: [InputPrompt.styles.form, InputPrompt.styles.input],
|
|
72
77
|
refs: ref.current ? [ref as RefObject<HTMLDivElement>] : [],
|
|
@@ -115,12 +120,12 @@ const Rack: FunctionComponent<Props> = ({ className, tileSize }) => {
|
|
|
115
120
|
const handleFocus = useCallback(() => {
|
|
116
121
|
setHasFocus(true);
|
|
117
122
|
floatingInputPrompt.refs.setPositionReference(ref.current);
|
|
118
|
-
const characters
|
|
123
|
+
const characters = rack.filter((character) => character !== null);
|
|
119
124
|
const uppercasedDigraphs = characters.map((character) => {
|
|
120
125
|
return character.length > 1 ? character.toLocaleUpperCase(locale) : character;
|
|
121
126
|
});
|
|
122
127
|
setInput(uppercasedDigraphs.join(''));
|
|
123
|
-
}, [rack, ref]);
|
|
128
|
+
}, [floatingInputPrompt.refs, locale, rack, ref]);
|
|
124
129
|
|
|
125
130
|
const handleKeyDown = useMemo(() => {
|
|
126
131
|
return createKeyboardNavigation({
|
|
@@ -159,12 +164,7 @@ const Rack: FunctionComponent<Props> = ({ className, tileSize }) => {
|
|
|
159
164
|
}
|
|
160
165
|
},
|
|
161
166
|
});
|
|
162
|
-
}, [changeActiveIndex, config, direction]);
|
|
163
|
-
|
|
164
|
-
const floatingInputPrompt = useFloating({
|
|
165
|
-
placement: 'bottom-start',
|
|
166
|
-
whileElementsMounted: autoUpdate,
|
|
167
|
-
});
|
|
167
|
+
}, [changeActiveIndex, config, direction, dispatch]);
|
|
168
168
|
|
|
169
169
|
return (
|
|
170
170
|
<>
|
|
@@ -216,5 +216,3 @@ const Rack: FunctionComponent<Props> = ({ className, tileSize }) => {
|
|
|
216
216
|
</>
|
|
217
217
|
);
|
|
218
218
|
};
|
|
219
|
-
|
|
220
|
-
export default Rack;
|