@scrabble-solver/scrabble-solver 2.10.6 → 2.10.8

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 (137) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +7 -13
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/eslint/.cache_8dgz12 +1 -1
  5. package/.next/cache/next-server.js.nft.json +1 -1
  6. package/.next/cache/webpack/client-production/0.pack +0 -0
  7. package/.next/cache/webpack/client-production/index.pack +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/server-production/0.pack +0 -0
  11. package/.next/cache/webpack/server-production/index.pack +0 -0
  12. package/.next/next-server.js.nft.json +1 -1
  13. package/.next/prerender-manifest.json +1 -1
  14. package/.next/routes-manifest.json +1 -1
  15. package/.next/server/chunks/176.js +4597 -568
  16. package/.next/server/chunks/290.js +3 -1
  17. package/.next/server/middleware-build-manifest.js +1 -1
  18. package/.next/server/pages/404.html +2 -2
  19. package/.next/server/pages/404.js.nft.json +1 -1
  20. package/.next/server/pages/500.html +2 -2
  21. package/.next/server/pages/_app.js +296 -13
  22. package/.next/server/pages/_app.js.nft.json +1 -1
  23. package/.next/server/pages/_document.js.nft.json +1 -1
  24. package/.next/server/pages/api/dictionary/[locale]/[word].js +18 -16
  25. package/.next/server/pages/api/solve.js +17 -0
  26. package/.next/server/pages/index.html +1 -9
  27. package/.next/server/pages/index.js +26 -12
  28. package/.next/server/pages/index.js.nft.json +1 -1
  29. package/.next/server/pages/index.json +1 -1
  30. package/.next/server/pages-manifest.json +2 -2
  31. package/.next/static/Cs23uxWG6AxS72F2yrjHu/_buildManifest.js +1 -0
  32. package/.next/static/chunks/pages/{404-ff35a4cf7f1ec85a.js → 404-8cab6d62fe4ead73.js} +1 -1
  33. package/.next/static/chunks/pages/_app-dcbbb823dc93a031.js +28 -0
  34. package/.next/static/chunks/pages/index-df1ff01aa82d2d4d.js +1 -0
  35. package/.next/static/css/bf2e969b88c4e3dd.css +2 -0
  36. package/.next/static/css/d1cc6b79b211b7b8.css +1 -0
  37. package/.next/trace +55 -55
  38. package/package.json +10 -9
  39. package/src/components/Badge/Badge.module.scss +1 -1
  40. package/src/components/Board/components/Cell/Cell.module.scss +32 -64
  41. package/src/components/Board/components/Cell/Cell.tsx +6 -0
  42. package/src/components/Board/components/Cell/CellPure.tsx +24 -22
  43. package/src/components/Button/Button.module.scss +2 -2
  44. package/src/components/Button/Button.tsx +1 -0
  45. package/src/components/Button/Link.tsx +1 -0
  46. package/src/components/Checkbox/Checkbox.tsx +1 -4
  47. package/src/components/Dictionary/Dictionary.tsx +28 -30
  48. package/src/components/DictionaryInput/DictionaryInput.tsx +3 -0
  49. package/src/components/{SquareButton/SquareButton.module.scss → IconButton/IconButton.module.scss} +1 -1
  50. package/src/components/{SquareButton/SquareButton.tsx → IconButton/IconButton.tsx} +7 -6
  51. package/src/components/{SquareButton → IconButton}/Link.tsx +3 -2
  52. package/src/components/IconButton/index.ts +1 -0
  53. package/src/components/Key/Key.module.scss +1 -1
  54. package/src/components/Logo/Logo.svg +44 -15
  55. package/src/components/LogoSplashScreen/LogoSplashScreen.module.scss +1 -1
  56. package/src/components/Modal/Modal.module.scss +4 -2
  57. package/src/components/Modal/Modal.tsx +3 -2
  58. package/src/components/NavButtons/NavButtons.tsx +37 -9
  59. package/src/components/Rack/Rack.module.scss +4 -0
  60. package/src/components/Rack/RackTile.tsx +5 -0
  61. package/src/components/Radio/Radio.tsx +1 -4
  62. package/src/components/Results/HeaderButton.tsx +1 -0
  63. package/src/components/Results/Result.tsx +1 -0
  64. package/src/components/Results/Results.module.scss +2 -3
  65. package/src/components/Results/SolveButton.tsx +1 -0
  66. package/src/components/SeoMessage/SeoMessage.tsx +19 -0
  67. package/src/components/SeoMessage/index.ts +1 -0
  68. package/src/components/Solver/Solver.module.scss +4 -0
  69. package/src/components/Solver/Solver.tsx +26 -8
  70. package/src/components/Solver/components/EmptyState/EmptyState.module.scss +1 -3
  71. package/src/components/Solver/components/InsertButton/InsertButton.module.scss +15 -0
  72. package/src/components/Solver/components/{ApplyButton/ApplyButton.tsx → InsertButton/InsertButton.tsx} +10 -6
  73. package/src/components/Solver/components/InsertButton/index.ts +1 -0
  74. package/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.module.scss +37 -7
  75. package/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.tsx +41 -17
  76. package/src/components/Solver/components/SolveButton/SolveButton.tsx +11 -1
  77. package/src/components/Solver/components/index.ts +1 -2
  78. package/src/components/Tile/Tile.module.scss +49 -11
  79. package/src/components/Tile/Tile.tsx +26 -8
  80. package/src/components/Tile/TilePure.tsx +29 -19
  81. package/src/components/Tooltip/Tooltip.module.scss +7 -7
  82. package/src/components/Tooltip/useTooltip.tsx +14 -2
  83. package/src/components/index.ts +2 -1
  84. package/src/i18n/de.json +6 -0
  85. package/src/i18n/en.json +6 -0
  86. package/src/i18n/es.json +6 -0
  87. package/src/i18n/fa.json +6 -0
  88. package/src/i18n/fr.json +6 -0
  89. package/src/i18n/pl.json +6 -0
  90. package/src/icons/ArrowDown.svg +1 -1
  91. package/src/icons/ArrowLeft.svg +1 -1
  92. package/src/icons/ArrowRight.svg +1 -1
  93. package/src/icons/ArrowUp.svg +1 -1
  94. package/src/icons/ChevronDown.svg +1 -1
  95. package/src/icons/ChevronLeft.svg +1 -1
  96. package/src/icons/ChevronRight.svg +1 -1
  97. package/src/icons/Flag.svg +2 -2
  98. package/src/icons/FlagFill.svg +4 -0
  99. package/src/icons/List.svg +1 -1
  100. package/src/icons/Square.svg +4 -0
  101. package/src/icons/SquareFill.svg +4 -0
  102. package/src/icons/index.ts +3 -0
  103. package/src/modals/MenuModal/MenuModal.tsx +9 -3
  104. package/src/modals/RemainingTilesModal/components/Character/Character.module.scss +1 -1
  105. package/src/modals/RemainingTilesModal/components/Character/Character.tsx +1 -0
  106. package/src/modals/ResultsModal/ResultsModal.module.scss +1 -1
  107. package/src/modals/SettingsModal/components/AutoGroupTilesSetting/AutoGroupTilesSetting.tsx +0 -1
  108. package/src/modals/SettingsModal/components/ConfigSetting/ConfigSetting.tsx +0 -1
  109. package/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.module.scss +14 -24
  110. package/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.tsx +0 -1
  111. package/src/pages/_app.tsx +9 -5
  112. package/src/pages/api/dictionary/[locale]/[word].ts +3 -1
  113. package/src/pages/index.module.scss +1 -2
  114. package/src/pages/index.tsx +6 -0
  115. package/src/parameters/index.ts +10 -0
  116. package/src/state/sagas.ts +5 -2
  117. package/src/state/slices/boardSlice.ts +5 -5
  118. package/src/state/useTranslate.ts +5 -2
  119. package/src/styles/mixins.scss +4 -2
  120. package/src/styles/variables.scss +39 -32
  121. package/src/types/index.ts +7 -1
  122. package/.next/server/chunks/579.js +0 -3917
  123. package/.next/static/chunks/490-d29992f1c264d70e.js +0 -5
  124. package/.next/static/chunks/791-93aa8b8c22e488ac.js +0 -1
  125. package/.next/static/chunks/pages/_app-fa0661b072fc6af9.js +0 -24
  126. package/.next/static/chunks/pages/index-ded620fd5df96be0.js +0 -1
  127. package/.next/static/css/4482c4a0064d3807.css +0 -1
  128. package/.next/static/css/78e42ad01f580f64.css +0 -1
  129. package/.next/static/css/a943dd97164732d4.css +0 -1
  130. package/.next/static/iL0av55MV28b0MXfhKKt2/_buildManifest.js +0 -1
  131. package/src/components/Board/components/Cell/Button.tsx +0 -31
  132. package/src/components/Solver/components/ApplyButton/ApplyButton.module.scss +0 -5
  133. package/src/components/Solver/components/ApplyButton/index.ts +0 -1
  134. package/src/components/Solver/components/MobileControls/MobileControls.tsx +0 -62
  135. package/src/components/Solver/components/MobileControls/index.ts +0 -1
  136. package/src/components/SquareButton/index.ts +0 -1
  137. /package/.next/static/{iL0av55MV28b0MXfhKKt2 → Cs23uxWG6AxS72F2yrjHu}/_ssgManifest.js +0 -0
