scrabble-solver 2.8.2 → 2.8.3

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.
Files changed (184) hide show
  1. package/.eslintrc.js +1 -1
  2. package/lerna.json +1 -1
  3. package/package.json +1 -1
  4. package/packages/configs/build/getConfig.js +6 -12
  5. package/packages/configs/build/getLocaleConfig.js +2 -2
  6. package/packages/configs/build/isConfigId.js +5 -8
  7. package/packages/configs/build/literaki/bonuses.js +2 -2
  8. package/packages/configs/build/literaki/literaki.js +14 -27
  9. package/packages/configs/build/literaki/tiles/tilesDe.js +1 -1
  10. package/packages/configs/build/literaki/tiles/tilesEn.js +1 -1
  11. package/packages/configs/build/literaki/tiles/tilesEs.js +1 -1
  12. package/packages/configs/build/literaki/tiles/tilesFr.js +1 -1
  13. package/packages/configs/build/literaki/tiles/tilesPl.js +1 -1
  14. package/packages/configs/build/scrabble/bonuses.js +2 -2
  15. package/packages/configs/build/scrabble/scrabble.js +14 -27
  16. package/packages/configs/build/scrabble/tiles/tilesDe.js +1 -1
  17. package/packages/configs/build/scrabble/tiles/tilesEn.js +1 -1
  18. package/packages/configs/build/scrabble/tiles/tilesEs.js +1 -1
  19. package/packages/configs/build/scrabble/tiles/tilesFr.js +1 -1
  20. package/packages/configs/build/scrabble/tiles/tilesPl.js +1 -1
  21. package/packages/configs/package.json +3 -3
  22. package/packages/constants/package.json +1 -1
  23. package/packages/dictionaries/build/Dictionaries.js +37 -110
  24. package/packages/dictionaries/build/constants/index.js +2 -2
  25. package/packages/dictionaries/build/index.js +1 -1
  26. package/packages/dictionaries/build/lib/DiskCache.js +31 -91
  27. package/packages/dictionaries/build/lib/LayeredCache.js +37 -101
  28. package/packages/dictionaries/build/lib/MemoryCache.js +16 -17
  29. package/packages/dictionaries/build/lib/createAsyncProxy.js +14 -58
  30. package/packages/dictionaries/build/lib/createCacheTimestampComparator.js +4 -4
  31. package/packages/dictionaries/build/lib/downloadDictionary.js +10 -54
  32. package/packages/dictionaries/build/lib/getDictionaryFilepath.js +4 -4
  33. package/packages/dictionaries/build/lib/readFile.js +12 -50
  34. package/packages/dictionaries/build/lib/writeFile.js +12 -50
  35. package/packages/dictionaries/package-lock.json +2 -2
  36. package/packages/dictionaries/package.json +4 -4
  37. package/packages/dictionaries/src/lib/LayeredCache.ts +17 -8
  38. package/packages/logger/build/constants.js +2 -2
  39. package/packages/logger/build/logger.js +4 -4
  40. package/packages/logger/package-lock.json +2 -2
  41. package/packages/logger/package.json +1 -1
  42. package/packages/scrabble-solver/.next/BUILD_ID +1 -1
  43. package/packages/scrabble-solver/.next/build-manifest.json +5 -5
  44. package/packages/scrabble-solver/.next/cache/.tsbuildinfo +1 -1
  45. package/packages/scrabble-solver/.next/cache/eslint/.cache_8dgz12 +1 -1
  46. package/packages/scrabble-solver/.next/cache/next-server.js.nft.json +1 -1
  47. package/packages/scrabble-solver/.next/cache/webpack/client-production/0.pack +0 -0
  48. package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack +0 -0
  49. package/packages/scrabble-solver/.next/cache/webpack/server-production/0.pack +0 -0
  50. package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack +0 -0
  51. package/packages/scrabble-solver/.next/next-server.js.nft.json +1 -1
  52. package/packages/scrabble-solver/.next/prerender-manifest.json +1 -1
  53. package/packages/scrabble-solver/.next/routes-manifest.json +1 -1
  54. package/packages/scrabble-solver/.next/server/chunks/413.js +391 -673
  55. package/packages/scrabble-solver/.next/server/chunks/515.js +414 -500
  56. package/packages/scrabble-solver/.next/server/chunks/907.js +397 -679
  57. package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -1
  58. package/packages/scrabble-solver/.next/server/pages/404.html +1 -1
  59. package/packages/scrabble-solver/.next/server/pages/404.js.nft.json +1 -1
  60. package/packages/scrabble-solver/.next/server/pages/500.html +2 -2
  61. package/packages/scrabble-solver/.next/server/pages/_app.js +7 -10
  62. package/packages/scrabble-solver/.next/server/pages/_app.js.nft.json +1 -1
  63. package/packages/scrabble-solver/.next/server/pages/_document.js +0 -3
  64. package/packages/scrabble-solver/.next/server/pages/_error.js.nft.json +1 -1
  65. package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js +114 -171
  66. package/packages/scrabble-solver/.next/server/pages/api/solve.js +428 -1164
  67. package/packages/scrabble-solver/.next/server/pages/index.html +1 -1
  68. package/packages/scrabble-solver/.next/server/pages/index.js +2 -2
  69. package/packages/scrabble-solver/.next/server/pages/index.js.nft.json +1 -1
  70. package/packages/scrabble-solver/.next/server/pages/index.json +1 -1
  71. package/packages/scrabble-solver/.next/static/OhUvTNKwyrrzmNwKBnpUU/_buildManifest.js +1 -0
  72. package/packages/scrabble-solver/.next/static/{nXSSCVI5pGlS_NxEidxkS → OhUvTNKwyrrzmNwKBnpUU}/_ssgManifest.js +0 -0
  73. package/packages/scrabble-solver/.next/static/chunks/{195-fcadef5c6eed8338.js → 195-4b75c9c697b7b455.js} +1 -1
  74. package/packages/scrabble-solver/.next/static/chunks/pages/_app-72522bfb306a8aef.js +1 -0
  75. package/packages/scrabble-solver/.next/trace +42 -42
  76. package/packages/scrabble-solver/package-lock.json +2 -2
  77. package/packages/scrabble-solver/package.json +8 -8
  78. package/packages/scrabble-solver/src/components/Board/Board.tsx +1 -1
  79. package/packages/scrabble-solver/src/components/Board/BoardPure.tsx +1 -1
  80. package/packages/scrabble-solver/src/components/Board/components/Cell/Button.tsx +1 -1
  81. package/packages/scrabble-solver/src/components/Board/components/Cell/Cell.tsx +1 -1
  82. package/packages/scrabble-solver/src/components/Board/components/Cell/CellPure.tsx +1 -1
  83. package/packages/scrabble-solver/src/components/Button/Button.tsx +1 -1
  84. package/packages/scrabble-solver/src/components/Checkbox/Checkbox.tsx +1 -1
  85. package/packages/scrabble-solver/src/components/Dictionary/Dictionary.tsx +1 -1
  86. package/packages/scrabble-solver/src/components/DictionaryInput/DictionaryInput.tsx +1 -1
  87. package/packages/scrabble-solver/src/components/EmptyState/EmptyState.tsx +1 -1
  88. package/packages/scrabble-solver/src/components/Key/Key.tsx +1 -1
  89. package/packages/scrabble-solver/src/components/KeyMap/KeyMap.tsx +1 -1
  90. package/packages/scrabble-solver/src/components/KeyMap/components/Mapping/Mapping.tsx +1 -1
  91. package/packages/scrabble-solver/src/components/Loading/Loading.tsx +1 -1
  92. package/packages/scrabble-solver/src/components/Logo/Logo.tsx +1 -1
  93. package/packages/scrabble-solver/src/components/NavButtons/NavButtons.tsx +1 -1
  94. package/packages/scrabble-solver/src/components/NotFound/NotFound.tsx +1 -1
  95. package/packages/scrabble-solver/src/components/PlainTiles/PlainTiles.tsx +1 -1
  96. package/packages/scrabble-solver/src/components/PlainTiles/Tile.tsx +1 -1
  97. package/packages/scrabble-solver/src/components/Rack/Rack.tsx +1 -1
  98. package/packages/scrabble-solver/src/components/Rack/RackTile.tsx +1 -1
  99. package/packages/scrabble-solver/src/components/Radio/Radio.tsx +1 -1
  100. package/packages/scrabble-solver/src/components/RemainingTiles/Character.tsx +1 -1
  101. package/packages/scrabble-solver/src/components/RemainingTiles/RemainingTiles.tsx +1 -1
  102. package/packages/scrabble-solver/src/components/Results/Cell.tsx +1 -1
  103. package/packages/scrabble-solver/src/components/Results/HeaderButton.tsx +1 -1
  104. package/packages/scrabble-solver/src/components/Results/Result.tsx +1 -1
  105. package/packages/scrabble-solver/src/components/Results/Results.tsx +1 -1
  106. package/packages/scrabble-solver/src/components/Results/SolveButton.tsx +1 -1
  107. package/packages/scrabble-solver/src/components/ResultsInput/ResultsInput.tsx +1 -1
  108. package/packages/scrabble-solver/src/components/Screen/Screen.tsx +1 -1
  109. package/packages/scrabble-solver/src/components/Settings/Settings.tsx +1 -1
  110. package/packages/scrabble-solver/src/components/Settings/components/AutoGroupTilesSetting/AutoGroupTilesSetting.tsx +1 -1
  111. package/packages/scrabble-solver/src/components/Settings/components/ConfigSetting/ConfigSetting.tsx +1 -1
  112. package/packages/scrabble-solver/src/components/Settings/components/LocaleSetting/LocaleSetting.tsx +1 -1
  113. package/packages/scrabble-solver/src/components/Sidebar/Sidebar.tsx +1 -1
  114. package/packages/scrabble-solver/src/components/Sidebar/components/Section/Section.tsx +1 -1
  115. package/packages/scrabble-solver/src/components/Splash/Splash.tsx +1 -1
  116. package/packages/scrabble-solver/src/components/SquareButton/Link.tsx +1 -1
  117. package/packages/scrabble-solver/src/components/SquareButton/SquareButton.tsx +1 -1
  118. package/packages/scrabble-solver/src/components/Tile/Tile.tsx +1 -1
  119. package/packages/scrabble-solver/src/components/Tile/TilePure.tsx +1 -1
  120. package/packages/scrabble-solver/src/components/Tooltip/useTooltip.tsx +1 -1
  121. package/packages/scrabble-solver/src/components/Well/Well.tsx +1 -1
  122. package/packages/scrabble-solver/src/hooks/usePortal.tsx +19 -9
  123. package/packages/scrabble-solver/src/lib/memoize.ts +1 -1
  124. package/packages/scrabble-solver/src/pages/_app.tsx +1 -1
  125. package/packages/scrabble-solver/src/pages/_document.tsx +1 -1
  126. package/packages/scrabble-solver/src/pages/index.tsx +1 -1
  127. package/packages/solver/build/PatternsFiller.js +37 -67
  128. package/packages/solver/build/PatternsGenerator.js +42 -75
  129. package/packages/solver/build/ScoresCalculator.js +20 -24
  130. package/packages/solver/build/Solver.js +19 -23
  131. package/packages/solver/package-lock.json +2 -2
  132. package/packages/solver/package.json +5 -5
  133. package/packages/solver/src/PatternsFiller.ts +3 -2
  134. package/packages/types/build/Board.js +68 -85
  135. package/packages/types/build/Bonus.js +15 -21
  136. package/packages/types/build/Cell.js +30 -32
  137. package/packages/types/build/CharacterBonus.js +18 -40
  138. package/packages/types/build/Config.js +62 -117
  139. package/packages/types/build/HorizontalPattern.js +17 -63
  140. package/packages/types/build/Pattern.js +36 -40
  141. package/packages/types/build/Result.js +23 -46
  142. package/packages/types/build/Tile.js +22 -24
  143. package/packages/types/build/VerticalPattern.js +17 -63
  144. package/packages/types/build/WordBonus.js +13 -35
  145. package/packages/types/build/WordDefinition.js +13 -15
  146. package/packages/types/package.json +2 -2
  147. package/packages/word-definitions/build/crawl/crawl.js +15 -16
  148. package/packages/word-definitions/build/crawl/crawlEnglish.js +3 -3
  149. package/packages/word-definitions/build/crawl/crawlFrench.js +3 -3
  150. package/packages/word-definitions/build/crawl/crawlGerman.js +3 -3
  151. package/packages/word-definitions/build/crawl/crawlPolish.js +3 -3
  152. package/packages/word-definitions/build/crawl/crawlSpanish.js +3 -3
  153. package/packages/word-definitions/build/getWordDefinition.js +9 -52
  154. package/packages/word-definitions/build/lib/normalizeDefinition.js +15 -15
  155. package/packages/word-definitions/build/lib/request.js +8 -20
  156. package/packages/word-definitions/build/lib/unique.js +1 -1
  157. package/packages/word-definitions/build/parse/parse.js +18 -19
  158. package/packages/word-definitions/build/parse/parseEnglish.js +5 -5
  159. package/packages/word-definitions/build/parse/parseFrench.js +5 -5
  160. package/packages/word-definitions/build/parse/parseGerman.js +6 -6
  161. package/packages/word-definitions/build/parse/parsePolish.js +6 -6
  162. package/packages/word-definitions/build/parse/parseSpanish.js +9 -9
  163. package/packages/word-definitions/package-lock.json +8 -8
  164. package/packages/word-definitions/package.json +2 -2
  165. package/packages/word-lists/build/getDeDeWordList.js +5 -43
  166. package/packages/word-lists/build/getEnGbWordList.js +5 -43
  167. package/packages/word-lists/build/getEnUsWordList.js +5 -43
  168. package/packages/word-lists/build/getEsEsWordList.js +7 -50
  169. package/packages/word-lists/build/getFrFrWordList.js +9 -50
  170. package/packages/word-lists/build/getPlPlWordList.js +34 -91
  171. package/packages/word-lists/build/getWordList.js +16 -17
  172. package/packages/word-lists/build/lib/downloadFile.js +5 -5
  173. package/packages/word-lists/build/lib/downloadHtml.js +8 -8
  174. package/packages/word-lists/build/lib/extractWords.js +5 -5
  175. package/packages/word-lists/build/lib/findFirstWordIndex.js +6 -6
  176. package/packages/word-lists/build/lib/getHash.js +2 -5
  177. package/packages/word-lists/build/lib/getTempFilename.js +3 -3
  178. package/packages/word-lists/build/lib/getTxtWordList.js +12 -56
  179. package/packages/word-lists/package-lock.json +2 -2
  180. package/packages/word-lists/package.json +2 -2
  181. package/packages/word-lists/src/getFrFrWordList.ts +1 -0
  182. package/tsconfig.json +1 -1
  183. package/packages/scrabble-solver/.next/static/chunks/pages/_app-f4030148d742bcd2.js +0 -1
  184. package/packages/scrabble-solver/.next/static/nXSSCVI5pGlS_NxEidxkS/_buildManifest.js +0 -1
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@scrabble-solver/scrabble-solver",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@scrabble-solver/scrabble-solver",
9
- "version": "2.8.2",
9
+ "version": "2.8.3",
10
10
  "license": "CC BY-NC-ND 4.0",
