@scrabble-solver/scrabble-solver 2.11.9 → 2.12.0

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 (40) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +4 -4
  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/277.js +49 -37
  16. package/.next/server/chunks/44.js +3 -3
  17. package/.next/server/middleware-build-manifest.js +1 -1
  18. package/.next/server/pages/404.html +1 -1
  19. package/.next/server/pages/404.js.nft.json +1 -1
  20. package/.next/server/pages/500.html +1 -1
  21. package/.next/server/pages/_app.js +8 -0
  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/index.html +1 -1
  25. package/.next/server/pages/index.js +8 -0
  26. package/.next/server/pages/index.js.nft.json +1 -1
  27. package/.next/server/pages/index.json +1 -1
  28. package/.next/static/chunks/pages/_app-bea4539a6b8042de.js +32 -0
  29. package/.next/static/css/58053f9594647860.css +2 -0
  30. package/.next/trace +52 -52
  31. package/package.json +11 -9
  32. package/src/components/Board/components/InputPrompt/InputPrompt.module.scss +1 -0
  33. package/src/components/Results/Cell.tsx +4 -3
  34. package/src/components/Results/Result.tsx +6 -2
  35. package/src/components/Results/Results.module.scss +6 -0
  36. package/src/styles/variables.scss +1 -0
  37. package/.next/static/chunks/pages/_app-b0231bed954dd413.js +0 -28
  38. package/.next/static/css/fcc46fec97b11afc.css +0 -2
  39. /package/.next/static/{9oRWxnZ1xFLSs55FJtiYi → fsjQvvJ13WNxBdMioL4sc}/_buildManifest.js +0 -0
  40. /package/.next/static/{9oRWxnZ1xFLSs55FJtiYi → fsjQvvJ13WNxBdMioL4sc}/_ssgManifest.js +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrabble-solver/scrabble-solver",
3
- "version": "2.11.9",
3
+ "version": "2.12.0",
4
4
  "description": "Scrabble Solver 2 - App",
5
5
  "engines": {
6
6
  "node": ">=16"
@@ -31,13 +31,13 @@
31
31
  "@floating-ui/react": "^0.22.2",
32
32
  "@kamilmielnik/trie": "^2.0.1",
33
33
  "@reduxjs/toolkit": "^1.9.3",
34
- "@scrabble-solver/configs": "^2.11.9",
35
- "@scrabble-solver/constants": "^2.11.9",
36
- "@scrabble-solver/dictionaries": "^2.11.9",
37
- "@scrabble-solver/logger": "^2.11.9",
38
- "@scrabble-solver/solver": "^2.11.9",
39
- "@scrabble-solver/types": "^2.11.9",
40
- "@scrabble-solver/word-definitions": "^2.11.9",
34
+ "@scrabble-solver/configs": "^2.12.0",
35
+ "@scrabble-solver/constants": "^2.12.0",
36
+ "@scrabble-solver/dictionaries": "^2.12.0",
37
+ "@scrabble-solver/logger": "^2.12.0",
38
+ "@scrabble-solver/solver": "^2.12.0",
39
+ "@scrabble-solver/types": "^2.12.0",
40
+ "@scrabble-solver/word-definitions": "^2.12.0",
41
41
  "classnames": "^2.3.2",
42
42
  "include-media": "^2.0.0",
43
43
  "include-media-query-builder": "^1.1.0",
@@ -46,6 +46,7 @@
46
46
  "react": "^18.2.0",
47
47
  "react-cool-onclickoutside": "^1.7.0",
48
48
  "react-dom": "^18.2.0",
49
+ "react-highlight-words": "^0.20.0",
49
50
  "react-modal": "^3.16.1",
50
51
  "react-portal": "^4.2.2",
51
52
  "react-redux": "^8.0.5",
@@ -62,6 +63,7 @@
62
63
  "@types/classnames": "^2.3.0",
63
64
  "@types/react": "^18.0.31",
64
65
  "@types/react-dom": "^18.0.11",
66
+ "@types/react-highlight-words": "^0.16.4",
65
67
  "@types/react-modal": "^3.13.1",
66
68
  "@types/react-portal": "^4.0.4",
67
69
  "@types/react-redux": "^7.1.25",
@@ -72,5 +74,5 @@
72
74
  "sass": "^1.60.0",
73
75
  "workbox-webpack-plugin": "^6.5.4"
74
76
  },
