scrabble-solver 2.18.1 → 2.18.2

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 (342) hide show
  1. package/.nx/workspace-data/d/server-process.json +2 -2
  2. package/.nx/workspace-data/file-map.json +1717 -1473
  3. package/.nx/workspace-data/lockfile-dependencies.hash +1 -1
  4. package/.nx/workspace-data/lockfile-nodes.hash +1 -1
  5. package/.nx/workspace-data/nx_files.nxt +0 -0
  6. package/.nx/workspace-data/parsed-lock-file.dependencies.json +184 -209
  7. package/.nx/workspace-data/parsed-lock-file.nodes.json +374 -419
  8. package/.nx/workspace-data/project-graph.json +608 -652
  9. package/.nx/workspace-data/source-maps.json +64 -0
  10. package/CLAUDE.md +12 -10
  11. package/README.md +2 -2
  12. package/bun.lock +115 -130
  13. package/e2e/bugs/398-digraphs-in-created-words.spec.ts +2 -2
  14. package/e2e/bugs/445-tile-text-selection.spec.ts +38 -0
  15. package/e2e/bugs/451-results-list-gap-hover.spec.ts +35 -0
  16. package/e2e/bugs/452-stale-translations-cache.spec.ts +32 -0
  17. package/e2e/features/427-highlight-created-words.spec.ts +86 -0
  18. package/e2e/features/430-highlight-unreachable-cells-results.spec.ts +75 -0
  19. package/e2e/features/91-hover-remaining-tile-highlights.spec.ts +22 -0
  20. package/e2e/features/result-candidate-picker.spec.ts +21 -0
  21. package/e2e/features/results-interactions.spec.ts +170 -0
  22. package/e2e/features/words-dictionary-search.spec.ts +36 -0
  23. package/e2e/features/words-empty-state.spec.ts +42 -0
  24. package/e2e/features/words-interactions.spec.ts +179 -0
  25. package/e2e/features/words-preview.spec.ts +140 -0
  26. package/e2e/features/words-table-filtering.spec.ts +22 -0
  27. package/e2e/features/words-table-sorting.spec.ts +33 -0
  28. package/e2e/lib/actions.ts +76 -6
  29. package/e2e/lib/selectors.ts +40 -3
  30. package/lerna.json +1 -1
  31. package/package.json +8 -9
  32. package/packages/configs/package.json +3 -3
  33. package/packages/constants/package.json +1 -1
  34. package/packages/dictionaries/package.json +4 -4
  35. package/packages/logger/package.json +1 -1
  36. package/packages/scrabble-solver/.next/BUILD_ID +1 -1
  37. package/packages/scrabble-solver/.next/build-manifest.json +14 -14
  38. package/packages/scrabble-solver/.next/cache/.previewinfo +1 -1
  39. package/packages/scrabble-solver/.next/cache/.rscinfo +1 -1
  40. package/packages/scrabble-solver/.next/cache/.tsbuildinfo +1 -1
  41. package/packages/scrabble-solver/.next/cache/webpack/client-production/0.pack +0 -0
  42. package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack +0 -0
  43. package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack.old +0 -0
  44. package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack +0 -0
  45. package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack.old +0 -0
  46. package/packages/scrabble-solver/.next/cache/webpack/server-production/0.pack +0 -0
  47. package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack +0 -0
  48. package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack.old +0 -0
  49. package/packages/scrabble-solver/.next/diagnostics/framework.json +1 -1
  50. package/packages/scrabble-solver/.next/dynamic-css-manifest.json +2 -2
  51. package/packages/scrabble-solver/.next/prerender-manifest.json +4 -4
  52. package/packages/scrabble-solver/.next/react-loadable-manifest.json +37 -37
  53. package/packages/scrabble-solver/.next/routes-manifest.json +1 -1
  54. package/packages/scrabble-solver/.next/server/chunks/309.js +1 -1
  55. package/packages/scrabble-solver/.next/server/chunks/344.js +1 -1
  56. package/packages/scrabble-solver/.next/server/chunks/371.js +1 -1
  57. package/packages/scrabble-solver/.next/server/chunks/392.js +1 -1
  58. package/packages/scrabble-solver/.next/server/chunks/465.js +1 -1
  59. package/packages/scrabble-solver/.next/server/chunks/546.js +1 -1
  60. package/packages/scrabble-solver/.next/server/chunks/641.js +1 -1
  61. package/packages/scrabble-solver/.next/server/chunks/67.js +1 -0
  62. package/packages/scrabble-solver/.next/server/chunks/712.js +1 -1
  63. package/packages/scrabble-solver/.next/server/chunks/846.js +1 -1
  64. package/packages/scrabble-solver/.next/server/chunks/886.js +1 -1
  65. package/packages/scrabble-solver/.next/server/chunks/942.js +1 -0
  66. package/packages/scrabble-solver/.next/server/chunks/953.js +1 -1
  67. package/packages/scrabble-solver/.next/server/chunks/961.js +1 -1
  68. package/packages/scrabble-solver/.next/server/dynamic-css-manifest.js +1 -1
  69. package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -1
  70. package/packages/scrabble-solver/.next/server/middleware-react-loadable-manifest.js +1 -1
  71. package/packages/scrabble-solver/.next/server/pages/404.html +2 -2
  72. package/packages/scrabble-solver/.next/server/pages/500.html +2 -2
  73. package/packages/scrabble-solver/.next/server/pages/_app.js +1 -1
  74. package/packages/scrabble-solver/.next/server/pages/_app.js.nft.json +1 -1
  75. package/packages/scrabble-solver/.next/server/pages/_document.js +2 -2
  76. package/packages/scrabble-solver/.next/server/pages/_document.js.nft.json +1 -1
  77. package/packages/scrabble-solver/.next/server/pages/_error.js +1 -1
  78. package/packages/scrabble-solver/.next/server/pages/_error.js.nft.json +1 -1
  79. package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js +1 -1
  80. package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
  81. package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js +1 -1
  82. package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
  83. package/packages/scrabble-solver/.next/server/pages/api/solve.js +1 -1
  84. package/packages/scrabble-solver/.next/server/pages/api/solve.js.nft.json +1 -1
  85. package/packages/scrabble-solver/.next/server/pages/api/verify.js +1 -1
  86. package/packages/scrabble-solver/.next/server/pages/api/verify.js.nft.json +1 -1
  87. package/packages/scrabble-solver/.next/server/pages/index.html +2 -2
  88. package/packages/scrabble-solver/.next/server/pages/index.js +4 -4
  89. package/packages/scrabble-solver/.next/server/pages/index.js.nft.json +1 -1
  90. package/packages/scrabble-solver/.next/server/pages/index.json +1 -1
  91. package/packages/scrabble-solver/.next/server/pages/not-found.html +2 -2
  92. package/packages/scrabble-solver/.next/server/pages/not-found.js.nft.json +1 -1
  93. package/packages/scrabble-solver/.next/server/pages-manifest.json +1 -1
  94. package/packages/scrabble-solver/.next/static/chunks/100.305bdf9c75b1758f.js +1 -0
  95. package/packages/scrabble-solver/.next/static/chunks/256.66ff9fb6d7db9ec7.js +1 -0
  96. package/packages/scrabble-solver/.next/static/chunks/{307.67f52f13e3d60d4e.js → 307.89e6100f58443679.js} +1 -1
  97. package/packages/scrabble-solver/.next/static/chunks/{363.01eed3233f92b6a4.js → 363.cec65b1f9668a75e.js} +1 -1
  98. package/packages/scrabble-solver/.next/static/chunks/{422.1559ae6756912ca5.js → 422.3e55b4c94e328701.js} +1 -1
  99. package/packages/scrabble-solver/.next/static/chunks/{663.d2c9ca36b26695b8.js → 663.bd2c45413fbca518.js} +1 -1
  100. package/packages/scrabble-solver/.next/static/chunks/693.677c88e0eb1340b5.js +1 -0
  101. package/packages/scrabble-solver/.next/static/chunks/{820.97b82f751ca49579.js → 820.823e9e885ebb66af.js} +1 -1
  102. package/packages/scrabble-solver/.next/static/chunks/827.c81b92b383a748c9.js +1 -0
  103. package/packages/scrabble-solver/.next/static/chunks/{865.a9b563a45848a83c.js → 865.59baba8296c9b116.js} +1 -1
  104. package/packages/scrabble-solver/.next/static/chunks/912.077603e4f0bc6cca.js +1 -0
  105. package/packages/scrabble-solver/.next/static/chunks/{939.19b33a3d3c351d73.js → 939.2ad86b50405c7897.js} +1 -1
  106. package/packages/scrabble-solver/.next/static/chunks/980.7ce17464fc56648a.js +1 -0
  107. package/packages/scrabble-solver/.next/static/chunks/{main-b92e08f3fc96dd8d.js → main-7e52da35a4beea0b.js} +1 -1
  108. package/packages/scrabble-solver/.next/static/chunks/pages/_app-f9ec81278ffa7b1a.js +1 -0
  109. package/packages/scrabble-solver/.next/static/chunks/pages/index-b5bf018100015277.js +1 -0
  110. package/packages/scrabble-solver/.next/static/chunks/webpack-9f5c9d275348829b.js +1 -0
  111. package/packages/scrabble-solver/.next/static/css/65bcc9440e067113.css +1 -0
  112. package/packages/scrabble-solver/.next/static/css/{4dbcacc1122ac6b9.css → 92f85ce358a0a468.css} +1 -1
  113. package/packages/scrabble-solver/.next/static/css/a691348b788f8bc0.css +1 -0
  114. package/packages/scrabble-solver/.next/static/css/cd4d7f2458487399.css +1 -0
  115. package/packages/scrabble-solver/.next/static/{5KOWzYqfY1Z2rjrzptr8D → nvGZh1gPuX98L07YmxlYD}/_buildManifest.js +1 -1
  116. package/packages/scrabble-solver/.next/trace +21 -21
  117. package/packages/scrabble-solver/.next/trace-build +1 -1
  118. package/packages/scrabble-solver/AGENTS.md +9 -0
  119. package/packages/scrabble-solver/CLAUDE.md +1 -0
  120. package/packages/scrabble-solver/package.json +13 -11
  121. package/packages/scrabble-solver/public/service-worker.js +1 -1
  122. package/packages/scrabble-solver/src/components/Board/Board.tsx +3 -1
  123. package/packages/scrabble-solver/src/components/Board/BoardPure.tsx +26 -20
  124. package/packages/scrabble-solver/src/components/Board/components/Cell/Cell.tsx +4 -4
  125. package/packages/scrabble-solver/src/components/Board/lib.test.ts +106 -0
  126. package/packages/scrabble-solver/src/components/Board/lib.ts +34 -3
  127. package/packages/scrabble-solver/src/components/Board/selectors.ts +17 -5
  128. package/packages/scrabble-solver/src/components/Button/Button.module.scss +1 -1
  129. package/packages/scrabble-solver/src/components/Modal/Modal.module.scss +0 -4
  130. package/packages/scrabble-solver/src/components/Results/Header.tsx +30 -5
  131. package/packages/scrabble-solver/src/components/Results/Result.tsx +45 -55
  132. package/packages/scrabble-solver/src/components/Results/Results.module.scss +0 -126
  133. package/packages/scrabble-solver/src/components/Results/Results.module.scss.d.ts +0 -10
  134. package/packages/scrabble-solver/src/components/Results/Results.tsx +25 -5
  135. package/packages/scrabble-solver/src/components/Solver/Solver.module.scss +4 -4
  136. package/packages/scrabble-solver/src/components/Solver/Solver.tsx +5 -3
  137. package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.module.scss +5 -1
  138. package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.module.scss.d.ts +1 -0
  139. package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.tsx +5 -2
  140. package/packages/scrabble-solver/src/components/Table/Cell.tsx +42 -0
  141. package/packages/scrabble-solver/src/components/Table/Header.tsx +11 -0
  142. package/packages/scrabble-solver/src/components/{Results → Table}/HeaderButton.tsx +22 -14
  143. package/packages/scrabble-solver/src/components/Table/Row.tsx +59 -0
  144. package/packages/scrabble-solver/src/components/{ResultsInput/ResultsInput.tsx → Table/Search.tsx} +9 -11
  145. package/packages/scrabble-solver/src/components/Table/Table.module.scss +147 -0
  146. package/packages/scrabble-solver/src/components/Table/Table.module.scss.d.ts +19 -0
  147. package/packages/scrabble-solver/src/components/Table/index.ts +5 -0
  148. package/packages/scrabble-solver/src/components/Tile/Tile.module.scss +2 -1
  149. package/packages/scrabble-solver/src/hooks/useColumns.ts +7 -5
  150. package/packages/scrabble-solver/src/hooks/useIsCompactLayout.ts +14 -0
  151. package/packages/scrabble-solver/src/i18n/languages/english.json +6 -1
  152. package/packages/scrabble-solver/src/i18n/languages/french.json +6 -1
  153. package/packages/scrabble-solver/src/i18n/languages/german.json +6 -1
  154. package/packages/scrabble-solver/src/i18n/languages/persian.json +6 -1
  155. package/packages/scrabble-solver/src/i18n/languages/polish.json +6 -1
  156. package/packages/scrabble-solver/src/i18n/languages/romanian.json +6 -1
  157. package/packages/scrabble-solver/src/i18n/languages/spanish.json +6 -1
  158. package/packages/scrabble-solver/src/i18n/languages/turkish.json +6 -1
  159. package/packages/scrabble-solver/src/icons/QuestionSquare.svg +5 -0
  160. package/packages/scrabble-solver/src/lib/createCoordinatesComparator.ts +23 -0
  161. package/packages/scrabble-solver/src/lib/createKeyComparator.ts +1 -4
  162. package/packages/scrabble-solver/src/lib/createSortComparator.ts +22 -0
  163. package/packages/scrabble-solver/src/lib/getCoordinates.test.ts +21 -0
  164. package/packages/scrabble-solver/src/lib/getCoordinates.ts +16 -0
  165. package/packages/scrabble-solver/src/lib/getNextSort.ts +12 -0
  166. package/packages/scrabble-solver/src/modals/RemainingTilesModal/RemainingTilesModal.tsx +3 -1
  167. package/packages/scrabble-solver/src/modals/RemainingTilesModal/components/Character/Character.tsx +8 -9
  168. package/packages/scrabble-solver/src/modals/ResultsModal/ResultsModal.tsx +14 -10
  169. package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.module.scss +16 -27
  170. package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.module.scss.d.ts +3 -6
  171. package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.tsx +56 -42
  172. package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordRow.tsx +92 -0
  173. package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordsTable.module.scss +69 -0
  174. package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordsTable.module.scss.d.ts +16 -0
  175. package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordsTable.tsx +137 -0
  176. package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/index.ts +1 -0
  177. package/packages/scrabble-solver/src/modals/WordsModal/components/index.ts +1 -0
  178. package/packages/scrabble-solver/src/pages/api/verify.ts +7 -6
  179. package/packages/scrabble-solver/src/pages/index.tsx +28 -3
  180. package/packages/scrabble-solver/src/parameters/index.ts +2 -0
  181. package/packages/scrabble-solver/src/sdk/verify.ts +3 -2
  182. package/packages/scrabble-solver/src/solver-worker/client.test.ts +10 -3
  183. package/packages/scrabble-solver/src/solver-worker/index.worker.ts +7 -7
  184. package/packages/scrabble-solver/src/solver-worker/messages.ts +3 -3
  185. package/packages/scrabble-solver/src/state/hoveredWord/index.ts +4 -0
  186. package/packages/scrabble-solver/src/state/hoveredWord/initialState.ts +5 -0
  187. package/packages/scrabble-solver/src/state/hoveredWord/selectors.ts +5 -0
  188. package/packages/scrabble-solver/src/state/hoveredWord/slice.ts +18 -0
  189. package/packages/scrabble-solver/src/state/hoveredWord/types.ts +5 -0
  190. package/packages/scrabble-solver/src/state/index.ts +1 -0
  191. package/packages/scrabble-solver/src/state/localStorage.ts +13 -2
  192. package/packages/scrabble-solver/src/state/results/lib.ts +9 -26
  193. package/packages/scrabble-solver/src/state/results/selectors.ts +9 -1
  194. package/packages/scrabble-solver/src/state/results/slice.ts +4 -16
  195. package/packages/scrabble-solver/src/state/sagas.ts +26 -1
  196. package/packages/scrabble-solver/src/state/selectors.ts +18 -1
  197. package/packages/scrabble-solver/src/state/store.ts +2 -0
  198. package/packages/scrabble-solver/src/state/types.ts +2 -0
  199. package/packages/scrabble-solver/src/state/verify/initialState.ts +7 -0
  200. package/packages/scrabble-solver/src/state/verify/lib.test.ts +55 -0
  201. package/packages/scrabble-solver/src/state/verify/lib.ts +49 -0
  202. package/packages/scrabble-solver/src/state/verify/selectors.ts +37 -0
  203. package/packages/scrabble-solver/src/state/verify/slice.ts +13 -2
  204. package/packages/scrabble-solver/src/state/verify/types.ts +6 -2
  205. package/packages/scrabble-solver/src/styles/_tokens.scss +2 -0
  206. package/packages/scrabble-solver/src/styles/mixins.scss +5 -0
  207. package/packages/scrabble-solver/src/styles/variables.module.scss +1 -0
  208. package/packages/scrabble-solver/src/styles/variables.module.scss.d.ts +1 -0
  209. package/packages/scrabble-solver/src/styles/variables.scss +1 -1
  210. package/packages/scrabble-solver/src/types/index.ts +24 -11
  211. package/packages/scrabble-solver/tsconfig.tsbuildinfo +1 -1
  212. package/packages/solver/package.json +5 -5
  213. package/packages/types/build/Bingo.d.ts +0 -3
  214. package/packages/types/build/Bingo.js +0 -14
  215. package/packages/types/build/Board.d.ts +3 -1
  216. package/packages/types/build/Board.js +5 -40
  217. package/packages/types/build/BoardJson.d.ts +0 -1
  218. package/packages/types/build/BoardJson.js +0 -19
  219. package/packages/types/build/BoardWord.d.ts +7 -0
  220. package/packages/types/build/BoardWord.js +2 -0
  221. package/packages/types/build/CellJson.d.ts +0 -1
  222. package/packages/types/build/CellJson.js +0 -11
  223. package/packages/types/build/Game.d.ts +0 -1
  224. package/packages/types/build/Game.js +1 -4
  225. package/packages/types/build/Locale.d.ts +0 -1
  226. package/packages/types/build/Locale.js +1 -4
  227. package/packages/types/build/Result.js +3 -3
  228. package/packages/types/build/TileJson.d.ts +0 -1
  229. package/packages/types/build/TileJson.js +0 -6
  230. package/packages/types/build/index.d.ts +9 -8
  231. package/packages/types/build/index.js +14 -17
  232. package/packages/types/build/lib/getBoardWords.d.ts +3 -0
  233. package/packages/types/build/lib/getBoardWords.js +10 -0
  234. package/packages/types/build/lib/getCells.d.ts +4 -0
  235. package/packages/types/build/lib/getCells.js +27 -0
  236. package/packages/types/build/lib/getCollidingWords.d.ts +3 -0
  237. package/packages/types/build/lib/getCollidingWords.js +19 -0
  238. package/packages/types/build/lib/getCollision.d.ts +3 -0
  239. package/packages/types/build/lib/getCollision.js +31 -0
  240. package/packages/types/build/lib/getCollisions.d.ts +3 -0
  241. package/packages/types/build/lib/getCollisions.js +17 -0
  242. package/packages/types/build/lib/getPlacedCell.d.ts +3 -0
  243. package/packages/types/build/lib/getPlacedCell.js +10 -0
  244. package/packages/types/build/lib/getWordThrough.d.ts +4 -0
  245. package/packages/types/build/lib/getWordThrough.js +23 -0
  246. package/packages/types/build/lib/getWordsInRows.d.ts +8 -0
  247. package/packages/types/build/lib/getWordsInRows.js +29 -0
  248. package/packages/types/build/lib/index.d.ts +5 -0
  249. package/packages/types/build/lib/index.js +21 -0
  250. package/packages/types/build/lib/isSameBoardWord.d.ts +2 -0
  251. package/packages/types/build/lib/isSameBoardWord.js +6 -0
  252. package/packages/types/build/lib/toBoardWord.d.ts +4 -0
  253. package/packages/types/build/lib/toBoardWord.js +11 -0
  254. package/packages/types/build/lib/transpose.d.ts +1 -0
  255. package/packages/types/build/lib/transpose.js +16 -0
  256. package/packages/types/build/type-guards/index.d.ts +10 -0
  257. package/packages/types/build/type-guards/index.js +23 -0
  258. package/packages/types/build/type-guards/isBingo.d.ts +2 -0
  259. package/packages/types/build/type-guards/isBingo.js +9 -0
  260. package/packages/types/build/type-guards/isBoardJson.d.ts +2 -0
  261. package/packages/types/build/type-guards/isBoardJson.js +21 -0
  262. package/packages/types/build/type-guards/isCellJson.d.ts +2 -0
  263. package/packages/types/build/type-guards/isCellJson.js +13 -0
  264. package/packages/types/build/type-guards/isGame.d.ts +2 -0
  265. package/packages/types/build/type-guards/isGame.js +7 -0
  266. package/packages/types/build/type-guards/isLocale.d.ts +2 -0
  267. package/packages/types/build/type-guards/isLocale.js +7 -0
  268. package/packages/types/build/type-guards/isMultiplierBingo.d.ts +2 -0
  269. package/packages/types/build/type-guards/isMultiplierBingo.js +8 -0
  270. package/packages/types/build/type-guards/isScoreBingo.d.ts +2 -0
  271. package/packages/types/build/type-guards/isScoreBingo.js +8 -0
  272. package/packages/types/build/type-guards/isTileJson.d.ts +2 -0
  273. package/packages/types/build/type-guards/isTileJson.js +8 -0
  274. package/packages/types/package.json +2 -2
  275. package/packages/types/src/Bingo.ts +0 -14
  276. package/packages/types/src/Board.test.ts +85 -0
  277. package/packages/types/src/Board.ts +8 -49
  278. package/packages/types/src/BoardJson.ts +1 -21
  279. package/packages/types/src/BoardWord.ts +8 -0
  280. package/packages/types/src/CellJson.ts +1 -12
  281. package/packages/types/src/Game.ts +0 -4
  282. package/packages/types/src/Locale.ts +0 -4
  283. package/packages/types/src/Result.ts +3 -3
  284. package/packages/types/src/TileJson.ts +0 -6
  285. package/packages/types/src/index.ts +20 -8
  286. package/packages/types/src/lib/getBoardWords.ts +11 -0
  287. package/packages/types/src/lib/getCells.test.ts +127 -0
  288. package/packages/types/src/lib/getCells.ts +31 -0
  289. package/packages/types/src/lib/getCollidingWords.ts +25 -0
  290. package/packages/types/src/lib/getCollision.ts +38 -0
  291. package/packages/types/src/lib/getCollisions.test.ts +82 -0
  292. package/packages/types/src/lib/getCollisions.ts +22 -0
  293. package/packages/types/src/lib/getPlacedCell.ts +9 -0
  294. package/packages/types/src/lib/getWordThrough.ts +30 -0
  295. package/packages/types/src/lib/getWordsInRows.ts +34 -0
  296. package/packages/types/src/lib/index.ts +5 -0
  297. package/packages/types/src/lib/isSameBoardWord.ts +5 -0
  298. package/packages/types/src/lib/toBoardWord.ts +12 -0
  299. package/packages/types/src/lib/transpose.ts +15 -0
  300. package/packages/types/src/type-guards/index.ts +10 -0
  301. package/packages/types/src/type-guards/isBingo.ts +8 -0
  302. package/packages/types/src/type-guards/isBoardJson.test.ts +33 -0
  303. package/packages/types/src/type-guards/isBoardJson.ts +23 -0
  304. package/packages/types/src/type-guards/isCellJson.ts +14 -0
  305. package/packages/types/src/type-guards/isGame.ts +5 -0
  306. package/packages/types/src/type-guards/isLocale.ts +5 -0
  307. package/packages/types/src/type-guards/isMultiplierBingo.ts +7 -0
  308. package/packages/types/src/type-guards/isScoreBingo.ts +7 -0
  309. package/packages/types/src/type-guards/isTileJson.ts +7 -0
  310. package/packages/word-definitions/package.json +2 -2
  311. package/packages/word-lists/package.json +2 -2
  312. package/playwright-report/index.html +1 -1
  313. package/screencast.gif +0 -0
  314. package/packages/scrabble-solver/.next/server/chunks/316.js +0 -1
  315. package/packages/scrabble-solver/.next/server/chunks/916.js +0 -1
  316. package/packages/scrabble-solver/.next/static/chunks/106.e414e88694add27f.js +0 -1
  317. package/packages/scrabble-solver/.next/static/chunks/127.125d896a19061d71.js +0 -1
  318. package/packages/scrabble-solver/.next/static/chunks/18.8b91e137d239e15c.js +0 -1
  319. package/packages/scrabble-solver/.next/static/chunks/583.7a46807be14c377e.js +0 -1
  320. package/packages/scrabble-solver/.next/static/chunks/711.ba7b8f900dfd40d0.js +0 -1
  321. package/packages/scrabble-solver/.next/static/chunks/912.ff8037ba9d4db5c8.js +0 -1
  322. package/packages/scrabble-solver/.next/static/chunks/pages/_app-2e607dcd4135f340.js +0 -1
  323. package/packages/scrabble-solver/.next/static/chunks/pages/index-e0087247c995328d.js +0 -1
  324. package/packages/scrabble-solver/.next/static/chunks/webpack-cfb34d175e081981.js +0 -1
  325. package/packages/scrabble-solver/.next/static/css/b74cd7de82dabcdd.css +0 -1
  326. package/packages/scrabble-solver/.next/static/css/c403ce739a9c0d83.css +0 -1
  327. package/packages/scrabble-solver/.next/static/css/fbfdce70731d0d2b.css +0 -1
  328. package/packages/scrabble-solver/src/components/Results/Cell.tsx +0 -32
  329. package/packages/scrabble-solver/src/components/ResultsInput/ResultsInput.module.scss +0 -12
  330. package/packages/scrabble-solver/src/components/ResultsInput/ResultsInput.module.scss.d.ts +0 -7
  331. package/packages/scrabble-solver/src/components/ResultsInput/index.ts +0 -1
  332. package/packages/types/build/readResultCells.d.ts +0 -5
  333. package/packages/types/build/readResultCells.js +0 -75
  334. package/packages/types/src/readResultCells.test.ts +0 -140
  335. package/packages/types/src/readResultCells.ts +0 -90
  336. /package/packages/scrabble-solver/.next/static/{5KOWzYqfY1Z2rjrzptr8D → nvGZh1gPuX98L07YmxlYD}/_ssgManifest.js +0 -0
  337. /package/packages/types/build/{isError.d.ts → type-guards/isError.d.ts} +0 -0
  338. /package/packages/types/build/{isError.js → type-guards/isError.js} +0 -0
  339. /package/packages/types/build/{isObject.d.ts → type-guards/isObject.d.ts} +0 -0
  340. /package/packages/types/build/{isObject.js → type-guards/isObject.js} +0 -0
  341. /package/packages/types/src/{isError.ts → type-guards/isError.ts} +0 -0
  342. /package/packages/types/src/{isObject.ts → type-guards/isObject.ts} +0 -0
