@scrabble-solver/scrabble-solver 2.9.1 → 2.9.2

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 (49) 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/next-server.js.nft.json +1 -1
  13. package/.next/prerender-manifest.json +1 -1
  14. package/.next/required-server-files.json +1 -1
  15. package/.next/routes-manifest.json +1 -1
  16. package/.next/server/chunks/413.js +6 -2
  17. package/.next/server/chunks/44.js +894 -3
  18. package/.next/server/chunks/515.js +10 -3
  19. package/.next/server/middleware-build-manifest.js +1 -1
  20. package/.next/server/pages/404.html +2 -2
  21. package/.next/server/pages/404.js.nft.json +1 -1
  22. package/.next/server/pages/500.html +2 -2
  23. package/.next/server/pages/_app.js.nft.json +1 -1
  24. package/.next/server/pages/api/dictionary/[locale]/[word].js +121 -65
  25. package/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
  26. package/.next/server/pages/api/dictionary/[locale].js +1 -1
  27. package/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
  28. package/.next/server/pages/api/solve.js +1 -1
  29. package/.next/server/pages/api/solve.js.nft.json +1 -1
  30. package/.next/server/pages/api/verify.js +1 -1
  31. package/.next/server/pages/api/verify.js.nft.json +1 -1
  32. package/.next/server/pages/index.html +2 -2
  33. package/.next/server/pages/index.js.nft.json +1 -1
  34. package/.next/server/pages/index.json +1 -1
  35. package/.next/static/{Oki2Ia4sgLw021iM7byAe → Ntg-ilwD7GqTIFwRpSaTQ}/_buildManifest.js +1 -1
  36. package/.next/static/{Oki2Ia4sgLw021iM7byAe → Ntg-ilwD7GqTIFwRpSaTQ}/_ssgManifest.js +0 -0
  37. package/.next/static/chunks/{317-e7d5d859f1f95938.js → 317-5e5334962dd7c681.js} +1 -1
  38. package/.next/static/chunks/pages/{_app-10893b318367f97c.js → _app-183f598b1d4d480b.js} +1 -1
  39. package/.next/static/css/e8de67ad5ea35427.css +1 -0
  40. package/.next/trace +52 -52
  41. package/LICENSE +1 -1
  42. package/package.json +11 -11
  43. package/src/components/Dictionary/Dictionary.module.scss +1 -0
  44. package/src/components/Dictionary/Dictionary.tsx +7 -2
  45. package/src/i18n/en.json +2 -2
  46. package/src/pages/api/dictionary/[locale]/[word].ts +3 -1
  47. package/.next/server/chunks/452.js +0 -894
  48. package/.next/static/css/e3d218f4ea72c5fb.css +0 -1
  49. package/public/robots.txt +0 -4
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2021 Kamil Mielnik <kamil.adam.mielnik@gmail.com>
1
+ Copyright (c) 2022 Kamil Mielnik <kamil@kamilmielnik.com>
2
2
 
3
3
  Attribution-NonCommercial-NoDerivatives 4.0 International
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrabble-solver/scrabble-solver",
3
- "version": "2.9.1",
3
+ "version": "2.9.2",
4
4
  "description": "Scrabble Solver 2 - App",
5
5
  "engines": {
6
6
  "node": ">=16"
@@ -11,8 +11,8 @@
11
11
  },
12
12
  "author": {
13
13
  "name": "Kamil Mielnik",
14
- "email": "kamil.adam.mielnik@gmail.com",
15
- "url": "https://kamilmielnik.com/"
14
+ "email": "kamil@kamilmielnik.com",
15
+ "url": "https://kamilmielnik.com"
16
16
  },
17
17
  "license": "CC BY-NC-ND 4.0",