75
- "gitHead": "ff5376346ee2ff7d0db2cbcbe98a47de1c96bea2"
77
+ "gitHead": "0fe4eb1f970634bbfc7f6aa5bd43dcb2ef3ba3d8"
76
78
  }
@@ -28,6 +28,7 @@
28
28
  border: none;
29
29
  border-top: var(--border);
30
30
  border-bottom: var(--border);
31
+ border-radius: 0;
31
32
  }
32
33
 
33
34
  .insert {
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import { FunctionComponent } from 'react';
2
+ import { FunctionComponent, ReactNode } from 'react';
3
3
 
4
4
  import { selectLocale, useTranslate, useTypedSelector } from 'state';
5
5
  import { TranslationKey } from 'types';
@@ -9,13 +9,14 @@ import { useTooltip } from '../Tooltip';
9
9
  import styles from './Results.module.scss';
10
10
 
11
11
  interface Props {
12
+ children?: ReactNode;
12
13
  className?: string;
13
14
  translationKey: TranslationKey;
14
15
  tooltip?: string | number;
15
16
  value: string | number;
16
17
  }
17
18
 
18
- const Cell: FunctionComponent<Props> = ({ className, translationKey, tooltip, value }) => {
19
+ const Cell: FunctionComponent<Props> = ({ children, className, translationKey, tooltip, value }) => {
19
20
  const translate = useTranslate();
20
21
  const locale = useTypedSelector(selectLocale);
21
22
  const formattedValue = value.toLocaleString(locale);
@@ -23,7 +24,7 @@ const Cell: FunctionComponent<Props> = ({ className, translationKey, tooltip, va
23
24
 
24
25
  return (
25
26
  <div className={classNames(styles.cell, className)} {...triggerProps}>
26
- {formattedValue}
27
+ {children || formattedValue}
27
28
  </div>
28
29
  );
29
30
  };
@@ -1,9 +1,10 @@
1
1
  import classNames from 'classnames';
2
2
  import { CSSProperties, FocusEventHandler, MouseEventHandler, ReactElement, useRef } from 'react';
3
+ import Highlighter from 'react-highlight-words';
3
4
 
4
5
  import { LOCALE_FEATURES } from 'i18n';
5
6
  import { noop } from 'lib';
6
- import { selectIsResultMatching, selectLocale, useTypedSelector } from 'state';
7
+ import { selectIsResultMatching, selectLocale, selectResultsQuery, useTypedSelector } from 'state';
7
8
  import { ResultColumn } from 'types';
8
9
 
9
10
  import Cell from './Cell';
@@ -30,6 +31,7 @@ const Result = ({ data, index, style }: Props): ReactElement => {
30
31
  const ref = useRef<HTMLButtonElement>(null);
31
32
  const columns = useColumns();
32
33
  const locale = useTypedSelector(selectLocale);
34
+ const query = useTypedSelector(selectResultsQuery);
33
35
  const { consonants, direction, separator, vowels } = LOCALE_FEATURES[locale];
34
36
  const result = results[index];
35
37
  const isMatching = useTypedSelector((state) => selectIsResultMatching(state, index));
@@ -60,7 +62,9 @@ const Result = ({ data, index, style }: Props): ReactElement => {
60
62
  >
61
63
  <span className={styles.resultContent}>
62
64
  {enabledColumns[ResultColumn.Word] && (
63
- <Cell className={styles.word} translationKey="common.word" value={result.word} />
65
+ <Cell className={styles.word} translationKey="common.word" value={result.word}>
66
+ <Highlighter highlightClassName={styles.highlight} searchWords={[query]} textToHighlight={result.word} />
67
+ </Cell>
64
68
  )}
65
69
 
66
70
  {enabledColumns[ResultColumn.TilesCount] && (
@@ -220,3 +220,9 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
220
220
  border-bottom-left-radius: var(--border--radius);
221
221
  border-bottom-right-radius: var(--border--radius);
222
222
  }
223
+
224
+ .highlight {
225
+ background-color: var(--color--mark);
226
+ color: var(--color--foreground);
227
+ border-radius: var(--border--radius);
228
+ }
@@ -39,6 +39,7 @@ $easeOutSine: cubic-bezier(0.61, 1, 0.88, 1);
39
39
  --color--background--overlay: rgba(255, 255, 255, 0.65);
40
40
  --color--foreground: #222;
41
41
  --color--foreground--secondary: #444;
42
+ --color--mark: #ffff00;
42
43
  --color--error: hsl(0, 92%, 62%);
43
44
  --color--error--opposite: var(--color--white);
44
45
  --color--info: #1868ad;