@scrabble-solver/scrabble-solver 2.11.6 → 2.11.7
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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +10 -10
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_8dgz12 +1 -1
- package/.next/cache/next-server.js.nft.json +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/277.js +608 -397
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/_app.js +9 -2
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/api/solve.js +29 -1
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/index.js +10 -2
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/index.json +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/static/chunks/framework-2c5cac93e8c637b5.js +49 -0
- package/.next/static/chunks/pages/{404-8176f4acd0cfeb42.js → 404-ca203fa27afc37d8.js} +1 -1
- package/.next/static/chunks/pages/_app-e89a3c225b87516a.js +28 -0
- package/.next/static/chunks/pages/index-58744f49bf6b891f.js +1 -0
- package/.next/static/css/edaeaa48321b4cf2.css +2 -0
- package/.next/static/{Jmk00rVXCbdjFgP77tKXQ → uhB6d-q63uRC6RubwepLq}/_buildManifest.js +1 -1
- package/.next/trace +50 -50
- package/package.json +9 -9
- package/src/components/Board/Board.module.scss +2 -59
- package/src/components/Board/Board.tsx +22 -10
- package/src/components/Board/BoardPure.tsx +13 -8
- package/src/components/Board/components/Cell/Cell.module.scss +8 -140
- package/src/components/Board/components/Cell/Cell.tsx +18 -37
- package/src/components/Board/hooks/index.ts +1 -0
- package/src/components/Board/hooks/useBackgroundImage.tsx +170 -0
- package/src/components/Board/lib/getBonusColor.ts +18 -0
- package/src/components/Board/lib/index.ts +1 -0
- package/src/components/DictionaryInput/DictionaryInput.tsx +5 -3
- package/src/components/Results/Cell.tsx +2 -2
- package/src/components/Results/Result.tsx +4 -8
- package/src/components/Results/Results.module.scss +5 -3
- package/src/components/Solver/Solver.tsx +2 -2
- package/src/components/Tooltip/Tooltip.module.scss +2 -0
- package/src/hooks/useAppLayout.ts +1 -0
- package/src/i18n/constants.ts +25 -8
- package/src/i18n/de.json +2 -2
- package/src/i18n/en.json +2 -2
- package/src/i18n/es.json +2 -2
- package/src/i18n/fa.json +2 -2
- package/src/i18n/fr.json +2 -2
- package/src/i18n/pl.json +2 -2
- package/src/lib/dataUrlToBlob.ts +20 -0
- package/src/lib/index.ts +1 -0
- package/src/pages/_app.tsx +1 -3
- package/src/parameters/index.ts +33 -2
- package/src/state/index.ts +1 -1
- package/src/state/sagas.ts +3 -4
- package/src/state/store.ts +34 -0
- package/src/styles/variables.scss +2 -0
- package/.next/static/chunks/framework-2c79e2a64abdb08b.js +0 -33
- package/.next/static/chunks/pages/_app-b4fa92112b8f0385.js +0 -28
- package/.next/static/chunks/pages/index-ccd762f8f5028729.js +0 -1
- package/.next/static/css/1cd302e7648d209c.css +0 -2
- package/src/components/Board/components/Cell/CellPure.tsx +0 -93
- package/src/components/Board/components/Cell/lib.ts +0 -59
- package/src/state/createAppStore.ts +0 -38
- /package/.next/static/{Jmk00rVXCbdjFgP77tKXQ → uhB6d-q63uRC6RubwepLq}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BONUS_WORD } from '@scrabble-solver/constants';
|
|
2
|
+
import { Bonus } from '@scrabble-solver/types';
|
|
3
|
+
|
|
4
|
+
import { COLOR_BONUS_CHARACTER, COLOR_BONUS_CHARACTER_MULTIPLIER, COLOR_BONUS_WORD } from 'parameters';
|
|
5
|
+
|
|
6
|
+
const getBonusColor = (bonus: Bonus): string => {
|
|
7
|
+
if (bonus.type === BONUS_WORD) {
|
|
8
|
+
return COLOR_BONUS_WORD[bonus.multiplier];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (bonus.score) {
|
|
12
|
+
return COLOR_BONUS_CHARACTER[bonus.score];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return COLOR_BONUS_CHARACTER_MULTIPLIER[bonus.multiplier];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default getBonusColor;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { COMMA_ARABIC, COMMA_LATIN } from '@scrabble-solver/constants';
|
|
2
1
|
import classNames from 'classnames';
|
|
3
2
|
import { ChangeEvent, FormEvent, FunctionComponent } from 'react';
|
|
4
3
|
import { useDispatch } from 'react-redux';
|
|
5
4
|
|
|
6
|
-
import {
|
|
5
|
+
import { LOCALE_FEATURES } from 'i18n';
|
|
6
|
+
import { dictionarySlice, selectDictionary, selectLocale, useTranslate, useTypedSelector } from 'state';
|
|
7
7
|
|
|
8
8
|
import styles from './DictionaryInput.module.scss';
|
|
9
9
|
|
|
@@ -14,7 +14,9 @@ interface Props {
|
|
|
14
14
|
const DictionaryInput: FunctionComponent<Props> = ({ className }) => {
|
|
15
15
|
const dispatch = useDispatch();
|
|
16
16
|
const translate = useTranslate();
|
|
17
|
+
const locale = useTypedSelector(selectLocale);
|
|
17
18
|
const { input } = useTypedSelector(selectDictionary);
|
|
19
|
+
const { comma } = LOCALE_FEATURES[locale];
|
|
18
20
|
|
|
19
21
|
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
|
|
20
22
|
dispatch(dictionarySlice.actions.changeInput(event.target.value));
|
|
@@ -29,7 +31,7 @@ const DictionaryInput: FunctionComponent<Props> = ({ className }) => {
|
|
|
29
31
|
<form className={classNames(styles.dictionaryInput, className)} onSubmit={handleSubmit}>
|
|
30
32
|
<input
|
|
31
33
|
className={styles.input}
|
|
32
|
-
pattern={`.*[^\\s${
|
|
34
|
+
pattern={`.*[^\\s${comma}].*`}
|
|
33
35
|
placeholder={translate('dictionary.input.placeholder')}
|
|
34
36
|
required
|
|
35
37
|
title={translate('dictionary.input.title')}
|
|
@@ -22,9 +22,9 @@ const Cell: FunctionComponent<Props> = ({ className, translationKey, tooltip, va
|
|
|
22
22
|
const triggerProps = useTooltip(`${translate(translationKey)}: ${tooltip || formattedValue}`);
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
|
-
<
|
|
25
|
+
<div className={classNames(styles.cell, className)} {...triggerProps}>
|
|
26
26
|
{formattedValue}
|
|
27
|
-
</
|
|
27
|
+
</div>
|
|
28
28
|
);
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -30,10 +30,10 @@ const Result = ({ data, index, style }: Props): ReactElement => {
|
|
|
30
30
|
const ref = useRef<HTMLButtonElement>(null);
|
|
31
31
|
const columns = useColumns();
|
|
32
32
|
const locale = useTypedSelector(selectLocale);
|
|
33
|
-
const { consonants, vowels } = LOCALE_FEATURES[locale];
|
|
33
|
+
const { consonants, direction, separator, vowels } = LOCALE_FEATURES[locale];
|
|
34
34
|
const result = results[index];
|
|
35
35
|
const isMatching = useTypedSelector((state) => selectIsResultMatching(state, index));
|
|
36
|
-
const
|
|
36
|
+
const words = direction === 'rtl' ? [...result.words].reverse() : result.words;
|
|
37
37
|
const enabledColumns = Object.fromEntries(columns.map((column) => [column.id, true]));
|
|
38
38
|
|
|
39
39
|
const handleClick: MouseEventHandler = (event) => onClick(result, event);
|
|
@@ -60,11 +60,7 @@ const Result = ({ data, index, style }: Props): ReactElement => {
|
|
|
60
60
|
>
|
|
61
61
|
<span className={styles.resultContent}>
|
|
62
62
|
{enabledColumns[ResultColumn.Word] && (
|
|
63
|
-
<Cell
|
|
64
|
-
className={styles.word}
|
|
65
|
-
translationKey="common.word"
|
|
66
|
-
value={`${result.word.toLocaleUpperCase()}${otherWords.length > 0 ? ` (${otherWords})` : ''}`}
|
|
67
|
-
/>
|
|
63
|
+
<Cell className={styles.word} translationKey="common.word" value={result.word} />
|
|
68
64
|
)}
|
|
69
65
|
|
|
70
66
|
{enabledColumns[ResultColumn.TilesCount] && (
|
|
@@ -87,7 +83,7 @@ const Result = ({ data, index, style }: Props): ReactElement => {
|
|
|
87
83
|
<Cell
|
|
88
84
|
className={styles.stat}
|
|
89
85
|
translationKey="common.words"
|
|
90
|
-
tooltip={`${result.wordsCount} (${
|
|
86
|
+
tooltip={`${result.wordsCount.toLocaleString(locale)} (${words.join(separator)})`}
|
|
91
87
|
value={result.wordsCount}
|
|
92
88
|
/>
|
|
93
89
|
)}
|
|
@@ -60,7 +60,6 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
60
60
|
cursor: pointer;
|
|
61
61
|
text-transform: uppercase;
|
|
62
62
|
transition: var(--transition);
|
|
63
|
-
padding: var(--spacing--s) 0;
|
|
64
63
|
|
|
65
64
|
&:focus,
|
|
66
65
|
&:hover {
|
|
@@ -135,6 +134,7 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
135
134
|
display: flex;
|
|
136
135
|
align-items: center;
|
|
137
136
|
justify-content: space-between;
|
|
137
|
+
height: 100%;
|
|
138
138
|
|
|
139
139
|
.word {
|
|
140
140
|
@include ellipsis;
|
|
@@ -145,8 +145,10 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
145
145
|
display: flex;
|
|
146
146
|
align-items: center;
|
|
147
147
|
justify-content: center;
|
|
148
|
+
height: 100%;
|
|
148
149
|
padding: 0 var(--spacing--s);
|
|
149
150
|
gap: var(--spacing--s);
|
|
151
|
+
line-height: var(--results--item--height);
|
|
150
152
|
|
|
151
153
|
.result &:first-child,
|
|
152
154
|
.headerButton:first-child & {
|
|
@@ -180,12 +182,12 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
180
182
|
}
|
|
181
183
|
|
|
182
184
|
.word {
|
|
183
|
-
flex: 1 0
|
|
185
|
+
flex: 1 0;
|
|
184
186
|
text-transform: uppercase;
|
|
185
187
|
}
|
|
186
188
|
|
|
187
189
|
.stat {
|
|
188
|
-
$width:
|
|
190
|
+
$width: 55px;
|
|
189
191
|
|
|
190
192
|
flex: 0 0 $width;
|
|
191
193
|
max-width: $width;
|
|
@@ -34,7 +34,7 @@ const Solver: FunctionComponent<Props> = ({ className, onShowResults }) => {
|
|
|
34
34
|
const dispatch = useDispatch();
|
|
35
35
|
const translate = useTranslate();
|
|
36
36
|
const isTouchDevice = useIsTouchDevice();
|
|
37
|
-
const {
|
|
37
|
+
const { maxControlsWidth, showCompactControls, showFloatingSolveButton, tileSize } = useAppLayout();
|
|
38
38
|
const error = useTypedSelector(selectSolveError);
|
|
39
39
|
const isOutdated = useTypedSelector(selectAreResultsOutdated);
|
|
40
40
|
const resultCandidate = useTypedSelector(selectResultCandidate);
|
|
@@ -93,7 +93,7 @@ const Solver: FunctionComponent<Props> = ({ className, onShowResults }) => {
|
|
|
93
93
|
<div className={styles.container}>
|
|
94
94
|
<div className={styles.content}>
|
|
95
95
|
<form className={styles.boardContainer} onSubmit={handleSubmit}>
|
|
96
|
-
<Board
|
|
96
|
+
<Board className={styles.board} />
|
|
97
97
|
<input className={styles.submitInput} tabIndex={-1} type="submit" />
|
|
98
98
|
</form>
|
|
99
99
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
.tooltip {
|
|
2
|
+
max-width: var(--tooltip--max-width);
|
|
2
3
|
padding: var(--spacing--s) var(--spacing--m);
|
|
3
4
|
box-shadow: var(--box-shadow);
|
|
4
5
|
border-radius: var(--border--radius);
|
|
5
6
|
background-color: var(--color--tooltip--background);
|
|
6
7
|
color: var(--color--tooltip--foreground);
|
|
7
8
|
z-index: var(--z-index--tooltip);
|
|
9
|
+
text-align: center;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
.arrow {
|
package/src/i18n/constants.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { COMMA_ARABIC, COMMA_LATIN } from '@scrabble-solver/constants';
|
|
1
2
|
import { Locale } from '@scrabble-solver/types';
|
|
2
3
|
import { FunctionComponent, SVGAttributes } from 'react';
|
|
3
4
|
|
|
@@ -6,45 +7,61 @@ import { FlagDe, FlagEs, FlagFa, FlagFr, FlagGb, FlagPl, FlagUs } from 'icons';
|
|
|
6
7
|
import styles from './i18n.module.scss';
|
|
7
8
|
|
|
8
9
|
interface LocaleFeatures {
|
|
9
|
-
|
|
10
|
+
comma: string;
|
|
10
11
|
consonants: boolean;
|
|
12
|
+
direction: 'ltr' | 'rtl';
|
|
13
|
+
separator: string;
|
|
11
14
|
vowels: boolean;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
export const LOCALE_FEATURES: Record<Locale, LocaleFeatures> = {
|
|
15
18
|
[Locale.DE_DE]: {
|
|
16
|
-
|
|
19
|
+
comma: COMMA_LATIN,
|
|
17
20
|
consonants: true,
|
|
21
|
+
direction: 'ltr',
|
|
22
|
+
separator: `${COMMA_LATIN} `,
|
|
18
23
|
vowels: true,
|
|
19
24
|
},
|
|
20
25
|
[Locale.EN_GB]: {
|
|
21
|
-
|
|
26
|
+
comma: COMMA_LATIN,
|
|
22
27
|
consonants: true,
|
|
28
|
+
direction: 'ltr',
|
|
29
|
+
separator: `${COMMA_LATIN} `,
|
|
23
30
|
vowels: true,
|
|
24
31
|
},
|
|
25
32
|
[Locale.EN_US]: {
|
|
26
|
-
|
|
33
|
+
comma: COMMA_LATIN,
|
|
27
34
|
consonants: true,
|
|
35
|
+
direction: 'ltr',
|
|
36
|
+
separator: `${COMMA_LATIN} `,
|
|
28
37
|
vowels: true,
|
|
29
38
|
},
|
|
30
39
|
[Locale.ES_ES]: {
|
|
31
|
-
|
|
40
|
+
comma: COMMA_LATIN,
|
|
32
41
|
consonants: true,
|
|
42
|
+
direction: 'ltr',
|
|
43
|
+
separator: `${COMMA_LATIN} `,
|
|
33
44
|
vowels: true,
|
|
34
45
|
},
|
|
35
46
|
[Locale.FA_IR]: {
|
|
36
|
-
|
|
47
|
+
comma: COMMA_ARABIC,
|
|
37
48
|
consonants: false,
|
|
49
|
+
direction: 'rtl',
|
|
50
|
+
separator: `${COMMA_ARABIC} `,
|
|
38
51
|
vowels: false,
|
|
39
52
|
},
|
|
40
53
|
[Locale.FR_FR]: {
|
|
41
|
-
|
|
54
|
+
comma: COMMA_LATIN,
|
|
42
55
|
consonants: true,
|
|
56
|
+
direction: 'ltr',
|
|
57
|
+
separator: `${COMMA_LATIN} `,
|
|
43
58
|
vowels: true,
|
|
44
59
|
},
|
|
45
60
|
[Locale.PL_PL]: {
|
|
46
|
-
|
|
61
|
+
comma: COMMA_LATIN,
|
|
47
62
|
consonants: true,
|
|
63
|
+
direction: 'ltr',
|
|
64
|
+
separator: `${COMMA_LATIN} `,
|
|
48
65
|
vowels: true,
|
|
49
66
|
},
|
|
50
67
|
};
|
package/src/i18n/de.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"cell.filter-cell": "Zielort
|
|
2
|
+
"cell.filter-cell": "Zielort",
|
|
3
3
|
"cell.set-blank": "Als Blanko markieren",
|
|
4
4
|
"cell.set-not-blank": "Nicht als Blanko markieren",
|
|
5
5
|
"cell.tile.location": "Brett: Stein ({{x}}, {{y}})",
|
|
6
|
-
"cell.toggle-direction": "Schreibrichtung
|
|
6
|
+
"cell.toggle-direction": "Schreibrichtung",
|
|
7
7
|
"common.blanks": "Blankos",
|
|
8
8
|
"common.clear": "Löschen",
|
|
9
9
|
"common.close": "Schließen",
|
package/src/i18n/en.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"cell.filter-cell": "Target destination
|
|
2
|
+
"cell.filter-cell": "Target destination",
|
|
3
3
|
"cell.set-blank": "Mark it a blank",
|
|
4
4
|
"cell.set-not-blank": "Mark it not a blank",
|
|
5
5
|
"cell.tile.location": "Board: tile ({{x}}, {{y}})",
|
|
6
|
-
"cell.toggle-direction": "Typing direction
|
|
6
|
+
"cell.toggle-direction": "Typing direction",
|
|
7
7
|
"common.blanks": "Blanks",
|
|
8
8
|
"common.clear": "Clear",
|
|
9
9
|
"common.close": "Close",
|
package/src/i18n/es.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"cell.filter-cell": "Destino objetivo
|
|
2
|
+
"cell.filter-cell": "Destino objetivo",
|
|
3
3
|
"cell.set-blank": "Marcar como en blanco",
|
|
4
4
|
"cell.set-not-blank": "Marcar como no en blanco",
|
|
5
5
|
"cell.tile.location": "Tablero: espacio ({{x}}, {{y}})",
|
|
6
|
-
"cell.toggle-direction": "Dirección de escritura
|
|
6
|
+
"cell.toggle-direction": "Dirección de escritura",
|
|
7
7
|
"common.blanks": "Blancos",
|
|
8
8
|
"common.clear": "Borrar",
|
|
9
9
|
"common.close": "Cerrar",
|
package/src/i18n/fa.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"cell.filter-cell": "مقصد
|
|
2
|
+
"cell.filter-cell": "مقصد",
|
|
3
3
|
"cell.set-blank": "علامت گذاری به عنوان خالی",
|
|
4
4
|
"cell.set-not-blank": "علامت گذاری به عنوان غیر خالی",
|
|
5
|
-
"cell.toggle-direction": "جهت تایپ - کلیک برای تغییر",
|
|
6
5
|
"cell.tile.location": "({{x}}، {{y}}) کاشی: صفحه",
|
|
6
|
+
"cell.toggle-direction": "جهت تایپ",
|
|
7
7
|
"common.blanks": "خالی",
|
|
8
8
|
"common.clear": "پاک کردن",
|
|
9
9
|
"common.close": "بستن",
|
package/src/i18n/fr.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"cell.filter-cell": "Destination cible
|
|
2
|
+
"cell.filter-cell": "Destination cible",
|
|
3
3
|
"cell.set-blank": "Marquer comme vide",
|
|
4
4
|
"cell.set-not-blank": "Marquer comme non vide",
|
|
5
5
|
"cell.tile.location": "Plateau: la case ({{x}}, {{y}})",
|
|
6
|
-
"cell.toggle-direction": "Direction d'écriture
|
|
6
|
+
"cell.toggle-direction": "Direction d'écriture",
|
|
7
7
|
"common.blanks": "Cases vides",
|
|
8
8
|
"common.clear": "Effacer",
|
|
9
9
|
"common.close": "Fermer",
|
package/src/i18n/pl.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"cell.filter-cell": "Miejsce docelowe
|
|
2
|
+
"cell.filter-cell": "Miejsce docelowe",
|
|
3
3
|
"cell.set-blank": "Oznacz jako blank",
|
|
4
4
|
"cell.set-not-blank": "Oznacz jako nie blank",
|
|
5
5
|
"cell.tile.location": "Plansza: płytka ({{x}}, {{y}})",
|
|
6
|
-
"cell.toggle-direction": "Kierunek wpisywania
|
|
6
|
+
"cell.toggle-direction": "Kierunek wpisywania",
|
|
7
7
|
"common.blanks": "Blanki",
|
|
8
8
|
"common.clear": "Wyczyść",
|
|
9
9
|
"common.close": "Zamknij",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const dataUrlToBlob = (dataUrl: string): Blob => {
|
|
2
|
+
const [mime = '', data] = dataUrl.split(',');
|
|
3
|
+
const [, type] = mime.match(/:(.*?);/) || [];
|
|
4
|
+
|
|
5
|
+
if (typeof type !== 'string') {
|
|
6
|
+
throw new Error('Unsupported data URL');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const byteString = globalThis.atob(data);
|
|
10
|
+
const u8arr = new Uint8Array(byteString.length);
|
|
11
|
+
let index = byteString.length;
|
|
12
|
+
|
|
13
|
+
while (index--) {
|
|
14
|
+
u8arr[index] = byteString.charCodeAt(index);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return new Blob([u8arr], { type });
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default dataUrlToBlob;
|
package/src/lib/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { default as createKeyComparator } from './createKeyComparator';
|
|
|
8
8
|
export { default as createNullMovingComparator } from './createNullMovingComparator';
|
|
9
9
|
export { default as createRegExp } from './createRegExp';
|
|
10
10
|
export { default as createStringComparator } from './createStringComparator';
|
|
11
|
+
export { default as dataUrlToBlob } from './dataUrlToBlob';
|
|
11
12
|
export { default as detectLocale } from './detectLocale';
|
|
12
13
|
export { default as extractCharacters } from './extractCharacters';
|
|
13
14
|
export { default as extractInputValue } from './extractInputValue';
|
package/src/pages/_app.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { FunctionComponent } from 'react';
|
|
|
4
4
|
import { Provider } from 'react-redux';
|
|
5
5
|
|
|
6
6
|
import { SeoMessage } from 'components';
|
|
7
|
-
import {
|
|
7
|
+
import { store } from 'state';
|
|
8
8
|
|
|
9
9
|
import 'styles/global.scss';
|
|
10
10
|
|
|
@@ -40,8 +40,6 @@ const KEYWORDS = [
|
|
|
40
40
|
'Kamil Mielnik',
|
|
41
41
|
].join(',');
|
|
42
42
|
|
|
43
|
-
const store = createAppStore();
|
|
44
|
-
|
|
45
43
|
const App: FunctionComponent<AppProps> = ({ Component, pageProps }) => (
|
|
46
44
|
<>
|
|
47
45
|
<Head>
|
package/src/parameters/index.ts
CHANGED
|
@@ -19,6 +19,34 @@ export const COLOR_GREEN = '#bae3ba';
|
|
|
19
19
|
export const COLOR_RED = '#f7c2aa';
|
|
20
20
|
export const COLOR_YELLOW = '#efe3ae';
|
|
21
21
|
|
|
22
|
+
export const COLOR_BONUS_CHARACTER_1 = '#f7f1d6';
|
|
23
|
+
export const COLOR_BONUS_CHARACTER_2 = '#d6ebd6';
|
|
24
|
+
export const COLOR_BONUS_CHARACTER_3 = '#dde4f6';
|
|
25
|
+
export const COLOR_BONUS_CHARACTER_5 = '#fbe0d4';
|
|
26
|
+
export const COLOR_BONUS_CHARACTER_MULTIPLIER_2 = '#b8d5ed';
|
|
27
|
+
export const COLOR_BONUS_CHARACTER_MULTIPLIER_3 = '#86aed1';
|
|
28
|
+
export const COLOR_BONUS_START = '#b284b8';
|
|
29
|
+
export const COLOR_BONUS_WORD_MULTIPLIER_2 = '#fbc997';
|
|
30
|
+
export const COLOR_BONUS_WORD_MULTIPLIER_3 = '#f19393';
|
|
31
|
+
export const COLOR_FILTERED = '#444';
|
|
32
|
+
|
|
33
|
+
export const COLOR_BONUS_CHARACTER: Record<number, string> = {
|
|
34
|
+
1: COLOR_BONUS_CHARACTER_1,
|
|
35
|
+
2: COLOR_BONUS_CHARACTER_2,
|
|
36
|
+
3: COLOR_BONUS_CHARACTER_3,
|
|
37
|
+
5: COLOR_BONUS_CHARACTER_5,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const COLOR_BONUS_CHARACTER_MULTIPLIER: Record<number, string> = {
|
|
41
|
+
2: COLOR_BONUS_CHARACTER_MULTIPLIER_2,
|
|
42
|
+
3: COLOR_BONUS_CHARACTER_MULTIPLIER_3,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const COLOR_BONUS_WORD: Record<number, string> = {
|
|
46
|
+
2: COLOR_BONUS_WORD_MULTIPLIER_2,
|
|
47
|
+
3: COLOR_BONUS_WORD_MULTIPLIER_3,
|
|
48
|
+
};
|
|
49
|
+
|
|
22
50
|
export const SPACING_XS = 2;
|
|
23
51
|
export const SPACING_S = 5;
|
|
24
52
|
export const SPACING_M = 10;
|
|
@@ -40,6 +68,9 @@ export const BOARD_TILE_SIZE_MAX = 64;
|
|
|
40
68
|
*/
|
|
41
69
|
export const BOARD_TILE_SIZE_MIN = 20;
|
|
42
70
|
|
|
71
|
+
export const BORDER_COLOR = '#cdcdcd';
|
|
72
|
+
export const BORDER_COLOR_LIGHT = '#d9d9d9';
|
|
73
|
+
export const BORDER_RADIUS = 5;
|
|
43
74
|
export const BORDER_WIDTH = 1;
|
|
44
75
|
|
|
45
76
|
export const BUTTON_ICON_SIZE = 24;
|
|
@@ -90,10 +121,10 @@ export const RACK_TILE_SIZE_MAX = 80;
|
|
|
90
121
|
|
|
91
122
|
export const REMAINING_TILES_TILE_SIZE = 50;
|
|
92
123
|
|
|
93
|
-
export const RESULTS_HEADER_HEIGHT = 35;
|
|
94
|
-
|
|
95
124
|
export const RESULTS_ITEM_HEIGHT = 40;
|
|
96
125
|
|
|
126
|
+
export const RESULTS_HEADER_HEIGHT = RESULTS_ITEM_HEIGHT;
|
|
127
|
+
|
|
97
128
|
export const SOLVER_COLUMN_WIDTH = 580;
|
|
98
129
|
|
|
99
130
|
export const TEXT_INPUT_HEIGHT = 40;
|
package/src/state/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './actions';
|
|
2
|
-
export { default as createAppStore } from './createAppStore';
|
|
3
2
|
export { default as localStorage } from './localStorage';
|
|
4
3
|
export * from './selectors';
|
|
5
4
|
export * from './slices';
|
|
5
|
+
export { default as store } from './store';
|
|
6
6
|
export { default as useTranslate } from './useTranslate';
|
|
7
7
|
export { default as useTypedSelector } from './useTypedSelector';
|
package/src/state/sagas.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
2
|
|
|
3
3
|
import { PayloadAction } from '@reduxjs/toolkit';
|
|
4
|
-
import { COMMA_ARABIC, COMMA_LATIN } from '@scrabble-solver/constants';
|
|
5
4
|
import { Locale, Result } from '@scrabble-solver/types';
|
|
6
5
|
import { call, delay, put, select, takeEvery, takeLatest } from 'redux-saga/effects';
|
|
7
6
|
|
|
7
|
+
import { LOCALE_FEATURES } from 'i18n';
|
|
8
8
|
import { memoize } from 'lib';
|
|
9
9
|
import { findWordDefinitions, solve, verify, visit } from 'sdk';
|
|
10
10
|
|
|
@@ -144,9 +144,8 @@ function* onLocaleChange(): AnyGenerator {
|
|
|
144
144
|
|
|
145
145
|
function* onResultCandidateChange({ payload: result }: PayloadAction<Result | null>): AnyGenerator {
|
|
146
146
|
if (result) {
|
|
147
|
-
const locale = yield select(selectLocale);
|
|
148
|
-
|
|
149
|
-
yield put(dictionarySlice.actions.changeInput(result.words.join(comma)));
|
|
147
|
+
const locale: Locale = yield select(selectLocale);
|
|
148
|
+
yield put(dictionarySlice.actions.changeInput(result.words.join(LOCALE_FEATURES[locale].separator)));
|
|
150
149
|
yield put(dictionarySlice.actions.submit());
|
|
151
150
|
}
|
|
152
151
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { configureStore } from '@reduxjs/toolkit';
|
|
2
|
+
import reduxSaga from 'redux-saga';
|
|
3
|
+
|
|
4
|
+
import { rootSaga } from './sagas';
|
|
5
|
+
import {
|
|
6
|
+
boardSlice,
|
|
7
|
+
cellFilterSlice,
|
|
8
|
+
dictionarySlice,
|
|
9
|
+
rackSlice,
|
|
10
|
+
resultsSlice,
|
|
11
|
+
settingsSlice,
|
|
12
|
+
solveSlice,
|
|
13
|
+
verifySlice,
|
|
14
|
+
} from './slices';
|
|
15
|
+
|
|
16
|
+
const sagaMiddleware = reduxSaga();
|
|
17
|
+
|
|
18
|
+
const store = configureStore({
|
|
19
|
+
reducer: {
|
|
20
|
+
board: boardSlice.reducer,
|
|
21
|
+
cellFilter: cellFilterSlice.reducer,
|
|
22
|
+
dictionary: dictionarySlice.reducer,
|
|
23
|
+
rack: rackSlice.reducer,
|
|
24
|
+
results: resultsSlice.reducer,
|
|
25
|
+
settings: settingsSlice.reducer,
|
|
26
|
+
solve: solveSlice.reducer,
|
|
27
|
+
verify: verifySlice.reducer,
|
|
28
|
+
},
|
|
29
|
+
middleware: [sagaMiddleware],
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
sagaMiddleware.run(rootSaga);
|
|
33
|
+
|
|
34
|
+
export default store;
|
|
@@ -112,9 +112,11 @@ $easeOutSine: cubic-bezier(0.61, 1, 0.88, 1);
|
|
|
112
112
|
--modal--width: 370px;
|
|
113
113
|
--nav--height: calc(var(--logo--height) + var(--nav--padding));
|
|
114
114
|
--nav--padding: var(--spacing--l);
|
|
115
|
+
--results--item--height: 40px;
|
|
115
116
|
--solver-column--width: 580px;
|
|
116
117
|
--square-button--size: 32px;
|
|
117
118
|
--text-input--height: 40px;
|
|
119
|
+
--tooltip--max-width: 360px;
|
|
118
120
|
|
|
119
121
|
@include media('<l') {
|
|
120
122
|
--dictionary--height: var(--dictionary--height--mobile);
|