@scrabble-solver/scrabble-solver 2.11.3 → 2.11.5

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 -7
  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/export-marker.json +1 -1
  13. package/.next/next-server.js.nft.json +1 -1
  14. package/.next/prerender-manifest.json +1 -1
  15. package/.next/routes-manifest.json +1 -1
  16. package/.next/server/chunks/131.js +1 -1
  17. package/.next/server/chunks/277.js +736 -913
  18. package/.next/server/chunks/44.js +2 -30
  19. package/.next/server/chunks/636.js +286 -0
  20. package/.next/server/chunks/675.js +550 -0
  21. package/.next/server/middleware-build-manifest.js +1 -1
  22. package/.next/server/pages/404.html +2 -2
  23. package/.next/server/pages/404.js.nft.json +1 -1
  24. package/.next/server/pages/500.html +1 -1
  25. package/.next/server/pages/_app.js +73 -9
  26. package/.next/server/pages/_app.js.nft.json +1 -1
  27. package/.next/server/pages/_document.js.nft.json +1 -1
  28. package/.next/server/pages/_error.js +1 -280
  29. package/.next/server/pages/_error.js.nft.json +1 -1
  30. package/.next/server/pages/api/solve.js +22 -2
  31. package/.next/server/pages/index.html +1 -1
  32. package/.next/server/pages/index.js +382 -313
  33. package/.next/server/pages/index.js.nft.json +1 -1
  34. package/.next/server/pages/index.json +1 -1
  35. package/.next/static/UzQCOB6CHhyOupkEq8oZM/_buildManifest.js +1 -0
  36. package/.next/static/chunks/pages/{404-448ba28510855455.js → 404-d30fe85d005ce32b.js} +1 -1
  37. package/.next/static/chunks/pages/_app-e27464a187a58684.js +28 -0
  38. package/.next/static/chunks/pages/index-3fd280f406cc00fd.js +1 -0
  39. package/.next/static/css/4bd04cebe207859c.css +1 -0
  40. package/.next/static/css/5b3b78170f4c5875.css +2 -0
  41. package/.next/trace +50 -53
  42. package/next.config.js +1 -0
  43. package/package.json +12 -13
  44. package/src/@types/svg.d.ts +1 -1
  45. package/src/components/Board/Board.tsx +48 -44
  46. package/src/components/Board/components/Actions/Actions.tsx +4 -2
  47. package/src/components/Board/components/Cell/Cell.module.scss +59 -1
  48. package/src/components/Board/hooks/useGrid.ts +5 -3
  49. package/src/components/Button/Button.module.scss +1 -1
  50. package/src/components/Loading/Loading.module.scss +1 -1
  51. package/src/components/Loading/Loading.tsx +1 -1
  52. package/src/components/Logo/Logo.tsx +10 -12
  53. package/src/components/Logo/LogoBlueprint.tsx +21 -0
  54. package/src/components/Logo/index.ts +1 -1
  55. package/src/components/Modal/Modal.module.scss +1 -6
  56. package/src/components/Modal/Modal.tsx +15 -8
  57. package/src/components/NavButtons/NavButtons.tsx +2 -2
  58. package/src/components/Rack/Rack.module.scss +59 -0
  59. package/src/components/Results/HeaderButton.tsx +6 -6
  60. package/src/components/Results/Results.module.scss +3 -0
  61. package/src/components/Results/Results.tsx +7 -7
  62. package/src/components/Results/useColumns.ts +2 -5
  63. package/src/components/Solver/Solver.tsx +6 -23
  64. package/src/components/Tile/Tile.module.scss +2 -1
  65. package/src/components/Tile/Tile.tsx +8 -4
  66. package/src/components/index.ts +0 -3
  67. package/src/hooks/index.ts +6 -0
  68. package/src/hooks/useAppLayout.ts +62 -12
  69. package/src/hooks/useEffectOnce.ts +5 -0
  70. package/src/hooks/useIsTouchDevice.ts +1 -1
  71. package/src/hooks/useLatest.ts +13 -0
  72. package/src/hooks/useLocalStorage.ts +51 -0
  73. package/src/hooks/useMedia.ts +36 -0
  74. package/src/hooks/useMediaQueries.ts +13 -0
  75. package/src/hooks/useMediaQuery.ts +2 -1
  76. package/src/hooks/useOnWindowResize.ts +13 -0
  77. package/src/hooks/useViewportSize.ts +19 -0
  78. package/src/i18n/constants.ts +14 -14
  79. package/src/i18n/de.json +2 -2
  80. package/src/i18n/en.json +2 -2
  81. package/src/i18n/es.json +2 -2
  82. package/src/i18n/fa.json +1 -1
  83. package/src/i18n/fr.json +2 -2
  84. package/src/i18n/pl.json +2 -2
  85. package/src/lib/arrayEquals.ts +5 -0
  86. package/src/lib/index.ts +1 -0
  87. package/src/lib/zipCharactersAndTiles.ts +3 -1
  88. package/src/modals/DictionaryModal/DictionaryModal.tsx +2 -2
  89. package/src/modals/KeyMapModal/KeyMapModal.tsx +2 -2
  90. package/src/modals/KeyMapModal/keys.tsx +0 -2
  91. package/src/modals/MenuModal/MenuModal.module.scss +28 -4
  92. package/src/modals/MenuModal/MenuModal.tsx +4 -4
  93. package/src/modals/RemainingTilesModal/RemainingTilesModal.tsx +2 -2
  94. package/src/modals/ResultsModal/ResultsModal.module.scss +1 -5
  95. package/src/modals/ResultsModal/ResultsModal.tsx +10 -2
  96. package/src/modals/SettingsModal/SettingsModal.tsx +2 -2
  97. package/src/modals/SettingsModal/components/AutoGroupTilesSetting/lib.ts +3 -1
  98. package/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.module.scss +1 -1
  99. package/src/modals/WordsModal/WordsModal.tsx +2 -2
  100. package/src/pages/index.module.scss +3 -21
  101. package/src/pages/index.tsx +51 -67
  102. package/src/parameters/index.ts +29 -2
  103. package/src/state/localStorage.ts +13 -2
  104. package/src/state/sagas.ts +16 -8
  105. package/src/state/slices/boardInitialState.ts +5 -1
  106. package/src/state/slices/boardSlice.ts +2 -2
  107. package/src/state/slices/rackInitialState.ts +8 -2
  108. package/src/state/slices/rackSlice.ts +16 -13
  109. package/src/state/slices/settingsInitialState.ts +9 -4
  110. package/src/state/slices/settingsSlice.ts +3 -1
  111. package/src/styles/animations.scss +0 -20
  112. package/src/styles/global.scss +0 -7
  113. package/src/styles/mixins.scss +0 -59
  114. package/src/styles/variables.scss +11 -0
  115. package/src/types/index.ts +4 -0
  116. package/.next/static/USLkKOoHbITebIEHkMGX_/_buildManifest.js +0 -1
  117. package/.next/static/chunks/pages/_app-21c83ddb81fc09d0.js +0 -28
  118. package/.next/static/chunks/pages/index-0858deea02b2a417.js +0 -1
  119. package/.next/static/css/885da289cec275b3.css +0 -1
  120. package/.next/static/css/ea1c8134fe9a143e.css +0 -2
  121. package/src/components/LogoSplashScreen/LogoSplashScreen.module.scss +0 -65
  122. package/src/components/LogoSplashScreen/LogoSplashScreen.tsx +0 -31
  123. package/src/components/LogoSplashScreen/index.ts +0 -1
  124. package/src/components/Sizer/Sizer.module.scss +0 -10
  125. package/src/components/Sizer/Sizer.tsx +0 -10
  126. package/src/components/Sizer/index.ts +0 -1
  127. package/src/components/SplashScreen/SplashScreen.module.scss +0 -14
  128. package/src/components/SplashScreen/SplashScreen.tsx +0 -19
  129. package/src/components/SplashScreen/index.ts +0 -1
  130. package/src/hooks/useLocalStorage/index.ts +0 -1
  131. package/src/hooks/useLocalStorage/useLocalStorage.ts +0 -13
  132. package/src/hooks/useLocalStorage/useLocalStorageBoard.ts +0 -29
  133. package/src/hooks/useLocalStorage/useLocalStorageConfigId.ts +0 -29
  134. package/src/hooks/useLocalStorage/useLocalStorageLocale.ts +0 -32
  135. package/src/hooks/useLocalStorage/useLocalStorageRack.ts +0 -29
  136. /package/.next/static/{USLkKOoHbITebIEHkMGX_ → UzQCOB6CHhyOupkEq8oZM}/_ssgManifest.js +0 -0
  137. /package/{src/components/Logo/Logo.svg → public/logo.svg} +0 -0
