@scrabble-solver/scrabble-solver 2.15.9 → 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.
Files changed (309) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +9 -9
  3. package/.next/cache/.rscinfo +1 -1
  4. package/.next/cache/.tsbuildinfo +1 -1
  5. package/.next/cache/webpack/client-production/0.pack +0 -0
  6. package/.next/cache/webpack/client-production/index.pack +0 -0
  7. package/.next/cache/webpack/client-production/index.pack.old +0 -0
  8. package/.next/cache/webpack/edge-server-production/0.pack +0 -0
  9. package/.next/cache/webpack/edge-server-production/index.pack +0 -0
  10. package/.next/cache/webpack/edge-server-production/index.pack.old +0 -0
  11. package/.next/cache/webpack/server-production/0.pack +0 -0
  12. package/.next/cache/webpack/server-production/index.pack +0 -0
  13. package/.next/cache/webpack/server-production/index.pack.old +0 -0
  14. package/.next/diagnostics/framework.json +1 -1
  15. package/.next/next-minimal-server.js.nft.json +1 -1
  16. package/.next/next-server.js.nft.json +1 -1
  17. package/.next/prerender-manifest.json +4 -4
  18. package/.next/required-server-files.json +1 -2
  19. package/.next/routes-manifest.json +1 -1
  20. package/.next/server/chunks/60.js +1 -1
  21. package/.next/server/chunks/812.js +1 -1
  22. package/.next/server/chunks/974.js +1 -1
  23. package/.next/server/middleware-build-manifest.js +1 -1
  24. package/.next/server/pages/404.html +1 -1
  25. package/.next/server/pages/404.js.nft.json +1 -1
  26. package/.next/server/pages/500.html +1 -1
  27. package/.next/server/pages/_app.js.nft.json +1 -1
  28. package/.next/server/pages/api/dictionary/[locale]/[word].js +2 -2
  29. package/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
  30. package/.next/server/pages/api/dictionary/[locale].js +1 -1
  31. package/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
  32. package/.next/server/pages/api/solve.js +1 -1
  33. package/.next/server/pages/api/solve.js.nft.json +1 -1
  34. package/.next/server/pages/api/verify.js +1 -1
  35. package/.next/server/pages/api/verify.js.nft.json +1 -1
  36. package/.next/server/pages/api/visit.js +1 -1
  37. package/.next/server/pages/index.html +1 -1
  38. package/.next/server/pages/index.js +1 -1
  39. package/.next/server/pages/index.js.nft.json +1 -1
  40. package/.next/server/pages/index.json +1 -1
  41. package/.next/server/webpack-api-runtime.js +1 -1
  42. package/.next/static/chunks/{main-b934e2c3dd3b55b5.js → main-016492249b3393e2.js} +1 -1
  43. package/.next/static/chunks/pages/{404-7451dd58396eaa39.js → 404-590e2a3839c1d9e0.js} +1 -1
  44. package/.next/static/chunks/pages/_app-ac93a74c390f2ab8.js +1 -0
  45. package/.next/static/chunks/pages/index-e5f1caa581e6d3b8.js +1 -0
  46. package/.next/static/{3MlxnccTCLyz9bgD30zY2 → ylO_ttKeJTuoqDYywao5A}/_buildManifest.js +1 -1
  47. package/.next/trace +23 -23
  48. package/next.config.js +3 -0
  49. package/package.json +10 -10
  50. package/src/api/getServerLoggingData.ts +1 -3
  51. package/src/api/index.ts +5 -5
  52. package/src/api/isBoardValid.ts +3 -5
  53. package/src/api/isCellValid.ts +4 -6
  54. package/src/api/isCharacterValid.ts +2 -3
  55. package/src/api/isRowValid.ts +3 -5
  56. package/src/components/Alert/Alert.tsx +1 -3
  57. package/src/components/Alert/index.ts +1 -1
  58. package/src/components/Badge/Badge.tsx +1 -3
  59. package/src/components/Badge/index.ts +1 -1
  60. package/src/components/Board/Board.tsx +2 -4
  61. package/src/components/Board/BoardPure.tsx +2 -2
  62. package/src/components/Board/components/Actions/Actions.tsx +3 -5
  63. package/src/components/Board/components/Actions/index.ts +1 -1
  64. package/src/components/Board/components/Cell/Cell.tsx +3 -5
  65. package/src/components/Board/components/Cell/index.ts +1 -1
  66. package/src/components/Board/components/InputPrompt/InputPrompt.tsx +3 -5
  67. package/src/components/Board/components/InputPrompt/index.ts +1 -1
  68. package/src/components/Board/components/ToggleDirectionButton/ToggleDirectionButton.tsx +2 -4
  69. package/src/components/Board/components/ToggleDirectionButton/index.ts +1 -1
  70. package/src/components/Board/components/index.ts +4 -4
  71. package/src/components/Board/hooks/index.ts +6 -6
  72. package/src/components/Board/hooks/useBackgroundImage.tsx +7 -9
  73. package/src/components/Board/hooks/useBoardStyle.ts +7 -9
  74. package/src/components/Board/hooks/useFloatingActions.ts +1 -3
  75. package/src/components/Board/hooks/useFloatingFocus.ts +1 -3
  76. package/src/components/Board/hooks/useFloatingInputPrompt.ts +1 -3
  77. package/src/components/Board/hooks/useGrid.ts +2 -4
  78. package/src/components/Board/index.ts +1 -1
  79. package/src/components/Board/lib/getBonusColor.ts +1 -3
  80. package/src/components/Board/lib/getPositionInGrid.ts +1 -3
  81. package/src/components/Board/lib/index.ts +2 -2
  82. package/src/components/Button/Button.tsx +3 -3
  83. package/src/components/Button/Link.tsx +1 -3
  84. package/src/components/Button/index.ts +1 -1
  85. package/src/components/Dictionary/Dictionary.tsx +3 -5
  86. package/src/components/Dictionary/index.ts +1 -1
  87. package/src/components/DictionaryInput/DictionaryInput.tsx +1 -3
  88. package/src/components/DictionaryInput/index.ts +1 -1
  89. package/src/components/EmptyState/EmptyState.tsx +2 -4
  90. package/src/components/EmptyState/index.ts +1 -1
  91. package/src/components/IconButton/IconButton.tsx +3 -3
  92. package/src/components/IconButton/Link.tsx +1 -3
  93. package/src/components/IconButton/index.ts +1 -1
  94. package/src/components/Key/Key.tsx +1 -3
  95. package/src/components/Key/index.ts +1 -1
  96. package/src/components/Keys/Arrows/Arrows.tsx +2 -4
  97. package/src/components/Keys/Arrows/index.ts +1 -1
  98. package/src/components/{keys.tsx → Keys/index.tsx} +3 -1
  99. package/src/components/Loading/Loading.tsx +2 -4
  100. package/src/components/Loading/index.ts +1 -1
  101. package/src/components/Logo/Logo.tsx +1 -3
  102. package/src/components/Logo/LogoBlueprint.tsx +2 -4
  103. package/src/components/Logo/index.ts +1 -1
  104. package/src/components/Modal/Modal.tsx +3 -3
  105. package/src/components/Modal/components/Section/Section.tsx +1 -3
  106. package/src/components/Modal/components/Section/index.ts +1 -1
  107. package/src/components/Modal/components/index.ts +1 -1
  108. package/src/components/Modal/index.ts +1 -1
  109. package/src/components/NavButtons/NavButtons.tsx +3 -3
  110. package/src/components/NavButtons/index.ts +1 -1
  111. package/src/components/NotFound/NotFound.tsx +2 -4
  112. package/src/components/NotFound/index.ts +1 -1
  113. package/src/components/PlainTiles/PlainTiles.tsx +10 -4
  114. package/src/components/PlainTiles/Tile.tsx +1 -3
  115. package/src/components/PlainTiles/index.ts +1 -1
  116. package/src/components/PlainTiles/lib/createPlainTile.ts +10 -6
  117. package/src/components/PlainTiles/lib/createPlainTiles.ts +2 -4
  118. package/src/components/PlainTiles/lib/getViewbox.ts +1 -3
  119. package/src/components/PlainTiles/lib/getX.ts +1 -3
  120. package/src/components/PlainTiles/lib/getY.ts +1 -3
  121. package/src/components/PlainTiles/lib/index.ts +6 -6
  122. package/src/components/PlainTiles/lib/randomize.ts +1 -3
  123. package/src/components/Progress/Progress.tsx +1 -3
  124. package/src/components/Progress/index.ts +1 -1
  125. package/src/components/Rack/Rack.tsx +2 -4
  126. package/src/components/Rack/components/InputPrompt/InputPrompt.tsx +2 -2
  127. package/src/components/Rack/components/InputPrompt/index.ts +1 -1
  128. package/src/components/Rack/components/RackTile/RackTile.tsx +4 -7
  129. package/src/components/Rack/components/RackTile/index.ts +1 -1
  130. package/src/components/Rack/components/index.ts +2 -2
  131. package/src/components/Rack/index.ts +1 -1
  132. package/src/components/Radio/Radio.tsx +1 -3
  133. package/src/components/Radio/index.ts +1 -1
  134. package/src/components/Results/Cell.tsx +9 -3
  135. package/src/components/Results/Header.tsx +2 -4
  136. package/src/components/Results/HeaderButton.tsx +1 -3
  137. package/src/components/Results/Result.tsx +2 -4
  138. package/src/components/Results/Results.tsx +7 -9
  139. package/src/components/Results/SolveButton.tsx +2 -4
  140. package/src/components/Results/index.ts +1 -1
  141. package/src/components/ResultsInput/ResultsInput.tsx +1 -3
  142. package/src/components/ResultsInput/index.ts +1 -1
  143. package/src/components/SeoMessage/SeoMessage.tsx +4 -6
  144. package/src/components/SeoMessage/index.ts +1 -1
  145. package/src/components/Solver/Solver.tsx +8 -8
  146. package/src/components/Solver/components/InsertButton/InsertButton.tsx +2 -4
  147. package/src/components/Solver/components/InsertButton/index.ts +1 -1
  148. package/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.tsx +4 -6
  149. package/src/components/Solver/components/ResultCandidatePicker/index.ts +1 -1
  150. package/src/components/Solver/components/index.ts +2 -2
  151. package/src/components/Solver/index.ts +1 -1
  152. package/src/components/Spinner/Spinner.tsx +1 -3
  153. package/src/components/Spinner/index.ts +1 -1
  154. package/src/components/Tile/Tile.tsx +2 -4
  155. package/src/components/Tile/TilePure.tsx +2 -2
  156. package/src/components/Tile/index.ts +1 -1
  157. package/src/components/Tooltip/TooltipTrigger.tsx +5 -3
  158. package/src/components/index.ts +24 -25
  159. package/src/hooks/index.ts +13 -13
  160. package/src/hooks/useAppLayout.ts +19 -15
  161. package/src/hooks/useColumns.ts +2 -4
  162. package/src/hooks/useDirection.ts +1 -3
  163. package/src/hooks/useEffectOnce.ts +2 -4
  164. package/src/hooks/useIsTouchDevice.ts +2 -4
  165. package/src/hooks/useLanguage.ts +1 -3
  166. package/src/hooks/useLatest.ts +1 -3
  167. package/src/hooks/useLocalStorage.ts +1 -3
  168. package/src/hooks/useMedia.ts +1 -3
  169. package/src/hooks/useMediaQueries.ts +2 -4
  170. package/src/hooks/useMediaQuery.ts +2 -4
  171. package/src/hooks/useOnWindowResize.ts +1 -3
  172. package/src/hooks/useViewportSize.ts +2 -4
  173. package/src/i18n/i18n.ts +1 -3
  174. package/src/i18n/index.ts +1 -1
  175. package/src/lib/arrayEquals.ts +1 -3
  176. package/src/lib/createArray.ts +1 -3
  177. package/src/lib/createComparator.ts +3 -5
  178. package/src/lib/createGridOf.ts +2 -4
  179. package/src/lib/createKeyComparator.ts +6 -5
  180. package/src/lib/createKeyboardNavigation.ts +2 -4
  181. package/src/lib/createNullMovingComparator.test.ts +1 -1
  182. package/src/lib/createNullMovingComparator.ts +1 -3
  183. package/src/lib/createRegExp.ts +1 -3
  184. package/src/lib/createStringComparator.ts +5 -3
  185. package/src/lib/detectLocale.ts +1 -3
  186. package/src/lib/extractCharacters.test.ts +1 -1
  187. package/src/lib/extractCharacters.ts +1 -3
  188. package/src/lib/extractCharactersByCase.test.ts +1 -1
  189. package/src/lib/extractCharactersByCase.ts +2 -4
  190. package/src/lib/extractInputValue.ts +1 -3
  191. package/src/lib/findCell.ts +1 -3
  192. package/src/lib/getCellSize.ts +3 -5
  193. package/src/lib/getCoordinate.ts +1 -3
  194. package/src/lib/getCoordinates.ts +2 -4
  195. package/src/lib/getRemainingTiles.ts +8 -5
  196. package/src/lib/getRemainingTilesCount.ts +1 -3
  197. package/src/lib/getRemainingTilesGroups.ts +3 -5
  198. package/src/lib/getTileSizes.ts +1 -3
  199. package/src/lib/getTotalRemainingTilesCount.ts +1 -3
  200. package/src/lib/groupResults.ts +3 -5
  201. package/src/lib/guessLocale.ts +2 -4
  202. package/src/lib/index.ts +39 -39
  203. package/src/lib/inverseDirection.ts +1 -3
  204. package/src/lib/isCtrl.ts +1 -3
  205. package/src/lib/isMac.ts +3 -4
  206. package/src/lib/isRegExp.ts +1 -3
  207. package/src/lib/isStringArray.ts +1 -3
  208. package/src/lib/isUpperCase.ts +1 -3
  209. package/src/lib/memoize.ts +18 -20
  210. package/src/lib/noop.ts +1 -3
  211. package/src/lib/numberComparator.ts +1 -3
  212. package/src/lib/resultMatchesCellFilter.ts +1 -3
  213. package/src/lib/reverseComparator.ts +1 -3
  214. package/src/lib/sortGroupedResults.ts +2 -4
  215. package/src/lib/sortResults.ts +5 -7
  216. package/src/lib/unorderedArraysEqual.ts +2 -4
  217. package/src/lib/zipCharactersAndTiles.ts +1 -3
  218. package/src/modals/DictionaryModal/DictionaryModal.tsx +2 -2
  219. package/src/modals/DictionaryModal/index.ts +1 -1
  220. package/src/modals/KeyMapModal/KeyMapModal.tsx +2 -2
  221. package/src/modals/KeyMapModal/components/Mapping/Mapping.tsx +1 -3
  222. package/src/modals/KeyMapModal/components/Mapping/index.ts +1 -1
  223. package/src/modals/KeyMapModal/components/index.ts +1 -1
  224. package/src/modals/KeyMapModal/index.ts +1 -1
  225. package/src/modals/MenuModal/MenuModal.tsx +2 -2
  226. package/src/modals/MenuModal/index.ts +1 -1
  227. package/src/modals/RemainingTilesModal/RemainingTilesModal.tsx +2 -2
  228. package/src/modals/RemainingTilesModal/components/Character/Character.tsx +1 -3
  229. package/src/modals/RemainingTilesModal/components/Character/index.ts +1 -1
  230. package/src/modals/RemainingTilesModal/components/index.ts +1 -1
  231. package/src/modals/RemainingTilesModal/index.ts +1 -1
  232. package/src/modals/ResultsModal/ResultsModal.tsx +2 -2
  233. package/src/modals/ResultsModal/index.ts +1 -1
  234. package/src/modals/SettingsModal/SettingsModal.tsx +2 -2
  235. package/src/modals/SettingsModal/components/AutoGroupTilesSetting/AutoGroupTilesSetting.tsx +1 -3
  236. package/src/modals/SettingsModal/components/AutoGroupTilesSetting/index.ts +1 -1
  237. package/src/modals/SettingsModal/components/ConfigSetting/ConfigSetting.tsx +4 -10
  238. package/src/modals/SettingsModal/components/ConfigSetting/index.ts +1 -1
  239. package/src/modals/SettingsModal/components/ConfigSetting/lib.ts +19 -0
  240. package/src/modals/SettingsModal/components/InputModeSetting/InputModeSetting.tsx +1 -3
  241. package/src/modals/SettingsModal/components/InputModeSetting/index.ts +1 -1
  242. package/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.tsx +1 -3
  243. package/src/modals/SettingsModal/components/LocaleSetting/index.ts +1 -1
  244. package/src/modals/SettingsModal/components/ShowCoordinatesSetting/ShowCoordinatesSetting.tsx +1 -3
  245. package/src/modals/SettingsModal/components/ShowCoordinatesSetting/index.ts +1 -1
  246. package/src/modals/SettingsModal/components/index.ts +5 -5
  247. package/src/modals/SettingsModal/index.ts +1 -1
  248. package/src/modals/WordsModal/WordsModal.tsx +2 -2
  249. package/src/modals/WordsModal/index.ts +1 -1
  250. package/src/modals/index.ts +7 -7
  251. package/src/pages/_app.tsx +2 -1
  252. package/src/pages/api/dictionary/[locale]/[word].ts +1 -1
  253. package/src/pages/api/dictionary/[locale]/index.ts +1 -1
  254. package/src/pages/api/solve.ts +6 -4
  255. package/src/pages/api/verify.ts +6 -4
  256. package/src/pages/api/visit.ts +2 -2
  257. package/src/pages/index.tsx +7 -0
  258. package/src/sdk/fetch.ts +1 -3
  259. package/src/sdk/fetchJson.ts +2 -4
  260. package/src/sdk/findWordDefinitions.ts +2 -4
  261. package/src/sdk/getDictionary.ts +2 -4
  262. package/src/sdk/index.ts +4 -4
  263. package/src/sdk/solve.ts +2 -4
  264. package/src/sdk/verify.ts +2 -4
  265. package/src/sdk/visit.ts +1 -3
  266. package/src/service-worker/average.ts +1 -3
  267. package/src/service-worker/dictionaries/expirationManager.ts +1 -3
  268. package/src/service-worker/dictionaries/getDictionary.ts +3 -5
  269. package/src/service-worker/dictionaries/getDictionaryUrl.ts +1 -3
  270. package/src/service-worker/dictionaries/index.ts +2 -2
  271. package/src/service-worker/dictionaries/revalidateDictionary.ts +3 -5
  272. package/src/service-worker/getTrie.ts +1 -3
  273. package/src/service-worker/index.ts +4 -2
  274. package/src/service-worker/routeSolveRequests.ts +17 -11
  275. package/src/service-worker/routeVerifyRequests.ts +7 -5
  276. package/src/serviceWorkerManager.ts +4 -4
  277. package/src/state/index.ts +4 -4
  278. package/src/state/localStorage.ts +10 -12
  279. package/src/state/sagas.ts +4 -1
  280. package/src/state/selectors.ts +2 -5
  281. package/src/state/slices/boardInitialState.ts +6 -7
  282. package/src/state/slices/boardSlice.ts +5 -7
  283. package/src/state/slices/cellFilterInitialState.ts +1 -3
  284. package/src/state/slices/cellFilterSlice.ts +2 -4
  285. package/src/state/slices/dictionaryInitialState.ts +2 -4
  286. package/src/state/slices/dictionarySlice.ts +2 -4
  287. package/src/state/slices/index.ts +16 -16
  288. package/src/state/slices/rackInitialState.ts +2 -4
  289. package/src/state/slices/rackSlice.ts +2 -4
  290. package/src/state/slices/resultsInitialState.ts +1 -3
  291. package/src/state/slices/resultsSlice.ts +2 -4
  292. package/src/state/slices/settingsInitialState.ts +2 -4
  293. package/src/state/slices/settingsSlice.ts +2 -4
  294. package/src/state/slices/solveInitialState.ts +3 -5
  295. package/src/state/slices/solveSlice.ts +2 -4
  296. package/src/state/slices/verifyInitialState.ts +2 -4
  297. package/src/state/slices/verifySlice.ts +2 -4
  298. package/src/state/store.ts +1 -3
  299. package/src/state/useTranslate.ts +2 -4
  300. package/src/state/useTypedSelector.ts +1 -3
  301. package/src/types/api.ts +15 -0
  302. package/src/types/index.ts +2 -0
  303. package/tsconfig.json +1 -1
  304. package/.next/cache/eslint/.cache_8dgz12 +0 -1
  305. package/.next/static/chunks/pages/_app-735105409cfdb48f.js +0 -1
  306. package/.next/static/chunks/pages/index-d492616d9bc42176.js +0 -1
  307. package/src/components/Keys/index.ts +0 -1
  308. package/tsconfig.jest.json +0 -7
  309. /package/.next/static/{3MlxnccTCLyz9bgD30zY2 → ylO_ttKeJTuoqDYywao5A}/_ssgManifest.js +0 -0
