@scrabble-solver/scrabble-solver 2.13.11 → 2.13.13

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 (96) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +14 -14
  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/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/prerender-manifest.js +1 -1
  15. package/.next/prerender-manifest.json +1 -1
  16. package/.next/routes-manifest.json +1 -1
  17. package/.next/server/chunks/807.js +1 -1
  18. package/.next/server/middleware-build-manifest.js +1 -1
  19. package/.next/server/pages/404.html +1 -1
  20. package/.next/server/pages/500.html +1 -1
  21. package/.next/server/pages/api/solve.js +1 -1
  22. package/.next/server/pages/index.html +1 -1
  23. package/.next/server/pages/index.js +1 -1
  24. package/.next/server/pages/index.json +1 -1
  25. package/.next/server/pages-manifest.json +1 -1
  26. package/.next/static/chunks/{main-b5b360c6afb66b05.js → main-8b0b4e610892a916.js} +1 -1
  27. package/.next/static/chunks/pages/{404-0c9f3e0f8b15f487.js → 404-b0c2ccded2455be0.js} +1 -1
  28. package/.next/static/chunks/pages/_app-42ce6b4032e931ff.js +17 -0
  29. package/.next/static/chunks/pages/index-3718075f2ba2220c.js +1 -0
  30. package/.next/static/chunks/webpack-c4acd79e87956a0e.js +1 -0
  31. package/.next/static/css/2adc9736d823979b.css +2 -0
  32. package/.next/static/{5T-kyZzpLLGYA9Qzg0-Sn → qwJjm2FeDHHGY92CY5oQQ}/_buildManifest.js +1 -1
  33. package/.next/trace +45 -45
  34. package/package.json +13 -13
  35. package/src/components/Board/Board.module.scss +3 -9
  36. package/src/components/Board/Board.tsx +2 -2
  37. package/src/components/Board/BoardPure.tsx +3 -2
  38. package/src/components/Board/components/ToggleDirectionButton/ToggleDirectionButton.tsx +4 -2
  39. package/src/components/Board/hooks/useBackgroundImage.tsx +2 -6
  40. package/src/components/Board/hooks/useBoardStyle.ts +10 -4
  41. package/src/components/Dictionary/Dictionary.module.scss +10 -7
  42. package/src/components/Dictionary/Dictionary.tsx +38 -36
  43. package/src/components/Loading/Loading.module.scss +1 -0
  44. package/src/components/Loading/Loading.tsx +1 -1
  45. package/src/components/Modal/components/Section/Section.tsx +3 -2
  46. package/src/components/NavButtons/NavButtons.tsx +1 -0
  47. package/src/components/Rack/Rack.tsx +1 -0
  48. package/src/components/Results/Cell.tsx +7 -3
  49. package/src/components/Results/Header.tsx +99 -0
  50. package/src/components/Results/HeaderButton.tsx +18 -13
  51. package/src/components/Results/Result.tsx +23 -16
  52. package/src/components/Results/Results.module.scss +24 -12
  53. package/src/components/Results/Results.tsx +3 -9
  54. package/src/components/Results/types.ts +0 -8
  55. package/src/components/Solver/Solver.tsx +1 -1
  56. package/src/components/Tile/TilePure.tsx +1 -0
  57. package/src/hooks/index.ts +1 -0
  58. package/src/hooks/useAppLayout.ts +12 -1
  59. package/src/hooks/useColumns.ts +47 -0
  60. package/src/i18n/languages/english.json +1 -0
  61. package/src/i18n/languages/french.json +1 -0
  62. package/src/i18n/languages/german.json +1 -0
  63. package/src/i18n/languages/persian.json +1 -0
  64. package/src/i18n/languages/polish.json +1 -0
  65. package/src/i18n/languages/romanian.json +1 -0
  66. package/src/i18n/languages/spanish.json +1 -0
  67. package/src/icons/GeoAlt.svg +5 -0
  68. package/src/icons/OneTwoThree.svg +4 -0
  69. package/src/icons/SquareA.svg +6 -0
  70. package/src/icons/SquareB.svg +6 -0
  71. package/src/icons/Squares.svg +34 -0
  72. package/src/icons/Words.svg +22 -0
  73. package/src/icons/index.ts +6 -0
  74. package/src/lib/groupResults.ts +1 -1
  75. package/src/lib/index.ts +0 -1
  76. package/src/lib/sortResults.ts +10 -10
  77. package/src/modals/KeyMapModal/KeyMapModal.tsx +8 -9
  78. package/src/modals/RemainingTilesModal/RemainingTilesModal.tsx +1 -0
  79. package/src/modals/SettingsModal/SettingsModal.tsx +5 -5
  80. package/src/modals/WordsModal/WordsModal.tsx +2 -0
  81. package/src/parameters/index.ts +12 -0
  82. package/src/state/selectors.ts +26 -1
  83. package/src/state/slices/resultsInitialState.ts +2 -2
  84. package/src/state/slices/resultsSlice.ts +2 -2
  85. package/src/state/useTranslate.ts +5 -1
  86. package/src/styles/variables.scss +1 -0
  87. package/src/types/index.ts +12 -2
  88. package/.next/static/chunks/pages/_app-264cd7dc7c7b5cc2.js +0 -17
  89. package/.next/static/chunks/pages/index-65bfe83d121535ab.js +0 -1
  90. package/.next/static/chunks/webpack-6ef43a8d4a395f49.js +0 -1
  91. package/.next/static/css/2f727b21d1331ea5.css +0 -2
  92. package/src/components/Results/getCoordinatesColumn.ts +0 -14
  93. package/src/components/Results/getLocaleColumns.ts +0 -58
  94. package/src/components/Results/useColumns.ts +0 -44
  95. package/src/lib/dataUrlToBlob.ts +0 -20
  96. /package/.next/static/{5T-kyZzpLLGYA9Qzg0-Sn → qwJjm2FeDHHGY92CY5oQQ}/_ssgManifest.js +0 -0