@@ -1,5 +1,6 @@
1
1
  import { PayloadAction } from '@reduxjs/toolkit';
2
- import { Result } from '@scrabble-solver/types';
2
+ import { COMMA_ARABIC, COMMA_LATIN } from '@scrabble-solver/constants';
3
+ import { Locale, Result } from '@scrabble-solver/types';
3
4
  import { call, delay, put, select, takeEvery, takeLatest } from 'redux-saga/effects';
4
5
 
5
6
  import { memoize } from 'lib';
@@ -134,7 +135,9 @@ function* onLocaleChange(): AnyGenerator {
134
135
 
135
136
  function* onResultCandidateChange({ payload: result }: PayloadAction<Result | null>): AnyGenerator {
136
137
  if (result) {
137
- yield put(dictionarySlice.actions.changeInput(result.words.join(', ')));
138
+ const locale = yield select(selectLocale);
139
+ const comma = locale === Locale.FA_IR ? ` ${COMMA_ARABIC}` : `${COMMA_LATIN} `;
140
+ yield put(dictionarySlice.actions.changeInput(result.words.join(comma)));
138
141
  yield put(dictionarySlice.actions.submit());
139
142
  }
140
143
  }
@@ -19,6 +19,11 @@ const boardSlice = createSlice({
19
19
  return newBoard;
20
20
  },
21
21
 
22
+ change: (_state, action: PayloadAction<Board>) => {
23
+ const board = action.payload;
24
+ return board;
25
+ },
26
+
22
27
  changeCellValue: (state, action: PayloadAction<{ value: string; x: number; y: number }>) => {
23
28
  const newBoard = state.clone();
24
29
  const { value, x, y } = action.payload;
@@ -32,11 +37,6 @@ const boardSlice = createSlice({
32
37
  return newBoard;
33
38
  },
34
39
 
35
- change: (_state, action: PayloadAction<Board>) => {
36
- const board = action.payload;
37
- return board;
38
- },
39
-
40
40
  init: (_state, action: PayloadAction<Board>) => {
41
41
  const board = action.payload;
42
42
  return board;
@@ -9,14 +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) => {
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
- return translation;
19
+ return Object.entries(replacements).reduce(
20
+ (result, [key, value]) => result.replaceAll(`{{${key}}}`, value),
21
+ translation,
22
+ );
20
23
  },
21
24
  [translations, locale],
22
25
  );
@@ -16,6 +16,8 @@ $media-expressions: (
16
16
  * It does not work when applied on input elements.
17
17
  */
18
18
  @mixin focus-effect {
19
+ --focus-effect--size: 6px;
20
+
19
21
  position: relative;
20
22
 
21
23
  &::after {
@@ -28,7 +30,7 @@ $media-expressions: (
28
30
  z-index: 1;
29
31
  transition: var(--transition);
30
32
  border-radius: var(--border--radius);
31
- box-shadow: 0 0 0 var(--box-shadow--focus--spread) transparent;
33
+ box-shadow: 0 0 0 var(--focus-effect--size) transparent;
32
34
  pointer-events: none;
33
35
  }
34
36
 
@@ -39,7 +41,7 @@ $media-expressions: (
39
41
  }
40
42
 
41
43
  &::after {
42
- box-shadow: 0 0 0 var(--box-shadow--focus--spread) var(--color--focus);
44
+ box-shadow: 0 0 0 var(--focus-effect--size) var(--color--focus);
43
45
  }
44
46
  }
45
47
  }
@@ -1,55 +1,62 @@
1
1
  $easeOutSine: cubic-bezier(0.61, 1, 0.88, 1);
2
2
 
3
3
  :root {
4
+ --border: var(--border--width) solid var(--border--color);
4
5
  --border--color: #cdcdcd;
5
6
  --border--color--light: #d9d9d9;
6
7
  --border--radius: 5px;
7
8
  --border--width: 1px;
8
- --border: var(--border--width) solid var(--border--color);
9
9
 
10
+ --box-shadow: 0 0 var(--box-shadow--blur) var(--box-shadow--spread) var(--box-shadow--color);
10
11
  --box-shadow--blur: 10px;
12
+ --box-shadow--color: rgba(0, 0, 0, 0.15);
11
13
  --box-shadow--spread: 1px;
12
- --box-shadow--offset: 1px;
13
- --box-shadow--offset--negative: calc(-1 * var(--box-shadow--offset));
14
- --box-shadow--color: #{rgba(#000, 0.15)};
15
- --box-shadow: 0 0 var(--box-shadow--blur) var(--box-shadow--spread) var(--box-shadow--color);
16
- --box-shadow--focus--spread: 6px;
17
14
  --box-shadow--null: 0 0 var(--box-shadow--blur) var(--box-shadow--spread) transparent;
18
15
  --box-shadow--error: 0 0 var(--box-shadow--blur) var(--box-shadow--spread) var(--color--error);
19
16
 
20
- --color--background: #f4f4f4;
21
- --color--background--secondary: #111;
22
- --color--background--overlay: rgba(255, 255, 255, 0.65);
23
- --color--error: hsl(0deg, 92%, 62%);
24
- --color--success: #00a900;
25
- --color--info: var(--color--dark-blue);
26
- --color--warning: hsl(35deg, 90%, 60%);
27
- --color--focus: #{rgba(#268fff, 0.5)};
28
- --color--foreground: #222;
29
- --color--foreground--secondary: #444;
30
- --color--inactive: #cdcdcd;
31
- --color--primary: var(--color--violet);
32
-
33
- --color--yellow: #efe3ae;
34
- --color--yellow--light: #f7f1d6;
35
- --color--green: #bae3ba;
36
- --color--green--light: #d6ebd6;
17
+ --color--white: #ffffff;
37
18
  --color--blue: #c7d8f9;
38
19
  --color--blue--light: #dde4f6;
39
- --color--light-blue: #7bb5e5;
40
- --color--light-blue--light: #b8d5ed;
41
- --color--dark-blue: #1868ad;
42
- --color--dark-blue--light: #86aed1;
20
+ --color--green: #bae3ba;
21
+ --color--green--light: #d6ebd6;
43
22
  --color--red: #f7c2aa;
44
23
  --color--red--light: #fbe0d4;
45
24
  --color--violet: #78387f;
46
25
  --color--violet--light: #b284b8;
47
- --color--orange: #fbc997;
48
- --color--pink: #f19393;
26
+ --color--yellow: #efe3ae;
27
+ --color--yellow--light: #f7f1d6;
28
+
29
+ --color--focus: #{rgba(#268fff, 0.5)};
30
+ --color--inactive: #cdcdcd;
31
+ --color--background: #f4f4f4;
32
+ --color--background--element: var(--color--white);
33
+ --color--background--overlay: rgba(255, 255, 255, 0.65);
34
+ --color--foreground: #222;
35
+ --color--foreground--secondary: #444;
36
+ --color--error: hsl(0, 92%, 62%);
37
+ --color--error--opposite: var(--color--white);
38
+ --color--info: #1868ad;
39
+ --color--success: #00a900;
40
+ --color--warning: hsl(35, 90%, 60%);
41
+ --color--primary: var(--color--violet);
42
+ --color--primary--opposite: var(--color--white);
43
+
44
+ --color--bonus--character--1: var(--color--yellow--light);
45
+ --color--bonus--character--2: var(--color--green--light);
46
+ --color--bonus--character--3: var(--color--blue--light);
47
+ --color--bonus--character--5: var(--color--red--light);
48
+ --color--bonus--character-multiplier--2: #b8d5ed;
49
+ --color--bonus--character-multiplier--3: #86aed1;
50
+ --color--bonus--start: var(--color--violet--light);
51
+ --color--bonus--word-multiplier--2: #fbc997;
52
+ --color--bonus--word-multiplier--3: #f19393;
53
+ --color--tooltip--background: #222;
54
+ --color--tooltip--foreground: var(--color--white);
49
55
 
50
56
  --font--family: 'Open Sans', sans-serif;
51
- --font--family--title: 'Lato', sans-serif;
57
+ --font--family--arabic: 'Vazirmatn', sans-serif;
52
58
  --font--family--monospace: 'Roboto Mono', monospace;
59
+ --font--family--title: 'Lato', sans-serif;
53
60
  --font--size--h1: 30px;
54
61
  --font--size--h2: 22px;
55
62
  --font--size--h3: 18px;
@@ -70,9 +77,11 @@ $easeOutSine: cubic-bezier(0.61, 1, 0.88, 1);
70
77
  --transition--duration--long: 250ms;
71
78
  --transition--easing: #{$easeOutSine};
72
79
  --transition: all var(--transition--duration) var(--transition--easing);
80
+ --transition--long: all var(--transition--duration--long) var(--transition--easing);
73
81
 
74
82
  --z-index--modal: 100;
75
83
  --z-index--close-button: 101;
84
+ --z-index--tooltip: 102;
76
85
 
77
86
  --dictionary--height: 260px;
78
87
  --modal--width: 370px;
@@ -80,6 +89,4 @@ $easeOutSine: cubic-bezier(0.61, 1, 0.88, 1);
80
89
  --square-button--size: 32px;
81
90
  --button--icon--size: 24px;
82
91
  --text-input--height: 40px;
83
- --tooltip--background: #222;
84
- --tooltip--foreground: #fff;
85
92
  }
@@ -36,12 +36,15 @@ export type TranslationKey =
36
36
  | 'cell.set-blank'
37
37
  | 'cell.set-not-blank'
38
38
  | 'cell.toggle-direction'
39
+ | 'cell.tile.location'
39
40
  | 'common.clear'
40
41
  | 'common.close'
41
42
  | 'common.loading'
42
43
  | 'common.blanks'
43
44
  | 'common.consonants'
45
+ | 'common.next'
44
46
  | 'common.points'
47
+ | 'common.previous'
45
48
  | 'common.tiles'
46
49
  | 'common.two-letter-tiles'
47
50
  | 'common.vowels'
@@ -52,6 +55,7 @@ export type TranslationKey =
52
55
  | 'dictionary.empty-state.not-allowed'
53
56
  | 'dictionary.empty-state.uninitialized'
54
57
  | 'dictionary.input.placeholder'
58
+ | 'dictionary.input.title'
55
59
  | 'empty-state.error'
56
60
  | 'empty-state.info'
57
61
  | 'empty-state.success'
@@ -70,6 +74,7 @@ export type TranslationKey =
70
74
  | 'keyMap.rack.insert-blank'
71
75
  | 'menu'
72
76
  | 'rack.placeholder'
77
+ | 'rack.tile.location'
73
78
  | 'remaining-tiles'
74
79
  | 'results'
75
80
  | 'results.empty-state.no-filtered-results'
@@ -77,6 +82,7 @@ export type TranslationKey =
77
82
  | 'results.empty-state.outdated'
78
83
  | 'results.empty-state.uninitialized'
79
84
  | 'results.input.placeholder'
85
+ | 'results.insert'
80
86
  | 'results.solve'
81
87
  | 'settings'
82
88
  | 'settings.autoGroupTiles'
@@ -89,6 +95,6 @@ export type TranslationKey =
89
95
  | 'words.invalid'
90
96
  | 'words.valid';
91
97
 
92
- export type Translate = (key: TranslationKey) => string;
98
+ export type Translate = (key: TranslationKey, replacements?: Record<string, string>) => string;
93
99
 
94
100
  export type Translations = Record<TranslationKey, string>;