@@ -1,17 +1,18 @@
1
1
  import { getConfig } from '@scrabble-solver/configs';
2
2
  import { Board } from '@scrabble-solver/types';
3
3
 
4
- import localStorage from '../localStorage';
4
+ import { localStorage } from '../localStorage';
5
5
 
6
- import settingsInitialState from './settingsInitialState';
6
+ import { settingsInitialState } from './settingsInitialState';
7
7
 
8
8
  export type BoardState = Board;
9
9
 
10
10
  const { game, locale } = settingsInitialState;
11
- const { boardSize } = getConfig(game, locale);
12
- export const boardDefaultState = Board.create(boardSize);
11
+ const { boardHeight, boardWidth } = getConfig(game, locale);
13
12
 
14
- const boardInitialState: BoardState = localStorage.getBoard() || boardDefaultState;
13
+ export const boardDefaultState = Board.create(boardWidth, boardHeight);
14
+
15
+ export const boardInitialState: BoardState = localStorage.getBoard() || boardDefaultState;
15
16
 
16
17
  // const createOxyphenbutazone = () => {
17
18
  // // Tiles: oypbaze
@@ -39,5 +40,3 @@ const boardInitialState: BoardState = localStorage.getBoard() || boardDefaultSta
39
40
 
40
41
  // return board;