18
18
  "bugs": {
@@ -31,13 +31,13 @@
31
31
  "@kamilmielnik/trie": "^2.0.1",
32
32
  "@popperjs/core": "^2.11.6",
33
33
  "@reduxjs/toolkit": "^1.8.6",
34
- "@scrabble-solver/configs": "^2.9.1",
35
- "@scrabble-solver/constants": "^2.9.1",
36
- "@scrabble-solver/dictionaries": "^2.9.1",
37
- "@scrabble-solver/logger": "^2.9.1",
38
- "@scrabble-solver/solver": "^2.9.1",
39
- "@scrabble-solver/types": "^2.9.1",
40
- "@scrabble-solver/word-definitions": "^2.9.1",
34
+ "@scrabble-solver/configs": "^2.9.2",
35
+ "@scrabble-solver/constants": "^2.9.2",
36
+ "@scrabble-solver/dictionaries": "^2.9.2",
37
+ "@scrabble-solver/logger": "^2.9.2",
38
+ "@scrabble-solver/solver": "^2.9.2",
39
+ "@scrabble-solver/types": "^2.9.2",
40
+ "@scrabble-solver/word-definitions": "^2.9.2",
41
41
  "classnames": "^2.3.2",
42
42
  "next": "^12.3.1",
43
43
  "normalize.css": "^8.0.1",
@@ -74,5 +74,5 @@
74
74
  "sass": "^1.55.0",
75
75
  "workbox-webpack-plugin": "^6.5.4"
76
76
  },
77
- "gitHead": "4849b4d123131fe043174f000c523868f3bd68c5"
77
+ "gitHead": "f50d782088cb89544f0c2c504f31fca81a6ff409"
78
78
  }
@@ -53,6 +53,7 @@
53
53
 
54
54
  .definition {
55
55
  margin-bottom: var(--spacing--s);
56
+ white-space: pre-wrap;
56
57
 
57
58
  &:last-child {
58
59
  margin-bottom: 0;
@@ -31,7 +31,7 @@ const Dictionary: FunctionComponent<Props> = ({ className }) => {
31
31
  </EmptyState>
32
32
  )}
33
33
 
34
- {results.map(({ definitions, isAllowed, word }) => (
34
+ {results.map(({ definitions, exists, isAllowed, word }) => (
35
35
  <div
36
36
  className={classNames(styles.result, {
37
37
  [styles.isAllowed]: isAllowed === true,
@@ -51,7 +51,12 @@ const Dictionary: FunctionComponent<Props> = ({ className }) => {
51
51
 
52
52
  {isAllowed === true && (
53
53
  <>
54
- {definitions.length === 0 && <div>{translate('dictionary.empty-state.no-definitions')}</div>}
54
+ {definitions.length === 0 && (
55
+ <>
56
+ {exists && <div>{translate('dictionary.empty-state.no-definitions')}</div>}
57
+ {!exists && <div>{translate('dictionary.empty-state.no-results')}</div>}
58
+ </>
59
+ )}
55
60
 
56
61
  {definitions.length > 0 && (
57
62
  <ul className={styles.definitions}>
package/src/i18n/en.json CHANGED
@@ -15,9 +15,9 @@
15
15
  "common.word": "Word",
16
16
  "common.words": "Words",
17
17
  "dictionary.empty-state.no-definitions": "Word exists in the dictionary but it does not have a definition.",
18
- "dictionary.empty-state.no-results": "Unable to find word definition in dictionary.",
18
+ "dictionary.empty-state.no-results": "Unable to find word definition in the dictionary.",
19
19
  "dictionary.empty-state.not-allowed": "This word is not allowed.",
20
- "dictionary.empty-state.uninitialized": "Dictionary definition of the last highlighted word will be shown here.",
20
+ "dictionary.empty-state.uninitialized": "Dictionary definition of the most recently highlighted word will be shown here.",
21
21
  "dictionary.input.placeholder": "Search dictionary...",
22
22
  "empty-state.error": "Error",
23
23
  "empty-state.info": "Info",
@@ -1,4 +1,5 @@
1
1
  import { scrabble } from '@scrabble-solver/configs';
2
+ import { dictionaries } from '@scrabble-solver/dictionaries';
2
3
  import logger from '@scrabble-solver/logger';
3
4
  import { isLocale, Locale } from '@scrabble-solver/types';
4
5
  import { getWordDefinition } from '@scrabble-solver/word-definitions';
@@ -27,7 +28,8 @@ const dictionary = async (request: NextApiRequest, response: NextApiResponse): P
27
28
  },
28
29
  });
29
30
 
30
- const results = await Promise.all(words.map((word) => getWordDefinition(locale, word)));
31
+ const trie = await dictionaries.get(locale);
32
+ const results = await Promise.all(words.map((word) => getWordDefinition(locale, word, trie.has(word))));
31
33
  response.status(200).send(results.map((result) => result.toJson()));
32
34
  } catch (error) {
33
35
  const message = error instanceof Error ? error.message : 'Unknown error';