11
11
  "dependencies": {
12
12
  "@popperjs/core": "^2.11.6",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrabble-solver/scrabble-solver",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "description": "Scrabble Solver 2 - App",
5
5
  "engines": {
6
6
  "node": ">=16.0.0"
@@ -30,13 +30,13 @@
30
30
  "dependencies": {
31
31
  "@popperjs/core": "^2.11.6",
32
32
  "@reduxjs/toolkit": "^1.8.5",
33
- "@scrabble-solver/configs": "^2.8.2",
34
- "@scrabble-solver/constants": "^2.8.2",
35
- "@scrabble-solver/dictionaries": "^2.8.2",
36
- "@scrabble-solver/logger": "^2.8.2",
37
- "@scrabble-solver/solver": "^2.8.2",
38
- "@scrabble-solver/types": "^2.8.2",
39
- "@scrabble-solver/word-definitions": "^2.8.2",
33
+ "@scrabble-solver/configs": "^2.8.3",
34
+ "@scrabble-solver/constants": "^2.8.3",
35
+ "@scrabble-solver/dictionaries": "^2.8.3",
36
+ "@scrabble-solver/logger": "^2.8.3",
37
+ "@scrabble-solver/solver": "^2.8.3",
38
+ "@scrabble-solver/types": "^2.8.3",
39
+ "@scrabble-solver/word-definitions": "^2.8.3",
40
40
  "classnames": "^2.3.2",
41
41
  "next": "^12.3.1",
42
42
  "normalize.css": "^8.0.1",
@@ -1,4 +1,4 @@
1
- import React, { FunctionComponent, Ref } from 'react';
1
+ import { FunctionComponent, Ref } from 'react';
2
2
 
3
3
  import { selectRowsWithCandidate, useTypedSelector } from 'state';
4
4
 
@@ -1,6 +1,6 @@
1
1
  import { Cell } from '@scrabble-solver/types';
2
2
  import classNames from 'classnames';
3
- import React, { FunctionComponent, KeyboardEventHandler, memo, Ref, RefObject } from 'react';
3
+ import { FunctionComponent, KeyboardEventHandler, memo, Ref, RefObject } from 'react';
4
4
 
5
5
  import styles from './Board.module.scss';
6
6
  import { Cell as CellComponent } from './components';
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { ButtonHTMLAttributes, FunctionComponent, MouseEventHandler, ReactNode } from 'react';
2
+ import { ButtonHTMLAttributes, FunctionComponent, MouseEventHandler, ReactNode } from 'react';
3
3
 
4
4
  import { useTooltip } from '../../../Tooltip';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { EMPTY_CELL } from '@scrabble-solver/constants';
2
2
  import { Cell as CellModel } from '@scrabble-solver/types';
3
- import React, { FunctionComponent, RefObject, useCallback, useMemo } from 'react';
3
+ import { FunctionComponent, RefObject, useCallback, useMemo } from 'react';
4
4
  import { useDispatch } from 'react-redux';
5
5
 
6
6
  import { getTileSizes } from 'lib';
@@ -1,6 +1,6 @@
1
1
  import { Bonus, Cell, Tile as TileModel } from '@scrabble-solver/types';
2
2
  import classNames from 'classnames';
3
- import React, { CSSProperties, FocusEventHandler, FunctionComponent, memo, MouseEventHandler, RefObject } from 'react';
3
+ import { CSSProperties, FocusEventHandler, FunctionComponent, memo, MouseEventHandler, RefObject } from 'react';
4
4
 
5
5
  import { ArrowDown } from 'icons';
6
6
  import { Translate } from 'types';
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { ButtonHTMLAttributes, FunctionComponent, MouseEventHandler, ReactNode, SVGAttributes } from 'react';
2
+ import { ButtonHTMLAttributes, FunctionComponent, MouseEventHandler, ReactNode, SVGAttributes } from 'react';
3
3
 
4
4
  import { useTooltip } from '../Tooltip';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { ChangeEventHandler, FunctionComponent, ReactNode } from 'react';
2
+ import { ChangeEventHandler, FunctionComponent, ReactNode } from 'react';
3
3
 
4
4
  import { CheckboxChecked, CheckboxEmpty } from 'icons';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { FunctionComponent } from 'react';
2
+ import { FunctionComponent } from 'react';
3
3
 
4
4
  import { selectDictionary, useTranslate, useTypedSelector } from 'state';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { ChangeEvent, FormEvent, FunctionComponent } from 'react';
2
+ import { ChangeEvent, FormEvent, FunctionComponent } from 'react';
3
3
  import { useDispatch } from 'react-redux';
4
4
 
5
5
  import { dictionarySlice, selectDictionary, useTranslate, useTypedSelector } from 'state';
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { FunctionComponent, ReactNode, useMemo } from 'react';
2
+ import { FunctionComponent, ReactNode, useMemo } from 'react';
3
3
 
4
4
  import { COLOR_BLUE, COLOR_GREEN, COLOR_RED, COLOR_YELLOW } from 'parameters';
5
5
  import { useTranslate } from 'state';
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { FunctionComponent, ReactNode } from 'react';
2
+ import { FunctionComponent, ReactNode } from 'react';
3
3
 
4
4
  import styles from './Key.module.scss';
5
5
 
@@ -1,4 +1,4 @@
1
- import React, { FunctionComponent } from 'react';
1
+ import { FunctionComponent } from 'react';
2
2
 
3
3
  import { selectConfig, useTranslate, useTypedSelector } from 'state';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { FunctionComponent, ReactNode } from 'react';
2
+ import { FunctionComponent, ReactNode } from 'react';
3
3
 
4
4
  import styles from './Mapping.module.scss';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { FunctionComponent, useMemo } from 'react';
2
+ import { FunctionComponent, useMemo } from 'react';
3
3
 
4
4
  import { useTranslate } from 'state';
5
5
 
@@ -1,4 +1,4 @@
1
- import React, { CSSProperties, FunctionComponent } from 'react';
1
+ import { CSSProperties, FunctionComponent } from 'react';
2
2
 
3
3
  import PlainTiles from '../PlainTiles';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { FunctionComponent } from 'react';
2
+ import { FunctionComponent } from 'react';
3
3
 
4
4
  import { Cog, Eraser, Github, Keyboard, Sack } from 'icons';
5
5
  import { GITHUB_PROJECT_URL } from 'parameters';
@@ -1,5 +1,5 @@
1
1
  import Link from 'next/link';
2
- import React, { FunctionComponent } from 'react';
2
+ import { FunctionComponent } from 'react';
3
3
 
4
4
  import { DashCircleFill } from 'icons';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { CSSProperties, FunctionComponent, useMemo } from 'react';
2
+ import { CSSProperties, FunctionComponent, useMemo } from 'react';
3
3
 
4
4
  import { createPlainTiles, getViewbox } from './lib';
5
5
  import styles from './PlainTiles.module.scss';
@@ -1,4 +1,4 @@
1
- import React, { FunctionComponent } from 'react';
1
+ import { FunctionComponent } from 'react';
2
2
 
3
3
  interface Props {
4
4
  character: string;
@@ -1,6 +1,6 @@
1
1
  import { BLANK } from '@scrabble-solver/constants';
2
2
  import classNames from 'classnames';
3
- import React, { createRef, FunctionComponent, useCallback, useMemo, useRef } from 'react';
3
+ import { createRef, FunctionComponent, useCallback, useMemo, useRef } from 'react';
4
4
 
5
5
  import { createArray, createKeyboardNavigation, zipCharactersAndTiles } from 'lib';
6
6
  import { selectConfig, selectRack, selectResultCandidateTiles, useTypedSelector } from 'state';
@@ -1,6 +1,6 @@
1
1
  import { BLANK } from '@scrabble-solver/constants';
2
2
  import { Tile as TileModel } from '@scrabble-solver/types';
3
- import React, {
3
+ import {
4
4
  FunctionComponent,
5
5
  KeyboardEventHandler,
6
6
  MutableRefObject,
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { ChangeEventHandler, FunctionComponent, ReactNode } from 'react';
2
+ import { ChangeEventHandler, FunctionComponent, ReactNode } from 'react';
3
3
 
4
4
  import styles from './Radio.module.scss';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { BLANK } from '@scrabble-solver/constants';
2
2
  import classNames from 'classnames';
3
- import React, { FunctionComponent } from 'react';
3
+ import { FunctionComponent } from 'react';
4
4
 
5
5
  import { REMAINING_TILES_TILE_SIZE } from 'parameters';
6
6
  import { selectCharacterPoints, useTypedSelector } from 'state';
@@ -1,4 +1,4 @@
1
- import React, { FunctionComponent } from 'react';
1
+ import { FunctionComponent } from 'react';
2
2
 
3
3
  import { selectRemainingTilesGroups, useTranslate, useTypedSelector } from 'state';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { FunctionComponent } from 'react';
2
+ import { FunctionComponent } from 'react';
3
3
 
4
4
  import { useTranslate } from 'state';
5
5
  import { TranslationKey } from 'types';
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { ReactElement } from 'react';
2
+ import { ReactElement } from 'react';
3
3
  import { useDispatch } from 'react-redux';
4
4
 
5
5
  import { SortDown, SortUp } from 'icons';
@@ -1,4 +1,4 @@
1
- import React, { CSSProperties, ReactElement } from 'react';
1
+ import { CSSProperties, ReactElement } from 'react';
2
2
  import { useDispatch } from 'react-redux';
3
3
 
4
4
  import { resultsSlice, selectSortedFilteredResults, useTypedSelector } from 'state';
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { FunctionComponent } from 'react';
2
+ import { FunctionComponent } from 'react';
3
3
  import { FixedSizeList } from 'react-window';
4
4
 
5
5
  import { RESULTS_HEADER_HEIGHT, RESULTS_INPUT_HEIGHT, RESULTS_ITEM_HEIGHT } from 'parameters';
@@ -1,4 +1,4 @@
1
- import React, { FunctionComponent } from 'react';
1
+ import { FunctionComponent } from 'react';
2
2
  import { useDispatch } from 'react-redux';
3
3
 
4
4
  import { Play } from 'icons';
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { ChangeEvent, FunctionComponent } from 'react';
2
+ import { ChangeEvent, FunctionComponent } from 'react';
3
3
  import { useDispatch } from 'react-redux';
4
4
 
5
5
  import { resultsSlice, selectResultsQuery, useTranslate, useTypedSelector } from 'state';
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { AnimationEventHandler, FunctionComponent, ReactNode } from 'react';
2
+ import { AnimationEventHandler, FunctionComponent, ReactNode } from 'react';
3
3
 
4
4
  import styles from './Screen.module.scss';
5
5
 
@@ -1,4 +1,4 @@
1
- import React, { FunctionComponent } from 'react';
1
+ import { FunctionComponent } from 'react';
2
2
 
3
3
  import { useTranslate } from 'state';
4
4
 
@@ -1,4 +1,4 @@
1
- import React, { ChangeEvent, FunctionComponent } from 'react';
1
+ import { ChangeEvent, FunctionComponent } from 'react';
2
2
  import { useDispatch } from 'react-redux';
3
3
 
4
4
  import { selectAutoGroupTiles, settingsSlice, useTranslate, useTypedSelector } from 'state';
@@ -1,4 +1,4 @@
1
- import React, { ChangeEvent, FunctionComponent } from 'react';
1
+ import { ChangeEvent, FunctionComponent } from 'react';
2
2
  import { useDispatch } from 'react-redux';
3
3
 
4
4
  import { selectConfigId, settingsSlice, useTypedSelector } from 'state';
@@ -1,6 +1,6 @@
1
1
  import { Locale } from '@scrabble-solver/types';
2
2
  import classNames from 'classnames';
3
- import React, { ChangeEvent, FunctionComponent } from 'react';
3
+ import { ChangeEvent, FunctionComponent } from 'react';
4
4
  import { useDispatch } from 'react-redux';
5
5
 
6
6
  import { selectLocale, settingsSlice, useTypedSelector } from 'state';
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { FunctionComponent, ReactNode } from 'react';
2
+ import { FunctionComponent, ReactNode } from 'react';
3
3
  import Modal from 'react-modal';
4
4
 
5
5
  import { Cross } from 'icons';
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { FunctionComponent, ReactNode } from 'react';
2
+ import { FunctionComponent, ReactNode } from 'react';
3
3
 
4
4
  import styles from './Section.module.scss';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { AnimationEventHandler, FunctionComponent } from 'react';
2
+ import { AnimationEventHandler, FunctionComponent } from 'react';
3
3
 
4
4
  import Logo from '../Logo';
5
5
  import Screen from '../Screen';
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { AnchorHTMLAttributes, FunctionComponent, SVGAttributes } from 'react';
2
+ import { AnchorHTMLAttributes, FunctionComponent, SVGAttributes } from 'react';
3
3
 
4
4
  import { useTooltip } from '../Tooltip';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { ButtonHTMLAttributes, FunctionComponent, MouseEventHandler, SVGAttributes } from 'react';
2
+ import { ButtonHTMLAttributes, FunctionComponent, MouseEventHandler, SVGAttributes } from 'react';
3
3
 
4
4
  import { useTooltip } from '../Tooltip';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { EMPTY_CELL } from '@scrabble-solver/constants';
2
- import React, {
2
+ import {
3
3
  createRef,
4
4
  FocusEventHandler,
5
5
  FunctionComponent,
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, {
2
+ import {
3
3
  ChangeEventHandler,
4
4
  CSSProperties,
5
5
  FocusEventHandler,
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, {
2
+ import {
3
3
  FocusEvent,
4
4
  FocusEventHandler,
5
5
  MouseEvent,
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import React, { forwardRef, HTMLAttributes, ReactNode } from 'react';
2
+ import { forwardRef, HTMLAttributes, ReactNode } from 'react';
3
3
 
4
4
  import styles from './Well.module.scss';
5
5
 
@@ -1,5 +1,5 @@
1
- import React, { ReactNode, useLayoutEffect, useMemo } from 'react';
2
- import { render, unmountComponentAtNode } from 'react-dom';
1
+ import { ReactNode, useLayoutEffect, useRef } from 'react';
2
+ import { createRoot, Root } from 'react-dom/client';
3
3
  import { Portal } from 'react-portal';
4
4
 
5
5
  import { canUseDom, noop } from 'lib';
@@ -12,26 +12,36 @@ interface Props {
12
12
  type TagName = Parameters<typeof document.createElement>[0];
13
13
 
14
14
  const usePortal = (children: ReactNode, { disabled = false, tagName = 'div' }: Props = {}): void => {
15
- const element = useMemo(() => document.createElement(tagName), [tagName]);
15
+ const rootRef = useRef<Root | null>(null);
16
16
 
17
17
  useLayoutEffect(() => {
18
18
  if (disabled) {
19
19
  return noop;
20
20
  }
21
21
 
22
+ const element = document.createElement(tagName);
22
23
  document.body.appendChild(element);
24
+ const root = createRoot(element);
25
+ rootRef.current = root;
23
26
 
24
27
  return () => {
25
- unmountComponentAtNode(element);
26
- document.body.removeChild(element);
28
+ // We need setTimeout for async unmount, otherwise we get this warning:
29
+ // "Attempted to synchronously unmount a root while React was already
30
+ // rendering. React cannot finish unmounting the root until the current
31
+ // render has completed, which may lead to a race condition.""
32
+ setTimeout(() => {
33
+ rootRef.current = null;
34
+ root.unmount();
35
+ element.remove();
36
+ }, 0);
27
37
  };
28
- }, [disabled, element]);
38
+ }, [disabled, tagName]);
29
39
 
30
40
  useLayoutEffect(() => {
31
- if (!disabled) {
32
- render(<Portal>{children}</Portal>, element);
41
+ if (rootRef.current) {
42
+ rootRef.current.render(<Portal>{children}</Portal>);
33
43
  }
34
- }, [children, disabled, element]);
44
+ }, [children, disabled, rootRef]);
35
45
  };
36
46
 
37
47
  export default canUseDom ? usePortal : noop;
@@ -1,5 +1,5 @@
1
1
  interface AnyFunction {
2
- (...parameters: any): any; // eslint-disable-line @typescript-eslint/no-explicit-any
2
+ (...parameters: any[]): any; // eslint-disable-line @typescript-eslint/no-explicit-any
3
3
  }
4
4
 
5
5
  interface AnyCachedFunction<T extends AnyFunction> extends AnyFunction {
@@ -1,6 +1,6 @@
1
1
  import { AppProps } from 'next/app';
2
2
  import Head from 'next/head';
3
- import React, { FunctionComponent } from 'react';
3
+ import { FunctionComponent } from 'react';
4
4
  import { Provider } from 'react-redux';
5
5
 
6
6
  import { createAppStore } from 'state';
@@ -1,5 +1,5 @@
1
1
  import Document, { Head, Html, Main, NextScript } from 'next/document';
2
- import React, { ReactElement } from 'react';
2
+ import { ReactElement } from 'react';
3
3
 
4
4
  class MyDocument extends Document {
5
5
  render(): ReactElement {
@@ -1,7 +1,7 @@
1
1
  import classNames from 'classnames';
2
2
  import fs from 'fs';
3
3
  import path from 'path';
4
- import React, { AnimationEvent, FormEvent, FunctionComponent, useState } from 'react';
4
+ import { AnimationEvent, FormEvent, FunctionComponent, useState } from 'react';
5
5
  import Modal from 'react-modal';
6
6
  import { useDispatch } from 'react-redux';
7
7
  import { useEffectOnce, useMeasure } from 'react-use';