@@ -1,5 +1,11 @@
1
- export type RackState = (string | null)[];
1
+ import { Rack } from 'types';
2
2
 
3
- const rackInitialState: RackState = [null, null, null, null, null, null, null];
3
+ import localStorage from '../localStorage';
4
+
5
+ export type RackState = Rack;
6
+
7
+ export const rackDefaultState: RackState = [null, null, null, null, null, null, null];
8
+
9
+ const rackInitialState: RackState = localStorage.getRack() || rackDefaultState;
4
10
 
5
11
  export default rackInitialState;
@@ -1,9 +1,10 @@
1
1
  import { createSlice, PayloadAction } from '@reduxjs/toolkit';
2
2
  import { Tile } from '@scrabble-solver/types';
3
3
 
4
- import { createNullMovingComparator, inverseDirection, zipCharactersAndTiles } from 'lib';
4
+ import { arrayEquals, createNullMovingComparator, inverseDirection, zipCharactersAndTiles } from 'lib';
5
+ import { AutoGroupTiles, Rack } from 'types';
5
6
 
6
- import rackInitialState from './rackInitialState';
7
+ import rackInitialState, { rackDefaultState } from './rackInitialState';
7
8
 
8
9
  const rackSlice = createSlice({
9
10
  initialState: rackInitialState,
@@ -14,28 +15,30 @@ const rackSlice = createSlice({
14
15
  return [...state.slice(0, index), character, ...state.slice(index + 1)];
15
16
  },
16
17
 
17
- changeCharacters: (state, action: PayloadAction<{ characters: (string | null)[]; index: number }>) => {
18
+ changeCharacters: (state, action: PayloadAction<{ characters: Rack; index: number }>) => {
18
19
  const { characters, index } = action.payload;
20
+
21
+ if (characters.length === 0) {
22
+ return state;
23
+ }
24
+
19
25
  const expectedRackLength = state.length;
20
26
  const rack = [...state.slice(0, index), ...characters, ...state.slice(index + characters.length)];
21
27
  return rack.slice(0, expectedRackLength);
22
28
  },
23
29
 
24
- groupTiles: (state, action: PayloadAction<'left' | 'right' | null>) => {
25
- const direction = action.payload;
26
-
27
- if (direction === null) {
30
+ groupTiles: (state, action: PayloadAction<AutoGroupTiles>) => {
31
+ if (action.payload === null) {
28
32
  return state;
29
33
  }
30
34
 
31
- const nullMovingComparator = createNullMovingComparator(inverseDirection(direction));
35
+ const nullMovingComparator = createNullMovingComparator(inverseDirection(action.payload));
32
36
  const sortedTiles = [...state].sort(nullMovingComparator);
33
- return sortedTiles;
37
+ return arrayEquals(state, sortedTiles) ? state : sortedTiles;
34
38
  },
35
39
 
36
- init: (_state, action: PayloadAction<(string | null)[]>) => {
37
- const rack = action.payload;
38
- return rack;
40
+ init: (state, action: PayloadAction<Rack>) => {
41
+ return arrayEquals(state, action.payload) ? state : action.payload;
39
42
  },
40
43
 
41
44
  removeTiles: (state, action: PayloadAction<Tile[]>) => {
@@ -45,7 +48,7 @@ const rackSlice = createSlice({
45
48
  return charactersWithoutMatchingTiles;
46
49
  },
47
50
 
48
- reset: () => rackInitialState,
51
+ reset: () => rackDefaultState,
49
52
  },
50
53
  });
51
54
 
@@ -2,17 +2,22 @@ import { literaki, scrabble } from '@scrabble-solver/configs';
2
2
  import { Locale } from '@scrabble-solver/types';
3
3
 
4
4
  import { guessLocale } from 'lib';
5
+ import { AutoGroupTiles } from 'types';
6
+
7
+ import localStorage from '../localStorage';
5
8
 
6
9
  export interface SettingsState {
7
- autoGroupTiles: 'left' | 'right' | null;
10
+ autoGroupTiles: AutoGroupTiles;
8
11
  configId: typeof literaki.id | typeof scrabble.id;
9
12
  locale: Locale;
10
13
  }
11
14
 
15
+ const localStorageAutoGroupTiles = localStorage.getAutoGroupTiles();
16
+
12
17
  const settingsInitialState: SettingsState = {
13
- autoGroupTiles: 'left',
14
- configId: scrabble.id,
15
- locale: guessLocale(),
18
+ autoGroupTiles: typeof localStorageAutoGroupTiles === 'undefined' ? 'left' : localStorageAutoGroupTiles,
19
+ configId: localStorage.getConfigId() || scrabble.id,
20
+ locale: localStorage.getLocale() || guessLocale(),
16
21
  };
17
22
 
18
23
  export default settingsInitialState;
@@ -1,13 +1,15 @@
1
1
  import { createSlice, PayloadAction } from '@reduxjs/toolkit';
2
2
  import { Locale } from '@scrabble-solver/types';
3
3
 
4
+ import { AutoGroupTiles } from 'types';
5
+
4
6
  import settingsInitialState from './settingsInitialState';
5
7
 
6
8
  const settingsSlice = createSlice({
7
9
  initialState: settingsInitialState,
8
10
  name: 'settings',
9
11
  reducers: {
10
- changeAutoGroupTiles: (state, action: PayloadAction<'left' | 'right' | null>) => {
12
+ changeAutoGroupTiles: (state, action: PayloadAction<AutoGroupTiles>) => {
11
13
  const autoGroupTiles = action.payload;
12
14
  return { ...state, autoGroupTiles };
13
15
  },
@@ -18,16 +18,6 @@
18
18
  }
19
19
  }
20
20
 
21
- @keyframes progress {
22
- 0% {
23
- clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
24
- }
25
-
26
- 100% {
27
- clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
28
- }
29
- }
30
-
31
21
  @keyframes rotate {
32
22
  0% {
33
23
  transform: rotate(0deg);
@@ -38,16 +28,6 @@
38
28
  }
39
29
  }
40
30
 
41
- @keyframes pulse {
42
- 0% {
43
- transform: scale(1);
44
- }
45
-
46
- 100% {
47
- transform: scale(1.2);
48
- }
49
- }
50
-
51
31
  @keyframes wave {
52
32
  $offset: 6px;
53
33
 
@@ -23,13 +23,6 @@ body {
23
23
  font-family: var(--font--family);
24
24
  font-size: var(--font--size--m);
25
25
  line-height: var(--line-height);
26
- overflow: hidden;
27
- }
28
-
29
- html,
30
- body,
31
- #__next {
32
- height: 100%;
33
26
  }
34
27
 
35
28
  a {
@@ -110,62 +110,3 @@ $media-expressions: (
110
110
  text-shadow: $size 0 $color, (-$size) 0 $color, 0 $size $color, 0 (-$size) $color, (-$size) (-$size) $color,
111
111
  (-$size) $size $color, $size (-$size) $color, $size $size $color;
112
112
  }
113
-
114
- @mixin lighthouse-input-size-hack {
115
- // Hack for this Lighthouse warning:
116
- // > Interactive elements like buttons and links should be large enough (48x48px), and have
117
- // > enough space around them, to be easy enough to tap without overlapping onto other elements.
118
-
119
- input {
120
- position: absolute;
121
- top: -100%;
122
- right: -100%;
123
- left: -100%;
124
- bottom: -100%;
125
- width: 300%;
126
- height: 300%;
127
- clip-path: inset((100% / 3));
128
- }
129
-
130
- [dir='ltr'] & {
131
- &:nth-child(1),
132
- &:nth-child(2),
133
- &:nth-child(3) {
134
- input {
135
- left: 0;
136
- clip-path: polygon(0 (100% / 3), (100% / 3) (100% / 3), (100% / 3) (200% / 3), 0 (200% / 3));
137
- }
138
- }
139
-
140
- &:nth-last-child(1),
141
- &:nth-last-child(2),
142
- &:nth-last-child(3) {
143
- input {
144
- left: -200%;
145
- clip-path: polygon((200% / 3) (100% / 3), 100% (100% / 3), 100% (200% / 3), (200% / 3) (200% / 3));
146
- }
147
- }
148
- }
149
-
150
- [dir='rtl'] & {
151
- &:nth-child(1),
152
- &:nth-child(2),
153
- &:nth-child(3) {
154
- input {
155
- left: -200%;
156
- right: 0;
157
- clip-path: polygon((200% / 3) (100% / 3), 100% (100% / 3), 100% (200% / 3), (200% / 3) (200% / 3));
158
- }
159
- }
160
-
161
- &:nth-last-child(1),
162
- &:nth-last-child(2),
163
- &:nth-last-child(3) {
164
- input {
165
- left: 0;
166
- right: -200%;
167
- clip-path: polygon(0 (100% / 3), (100% / 3) (100% / 3), (100% / 3) (200% / 3), 0 (200% / 3));
168
- }
169
- }
170
- }
171
- }
@@ -108,13 +108,24 @@ $easeOutSine: cubic-bezier(0.61, 1, 0.88, 1);
108
108
 
109
109
  --button--icon--size: 24px;
110
110
  --dictionary--height: 260px;
111
+ --dictionary--height--mobile: 110px;
112
+ --logo--aspect-ratio: 682 / 166;
113
+ --logo--height: 60px;
111
114
  --modal--width: 370px;
115
+ --nav--height: calc(var(--logo--height) + var(--nav--padding));
116
+ --nav--padding: var(--spacing--l);
112
117
  --solver-column--width: 580px;
113
118
  --square-button--size: 32px;
114
119
  --text-input--height: 40px;
115
120
 
121
+ @include media('<l') {
122
+ --dictionary--height: var(--dictionary--height--mobile);
123
+ --logo--height: 48px;
124
+ }
125
+
116
126
  @include media('<s') {
117
127
  --box-shadow--blur: 5px;
128
+ --modal--width: 100%;
118
129
  }
119
130
 
120
131
  @include media('<xs') {
@@ -1,5 +1,7 @@
1
1
  export type Comparator<T> = (a: T, B: T) => number;
2
2
 
3
+ export type AutoGroupTiles = 'left' | 'right' | null;
4
+
3
5
  export type Direction = 'horizontal' | 'vertical';
4
6
 
5
7
  export interface Point {
@@ -7,6 +9,8 @@ export interface Point {
7
9
  y: number;
8
10
  }
9
11
 
12
+ export type Rack = (string | null)[];
13
+
10
14
  export interface Sort {
11
15
  column: ResultColumn;
12
16
  direction: SortDirection;
@@ -1 +0,0 @@
1
- self.__BUILD_MANIFEST={__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static/css/885da289cec275b3.css","static/chunks/pages/index-0858deea02b2a417.js"],"/404":["static/chunks/pages/404-448ba28510855455.js"],"/_error":["static/chunks/pages/_error-54de1933a164a1ff.js"],sortedPages:["/","/404","/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();