41
42
  // };
42
-
43
- export default boardInitialState;
@@ -3,10 +3,10 @@ import { games } from '@scrabble-solver/configs';
3
3
  import { EMPTY_CELL } from '@scrabble-solver/constants';
4
4
  import { Board, Cell, Result, Tile } from '@scrabble-solver/types';
5
5
 
6
- import boardInitialState from './boardInitialState';
7
- import settingsSlice from './settingsSlice';
6
+ import { boardInitialState } from './boardInitialState';
7
+ import { settingsSlice } from './settingsSlice';
8
8
 
9
- const boardSlice = createSlice({
9
+ export const boardSlice = createSlice({
10
10
  initialState: boardInitialState,
11
11
  name: 'board',
12
12
  reducers: {
@@ -65,13 +65,11 @@ const boardSlice = createSlice({
65
65
  throw new Error(`Cannot find config for game "${game}"`);
66
66
  }
67
67
 
68
- if (state.rows.length !== config.boardSize || state.rows[0].length !== config.boardSize) {
69
- return Board.create(config.boardSize);
68
+ if (state.rows.length !== config.boardHeight || state.rows[0].length !== config.boardWidth) {
69
+ return Board.create(config.boardWidth, config.boardHeight);
70
70
  }
71
71
 
72
72
  return state;
73
73
  });
74
74
  },
75
75
  });
76
-
77
- export default boardSlice;
@@ -2,6 +2,4 @@ import { CellFilterEntry } from 'types';
2
2
 
3
3
  export type CellFilterState = CellFilterEntry[];
4
4
 
5
- const cellFilterInitialState: CellFilterState = [];
6
-
7
- export default cellFilterInitialState;
5
+ export const cellFilterInitialState: CellFilterState = [];
@@ -2,9 +2,9 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit';
2
2
 
3
3
  import { CellFilterType, Point } from 'types';
4
4
 
5
- import cellFilterInitialState from './cellFilterInitialState';
5
+ import { cellFilterInitialState } from './cellFilterInitialState';
6
6
 
7
- const cellFilterSlice = createSlice({
7
+ export const cellFilterSlice = createSlice({
8
8
  initialState: cellFilterInitialState,
9
9
  name: 'cellFilter',
10
10
  reducers: {
@@ -47,5 +47,3 @@ const toggleCellFilterState = (type: CellFilterType): CellFilterType | null => {
47
47
  const nextIndex = (index + 1) % chain.length;
48
48
  return chain[nextIndex];
49
49
  };
50
-
51
- export default cellFilterSlice;
@@ -1,17 +1,15 @@
1
1
  import { WordDefinition } from '@scrabble-solver/types';
2
2
 
3
3
  export interface DictionaryState {
4
- error: unknown | undefined;
4
+ error: unknown;
5
5
  input: string;
6
6
  isLoading: boolean;
7
7
  results: WordDefinition[];
8
8
  }
9
9
 
10
- const dictionaryInitialState: DictionaryState = {
10
+ export const dictionaryInitialState: DictionaryState = {
11
11
  error: undefined,
12
12
  input: '',
13
13
  isLoading: false,
14
14
  results: [],
15
15
  };
16
-
17
- export default dictionaryInitialState;
@@ -1,9 +1,9 @@
1
1
  import { createSlice, PayloadAction } from '@reduxjs/toolkit';
2
2
  import { WordDefinition } from '@scrabble-solver/types';
3
3
 
4
- import dictionaryInitialState from './dictionaryInitialState';
4
+ import { dictionaryInitialState } from './dictionaryInitialState';
5
5
 
6
- const dictionarySlice = createSlice({
6
+ export const dictionarySlice = createSlice({
7
7
  initialState: dictionaryInitialState,
8
8
  name: 'dictionary',
9
9
  reducers: {
@@ -32,5 +32,3 @@ const dictionarySlice = createSlice({
32
32
  },
33
33
  },
34
34
  });
35
-
36
- export default dictionarySlice;
@@ -1,16 +1,16 @@
1
- export { default as boardInitialState } from './boardInitialState';
2
- export { default as boardSlice } from './boardSlice';
3
- export { default as cellFilterInitialState } from './cellFilterInitialState';
4
- export { default as cellFilterSlice } from './cellFilterSlice';
5
- export { default as dictionaryInitialState } from './dictionaryInitialState';
6
- export { default as dictionarySlice } from './dictionarySlice';
7
- export { default as rackInitialState } from './rackInitialState';
8
- export { default as rackSlice } from './rackSlice';
9
- export { default as resultsInitialState } from './resultsInitialState';
10
- export { default as resultsSlice } from './resultsSlice';
11
- export { default as settingsInitialState } from './settingsInitialState';
12
- export { default as settingsSlice } from './settingsSlice';
13
- export { default as solveInitialState } from './solveInitialState';
14
- export { default as solveSlice } from './solveSlice';
15
- export { default as verifyInitialState } from './verifyInitialState';
16
- export { default as verifySlice } from './verifySlice';
1
+ export { boardInitialState } from './boardInitialState';
2
+ export { boardSlice } from './boardSlice';
3
+ export { cellFilterInitialState } from './cellFilterInitialState';
4
+ export { cellFilterSlice } from './cellFilterSlice';
5
+ export { dictionaryInitialState } from './dictionaryInitialState';
6
+ export { dictionarySlice } from './dictionarySlice';
7
+ export { rackInitialState } from './rackInitialState';
8
+ export { rackSlice } from './rackSlice';
9
+ export { resultsInitialState } from './resultsInitialState';
10
+ export { resultsSlice } from './resultsSlice';
11
+ export { settingsInitialState } from './settingsInitialState';
12
+ export { settingsSlice } from './settingsSlice';
13
+ export { solveInitialState } from './solveInitialState';
14
+ export { solveSlice } from './solveSlice';
15
+ export { verifyInitialState } from './verifyInitialState';
16
+ export { verifySlice } from './verifySlice';
@@ -1,11 +1,9 @@
1
1
  import { Rack } from 'types';
2
2
 
3
- import localStorage from '../localStorage';
3
+ import { localStorage } from '../localStorage';
4
4
 
5
5
  export type RackState = Rack;
6
6
 
7
7
  export const rackDefaultState: RackState = [null, null, null, null, null, null, null];
8
8
 
9
- const rackInitialState: RackState = localStorage.getRack() || rackDefaultState;
10
-
11
- export default rackInitialState;
9
+ export const rackInitialState: RackState = localStorage.getRack() || rackDefaultState;
@@ -4,9 +4,9 @@ import { Tile } from '@scrabble-solver/types';
4
4
  import { arrayEquals, createNullMovingComparator, inverseDirection, zipCharactersAndTiles } from 'lib';
5
5
  import { AutoGroupTiles, Rack } from 'types';
6
6
 
7
- import rackInitialState, { rackDefaultState } from './rackInitialState';
7
+ import { rackInitialState, rackDefaultState } from './rackInitialState';
8
8
 
9
- const rackSlice = createSlice({
9
+ export const rackSlice = createSlice({
10
10
  initialState: rackInitialState,
11
11
  name: 'rack',
12
12
  reducers: {
@@ -51,5 +51,3 @@ const rackSlice = createSlice({
51
51
  reset: () => rackDefaultState,
52
52
  },
53
53
  });
54
-
55
- export default rackSlice;
@@ -9,7 +9,7 @@ export interface ResultsState {
9
9
  sort: Sort;
10
10
  }
11
11
 
12
- const resultsInitialState: ResultsState = {
12
+ export const resultsInitialState: ResultsState = {
13
13
  candidate: null,
14
14
  query: '',
15
15
  results: undefined,
@@ -18,5 +18,3 @@ const resultsInitialState: ResultsState = {
18
18
  direction: SortDirection.Descending,
19
19
  },
20
20
  };
21
-
22
- export default resultsInitialState;
@@ -3,13 +3,13 @@ import { Result } from '@scrabble-solver/types';
3
3
 
4
4
  import { ResultColumnId, SortDirection } from 'types';
5
5
 
6
- import resultsInitialState from './resultsInitialState';
6
+ import { resultsInitialState } from './resultsInitialState';
7
7
 
8
8
  const toggleDirection = (direction: SortDirection): SortDirection => {
9
9
  return direction === SortDirection.Ascending ? SortDirection.Descending : SortDirection.Ascending;
10
10
  };
11
11
 
12
- const resultsSlice = createSlice({
12
+ export const resultsSlice = createSlice({
13
13
  initialState: resultsInitialState,
14
14
  name: 'results',
15
15
  reducers: {
@@ -53,5 +53,3 @@ const resultsSlice = createSlice({
53
53
  reset: () => resultsInitialState,
54
54
  },
55
55
  });
56
-
57
- export default resultsSlice;
@@ -3,7 +3,7 @@ import { Game, Locale, ShowCoordinates } from '@scrabble-solver/types';
3
3
  import { guessLocale } from 'lib';
4
4
  import { AutoGroupTiles, InputMode } from 'types';
5
5
 
6
- import localStorage from '../localStorage';
6
+ import { localStorage } from '../localStorage';
7
7
 
8
8
  export interface SettingsState {
9
9
  autoGroupTiles: AutoGroupTiles;
@@ -16,12 +16,10 @@ export interface SettingsState {
16
16
  const localStorageAutoGroupTiles = localStorage.getAutoGroupTiles();
17
17
  const isTouchScreen = typeof globalThis.matchMedia !== 'undefined' && globalThis.matchMedia('(hover: none)').matches;
18
18
 
19
- const settingsInitialState: SettingsState = {
19
+ export const settingsInitialState: SettingsState = {
20
20
  autoGroupTiles: typeof localStorageAutoGroupTiles === 'undefined' ? 'left' : localStorageAutoGroupTiles,
21
21
  game: localStorage.getGame() ?? Game.Scrabble,
22
22
  inputMode: localStorage.getInputMode() ?? (isTouchScreen ? 'touchscreen' : 'keyboard'),
23
23
  locale: localStorage.getLocale() ?? guessLocale(),
24
24
  showCoordinates: localStorage.getShowCoordinates() ?? 'hidden',
25
25
  };
26
-
27
- export default settingsInitialState;
@@ -3,9 +3,9 @@ import { Game, Locale, ShowCoordinates } from '@scrabble-solver/types';
3
3
 
4
4
  import { AutoGroupTiles, InputMode } from 'types';
5
5
 
6
- import settingsInitialState from './settingsInitialState';
6
+ import { settingsInitialState } from './settingsInitialState';
7
7
 
8
- const settingsSlice = createSlice({
8
+ export const settingsSlice = createSlice({
9
9
  initialState: settingsInitialState,
10
10
  name: 'settings',
11
11
  reducers: {
@@ -39,5 +39,3 @@ const settingsSlice = createSlice({
39
39
  },
40
40
  },
41
41
  });
42
-
43
- export default settingsSlice;
@@ -1,9 +1,9 @@
1
1
  import { Board } from '@scrabble-solver/types';
2
2
 
3
- import boardInitialState from './boardInitialState';
3
+ import { boardInitialState } from './boardInitialState';
4
4
 
5
5
  export interface SolveState {
6
- error: unknown | undefined;
6
+ error: unknown;
7
7
  isLoading: boolean;
8
8
  lastSolvedParameters: {
9
9
  board: Board;
@@ -11,7 +11,7 @@ export interface SolveState {
11
11
  };
12
12
  }
13
13
 
14
- const solveInitialState: SolveState = {
14
+ export const solveInitialState: SolveState = {
15
15
  error: undefined,
16
16
  isLoading: false,
17
17
  lastSolvedParameters: {
@@ -19,5 +19,3 @@ const solveInitialState: SolveState = {
19
19
  characters: [],
20
20
  },
21
21
  };
22
-
23
- export default solveInitialState;
@@ -1,14 +1,14 @@
1
1
  import { createSlice, PayloadAction } from '@reduxjs/toolkit';
2
2
  import { Board } from '@scrabble-solver/types';
3
3
 
4
- import solveInitialState from './solveInitialState';
4
+ import { solveInitialState } from './solveInitialState';
5
5
 
6
6
  interface SolveParameters {
7
7
  board: Board;
8
8
  characters: string[];
9
9
  }
10
10
 
11
- const solveSlice = createSlice({
11
+ export const solveSlice = createSlice({
12
12
  initialState: solveInitialState,
13
13
  name: 'solve',
14
14
  reducers: {
@@ -31,5 +31,3 @@ const solveSlice = createSlice({
31
31
  },
32
32
  },
33
33
  });
34
-
35
- export default solveSlice;
@@ -1,4 +1,4 @@
1
- import boardInitialState, { BoardState } from './boardInitialState';
1
+ import { boardInitialState, BoardState } from './boardInitialState';
2
2
 
3
3
  export interface VerifyState {
4
4
  isLoading: boolean;
@@ -9,7 +9,7 @@ export interface VerifyState {
9
9
  validWords: string[];
10
10
  }
11
11
 
12
- const verifyInitialState: VerifyState = {
12
+ export const verifyInitialState: VerifyState = {
13
13
  isLoading: false,
14
14
  lastSolvedParameters: {
15
15
  board: boardInitialState,
@@ -17,5 +17,3 @@ const verifyInitialState: VerifyState = {
17
17
  invalidWords: [],
18
18
  validWords: [],
19
19
  };
20
-
21
- export default verifyInitialState;
@@ -1,7 +1,7 @@
1
1
  import { createSlice, PayloadAction } from '@reduxjs/toolkit';
2
2
  import { Board } from '@scrabble-solver/types';
3
3
 
4
- import verifyInitialState from './verifyInitialState';
4
+ import { verifyInitialState } from './verifyInitialState';
5
5
 
6
6
  interface VerifyParameters {
7
7
  board: Board;
@@ -9,7 +9,7 @@ interface VerifyParameters {
9
9
  validWords: string[];
10
10
  }
11
11
 
12
- const verifySlice = createSlice({
12
+ export const verifySlice = createSlice({
13
13
  initialState: verifyInitialState,
14
14
  name: 'verify',
15
15
  reducers: {
@@ -27,5 +27,3 @@ const verifySlice = createSlice({
27
27
  },
28
28
  },
29
29
  });
30
-
31
- export default verifySlice;
@@ -15,7 +15,7 @@ import {
15
15
 
16
16
  const sagaMiddleware = reduxSaga();
17
17
 
18
- const store = configureStore({
18
+ export const store = configureStore({
19
19
  reducer: {
20
20
  board: boardSlice.reducer,
21
21
  cellFilter: cellFilterSlice.reducer,
@@ -30,5 +30,3 @@ const store = configureStore({
30
30
  });
31
31
 
32
32
  sagaMiddleware.run(rootSaga);
33
-
34
- export default store;
@@ -3,9 +3,9 @@ import { useCallback } from 'react';
3
3
  import { Translate } from 'types';
4
4
 
5
5
  import { selectLocale, selectTranslations } from './selectors';
6
- import useTypedSelector from './useTypedSelector';
6
+ import { useTypedSelector } from './useTypedSelector';
7
7
 
8
- const useTranslate = (): Translate => {
8
+ export const useTranslate = (): Translate => {
9
9
  const translations = useTypedSelector(selectTranslations);
10
10
  const locale = useTypedSelector(selectLocale);
11
11
  const translate: Translate = useCallback(
@@ -30,5 +30,3 @@ const useTranslate = (): Translate => {
30
30
 
31
31
  return translate;
32
32
  };
33
-
34
- export default useTranslate;
@@ -2,6 +2,4 @@ import { TypedUseSelectorHook, useSelector } from 'react-redux';
2
2
 
3
3
  import { RootState } from './types';
4
4
 
5
- const useTypedSelector: TypedUseSelectorHook<RootState> = useSelector;
6
-
7
- export default useTypedSelector;
5
+ export const useTypedSelector: TypedUseSelectorHook<RootState> = useSelector;
@@ -0,0 +1,15 @@
1
+ import { BoardJson, ConfigJson, Game, Locale } from '@scrabble-solver/types';
2
+
3
+ export interface SolveRequestPayload {
4
+ board: BoardJson;
5
+ characters: string[];
6
+ config: ConfigJson;
7
+ game: Game;
8
+ locale: Locale;
9
+ }
10
+
11
+ export interface VerifyRequestPayload {
12
+ board: BoardJson;
13
+ game: Game;
14
+ locale: Locale;
15
+ }
@@ -153,3 +153,5 @@ export type TranslationKey =
153
153
  export type Translate = (key: TranslationKey, replacements?: Record<string, string>) => string;
154
154
 
155
155
  export type Translations = Record<TranslationKey, string>;
156
+
157
+ export * from './api';
package/tsconfig.json CHANGED
@@ -31,7 +31,7 @@
31
31
  "typeRoots": ["./node_modules/@types", "./src/@types"],
32
32
  "incremental": true
33
33
  },
34
- "exclude": ["node_modules"],
34
+ "exclude": [ "node_modules", "**/*.test.ts"],
35
35
  "files": ["./src/@types/scss.d.ts", "./src/@types/svg.d.ts"],
36
36
  "include": ["next-env.d.ts", "./src"]
37
37
  }