@scrabble-solver/scrabble-solver 2.13.8 → 2.13.9

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 (59) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +6 -6
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/eslint/.cache_8dgz12 +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/edge-server-production/0.pack +0 -0
  8. package/.next/cache/webpack/edge-server-production/index.pack +0 -0
  9. package/.next/cache/webpack/server-production/0.pack +0 -0
  10. package/.next/cache/webpack/server-production/index.pack +0 -0
  11. package/.next/prerender-manifest.js +1 -1
  12. package/.next/prerender-manifest.json +1 -1
  13. package/.next/routes-manifest.json +1 -1
  14. package/.next/server/chunks/807.js +1 -1
  15. package/.next/server/middleware-build-manifest.js +1 -1
  16. package/.next/server/pages/404.html +1 -1
  17. package/.next/server/pages/500.html +1 -1
  18. package/.next/server/pages/index.html +1 -1
  19. package/.next/server/pages/index.js +1 -1
  20. package/.next/server/pages/index.json +1 -1
  21. package/.next/static/chunks/pages/{404-63b972b24be99c62.js → 404-01653a877b233143.js} +1 -1
  22. package/.next/static/chunks/pages/_app-735b5863675c1b5d.js +17 -0
  23. package/.next/static/chunks/pages/{index-7b73be2915cc7099.js → index-36c448d585a58425.js} +1 -1
  24. package/.next/static/css/841a5b5f0b2fb131.css +2 -0
  25. package/.next/static/{7zESQYo9UAqNh9LV0b7Sd → eLvYNd4B2hzSgBZ_PuZcQ}/_buildManifest.js +1 -1
  26. package/.next/trace +44 -44
  27. package/LICENSE +1 -1
  28. package/package.json +9 -9
  29. package/src/components/Board/Board.tsx +3 -3
  30. package/src/components/Board/BoardPure.tsx +27 -19
  31. package/src/components/Board/components/Actions/Actions.tsx +8 -12
  32. package/src/components/Board/components/Actions/lib.ts +30 -0
  33. package/src/components/Board/hooks/useBackgroundImage.tsx +3 -24
  34. package/src/components/Radio/Radio.module.scss +2 -1
  35. package/src/components/Tile/Tile.module.scss +0 -2
  36. package/src/components/Tile/Tile.tsx +1 -15
  37. package/src/components/Tooltip/Tooltip.module.scss +1 -0
  38. package/src/hooks/useAppLayout.ts +0 -1
  39. package/src/i18n/languages/english.json +2 -1
  40. package/src/i18n/languages/french.json +2 -1
  41. package/src/i18n/languages/german.json +2 -1
  42. package/src/i18n/languages/persian.json +2 -1
  43. package/src/i18n/languages/polish.json +2 -1
  44. package/src/i18n/languages/romanian.json +2 -1
  45. package/src/i18n/languages/spanish.json +2 -1
  46. package/src/icons/Ban.svg +4 -0
  47. package/src/icons/index.ts +1 -0
  48. package/src/lib/groupResults.ts +4 -7
  49. package/src/lib/index.ts +1 -0
  50. package/src/lib/resultMatchesCellFilter.ts +23 -0
  51. package/src/parameters/index.ts +0 -9
  52. package/src/state/sagas.ts +4 -4
  53. package/src/state/selectors.ts +5 -8
  54. package/src/state/slices/cellFilterInitialState.ts +2 -2
  55. package/src/state/slices/cellFilterSlice.ts +29 -4
  56. package/src/types/index.ts +10 -1
  57. package/.next/static/chunks/pages/_app-a2848b7efa6bb6b0.js +0 -17
  58. package/.next/static/css/b37850c8d5270d91.css +0 -2
  59. /package/.next/static/{7zESQYo9UAqNh9LV0b7Sd → eLvYNd4B2hzSgBZ_PuZcQ}/_ssgManifest.js +0 -0
@@ -1,6 +1,6 @@
1
1
  import { createSlice, PayloadAction } from '@reduxjs/toolkit';
2
2
 
3
- import { Point } from 'types';
3
+ import { CellFilterType, Point } from 'types';
4
4
 
5
5
  import cellFilterInitialState from './cellFilterInitialState';
6
6
 
@@ -10,17 +10,42 @@ const cellFilterSlice = createSlice({
10
10
  reducers: {
11
11
  toggle: (state, action: PayloadAction<Point>) => {
12
12
  const { x, y } = action.payload;
13
- const has = state.some((point) => point.x === x && point.y === y);
13
+ const currentEntry = state.find((point) => point.x === x && point.y === y);
14
+ const has = Boolean(currentEntry);
15
+ const nextType = currentEntry ? toggleCellFilterState(currentEntry.type) : 'include';
14
16
 
15
- if (has) {
17
+ if (nextType === null) {
16
18
  return state.filter((point) => point.x !== x || point.y !== y);
17
19
  }
18
20
 
19
- return [...state, action.payload];
21
+ if (!has) {
22
+ return [...state, { ...action.payload, type: nextType }];
23
+ }
24
+
25
+ return state.map((entry) => {
26
+ if (entry.x === x && entry.y === y) {
27
+ return { ...entry, type: nextType };
28
+ }
29
+
30
+ return entry;
31
+ });
32
+ },
33
+
34
+ cancel: (state, action: PayloadAction<Point>) => {
35
+ const { x, y } = action.payload;
36
+
37
+ return state.filter((point) => point.x !== x || point.y !== y);
20
38
  },
21
39
 
22
40
  reset: () => cellFilterInitialState,
23
41
  },
24
42
  });
25
43
 
44
+ const toggleCellFilterState = (type: CellFilterType): CellFilterType | null => {
45
+ const chain: (CellFilterType | null)[] = ['include', 'exclude', null];
46
+ const index = chain.indexOf(type);
47
+ const nextIndex = (index + 1) % chain.length;
48
+ return chain[nextIndex];
49
+ };
50
+
26
51
  export default cellFilterSlice;
@@ -2,6 +2,14 @@ export type Comparator<T> = (a: T, B: T) => number;
2
2
 
3
3
  export type AutoGroupTiles = 'left' | 'right' | null;
4
4
 
5
+ export type CellFilterType = 'include' | 'exclude';
6
+
7
+ export type CellFilterEntry = {
8
+ x: Point['x'];
9
+ y: Point['y'];
10
+ type: CellFilterType;
11
+ };
12
+
5
13
  export type Direction = 'horizontal' | 'vertical';
6
14
 
7
15
  export type InputMode = 'keyboard' | 'touchscreen';
@@ -49,7 +57,8 @@ export enum ResultColumn {
49
57
  }
50
58
  export type TranslationKey =
51
59
  | 'cell.enter-word'
52
- | 'cell.filter-cell'
60
+ | 'cell.filter-cell.exclude'
61
+ | 'cell.filter-cell.include'
53
62
  | 'cell.set-blank'
54
63
  | 'cell.set-not-blank'
55
64
  | 'cell.toggle-direction'