@@ -18,10 +18,11 @@ import { type RemainingTile } from '@/types';
18
18
  import styles from './Character.module.scss';
19
19
 
20
20
  interface Props {
21
+ canHighlight: boolean;
21
22
  tile: RemainingTile;
22
23
  }
23
24
 
24
- export const Character: FunctionComponent<Props> = ({ tile }) => {
25
+ export const Character: FunctionComponent<Props> = ({ canHighlight, tile }) => {
25
26
  const dispatch = useDispatch();
26
27
  const locale = useTypedSelector(selectLocale);
27
28
  const hoveredCharacter = useTypedSelector(selectHoveredCharacter);
@@ -37,14 +38,12 @@ export const Character: FunctionComponent<Props> = ({ tile }) => {
37
38
  const current = direction === 'ltr' ? remainingCount : count;
38
39
  const total = direction === 'ltr' ? count : remainingCount;
39
40
  const isUsed = usedCount > 0;
40
- const isHovered = isUsed && hoveredCharacter === character;
41
+ const isHighlightable = canHighlight && isUsed;
42
+ const isHighlighted = isHighlightable && hoveredCharacter === character;
41
43
 
42
44
  const handleMouseEnter = useCallback(() => {
43
- if (!isUsed) {
44
- return;
45
- }
46
45
  dispatch(hoveredTileSlice.actions.set(character));
47
- }, [character, dispatch, isUsed]);
46
+ }, [character, dispatch]);
48
47
 
49
48
  const handleMouseLeave = useCallback(() => {
50
49
  dispatch(hoveredTileSlice.actions.clear());
@@ -64,15 +63,15 @@ export const Character: FunctionComponent<Props> = ({ tile }) => {
64
63
  [styles.unused]: !isUsed,
65
64
  })}
66
65
  data-testid={character === BLANK ? 'remaining-tile-blank' : `remaining-tile-${character}`}
67
- onMouseEnter={handleMouseEnter}
68
- onMouseLeave={handleMouseLeave}
66
+ onMouseEnter={isHighlightable ? handleMouseEnter : undefined}
67
+ onMouseLeave={isHighlightable ? handleMouseLeave : undefined}
69
68
  >
70
69
  <Tile
71
70
  aria-label={character}
72
71
  character={character}
73
72
  className={styles.tile}
74
73
  disabled
75
- highlighted={isHovered}
74
+ highlighted={isHighlighted}
76
75
  isBlank={character === BLANK}
77
76
  isValid={remainingCount >= 0}
78
77
  locale={locale}
@@ -6,10 +6,17 @@ import { Button } from '@/components/Button';
6
6
  import { Dictionary } from '@/components/Dictionary';
7
7
  import { Modal } from '@/components/Modal';
8
8
  import { Results } from '@/components/Results';
9
- import { useMediaQuery } from '@/hooks/useMediaQuery';
9
+ import { useIsCompactLayout } from '@/hooks/useIsCompactLayout';
10
+ import { useIsTouchDevice } from '@/hooks/useIsTouchDevice';
10
11
  import Check from '@/icons/Check.svg';
11
12
  import EyeFill from '@/icons/EyeFill.svg';
12
- import { resultsSlice, selectProcessedResults, selectResultCandidate, useTranslate, useTypedSelector } from '@/state';
13
+ import {
14
+ resultsSlice,
15
+ selectResultCandidate,
16
+ selectResultCandidateIndex,
17
+ useTranslate,
18
+ useTypedSelector,
19
+ } from '@/state';
13
20
 
14
21
  import styles from './ResultsModal.module.scss';
15
22
 
@@ -22,25 +29,22 @@ interface Props {
22
29
  const ResultsModalBase: FunctionComponent<Props> = ({ className, isOpen, onClose }) => {
23
30
  const dispatch = useDispatch();
24
31
  const translate = useTranslate();
25
- const showResultsInModal = useMediaQuery('<l');
26
- const results = useTypedSelector(selectProcessedResults);
32
+ const showResultsInModal = useIsCompactLayout();
33
+ const previewsOnRepeatedClick = useIsTouchDevice();
27
34
  const resultCandidate = useTypedSelector(selectResultCandidate);
28
- const index = results ? results.findIndex((result) => result.id === resultCandidate?.id) : -1;
29
- const highlightedIndex = index === -1 ? undefined : index;
35
+ const highlightedIndex = useTypedSelector(selectResultCandidateIndex);
30
36
 
31
37
  const callbacks = useMemo(
32
38
  () => ({
33
39
  onClick: (result: Result) => {
34
- const isSelected = result === resultCandidate;
35
-
36
- if (isSelected) {
40
+ if (previewsOnRepeatedClick && result === resultCandidate) {
37
41
  onClose();
38
42
  } else {
39
43
  dispatch(resultsSlice.actions.changeResultCandidate(result));
40
44
  }
41
45
  },
42
46
  }),
43
- [dispatch, onClose, resultCandidate],
47
+ [dispatch, onClose, previewsOnRepeatedClick, resultCandidate],
44
48
  );
45
49
 
46
50
  const handleInsert = () => {
@@ -1,35 +1,24 @@
1
- .title {
2
- display: flex;
3
- align-items: center;
4
- justify-content: space-between;
5
- flex-wrap: wrap;
6
- }
1
+ @use 'styles/mixins' as *;
7
2
 
8
- .badge {
9
- margin-inline-start: var(--spacing--m);
10
- }
11
-
12
- .word {
3
+ .content {
4
+ position: relative;
13
5
  display: flex;
14
- align-items: center;
15
-
16
- & + & {
17
- margin-top: var(--spacing--s);
18
- }
19
- }
20
-
21
- .invalid {
22
- color: var(--color--error);
6
+ flex-direction: column;
7
+ height: 100%;
8
+ gap: var(--spacing--l);
23
9
  }
24
10
 
25
- .valid {
26
- color: var(--color--success);
11
+ .words {
12
+ flex: 1 1 auto;
27
13
  }
28
14
 
29
- .icon {
30
- $size: 24px;
15
+ .dictionary {
16
+ flex: 0 0 var(--dictionary--height--mobile);
17
+ background-color: var(--color--background--element);
18
+ border: var(--border);
19
+ border-radius: var(--border--radius);
31
20
 
32
- width: $size;
33
- height: $size;
34
- margin-inline-end: var(--spacing--s);
21
+ @include media('desktop') {
22
+ display: none;
23
+ }
35
24
  }
@@ -1,11 +1,8 @@
1
1
  // Generated by scripts/generate-scss-types.ts - do not edit.
2
2
  declare const styles: {
3
- readonly badge: string;
4
- readonly icon: string;
5
- readonly invalid: string;
6
- readonly title: string;
7
- readonly valid: string;
8
- readonly word: string;
3
+ readonly content: string;
4
+ readonly dictionary: string;
5
+ readonly words: string;
9
6
  };
10
7
 
11
8
  export default styles;
@@ -1,59 +1,73 @@
1
- import classNames from 'classnames';
2
- import { type FunctionComponent, memo } from 'react';
1
+ import { type FunctionComponent, memo, useCallback, useEffect, useRef } from 'react';
2
+ import { useDispatch } from 'react-redux';
3
3
 
4
- import { Badge } from '@/components/Badge';
4
+ import { Button } from '@/components/Button';
5
+ import { Dictionary } from '@/components/Dictionary';
5
6
  import { Modal } from '@/components/Modal';
6
- import Check from '@/icons/Check.svg';
7
- import Cross from '@/icons/Cross.svg';
8
- import { selectInvalidWords, selectLocale, selectValidWords, useTranslate, useTypedSelector } from '@/state';
7
+ import { useIsCompactLayout } from '@/hooks/useIsCompactLayout';
8
+ import EyeFill from '@/icons/EyeFill.svg';
9
+ import { hoveredWordSlice, selectHoveredWord, useTranslate, useTypedSelector } from '@/state';
9
10
 
11
+ import { WordsTable } from './components';
10
12
  import styles from './WordsModal.module.scss';
11
13
 
12
14
  interface Props {
13
15
  className?: string;
14
16
  isOpen: boolean;
15
17
  onClose: () => void;
18
+ onPreview: () => void;
16
19
  }
17
20
 
18
- const WordsModalBase: FunctionComponent<Props> = ({ className, isOpen, onClose }) => {
21
+ const WordsModalBase: FunctionComponent<Props> = ({ className, isOpen, onClose, onPreview }) => {
22
+ const dispatch = useDispatch();
19
23
  const translate = useTranslate();
20
- const locale = useTypedSelector(selectLocale);
21
- const invalidWords = useTypedSelector(selectInvalidWords);
22
- const validWords = useTypedSelector(selectValidWords);
24
+ const hoveredWord = useTypedSelector(selectHoveredWord);
25
+ const showsPreviewButton = useIsCompactLayout();
26
+ const keepsHighlightOnClose = useRef(false);
27
+
28
+ const handlePreview = useCallback(() => {
29
+ keepsHighlightOnClose.current = true;
30
+ onPreview();
31
+ }, [onPreview]);
32
+
33
+ useEffect(() => {
34
+ if (!isOpen) {
35
+ return;
36
+ }
37
+
38
+ return () => {
39
+ if (!keepsHighlightOnClose.current) {
40
+ dispatch(hoveredWordSlice.actions.clear());
41
+ }
42
+
43
+ keepsHighlightOnClose.current = false;
44
+ };
45
+ }, [dispatch, isOpen]);
23
46
 
24
47
  return (
25
- <Modal className={className} isOpen={isOpen} title={translate('words')} onClose={onClose}>
26
- <Modal.Section
27
- label={translate('words.invalid')}
28
- title={
29
- <span className={styles.title}>
30
- <span>{translate('words.invalid')}</span>
31
- <Badge className={styles.badge}>{invalidWords.length.toLocaleString(locale)}</Badge>
32
- </span>
33
- }
34
- >
35
- {invalidWords.map((word, index) => (
36
- <div className={styles.word} key={index}>
37
- <Cross aria-hidden="true" className={classNames(styles.icon, styles.invalid)} role="img" /> {word}
38
- </div>
39
- ))}
40
- </Modal.Section>
41
-
42
- <Modal.Section
43
- label={translate('words.valid')}
44
- title={
45
- <span className={styles.title}>
46
- <span>{translate('words.valid')}</span>
47
- <Badge className={styles.badge}>{validWords.length.toLocaleString(locale)}</Badge>
48
- </span>
49
- }
50
- >
51
- {validWords.map((word, index) => (
52
- <div className={styles.word} key={index}>
53
- <Check aria-hidden="true" className={classNames(styles.icon, styles.valid)} role="img" /> {word}
54
- </div>
55
- ))}
56
- </Modal.Section>
48
+ <Modal
49
+ className={className}
50
+ footer={
51
+ showsPreviewButton && (
52
+ <Button
53
+ aria-label={translate('words.preview')}
54
+ disabled={!hoveredWord}
55
+ Icon={EyeFill}
56
+ tooltip={translate('words.preview')}
57
+ onClick={handlePreview}
58
+ >
59
+ {translate('words.preview')}
60
+ </Button>
61
+ )
62
+ }
63
+ isOpen={isOpen}
64
+ title={translate('words')}
65
+ onClose={onClose}
66
+ >
67
+ <div className={styles.content}>
68
+ <WordsTable className={styles.words} isOpen={isOpen} onPreview={handlePreview} />
69
+ <Dictionary className={styles.dictionary} />
70
+ </div>
57
71
  </Modal>
58
72
  );
59
73
  };
@@ -0,0 +1,92 @@
1
+ import classNames from 'classnames';
2
+ import { type ReactElement } from 'react';
3
+ import Highlighter from 'react-highlight-words';
4
+ import { useDispatch } from 'react-redux';
5
+ import { type RowComponentProps } from 'react-window';
6
+
7
+ import { Cell, Row } from '@/components/Table';
8
+ import Check from '@/icons/Check.svg';
9
+ import Cross from '@/icons/Cross.svg';
10
+ import {
11
+ hoveredWordSlice,
12
+ selectIsWordMatching,
13
+ selectWordCoordinates,
14
+ selectWordsQuery,
15
+ useTranslate,
16
+ useTypedSelector,
17
+ } from '@/state';
18
+ import { type VerifiedWord } from '@/types';
19
+
20
+ import styles from './WordsTable.module.scss';
21
+
22
+ export interface WordRowData {
23
+ highlightFollowsPointer: boolean;
24
+ highlightedIndex: number;
25
+ isTouchDevice: boolean;
26
+ words: VerifiedWord[];
27
+ onPreview: () => void;
28
+ }
29
+
30
+ export const WordRow = ({
31
+ highlightFollowsPointer,
32
+ highlightedIndex,
33
+ index,
34
+ isTouchDevice,
35
+ style,
36
+ words,
37
+ onPreview,
38
+ }: RowComponentProps<WordRowData>): ReactElement => {
39
+ const dispatch = useDispatch();
40
+ const translate = useTranslate();
41
+ const isSelected = index === highlightedIndex;
42
+ const word = words[index];
43
+ const coordinates = useTypedSelector((state) => selectWordCoordinates(state, index));
44
+ const isMatching = useTypedSelector((state) => selectIsWordMatching(state, index));
45
+ const query = useTypedSelector(selectWordsQuery);
46
+ const validityLabel = translate(word.isValid ? 'words.valid' : 'words.invalid');
47
+ const Icon = word.isValid ? Check : Cross;
48
+
49
+ const handleSet = () => {
50
+ dispatch(hoveredWordSlice.actions.set(word));
51
+ };
52
+
53
+ const handleClear = () => {
54
+ dispatch(hoveredWordSlice.actions.clear());
55
+ };
56
+
57
+ const handleClick = () => {
58
+ if (!isSelected) {
59
+ handleSet();
60
+ } else if (isTouchDevice) {
61
+ onPreview();
62
+ }
63
+ };
64
+
65
+ return (
66
+ <Row
67
+ aria-label={word.word}
68
+ data-testid={`word-${word.x}-${word.y}-${word.direction}`}
69
+ highlighted={isSelected}
70
+ inactive={!isMatching}
71
+ style={style}
72
+ onBlur={highlightFollowsPointer ? handleClear : undefined}
73
+ onClick={highlightFollowsPointer ? undefined : handleClick}
74
+ onFocus={highlightFollowsPointer ? handleSet : undefined}
75
+ onMouseEnter={highlightFollowsPointer ? handleSet : undefined}
76
+ >
77
+ <Cell className={styles.coordinates} translationKey="settings.showCoordinates" value={coordinates} />
78
+
79
+ <Cell primary translationKey="common.word" value={word.word}>
80
+ <Highlighter highlightClassName={styles.highlight} searchWords={[query]} textToHighlight={word.word} />
81
+ </Cell>
82
+
83
+ <Cell className={styles.stat} value={validityLabel}>
84
+ <Icon
85
+ aria-label={validityLabel}
86
+ className={classNames(styles.icon, word.isValid ? styles.valid : styles.invalid)}
87
+ role="img"
88
+ />
89
+ </Cell>
90
+ </Row>
91
+ );
92
+ };
@@ -0,0 +1,69 @@
1
+ @use 'styles/mixins' as *;
2
+
3
+ .words {
4
+ position: relative;
5
+ display: flex;
6
+ flex-direction: column;
7
+ height: 100%;
8
+ background: var(--color--background--element);
9
+ border: var(--border);
10
+ border-radius: var(--border--radius);
11
+ }
12
+
13
+ .content {
14
+ flex: 1;
15
+ position: relative;
16
+ height: 100%;
17
+ }
18
+
19
+ .listContainer {
20
+ position: absolute;
21
+ inset: 0;
22
+ }
23
+
24
+ .list {
25
+ @include scrollbars;
26
+ }
27
+
28
+ .stat {
29
+ $width: 55px;
30
+
31
+ flex: 0 0 $width;
32
+ max-width: $width;
33
+ justify-content: center;
34
+ }
35
+
36
+ .coordinates {
37
+ $width: 55px;
38
+
39
+ flex: 0 0 $width;
40
+ max-width: $width;
41
+ }
42
+
43
+ .invalid {
44
+ color: var(--color--error);
45
+ }
46
+
47
+ .valid {
48
+ color: var(--color--success);
49
+ }
50
+
51
+ .icon {
52
+ $size: 24px;
53
+
54
+ display: block;
55
+ width: $size;
56
+ height: $size;
57
+ }
58
+
59
+ .input {
60
+ border-top: var(--border);
61
+ border-bottom-left-radius: var(--border--radius);
62
+ border-bottom-right-radius: var(--border--radius);
63
+ }
64
+
65
+ .highlight {
66
+ background-color: var(--color--mark);
67
+ color: var(--color--foreground);
68
+ border-radius: var(--border--radius);
69
+ }
@@ -0,0 +1,16 @@
1
+ // Generated by scripts/generate-scss-types.ts - do not edit.
2
+ declare const styles: {
3
+ readonly content: string;
4
+ readonly coordinates: string;
5
+ readonly highlight: string;
6
+ readonly icon: string;
7
+ readonly input: string;
8
+ readonly invalid: string;
9
+ readonly list: string;
10
+ readonly listContainer: string;
11
+ readonly stat: string;
12
+ readonly valid: string;
13
+ readonly words: string;
14
+ };
15
+
16
+ export default styles;
@@ -0,0 +1,137 @@
1
+ import { isSameBoardWord } from '@scrabble-solver/types';
2
+ import classNames from 'classnames';
3
+ import { type FunctionComponent, useCallback, useEffect, useMemo } from 'react';
4
+ import { useDispatch } from 'react-redux';
5
+ import { List } from 'react-window';
6
+
7
+ import { EmptyState } from '@/components/EmptyState';
8
+ import { Header, HeaderButton, Search } from '@/components/Table';
9
+ import { useIsCompactLayout } from '@/hooks/useIsCompactLayout';
10
+ import { useIsTouchDevice } from '@/hooks/useIsTouchDevice';
11
+ import { LOCALE_FEATURES } from '@/i18n/constants';
12
+ import GeoAlt from '@/icons/GeoAlt.svg';
13
+ import QuestionSquare from '@/icons/QuestionSquare.svg';
14
+ import { RESULTS_ITEM_HEIGHT, RESULTS_OVERSCAN_COUNT } from '@/parameters';
15
+ import {
16
+ hoveredWordSlice,
17
+ selectHoveredWord,
18
+ selectLocale,
19
+ selectProcessedWords,
20
+ selectWordsQuery,
21
+ selectWordsSort,
22
+ useTranslate,
23
+ useTypedSelector,
24
+ verifySlice,
25
+ } from '@/state';
26
+ import { WordColumnId } from '@/types';
27
+
28
+ import { WordRow, type WordRowData } from './WordRow';
29
+ import styles from './WordsTable.module.scss';
30
+
31
+ interface Props {
32
+ className?: string;
33
+ isOpen: boolean;
34
+ onPreview: () => void;
35
+ }
36
+
37
+ export const WordsTable: FunctionComponent<Props> = ({ className, isOpen, onPreview }) => {
38
+ const dispatch = useDispatch();
39
+ const translate = useTranslate();
40
+ const isTouchDevice = useIsTouchDevice();
41
+ const isCompactLayout = useIsCompactLayout();
42
+ const highlightFollowsPointer = !isTouchDevice && !isCompactLayout;
43
+ const locale = useTypedSelector(selectLocale);
44
+ const { direction } = LOCALE_FEATURES[locale];
45
+ const words = useTypedSelector(selectProcessedWords);
46
+ const query = useTypedSelector(selectWordsQuery);
47
+ const sort = useTypedSelector(selectWordsSort);
48
+ const hoveredWord = useTypedSelector(selectHoveredWord);
49
+ const highlightedIndex = hoveredWord ? words.findIndex((word) => isSameBoardWord(word, hoveredWord)) : -1;
50
+ const rowProps = useMemo<WordRowData>(
51
+ () => ({ highlightFollowsPointer, highlightedIndex, isTouchDevice, words, onPreview }),
52
+ [highlightFollowsPointer, highlightedIndex, isTouchDevice, words, onPreview],
53
+ );
54
+
55
+ const handleSort = useCallback(
56
+ (columnId: WordColumnId) => {
57
+ dispatch(verifySlice.actions.sort(columnId));
58
+ },
59
+ [dispatch],
60
+ );
61
+
62
+ const handleQueryChange = useCallback(
63
+ (newQuery: string) => {
64
+ dispatch(verifySlice.actions.changeQuery(newQuery));
65
+ },
66
+ [dispatch],
67
+ );
68
+
69
+ const handleMouseLeave = useCallback(() => {
70
+ dispatch(hoveredWordSlice.actions.clear());
71
+ }, [dispatch]);
72
+
73
+ useEffect(() => {
74
+ if (isOpen && isCompactLayout && words.length > 0 && highlightedIndex === -1) {
75
+ dispatch(hoveredWordSlice.actions.set(words[0]));
76
+ }
77
+ }, [dispatch, highlightedIndex, isOpen, isCompactLayout, words]);
78
+
79
+ return (
80
+ <div
81
+ aria-label={translate('words')}
82
+ className={classNames(styles.words, className)}
83
+ data-testid="words"
84
+ role="region"
85
+ >
86
+ <Header>
87
+ <HeaderButton
88
+ className={styles.coordinates}
89
+ Icon={GeoAlt}
90
+ id={WordColumnId.Coordinates}
91
+ sort={sort}
92
+ translationKey="settings.showCoordinates"
93
+ onSort={handleSort}
94
+ />
95
+
96
+ <HeaderButton id={WordColumnId.Word} primary sort={sort} translationKey="common.word" onSort={handleSort} />
97
+
98
+ <HeaderButton
99
+ className={styles.stat}
100
+ Icon={QuestionSquare}
101
+ id={WordColumnId.Validity}
102
+ sort={sort}
103
+ translationKey="words.validity"
104
+ onSort={handleSort}
105
+ />
106
+ </Header>
107
+
108
+ <div aria-live="polite" className={styles.content}>
109
+ {words.length === 0 && <EmptyState variant="info">{translate('words.empty-state.no-words')}</EmptyState>}
110
+
111
+ {words.length > 0 && (
112
+ <div className={styles.listContainer}>
113
+ <List
114
+ className={styles.list}
115
+ dir={direction}
116
+ overscanCount={RESULTS_OVERSCAN_COUNT}
117
+ rowComponent={WordRow}
118
+ rowCount={words.length}
119
+ rowHeight={RESULTS_ITEM_HEIGHT}
120
+ rowProps={rowProps}
121
+ onMouseLeave={highlightFollowsPointer ? handleMouseLeave : undefined}
122
+ />
123
+ </div>
124
+ )}
125
+ </div>
126
+
127
+ {words.length > 0 && (
128
+ <Search
129
+ className={styles.input}
130
+ placeholder={translate('words.input.placeholder')}
131
+ value={query}
132
+ onChange={handleQueryChange}
133
+ />
134
+ )}
135
+ </div>
136
+ );
137
+ };
@@ -0,0 +1 @@
1
+ export { WordsTable } from './WordsTable';
@@ -0,0 +1 @@
1
+ export { WordsTable } from './WordsTable';
@@ -5,6 +5,7 @@ import { Board, type Config, type Game, type Locale, isBoardJson, isGame, isLoca
5
5
  import { type NextApiRequest, type NextApiResponse } from 'next';
6
6
 
7
7
  import { getServerLoggingData, isBoardValid } from '@/api';
8
+ import { type VerifiedWord } from '@/types';
8
9
 
9
10
  interface RequestData {
10
11
  board: Board;
@@ -31,15 +32,15 @@ const verify = async (request: NextApiRequest, response: NextApiResponse): Promi
31
32
  });
32
33
 
33
34
  const gaddag = await dictionaries.get(locale);
34
- const words = board.getWords().sort((a, b) => a.localeCompare(b, locale));
35
- const invalidWords: string[] = [];
36
- const validWords: string[] = [];
35
+ const words = board.getWords().sort((a, b) => a.word.localeCompare(b.word, locale));
36
+ const invalidWords: VerifiedWord[] = [];
37
+ const validWords: VerifiedWord[] = [];
37
38
 
38
39
  for (const word of words) {
39
- if (gaddag.has(word)) {
40
- validWords.push(word);
40
+ if (gaddag.has(word.word)) {
41
+ validWords.push({ ...word, isValid: true });
41
42
  } else {
42
- invalidWords.push(word);
43
+ invalidWords.push({ ...word, isValid: false });
43
44
  }
44
45
  }
45
46