@@ -17,7 +17,7 @@ const KeyMapModal: FunctionComponent<Props> = ({ className, isOpen, onClose }) =
17
17
 
18
18
  return (
19
19
  <Modal className={className} isOpen={isOpen} title={translate('keyMap')} onClose={onClose}>
20
- <Modal.Section title={translate('keyMap.board-and-rack')}>
20
+ <Modal.Section label={translate('keyMap.board-and-rack')} title={translate('keyMap.board-and-rack')}>
21
21
  <Mapping description={translate('keyMap.board-and-rack.navigate')} mapping={[<Arrows key="arrows" />]} />
22
22
 
23
23
  <Mapping
@@ -27,11 +27,6 @@ const KeyMapModal: FunctionComponent<Props> = ({ className, isOpen, onClose }) =
27
27
 
28
28
  <Mapping description={translate('keyMap.board-and-rack.submit')} mapping={[<Enter key="del" />]} />
29
29
 
30
- <Mapping
31
- description={translate('keyMap.board.toggle-cell-filter')}
32
- mapping={[[<Ctrl key="ctrl" />, <Key key="g">G</Key>]]}
33
- />
34
-
35
30
  {config.twoCharacterTiles.length > 0 && (
36
31
  <Mapping
37
32
  description={translate('keyMap.board-and-rack.insert-two-letter-tile')}
@@ -49,12 +44,16 @@ const KeyMapModal: FunctionComponent<Props> = ({ className, isOpen, onClose }) =
49
44
  )}
50
45
  </Modal.Section>
51
46
 
52
- <Modal.Section title={translate('keyMap.board')}>
53
- <Mapping description={translate('keyMap.board.toggle-blank')} mapping={[<Space key="space" />]} />
47
+ <Modal.Section label={translate('keyMap.board')} title={translate('keyMap.board')}>
54
48
  <Mapping description={translate('keyMap.board.toggle-direction')} mapping={[<Arrows key="arrows" />]} />
49
+ <Mapping description={translate('keyMap.board.toggle-blank')} mapping={[<Space key="space" />]} />
50
+ <Mapping
51
+ description={translate('keyMap.board.toggle-cell-filter')}
52
+ mapping={[[<Ctrl key="ctrl" />, <Key key="g">G</Key>]]}
53
+ />
55
54
  </Modal.Section>
56
55
 
57
- <Modal.Section title={translate('keyMap.rack')}>
56
+ <Modal.Section label={translate('keyMap.rack')} title={translate('keyMap.rack')}>
58
57
  <Mapping description={translate('keyMap.rack.insert-blank')} mapping={[<Space key="space" />]} />
59
58
  </Modal.Section>
60
59
  </Modal>
@@ -31,6 +31,7 @@ const RemainingTilesModal: FunctionComponent<Props> = ({ className, isOpen, onCl
31
31
  return (
32
32
  <Modal.Section
33
33
  key={translationKey}
34
+ label={translate(translationKey)}
34
35
  title={
35
36
  <span className={styles.title}>
36
37
  <span>{translate(translationKey)}</span>
@@ -24,25 +24,25 @@ const SettingsModal: FunctionComponent<Props> = ({ className, isOpen, onClose })
24
24
 
25
25
  return (
26
26
  <Modal className={className} isOpen={isOpen} title={translate('settings')} onClose={onClose}>
27
- <Modal.Section title={translate('settings.game')}>
27
+ <Modal.Section label={translate('settings.game')} title={translate('settings.game')}>
28
28
  <ConfigSetting disabled={!isOpen} />
29
29
  </Modal.Section>
30
30
 
31
- <Modal.Section title={translate('settings.language')}>
31
+ <Modal.Section label={translate('settings.language')} title={translate('settings.language')}>
32
32
  <LocaleSetting disabled={!isOpen} />
33
33
  </Modal.Section>
34
34
 
35
- <Modal.Section title={translate('settings.showCoordinates')}>
35
+ <Modal.Section label={translate('settings.showCoordinates')} title={translate('settings.showCoordinates')}>
36
36
  <ShowCoordinatesSetting disabled={!isOpen} />
37
37
  </Modal.Section>
38
38
 
39
39
  {!isTouchDevice && (
40
- <Modal.Section title={translate('settings.inputMode')}>
40
+ <Modal.Section label={translate('settings.inputMode')} title={translate('settings.inputMode')}>
41
41
  <InputModeSetting disabled={!isOpen} />
42
42
  </Modal.Section>
43
43
  )}
44
44
 
45
- <Modal.Section title={translate('settings.autoGroupTiles')}>
45
+ <Modal.Section label={translate('settings.autoGroupTiles')} title={translate('settings.autoGroupTiles')}>
46
46
  <AutoGroupTilesSetting disabled={!isOpen} />
47
47
  </Modal.Section>
48
48
  </Modal>
@@ -21,6 +21,7 @@ const WordsModal: FunctionComponent<Props> = ({ className, isOpen, onClose }) =>
21
21
  return (
22
22
  <Modal className={className} isOpen={isOpen} title={translate('words')} onClose={onClose}>
23
23
  <Modal.Section
24
+ label={translate('words.invalid')}
24
25
  title={
25
26
  <span className={styles.title}>
26
27
  <span>{translate('words.invalid')}</span>
@@ -36,6 +37,7 @@ const WordsModal: FunctionComponent<Props> = ({ className, isOpen, onClose }) =>
36
37
  </Modal.Section>
37
38
 
38
39
  <Modal.Section
40
+ label={translate('words.valid')}
39
41
  title={
40
42
  <span className={styles.title}>
41
43
  <span>{translate('words.valid')}</span>
@@ -1,3 +1,5 @@
1
+ import { ResultColumnId } from 'types';
2
+
1
3
  export const BREAKPOINTS = {
2
4
  xs: 480,
3
5
  s: 768,
@@ -120,6 +122,16 @@ export const RACK_TILE_SIZE_MAX = 80;
120
122
 
121
123
  export const REMAINING_TILES_TILE_SIZE = 50;
122
124
 
125
+ export const RESULTS_COLUMN_WIDTH: Record<ResultColumnId, number | undefined> = {
126
+ [ResultColumnId.BlanksCount]: 55,
127
+ [ResultColumnId.ConsonantsCount]: 55,
128
+ [ResultColumnId.Coordinates]: 55,
129
+ [ResultColumnId.Points]: 80,
130
+ [ResultColumnId.TilesCount]: 55,
131
+ [ResultColumnId.VowelsCount]: 55,
132
+ [ResultColumnId.Word]: undefined,
133
+ [ResultColumnId.WordsCount]: 55,
134
+ };
123
135
  export const RESULTS_ITEM_HEIGHT = 40;
124
136
 
125
137
  export const RESULTS_HEADER_HEIGHT = RESULTS_ITEM_HEIGHT;
@@ -16,7 +16,7 @@ import {
16
16
  sortGroupedResults,
17
17
  unorderedArraysEqual,
18
18
  } from 'lib';
19
- import { Point, Translations } from 'types';
19
+ import { Point, ResultColumnId, Translations } from 'types';
20
20
 
21
21
  import { RootState } from './types';
22
22
 
@@ -231,3 +231,28 @@ export const selectVerify = selectVerifyRoot;
231
231
  export const selectHasInvalidWords = createSelector([selectVerify], ({ invalidWords }) => {
232
232
  return invalidWords.length > 0;
233
233
  });
234
+
235
+ export const selectColumns = createSelector([selectLocale, selectShowCoordinates], (locale, showCoordinates) => {
236
+ const { consonants, vowels } = LOCALE_FEATURES[locale];
237
+ const columns: ResultColumnId[] = [
238
+ ResultColumnId.Word,
239
+ ResultColumnId.TilesCount,
240
+ ResultColumnId.BlanksCount,
241
+ ResultColumnId.WordsCount,
242
+ ResultColumnId.Points,
243
+ ];
244
+
245
+ if (showCoordinates !== 'hidden') {
246
+ columns.push(ResultColumnId.Coordinates);
247
+ }
248
+
249
+ if (vowels) {
250
+ columns.push(ResultColumnId.VowelsCount);
251
+ }
252
+
253
+ if (consonants) {
254
+ columns.push(ResultColumnId.ConsonantsCount);
255
+ }
256
+
257
+ return columns;
258
+ });
@@ -1,6 +1,6 @@
1
1
  import { Result } from '@scrabble-solver/types';
2
2
 
3
- import { ResultColumn, Sort, SortDirection } from 'types';
3
+ import { ResultColumnId, Sort, SortDirection } from 'types';
4
4
 
5
5
  export interface ResultsState {
6
6
  candidate: Result | null;
@@ -14,7 +14,7 @@ const resultsInitialState: ResultsState = {
14
14
  query: '',
15
15
  results: undefined,
16
16
  sort: {
17
- column: ResultColumn.Points,
17
+ column: ResultColumnId.Points,
18
18
  direction: SortDirection.Descending,
19
19
  },
20
20
  };
@@ -1,7 +1,7 @@
1
1
  import { createSlice, PayloadAction } from '@reduxjs/toolkit';
2
2
  import { Result } from '@scrabble-solver/types';
3
3
 
4
- import { ResultColumn, SortDirection } from 'types';
4
+ import { ResultColumnId, SortDirection } from 'types';
5
5
 
6
6
  import resultsInitialState from './resultsInitialState';
7
7
 
@@ -37,7 +37,7 @@ const resultsSlice = createSlice({
37
37
  };
38
38
  },
39
39
 
40
- sort: (state, action: PayloadAction<ResultColumn>) => {
40
+ sort: (state, action: PayloadAction<ResultColumnId>) => {
41
41
  const columndId = action.payload;
42
42
  const { column, direction } = state.sort;
43
43
 
@@ -9,13 +9,17 @@ const useTranslate = (): Translate => {
9
9
  const translations = useTypedSelector(selectTranslations);
10
10
  const locale = useTypedSelector(selectLocale);
11
11
  const translate: Translate = useCallback(
12
- (id, replacements = {}) => {
12
+ (id, replacements) => {
13
13
  const translation = translations[id];
14
14
 
15
15
  if (typeof translation === 'undefined') {
16
16
  throw new Error(`Untranslated key "${id}" in locale "${locale}"`);
17
17
  }
18
18
 
19
+ if (!replacements) {
20
+ return translation;
21
+ }
22
+
19
23
  return Object.entries(replacements).reduce(
20
24
  (result, [key, value]) => result.replaceAll(`{{${key}}}`, value),
21
25
  translation,
@@ -106,6 +106,7 @@ $easeOutSine: cubic-bezier(0.61, 1, 0.88, 1);
106
106
  --modal--width: 370px;
107
107
  --nav--height: calc(var(--logo--height) + var(--nav--padding));
108
108
  --nav--padding: var(--spacing--l);
109
+ --results--icon--size: 18px;
109
110
  --results--item--height: 40px;
110
111
  --solver-column--width: 580px;
111
112
  --square-button--size: 32px;
@@ -1,4 +1,5 @@
1
1
  import { Result } from '@scrabble-solver/types';
2
+ import { FunctionComponent, SVGAttributes } from 'react';
2
3
 
3
4
  export type Comparator<T> = (a: T, B: T) => number;
4
5
 
@@ -24,7 +25,7 @@ export interface Point {
24
25
  export type Rack = (string | null)[];
25
26
 
26
27
  export interface Sort {
27
- column: ResultColumn;
28
+ column: ResultColumnId;
28
29
  direction: SortDirection;
29
30
  }
30
31
 
@@ -47,7 +48,7 @@ export interface RemainingTilesGroup {
47
48
  totalCount: number;
48
49
  }
49
50
 
50
- export enum ResultColumn {
51
+ export enum ResultColumnId {
51
52
  BlanksCount = 'blanks-count',
52
53
  ConsonantsCount = 'consonants-count',
53
54
  Coordinates = 'coordinates',
@@ -58,6 +59,14 @@ export enum ResultColumn {
58
59
  WordsCount = 'words-count',
59
60
  }
60
61
 
62
+ export interface ResultColumn {
63
+ className: string;
64
+ Icon?: FunctionComponent<SVGAttributes<SVGElement>>;
65
+ id: ResultColumnId;
66
+ translationKey: TranslationKey;
67
+ width?: number;
68
+ }
69
+
61
70
  export interface GroupedResults {
62
71
  matching: Result[];
63
72
  other: Result[];
@@ -70,6 +79,7 @@ export type TranslationKey =
70
79
  | 'cell.set-blank'
71
80
  | 'cell.set-not-blank'
72
81
  | 'cell.tile.location'
82
+ | 'cell.toggle-direction'
73
83
  | 'common.arrows'
74
84
  | 'common.clear'
75
85
  | 'common.close'