scrabble-solver 2.18.10-alpha.1 → 2.18.10-alpha.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.
- package/CLAUDE.md +1 -1
- package/bun.lock +29 -29
- package/package.json +2 -2
- package/packages/configs/README.md +3 -0
- package/packages/configs/build/games/crossplay.d.ts +19 -0
- package/packages/configs/build/games/crossplay.js +73 -0
- package/packages/configs/build/games/index.d.ts +9 -0
- package/packages/configs/build/games/index.js +25 -0
- package/packages/configs/build/games/kelimelik.d.ts +19 -0
- package/packages/configs/build/games/kelimelik.js +65 -0
- package/packages/configs/build/games/letterLeague.d.ts +19 -0
- package/packages/configs/build/games/letterLeague.js +161 -0
- package/packages/configs/build/games/literaki.d.ts +26 -0
- package/packages/configs/build/games/literaki.js +110 -0
- package/packages/configs/build/games/scrabble.d.ts +19 -0
- package/packages/configs/build/games/scrabble.js +78 -0
- package/packages/configs/build/games/scrabbleDuel.d.ts +19 -0
- package/packages/configs/build/games/scrabbleDuel.js +50 -0
- package/packages/configs/build/games/superScrabble.d.ts +19 -0
- package/packages/configs/build/games/superScrabble.js +141 -0
- package/packages/configs/build/games/wordfeud.d.ts +19 -0
- package/packages/configs/build/games/wordfeud.js +81 -0
- package/packages/configs/build/games/wyrazy.d.ts +19 -0
- package/packages/configs/build/games/wyrazy.js +73 -0
- package/packages/configs/build/getConfig.d.ts +2 -0
- package/packages/configs/build/getConfig.js +46 -0
- package/packages/configs/build/hasConfig.d.ts +2 -0
- package/packages/configs/build/hasConfig.js +42 -0
- package/packages/configs/build/index.d.ts +5 -0
- package/packages/configs/build/index.js +44 -0
- package/packages/configs/build/languages/english.d.ts +15 -0
- package/packages/configs/build/languages/english.js +456 -0
- package/packages/configs/build/languages/french.d.ts +2 -0
- package/packages/configs/build/languages/french.js +37 -0
- package/packages/configs/build/languages/german.d.ts +2 -0
- package/packages/configs/build/languages/german.js +40 -0
- package/packages/configs/build/languages/index.d.ts +8 -0
- package/packages/configs/build/languages/index.js +24 -0
- package/packages/configs/build/languages/persian.d.ts +2 -0
- package/packages/configs/build/languages/persian.js +43 -0
- package/packages/configs/build/languages/polish.d.ts +4 -0
- package/packages/configs/build/languages/polish.js +119 -0
- package/packages/configs/build/languages/romanian.d.ts +3 -0
- package/packages/configs/build/languages/romanian.js +64 -0
- package/packages/configs/build/languages/spanish.d.ts +2 -0
- package/packages/configs/build/languages/spanish.js +39 -0
- package/packages/configs/build/languages/turkish.d.ts +3 -0
- package/packages/configs/build/languages/turkish.js +75 -0
- package/packages/configs/package.json +41 -0
- package/packages/configs/src/games/crossplay.ts +87 -0
- package/packages/configs/src/games/index.ts +9 -0
- package/packages/configs/src/games/kelimelik.ts +63 -0
- package/packages/configs/src/games/letterLeague.ts +177 -0
- package/packages/configs/src/games/literaki.ts +108 -0
- package/packages/configs/src/games/scrabble.ts +76 -0
- package/packages/configs/src/games/scrabbleDuel.ts +56 -0
- package/packages/configs/src/games/superScrabble.ts +139 -0
- package/packages/configs/src/games/wordfeud.ts +79 -0
- package/packages/configs/src/games/wyrazy.ts +71 -0
- package/packages/configs/src/getConfig.ts +14 -0
- package/packages/configs/src/hasConfig.ts +8 -0
- package/packages/configs/src/index.ts +6 -0
- package/packages/configs/src/languages/english.ts +469 -0
- package/packages/configs/src/languages/french.ts +36 -0
- package/packages/configs/src/languages/german.ts +39 -0
- package/packages/configs/src/languages/index.ts +8 -0
- package/packages/configs/src/languages/persian.ts +42 -0
- package/packages/configs/src/languages/polish.ts +120 -0
- package/packages/configs/src/languages/romanian.ts +64 -0
- package/packages/configs/src/languages/spanish.ts +38 -0
- package/packages/configs/src/languages/turkish.ts +75 -0
- package/packages/configs/tsconfig.json +10 -0
- package/packages/constants/README.md +3 -0
- package/packages/constants/build/index.d.ts +12 -0
- package/packages/constants/build/index.js +12 -0
- package/packages/constants/package.json +30 -0
- package/packages/constants/src/index.ts +17 -0
- package/packages/constants/tsconfig.json +10 -0
- package/packages/dictionaries/README.md +3 -0
- package/packages/dictionaries/bin/remove-dictionaries.js +13 -0
- package/packages/dictionaries/bin/update-dictionaries.js +14 -0
- package/packages/dictionaries/build/Dictionaries.d.ts +12 -0
- package/packages/dictionaries/build/Dictionaries.js +53 -0
- package/packages/dictionaries/build/constants.d.ts +3 -0
- package/packages/dictionaries/build/constants.js +11 -0
- package/packages/dictionaries/build/index.d.ts +3 -0
- package/packages/dictionaries/build/index.js +20 -0
- package/packages/dictionaries/build/lib/DiskCache.d.ts +17 -0
- package/packages/dictionaries/build/lib/DiskCache.js +64 -0
- package/packages/dictionaries/build/lib/LayeredCache.d.ts +12 -0
- package/packages/dictionaries/build/lib/LayeredCache.js +53 -0
- package/packages/dictionaries/build/lib/MemoryCache.d.ts +12 -0
- package/packages/dictionaries/build/lib/MemoryCache.js +33 -0
- package/packages/dictionaries/build/lib/createAsyncProxy.d.ts +3 -0
- package/packages/dictionaries/build/lib/createAsyncProxy.js +19 -0
- package/packages/dictionaries/build/lib/createCacheTimestampComparator.d.ts +4 -0
- package/packages/dictionaries/build/lib/createCacheTimestampComparator.js +20 -0
- package/packages/dictionaries/build/lib/downloadDictionary.d.ts +3 -0
- package/packages/dictionaries/build/lib/downloadDictionary.js +20 -0
- package/packages/dictionaries/build/lib/getDictionaryFilepath.d.ts +2 -0
- package/packages/dictionaries/build/lib/getDictionaryFilepath.js +12 -0
- package/packages/dictionaries/build/lib/index.d.ts +7 -0
- package/packages/dictionaries/build/lib/index.js +17 -0
- package/packages/dictionaries/build/types.d.ts +7 -0
- package/packages/dictionaries/build/types.js +2 -0
- package/packages/dictionaries/package.json +46 -0
- package/packages/dictionaries/src/Dictionaries.ts +65 -0
- package/packages/dictionaries/src/constants.ts +8 -0
- package/packages/dictionaries/src/index.ts +5 -0
- package/packages/dictionaries/src/lib/DiskCache.test.ts +75 -0
- package/packages/dictionaries/src/lib/DiskCache.ts +75 -0
- package/packages/dictionaries/src/lib/LayeredCache.ts +67 -0
- package/packages/dictionaries/src/lib/MemoryCache.ts +40 -0
- package/packages/dictionaries/src/lib/createAsyncProxy.ts +18 -0
- package/packages/dictionaries/src/lib/createCacheTimestampComparator.ts +25 -0
- package/packages/dictionaries/src/lib/downloadDictionary.ts +21 -0
- package/packages/dictionaries/src/lib/getDictionaryFilepath.ts +8 -0
- package/packages/dictionaries/src/lib/index.ts +7 -0
- package/packages/dictionaries/src/types.ts +7 -0
- package/packages/dictionaries/tsconfig.json +10 -0
- package/packages/logger/README.md +21 -0
- package/packages/logger/build/constants.d.ts +4 -0
- package/packages/logger/build/constants.js +12 -0
- package/packages/logger/build/describeError.d.ts +5 -0
- package/packages/logger/build/describeError.js +23 -0
- package/packages/logger/build/events.d.ts +92 -0
- package/packages/logger/build/events.js +13 -0
- package/packages/logger/build/formatCsvRow.d.ts +2 -0
- package/packages/logger/build/formatCsvRow.js +20 -0
- package/packages/logger/build/index.d.ts +5 -0
- package/packages/logger/build/index.js +15 -0
- package/packages/logger/build/logError.d.ts +4 -0
- package/packages/logger/build/logError.js +17 -0
- package/packages/logger/build/logEvent.d.ts +3 -0
- package/packages/logger/build/logEvent.js +29 -0
- package/packages/logger/package.json +34 -0
- package/packages/logger/scripts/export-csv.ts +113 -0
- package/packages/logger/scripts/readEvents.ts +34 -0
- package/packages/logger/scripts/tsconfig.json +10 -0
- package/packages/logger/src/constants.ts +13 -0
- package/packages/logger/src/describeError.test.ts +44 -0
- package/packages/logger/src/describeError.ts +30 -0
- package/packages/logger/src/events.ts +103 -0
- package/packages/logger/src/formatCsvRow.test.ts +41 -0
- package/packages/logger/src/formatCsvRow.ts +24 -0
- package/packages/logger/src/index.ts +13 -0
- package/packages/logger/src/logError.ts +24 -0
- package/packages/logger/src/logEvent.test.ts +59 -0
- package/packages/logger/src/logEvent.ts +26 -0
- package/packages/logger/tsconfig.json +10 -0
- package/packages/scrabble-solver/.env +1 -0
- package/packages/scrabble-solver/.next/BUILD_ID +1 -0
- package/packages/scrabble-solver/.next/build-manifest.json +42 -0
- package/packages/scrabble-solver/.next/diagnostics/build-diagnostics.json +6 -0
- package/packages/scrabble-solver/.next/diagnostics/framework.json +1 -0
- package/packages/scrabble-solver/.next/dynamic-css-manifest.json +8 -0
- package/packages/scrabble-solver/.next/export-marker.json +6 -0
- package/packages/scrabble-solver/.next/images-manifest.json +68 -0
- package/packages/scrabble-solver/.next/next-minimal-server.js.nft.json +1 -0
- package/packages/scrabble-solver/.next/next-server.js.nft.json +1 -0
- package/packages/scrabble-solver/.next/package.json +1 -0
- package/packages/scrabble-solver/.next/prerender-manifest.json +28 -0
- package/packages/scrabble-solver/.next/react-loadable-manifest.json +176 -0
- package/packages/scrabble-solver/.next/required-server-files.js +371 -0
- package/packages/scrabble-solver/.next/required-server-files.json +371 -0
- package/packages/scrabble-solver/.next/routes-manifest.json +129 -0
- package/packages/scrabble-solver/.next/server/chunks/30.js +6 -0
- package/packages/scrabble-solver/.next/server/chunks/309.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/344.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/371.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/465.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/546.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/612.js +5 -0
- package/packages/scrabble-solver/.next/server/chunks/623.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/624.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/641.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/67.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/671.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/692.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/705.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/712.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/715.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/812.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/846.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/853.js +15 -0
- package/packages/scrabble-solver/.next/server/chunks/886.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/942.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/953.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/961.js +1 -0
- package/packages/scrabble-solver/.next/server/chunks/968.js +1 -0
- package/packages/scrabble-solver/.next/server/dynamic-css-manifest.js +1 -0
- package/packages/scrabble-solver/.next/server/functions-config-manifest.json +4 -0
- package/packages/scrabble-solver/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -0
- package/packages/scrabble-solver/.next/server/middleware-manifest.json +6 -0
- package/packages/scrabble-solver/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/packages/scrabble-solver/.next/server/next-font-manifest.js +1 -0
- package/packages/scrabble-solver/.next/server/next-font-manifest.json +1 -0
- package/packages/scrabble-solver/.next/server/pages/404.html +29 -0
- package/packages/scrabble-solver/.next/server/pages/500.html +29 -0
- package/packages/scrabble-solver/.next/server/pages/_app.js +1 -0
- package/packages/scrabble-solver/.next/server/pages/_app.js.nft.json +1 -0
- package/packages/scrabble-solver/.next/server/pages/_document.js +28 -0
- package/packages/scrabble-solver/.next/server/pages/_document.js.nft.json +1 -0
- package/packages/scrabble-solver/.next/server/pages/_error.js +28 -0
- package/packages/scrabble-solver/.next/server/pages/_error.js.nft.json +1 -0
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js +2 -0
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -0
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js +1 -0
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -0
- package/packages/scrabble-solver/.next/server/pages/api/solve.js +1 -0
- package/packages/scrabble-solver/.next/server/pages/api/solve.js.nft.json +1 -0
- package/packages/scrabble-solver/.next/server/pages/api/verify.js +1 -0
- package/packages/scrabble-solver/.next/server/pages/api/verify.js.nft.json +1 -0
- package/packages/scrabble-solver/.next/server/pages/api/visit.js +1 -0
- package/packages/scrabble-solver/.next/server/pages/api/visit.js.nft.json +1 -0
- package/packages/scrabble-solver/.next/server/pages/index.html +29 -0
- package/packages/scrabble-solver/.next/server/pages/index.js +30 -0
- package/packages/scrabble-solver/.next/server/pages/index.js.nft.json +1 -0
- package/packages/scrabble-solver/.next/server/pages/index.json +1 -0
- package/packages/scrabble-solver/.next/server/pages/index.meta +1 -0
- package/packages/scrabble-solver/.next/server/pages/not-found.html +29 -0
- package/packages/scrabble-solver/.next/server/pages/not-found.js.nft.json +1 -0
- package/packages/scrabble-solver/.next/server/pages-manifest.json +13 -0
- package/packages/scrabble-solver/.next/server/prefetch-hints.json +1 -0
- package/packages/scrabble-solver/.next/server/preview-props.json +5 -0
- package/packages/scrabble-solver/.next/server/route-cache/PAGES/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1/$/index.html +29 -0
- package/packages/scrabble-solver/.next/server/route-cache/PAGES/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1/$/index.json +1 -0
- package/packages/scrabble-solver/.next/server/route-cache/PAGES/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1/$/index.meta +1 -0
- package/packages/scrabble-solver/.next/server/webpack-api-runtime.js +1 -0
- package/packages/scrabble-solver/.next/server/webpack-runtime.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/100.305bdf9c75b1758f.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/256.9fcbd6c03ebdb85b.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/277.6785dfaf22fdb0b7.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/307.92ab8bd0b380a54b.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/341.79535ba85bf1986f.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/363.1e1dca73189c1b3e.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/422.905bb771191013e7.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/541.dcd9e8b804f88da5.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/601.d6817fd655b959d1.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/631.98d42abad0a60af6.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/663.0b4d7a0e7f8e4ad3.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/693.1f53805be6ad36d1.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/744-5ad846426b8f4514.js +3 -0
- package/packages/scrabble-solver/.next/static/chunks/820.c5e57d8b664cf9df.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/827.d01b6d69af340ba4.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/865.88d79c2c4b53cc8f.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/912.077603e4f0bc6cca.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/939.f8728029bfdc4515.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/980.dd35e807b18063c1.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/990.61296e5870b91f11.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/framework-86d3b250d278cea9.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/main-738e097cd313908f.js +5 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-5b1d356edb0d0f78.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/_error-f0290a98eb3ed0ec.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/index-c21b524ce1875d6e.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/not-found-a59f9deeeff63d17.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/webpack-c4c264f86e0bb34b.js +1 -0
- package/packages/scrabble-solver/.next/static/css/2d03f0da2c678dfc.css +1 -0
- package/packages/scrabble-solver/.next/static/css/4dbcacc1122ac6b9.css +2 -0
- package/packages/scrabble-solver/.next/static/css/7b6724d2df70f48f.css +1 -0
- package/packages/scrabble-solver/.next/static/css/8b8087461767360a.css +1 -0
- package/packages/scrabble-solver/.next/static/css/98051ed25076b896.css +1 -0
- package/packages/scrabble-solver/.next/static/css/b736be3bd02b5d99.css +1 -0
- package/packages/scrabble-solver/.next/static/css/ca311e6c030663d4.css +1 -0
- package/packages/scrabble-solver/.next/static/css/cd4d7f2458487399.css +1 -0
- package/packages/scrabble-solver/.next/static/css/dee878eb64099d92.css +1 -0
- package/packages/scrabble-solver/.next/static/iJDkHROLsX-5CEsv2p6sC/_buildManifest.js +1 -0
- package/packages/scrabble-solver/.next/static/iJDkHROLsX-5CEsv2p6sC/_ssgManifest.js +1 -0
- package/packages/scrabble-solver/.next/trace +36 -0
- package/packages/scrabble-solver/.next/trace-build +1 -0
- package/packages/scrabble-solver/.next/types/cache-life.d.ts +114 -0
- package/packages/scrabble-solver/.next/types/root-params.d.ts +3 -0
- package/packages/scrabble-solver/.next/types/routes.d.ts +57 -0
- package/packages/scrabble-solver/.next/types/validator.ts +113 -0
- package/packages/scrabble-solver/AGENTS.md +9 -0
- package/packages/scrabble-solver/CLAUDE.md +1 -0
- package/packages/scrabble-solver/README.md +19 -0
- package/packages/scrabble-solver/empty-module.js +2 -0
- package/packages/scrabble-solver/next-env.d.ts +7 -0
- package/packages/scrabble-solver/next.config.js +60 -0
- package/packages/scrabble-solver/package.json +99 -0
- package/packages/scrabble-solver/public/favicon.ico +0 -0
- package/packages/scrabble-solver/public/icons/apple-touch-icon-114x114.png +0 -0
- package/packages/scrabble-solver/public/icons/apple-touch-icon-120x120.png +0 -0
- package/packages/scrabble-solver/public/icons/apple-touch-icon-144x144.png +0 -0
- package/packages/scrabble-solver/public/icons/apple-touch-icon-152x152.png +0 -0
- package/packages/scrabble-solver/public/icons/apple-touch-icon-57x57.png +0 -0
- package/packages/scrabble-solver/public/icons/apple-touch-icon-60x60.png +0 -0
- package/packages/scrabble-solver/public/icons/apple-touch-icon-72x72.png +0 -0
- package/packages/scrabble-solver/public/icons/apple-touch-icon-76x76.png +0 -0
- package/packages/scrabble-solver/public/icons/favicon-128.png +0 -0
- package/packages/scrabble-solver/public/icons/favicon-16x16.png +0 -0
- package/packages/scrabble-solver/public/icons/favicon-196x196.png +0 -0
- package/packages/scrabble-solver/public/icons/favicon-32x32.png +0 -0
- package/packages/scrabble-solver/public/icons/favicon-96x96.png +0 -0
- package/packages/scrabble-solver/public/icons/favicon.svg +6 -0
- package/packages/scrabble-solver/public/icons/mstile-144x144.png +0 -0
- package/packages/scrabble-solver/public/icons/mstile-150x150.png +0 -0
- package/packages/scrabble-solver/public/icons/mstile-310x150.png +0 -0
- package/packages/scrabble-solver/public/icons/mstile-310x310.png +0 -0
- package/packages/scrabble-solver/public/icons/mstile-70x70.png +0 -0
- package/packages/scrabble-solver/public/llms.txt +11 -0
- package/packages/scrabble-solver/public/logo.svg +62 -0
- package/packages/scrabble-solver/public/og.png +0 -0
- package/packages/scrabble-solver/public/robots.txt +5 -0
- package/packages/scrabble-solver/public/service-worker.js +2 -0
- package/packages/scrabble-solver/public/service-worker.js.map +1 -0
- package/packages/scrabble-solver/public/site.webmanifest +14 -0
- package/packages/scrabble-solver/public/sitemap.xml +1 -0
- package/packages/scrabble-solver/scripts/generate-scss-types.ts +112 -0
- package/packages/scrabble-solver/src/@types/scss.d.ts +6 -0
- package/packages/scrabble-solver/src/@types/svg.d.ts +7 -0
- package/packages/scrabble-solver/src/api/BadRequestError.ts +6 -0
- package/packages/scrabble-solver/src/api/index.ts +6 -0
- package/packages/scrabble-solver/src/api/isBoardValid.ts +41 -0
- package/packages/scrabble-solver/src/api/isCellValid.ts +25 -0
- package/packages/scrabble-solver/src/api/isCharacterValid.ts +12 -0
- package/packages/scrabble-solver/src/api/isRowValid.ts +17 -0
- package/packages/scrabble-solver/src/api/withApiLog.ts +85 -0
- package/packages/scrabble-solver/src/components/Alert/Alert.module.scss +52 -0
- package/packages/scrabble-solver/src/components/Alert/Alert.module.scss.d.ts +13 -0
- package/packages/scrabble-solver/src/components/Alert/Alert.tsx +44 -0
- package/packages/scrabble-solver/src/components/Alert/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Badge/Badge.module.scss +12 -0
- package/packages/scrabble-solver/src/components/Badge/Badge.module.scss.d.ts +6 -0
- package/packages/scrabble-solver/src/components/Badge/Badge.tsx +13 -0
- package/packages/scrabble-solver/src/components/Badge/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Board/Board.module.scss +83 -0
- package/packages/scrabble-solver/src/components/Board/Board.module.scss.d.ts +17 -0
- package/packages/scrabble-solver/src/components/Board/Board.tsx +221 -0
- package/packages/scrabble-solver/src/components/Board/BoardPure.tsx +166 -0
- package/packages/scrabble-solver/src/components/Board/components/Actions/Actions.module.scss +33 -0
- package/packages/scrabble-solver/src/components/Board/components/Actions/Actions.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/Board/components/Actions/Actions.tsx +103 -0
- package/packages/scrabble-solver/src/components/Board/components/Actions/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Board/components/Actions/lib.ts +32 -0
- package/packages/scrabble-solver/src/components/Board/components/Cell/Cell.module.scss +99 -0
- package/packages/scrabble-solver/src/components/Board/components/Cell/Cell.module.scss.d.ts +13 -0
- package/packages/scrabble-solver/src/components/Board/components/Cell/Cell.tsx +135 -0
- package/packages/scrabble-solver/src/components/Board/components/Cell/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Board/components/InputPrompt/InputPrompt.module.scss +34 -0
- package/packages/scrabble-solver/src/components/Board/components/InputPrompt/InputPrompt.module.scss.d.ts +10 -0
- package/packages/scrabble-solver/src/components/Board/components/InputPrompt/InputPrompt.tsx +87 -0
- package/packages/scrabble-solver/src/components/Board/components/InputPrompt/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Board/components/ToggleDirectionButton/ToggleDirectionButton.module.scss +21 -0
- package/packages/scrabble-solver/src/components/Board/components/ToggleDirectionButton/ToggleDirectionButton.module.scss.d.ts +8 -0
- package/packages/scrabble-solver/src/components/Board/components/ToggleDirectionButton/ToggleDirectionButton.tsx +41 -0
- package/packages/scrabble-solver/src/components/Board/components/ToggleDirectionButton/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Board/components/index.ts +4 -0
- package/packages/scrabble-solver/src/components/Board/getBoardBackground.ts +175 -0
- package/packages/scrabble-solver/src/components/Board/hooks/index.ts +5 -0
- package/packages/scrabble-solver/src/components/Board/hooks/useBoardStyle.ts +24 -0
- package/packages/scrabble-solver/src/components/Board/hooks/useFloatingActions.ts +17 -0
- package/packages/scrabble-solver/src/components/Board/hooks/useFloatingFocus.ts +8 -0
- package/packages/scrabble-solver/src/components/Board/hooks/useFloatingInputPrompt.ts +17 -0
- package/packages/scrabble-solver/src/components/Board/hooks/useGrid.ts +390 -0
- package/packages/scrabble-solver/src/components/Board/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Board/lib.test.ts +106 -0
- package/packages/scrabble-solver/src/components/Board/lib.ts +149 -0
- package/packages/scrabble-solver/src/components/Board/selectors.ts +39 -0
- package/packages/scrabble-solver/src/components/Button/Button.module.scss +96 -0
- package/packages/scrabble-solver/src/components/Button/Button.module.scss.d.ts +12 -0
- package/packages/scrabble-solver/src/components/Button/Button.tsx +50 -0
- package/packages/scrabble-solver/src/components/Button/Link.tsx +45 -0
- package/packages/scrabble-solver/src/components/Button/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Dictionary/Dictionary.module.scss +65 -0
- package/packages/scrabble-solver/src/components/Dictionary/Dictionary.module.scss.d.ts +14 -0
- package/packages/scrabble-solver/src/components/Dictionary/Dictionary.tsx +78 -0
- package/packages/scrabble-solver/src/components/Dictionary/index.ts +1 -0
- package/packages/scrabble-solver/src/components/DictionaryInput/DictionaryInput.module.scss +12 -0
- package/packages/scrabble-solver/src/components/DictionaryInput/DictionaryInput.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/DictionaryInput/DictionaryInput.tsx +45 -0
- package/packages/scrabble-solver/src/components/DictionaryInput/index.ts +1 -0
- package/packages/scrabble-solver/src/components/EmptyState/EmptyState.module.scss +14 -0
- package/packages/scrabble-solver/src/components/EmptyState/EmptyState.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/EmptyState/EmptyState.tsx +55 -0
- package/packages/scrabble-solver/src/components/EmptyState/index.ts +1 -0
- package/packages/scrabble-solver/src/components/IconButton/IconButton.module.scss +39 -0
- package/packages/scrabble-solver/src/components/IconButton/IconButton.module.scss.d.ts +8 -0
- package/packages/scrabble-solver/src/components/IconButton/IconButton.tsx +31 -0
- package/packages/scrabble-solver/src/components/IconButton/Link.tsx +26 -0
- package/packages/scrabble-solver/src/components/IconButton/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Key/Key.module.scss +29 -0
- package/packages/scrabble-solver/src/components/Key/Key.module.scss.d.ts +6 -0
- package/packages/scrabble-solver/src/components/Key/Key.tsx +13 -0
- package/packages/scrabble-solver/src/components/Key/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Keys/Arrows/Arrows.module.scss +41 -0
- package/packages/scrabble-solver/src/components/Keys/Arrows/Arrows.module.scss.d.ts +11 -0
- package/packages/scrabble-solver/src/components/Keys/Arrows/Arrows.tsx +32 -0
- package/packages/scrabble-solver/src/components/Keys/Arrows/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Keys/index.tsx +28 -0
- package/packages/scrabble-solver/src/components/Loading/Loading.module.scss +33 -0
- package/packages/scrabble-solver/src/components/Loading/Loading.module.scss.d.ts +9 -0
- package/packages/scrabble-solver/src/components/Loading/Loading.tsx +37 -0
- package/packages/scrabble-solver/src/components/Loading/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Logo/Logo.tsx +12 -0
- package/packages/scrabble-solver/src/components/Logo/LogoBlueprint.tsx +22 -0
- package/packages/scrabble-solver/src/components/Logo/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Modal/Modal.module.scss +119 -0
- package/packages/scrabble-solver/src/components/Modal/Modal.module.scss.d.ts +15 -0
- package/packages/scrabble-solver/src/components/Modal/Modal.tsx +105 -0
- package/packages/scrabble-solver/src/components/Modal/components/Section/Section.module.scss +11 -0
- package/packages/scrabble-solver/src/components/Modal/components/Section/Section.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/Modal/components/Section/Section.tsx +18 -0
- package/packages/scrabble-solver/src/components/Modal/components/Section/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Modal/components/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Modal/index.ts +1 -0
- package/packages/scrabble-solver/src/components/NavButtons/NavButtons.module.scss +53 -0
- package/packages/scrabble-solver/src/components/NavButtons/NavButtons.module.scss.d.ts +13 -0
- package/packages/scrabble-solver/src/components/NavButtons/NavButtons.tsx +127 -0
- package/packages/scrabble-solver/src/components/NavButtons/index.ts +1 -0
- package/packages/scrabble-solver/src/components/NavButtons/selectors.ts +11 -0
- package/packages/scrabble-solver/src/components/NotFound/NotFound.module.scss +37 -0
- package/packages/scrabble-solver/src/components/NotFound/NotFound.module.scss.d.ts +9 -0
- package/packages/scrabble-solver/src/components/NotFound/NotFound.tsx +18 -0
- package/packages/scrabble-solver/src/components/NotFound/index.ts +1 -0
- package/packages/scrabble-solver/src/components/PlainTiles/PlainTiles.module.scss +24 -0
- package/packages/scrabble-solver/src/components/PlainTiles/PlainTiles.module.scss.d.ts +11 -0
- package/packages/scrabble-solver/src/components/PlainTiles/PlainTiles.tsx +53 -0
- package/packages/scrabble-solver/src/components/PlainTiles/Tile.tsx +41 -0
- package/packages/scrabble-solver/src/components/PlainTiles/index.ts +1 -0
- package/packages/scrabble-solver/src/components/PlainTiles/lib.ts +75 -0
- package/packages/scrabble-solver/src/components/PlainTiles/types.ts +22 -0
- package/packages/scrabble-solver/src/components/Progress/Progress.module.scss +16 -0
- package/packages/scrabble-solver/src/components/Progress/Progress.module.scss.d.ts +6 -0
- package/packages/scrabble-solver/src/components/Progress/Progress.tsx +32 -0
- package/packages/scrabble-solver/src/components/Progress/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Rack/Rack.module.scss +95 -0
- package/packages/scrabble-solver/src/components/Rack/Rack.module.scss.d.ts +10 -0
- package/packages/scrabble-solver/src/components/Rack/Rack.tsx +199 -0
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/InputPrompt.module.scss +21 -0
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/InputPrompt.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/InputPrompt.tsx +73 -0
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/lib.test.ts +27 -0
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/lib.ts +17 -0
- package/packages/scrabble-solver/src/components/Rack/components/RackTile/RackTile.module.scss +11 -0
- package/packages/scrabble-solver/src/components/Rack/components/RackTile/RackTile.module.scss.d.ts +6 -0
- package/packages/scrabble-solver/src/components/Rack/components/RackTile/RackTile.tsx +165 -0
- package/packages/scrabble-solver/src/components/Rack/components/RackTile/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Rack/components/index.ts +2 -0
- package/packages/scrabble-solver/src/components/Rack/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Rack/selectors.ts +9 -0
- package/packages/scrabble-solver/src/components/Radio/Radio.module.scss +61 -0
- package/packages/scrabble-solver/src/components/Radio/Radio.module.scss.d.ts +12 -0
- package/packages/scrabble-solver/src/components/Radio/Radio.tsx +39 -0
- package/packages/scrabble-solver/src/components/Radio/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Results/Header.tsx +114 -0
- package/packages/scrabble-solver/src/components/Results/Result.tsx +101 -0
- package/packages/scrabble-solver/src/components/Results/Results.module.scss +76 -0
- package/packages/scrabble-solver/src/components/Results/Results.module.scss.d.ts +17 -0
- package/packages/scrabble-solver/src/components/Results/Results.tsx +164 -0
- package/packages/scrabble-solver/src/components/Results/SolveButton.tsx +45 -0
- package/packages/scrabble-solver/src/components/Results/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Results/types.ts +15 -0
- package/packages/scrabble-solver/src/components/Solver/Solver.module.scss +116 -0
- package/packages/scrabble-solver/src/components/Solver/Solver.module.scss.d.ts +20 -0
- package/packages/scrabble-solver/src/components/Solver/Solver.tsx +143 -0
- package/packages/scrabble-solver/src/components/Solver/components/InsertButton/InsertButton.module.scss +15 -0
- package/packages/scrabble-solver/src/components/Solver/components/InsertButton/InsertButton.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/Solver/components/InsertButton/InsertButton.tsx +40 -0
- package/packages/scrabble-solver/src/components/Solver/components/InsertButton/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.module.scss +138 -0
- package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.module.scss.d.ts +19 -0
- package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.tsx +108 -0
- package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Solver/components/index.ts +2 -0
- package/packages/scrabble-solver/src/components/Solver/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Spinner/Spinner.module.scss +11 -0
- package/packages/scrabble-solver/src/components/Spinner/Spinner.module.scss.d.ts +10 -0
- package/packages/scrabble-solver/src/components/Spinner/Spinner.tsx +17 -0
- package/packages/scrabble-solver/src/components/Spinner/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Table/Cell.tsx +42 -0
- package/packages/scrabble-solver/src/components/Table/Header.tsx +11 -0
- package/packages/scrabble-solver/src/components/Table/HeaderButton.tsx +61 -0
- package/packages/scrabble-solver/src/components/Table/Row.tsx +59 -0
- package/packages/scrabble-solver/src/components/Table/Search.tsx +43 -0
- package/packages/scrabble-solver/src/components/Table/Table.module.scss +147 -0
- package/packages/scrabble-solver/src/components/Table/Table.module.scss.d.ts +19 -0
- package/packages/scrabble-solver/src/components/Table/index.ts +5 -0
- package/packages/scrabble-solver/src/components/Tile/Tile.module.scss +129 -0
- package/packages/scrabble-solver/src/components/Tile/Tile.module.scss.d.ts +19 -0
- package/packages/scrabble-solver/src/components/Tile/Tile.tsx +101 -0
- package/packages/scrabble-solver/src/components/Tile/TilePure.tsx +106 -0
- package/packages/scrabble-solver/src/components/Tile/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Tooltip/Tooltip.module.scss +15 -0
- package/packages/scrabble-solver/src/components/Tooltip/Tooltip.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/components/Tooltip/Tooltip.tsx +42 -0
- package/packages/scrabble-solver/src/components/Tooltip/TooltipContent.tsx +53 -0
- package/packages/scrabble-solver/src/components/Tooltip/TooltipTrigger.tsx +30 -0
- package/packages/scrabble-solver/src/components/Tooltip/context.ts +17 -0
- package/packages/scrabble-solver/src/components/Tooltip/index.ts +1 -0
- package/packages/scrabble-solver/src/components/Tooltip/useTooltip.ts +55 -0
- package/packages/scrabble-solver/src/hooks/useColumns.ts +69 -0
- package/packages/scrabble-solver/src/hooks/useDeferredRender.ts +20 -0
- package/packages/scrabble-solver/src/hooks/useDirection.ts +21 -0
- package/packages/scrabble-solver/src/hooks/useEffectOnce.ts +11 -0
- package/packages/scrabble-solver/src/hooks/useIsTouchDevice.ts +5 -0
- package/packages/scrabble-solver/src/hooks/useLanguage.ts +20 -0
- package/packages/scrabble-solver/src/hooks/useLatest.ts +11 -0
- package/packages/scrabble-solver/src/hooks/useLocalStorage.ts +49 -0
- package/packages/scrabble-solver/src/hooks/useMedia.ts +34 -0
- package/packages/scrabble-solver/src/hooks/useMediaQueries.ts +11 -0
- package/packages/scrabble-solver/src/hooks/useMediaQuery.ts +10 -0
- package/packages/scrabble-solver/src/i18n/constants.ts +106 -0
- package/packages/scrabble-solver/src/i18n/i18n.ts +25 -0
- package/packages/scrabble-solver/src/i18n/languages/english.json +88 -0
- package/packages/scrabble-solver/src/i18n/languages/french.json +88 -0
- package/packages/scrabble-solver/src/i18n/languages/german.json +88 -0
- package/packages/scrabble-solver/src/i18n/languages/persian.json +88 -0
- package/packages/scrabble-solver/src/i18n/languages/polish.json +88 -0
- package/packages/scrabble-solver/src/i18n/languages/romanian.json +88 -0
- package/packages/scrabble-solver/src/i18n/languages/spanish.json +88 -0
- package/packages/scrabble-solver/src/i18n/languages/turkish.json +88 -0
- package/packages/scrabble-solver/src/i18n/localeIcons.ts +24 -0
- package/packages/scrabble-solver/src/icons/ArrowDown.svg +4 -0
- package/packages/scrabble-solver/src/icons/ArrowLeft.svg +4 -0
- package/packages/scrabble-solver/src/icons/ArrowRight.svg +4 -0
- package/packages/scrabble-solver/src/icons/ArrowUp.svg +4 -0
- package/packages/scrabble-solver/src/icons/Ban.svg +4 -0
- package/packages/scrabble-solver/src/icons/BookHalf.svg +4 -0
- package/packages/scrabble-solver/src/icons/CardChecklist.svg +5 -0
- package/packages/scrabble-solver/src/icons/Check.svg +4 -0
- package/packages/scrabble-solver/src/icons/ChevronDown.svg +4 -0
- package/packages/scrabble-solver/src/icons/ChevronLeft.svg +4 -0
- package/packages/scrabble-solver/src/icons/ChevronRight.svg +4 -0
- package/packages/scrabble-solver/src/icons/Cog.svg +4 -0
- package/packages/scrabble-solver/src/icons/Cross.svg +4 -0
- package/packages/scrabble-solver/src/icons/CrossCircleFill.svg +4 -0
- package/packages/scrabble-solver/src/icons/CrossSquareFill.svg +4 -0
- package/packages/scrabble-solver/src/icons/DashCircleFill.svg +4 -0
- package/packages/scrabble-solver/src/icons/Eraser.svg +4 -0
- package/packages/scrabble-solver/src/icons/ExclamationSquareFill.svg +4 -0
- package/packages/scrabble-solver/src/icons/ExclamationTriangleFill.svg +4 -0
- package/packages/scrabble-solver/src/icons/EyeFill.svg +5 -0
- package/packages/scrabble-solver/src/icons/FlagDe.svg +5 -0
- package/packages/scrabble-solver/src/icons/FlagEs.svg +4 -0
- package/packages/scrabble-solver/src/icons/FlagFa.svg +95 -0
- package/packages/scrabble-solver/src/icons/FlagFill.svg +4 -0
- package/packages/scrabble-solver/src/icons/FlagFr.svg +5 -0
- package/packages/scrabble-solver/src/icons/FlagGb.svg +10 -0
- package/packages/scrabble-solver/src/icons/FlagPl.svg +4 -0
- package/packages/scrabble-solver/src/icons/FlagRo.svg +5 -0
- package/packages/scrabble-solver/src/icons/FlagTr.svg +4 -0
- package/packages/scrabble-solver/src/icons/FlagUs.svg +33 -0
- package/packages/scrabble-solver/src/icons/GeoAlt.svg +5 -0
- package/packages/scrabble-solver/src/icons/Github.svg +4 -0
- package/packages/scrabble-solver/src/icons/InfoCircleFill.svg +4 -0
- package/packages/scrabble-solver/src/icons/Keyboard.svg +5 -0
- package/packages/scrabble-solver/src/icons/KeyboardFill.svg +4 -0
- package/packages/scrabble-solver/src/icons/List.svg +4 -0
- package/packages/scrabble-solver/src/icons/OneTwoThree.svg +4 -0
- package/packages/scrabble-solver/src/icons/QuestionSquare.svg +5 -0
- package/packages/scrabble-solver/src/icons/Sack.svg +4 -0
- package/packages/scrabble-solver/src/icons/Search.svg +4 -0
- package/packages/scrabble-solver/src/icons/SortDown.svg +4 -0
- package/packages/scrabble-solver/src/icons/SortUp.svg +4 -0
- package/packages/scrabble-solver/src/icons/Square.svg +4 -0
- package/packages/scrabble-solver/src/icons/SquareA.svg +6 -0
- package/packages/scrabble-solver/src/icons/SquareB.svg +6 -0
- package/packages/scrabble-solver/src/icons/SquareFill.svg +4 -0
- package/packages/scrabble-solver/src/icons/Squares.svg +34 -0
- package/packages/scrabble-solver/src/icons/Words.svg +22 -0
- package/packages/scrabble-solver/src/lib/arrayEquals.ts +3 -0
- package/packages/scrabble-solver/src/lib/createComparator.ts +20 -0
- package/packages/scrabble-solver/src/lib/createCoordinatesComparator.ts +23 -0
- package/packages/scrabble-solver/src/lib/createHighlightWords.test.ts +13 -0
- package/packages/scrabble-solver/src/lib/createHighlightWords.ts +9 -0
- package/packages/scrabble-solver/src/lib/createKeyComparator.ts +23 -0
- package/packages/scrabble-solver/src/lib/createKeyboardNavigation.ts +46 -0
- package/packages/scrabble-solver/src/lib/createNullMovingComparator.test.ts +15 -0
- package/packages/scrabble-solver/src/lib/createNullMovingComparator.ts +17 -0
- package/packages/scrabble-solver/src/lib/createRegExp.ts +11 -0
- package/packages/scrabble-solver/src/lib/createSortComparator.ts +22 -0
- package/packages/scrabble-solver/src/lib/createStringComparator.ts +7 -0
- package/packages/scrabble-solver/src/lib/extractCharacters.test.ts +52 -0
- package/packages/scrabble-solver/src/lib/extractCharacters.ts +42 -0
- package/packages/scrabble-solver/src/lib/extractInputValue.ts +15 -0
- package/packages/scrabble-solver/src/lib/findCell.ts +5 -0
- package/packages/scrabble-solver/src/lib/getCoordinate.test.ts +22 -0
- package/packages/scrabble-solver/src/lib/getCoordinate.ts +17 -0
- package/packages/scrabble-solver/src/lib/getCoordinates.test.ts +21 -0
- package/packages/scrabble-solver/src/lib/getCoordinates.ts +16 -0
- package/packages/scrabble-solver/src/lib/getNextSort.ts +12 -0
- package/packages/scrabble-solver/src/lib/inverseDirection.ts +3 -0
- package/packages/scrabble-solver/src/lib/isCtrl.ts +5 -0
- package/packages/scrabble-solver/src/lib/isMac.ts +7 -0
- package/packages/scrabble-solver/src/lib/isRegExp.ts +9 -0
- package/packages/scrabble-solver/src/lib/isStringArray.ts +3 -0
- package/packages/scrabble-solver/src/lib/localeTransliterate.test.ts +19 -0
- package/packages/scrabble-solver/src/lib/localeTransliterate.ts +38 -0
- package/packages/scrabble-solver/src/lib/memoize.ts +64 -0
- package/packages/scrabble-solver/src/lib/noop.ts +1 -0
- package/packages/scrabble-solver/src/lib/numberComparator.ts +3 -0
- package/packages/scrabble-solver/src/lib/reverseComparator.ts +5 -0
- package/packages/scrabble-solver/src/lib/unorderedArraysEqual.ts +12 -0
- package/packages/scrabble-solver/src/lib/waitForIdleOrFirstIntent.ts +44 -0
- package/packages/scrabble-solver/src/lib/zipCharactersAndTiles.ts +28 -0
- package/packages/scrabble-solver/src/modals/DictionaryModal/DictionaryModal.module.scss +22 -0
- package/packages/scrabble-solver/src/modals/DictionaryModal/DictionaryModal.module.scss.d.ts +8 -0
- package/packages/scrabble-solver/src/modals/DictionaryModal/DictionaryModal.tsx +29 -0
- package/packages/scrabble-solver/src/modals/DictionaryModal/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/KeyMapModal/KeyMapModal.tsx +65 -0
- package/packages/scrabble-solver/src/modals/KeyMapModal/components/Mapping/Mapping.module.scss +48 -0
- package/packages/scrabble-solver/src/modals/KeyMapModal/components/Mapping/Mapping.module.scss.d.ts +11 -0
- package/packages/scrabble-solver/src/modals/KeyMapModal/components/Mapping/Mapping.tsx +36 -0
- package/packages/scrabble-solver/src/modals/KeyMapModal/components/Mapping/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/KeyMapModal/components/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/KeyMapModal/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/MenuModal/MenuModal.module.scss +48 -0
- package/packages/scrabble-solver/src/modals/MenuModal/MenuModal.module.scss.d.ts +10 -0
- package/packages/scrabble-solver/src/modals/MenuModal/MenuModal.tsx +93 -0
- package/packages/scrabble-solver/src/modals/MenuModal/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/RemainingTilesModal.module.scss +25 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/RemainingTilesModal.module.scss.d.ts +9 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/RemainingTilesModal.tsx +61 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/components/Character/Character.module.scss +50 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/components/Character/Character.module.scss.d.ts +12 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/components/Character/Character.tsx +89 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/components/Character/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/components/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/lib.ts +81 -0
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/selectors.ts +7 -0
- package/packages/scrabble-solver/src/modals/ResultsModal/ResultsModal.module.scss +20 -0
- package/packages/scrabble-solver/src/modals/ResultsModal/ResultsModal.module.scss.d.ts +8 -0
- package/packages/scrabble-solver/src/modals/ResultsModal/ResultsModal.tsx +107 -0
- package/packages/scrabble-solver/src/modals/ResultsModal/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/SettingsModal.tsx +65 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/AutoGroupTilesSetting/AutoGroupTilesSetting.module.scss +12 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/AutoGroupTilesSetting/AutoGroupTilesSetting.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/AutoGroupTilesSetting/AutoGroupTilesSetting.tsx +58 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/AutoGroupTilesSetting/constants.ts +1 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/AutoGroupTilesSetting/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/AutoGroupTilesSetting/lib.ts +15 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ConfigSetting/ConfigSetting.module.scss +12 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ConfigSetting/ConfigSetting.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ConfigSetting/ConfigSetting.tsx +45 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ConfigSetting/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ConfigSetting/lib.ts +19 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/HighlightUnreachableCellsSetting/HighlightUnreachableCellsSetting.module.scss +12 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/HighlightUnreachableCellsSetting/HighlightUnreachableCellsSetting.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/HighlightUnreachableCellsSetting/HighlightUnreachableCellsSetting.tsx +51 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/HighlightUnreachableCellsSetting/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/InputModeSetting/InputModeSetting.module.scss +12 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/InputModeSetting/InputModeSetting.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/InputModeSetting/InputModeSetting.tsx +53 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/InputModeSetting/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/InputModeSetting/lib.ts +13 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.module.scss +20 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.module.scss.d.ts +8 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.tsx +54 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/LocaleSetting/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/RemoveCellFiltersSetting/RemoveCellFiltersSetting.module.scss +12 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/RemoveCellFiltersSetting/RemoveCellFiltersSetting.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/RemoveCellFiltersSetting/RemoveCellFiltersSetting.tsx +53 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/RemoveCellFiltersSetting/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/RemoveCellFiltersSetting/lib.ts +13 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ShowCoordinatesSetting/ShowCoordinatesSetting.module.scss +12 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ShowCoordinatesSetting/ShowCoordinatesSetting.module.scss.d.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ShowCoordinatesSetting/ShowCoordinatesSetting.tsx +53 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/ShowCoordinatesSetting/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/components/index.ts +7 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.module.scss +24 -0
- package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.module.scss.d.ts +8 -0
- package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.tsx +75 -0
- package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordRow.tsx +97 -0
- package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordsTable.module.scss +69 -0
- package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordsTable.module.scss.d.ts +16 -0
- package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordsTable.tsx +137 -0
- package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/WordsModal/components/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/WordsModal/index.ts +1 -0
- package/packages/scrabble-solver/src/modals/preload.ts +24 -0
- package/packages/scrabble-solver/src/pages/_app.tsx +52 -0
- package/packages/scrabble-solver/src/pages/_document.tsx +129 -0
- package/packages/scrabble-solver/src/pages/api/dictionary/[locale]/[word].ts +66 -0
- package/packages/scrabble-solver/src/pages/api/dictionary/[locale]/index.ts +123 -0
- package/packages/scrabble-solver/src/pages/api/solve.ts +103 -0
- package/packages/scrabble-solver/src/pages/api/verify.ts +78 -0
- package/packages/scrabble-solver/src/pages/api/visit.ts +44 -0
- package/packages/scrabble-solver/src/pages/index.module.scss +31 -0
- package/packages/scrabble-solver/src/pages/index.module.scss.d.ts +11 -0
- package/packages/scrabble-solver/src/pages/index.tsx +274 -0
- package/packages/scrabble-solver/src/pages/not-found.tsx +16 -0
- package/packages/scrabble-solver/src/parameters/index.ts +83 -0
- package/packages/scrabble-solver/src/sdk/fetch.ts +28 -0
- package/packages/scrabble-solver/src/sdk/fetchJson.ts +9 -0
- package/packages/scrabble-solver/src/sdk/findWordDefinitions.ts +8 -0
- package/packages/scrabble-solver/src/sdk/index.ts +4 -0
- package/packages/scrabble-solver/src/sdk/solve.ts +19 -0
- package/packages/scrabble-solver/src/sdk/verify.ts +20 -0
- package/packages/scrabble-solver/src/sdk/visit.ts +10 -0
- package/packages/scrabble-solver/src/service-worker/appShell.test.ts +86 -0
- package/packages/scrabble-solver/src/service-worker/appShell.ts +39 -0
- package/packages/scrabble-solver/src/service-worker/index.ts +22 -0
- package/packages/scrabble-solver/src/serviceWorkerManager.ts +12 -0
- package/packages/scrabble-solver/src/solver-worker/client.test.ts +158 -0
- package/packages/scrabble-solver/src/solver-worker/client.ts +106 -0
- package/packages/scrabble-solver/src/solver-worker/dictionaries/constants.ts +9 -0
- package/packages/scrabble-solver/src/solver-worker/dictionaries/expirationManager.ts +7 -0
- package/packages/scrabble-solver/src/solver-worker/dictionaries/getDictionary.ts +21 -0
- package/packages/scrabble-solver/src/solver-worker/dictionaries/getDictionaryUrl.ts +5 -0
- package/packages/scrabble-solver/src/solver-worker/dictionaries/index.ts +2 -0
- package/packages/scrabble-solver/src/solver-worker/dictionaries/revalidateDictionary.test.ts +199 -0
- package/packages/scrabble-solver/src/solver-worker/dictionaries/revalidateDictionary.ts +86 -0
- package/packages/scrabble-solver/src/solver-worker/dictionaries/revalidatedAt.ts +43 -0
- package/packages/scrabble-solver/src/solver-worker/getGaddag.test.ts +109 -0
- package/packages/scrabble-solver/src/solver-worker/getGaddag.ts +62 -0
- package/packages/scrabble-solver/src/solver-worker/index.ts +1 -0
- package/packages/scrabble-solver/src/solver-worker/index.worker.ts +124 -0
- package/packages/scrabble-solver/src/solver-worker/messages.ts +20 -0
- package/packages/scrabble-solver/src/state/actions.ts +5 -0
- package/packages/scrabble-solver/src/state/app/index.ts +4 -0
- package/packages/scrabble-solver/src/state/app/initialState.ts +6 -0
- package/packages/scrabble-solver/src/state/app/selectors.ts +5 -0
- package/packages/scrabble-solver/src/state/app/slice.ts +20 -0
- package/packages/scrabble-solver/src/state/app/types.ts +4 -0
- package/packages/scrabble-solver/src/state/board/index.ts +4 -0
- package/packages/scrabble-solver/src/state/board/initialState.ts +38 -0
- package/packages/scrabble-solver/src/state/board/selectors.ts +3 -0
- package/packages/scrabble-solver/src/state/board/slice.ts +101 -0
- package/packages/scrabble-solver/src/state/board/types.ts +3 -0
- package/packages/scrabble-solver/src/state/cellFilters/index.ts +4 -0
- package/packages/scrabble-solver/src/state/cellFilters/initialState.ts +3 -0
- package/packages/scrabble-solver/src/state/cellFilters/lib.ts +8 -0
- package/packages/scrabble-solver/src/state/cellFilters/selectors.ts +13 -0
- package/packages/scrabble-solver/src/state/cellFilters/slice.ts +49 -0
- package/packages/scrabble-solver/src/state/cellFilters/types.ts +3 -0
- package/packages/scrabble-solver/src/state/dictionary/index.ts +4 -0
- package/packages/scrabble-solver/src/state/dictionary/initialState.ts +8 -0
- package/packages/scrabble-solver/src/state/dictionary/selectors.ts +16 -0
- package/packages/scrabble-solver/src/state/dictionary/slice.ts +34 -0
- package/packages/scrabble-solver/src/state/dictionary/types.ts +8 -0
- package/packages/scrabble-solver/src/state/hoveredTile/index.ts +4 -0
- package/packages/scrabble-solver/src/state/hoveredTile/initialState.ts +5 -0
- package/packages/scrabble-solver/src/state/hoveredTile/selectors.ts +3 -0
- package/packages/scrabble-solver/src/state/hoveredTile/slice.ts +16 -0
- package/packages/scrabble-solver/src/state/hoveredTile/types.ts +3 -0
- package/packages/scrabble-solver/src/state/hoveredWord/index.ts +4 -0
- package/packages/scrabble-solver/src/state/hoveredWord/initialState.ts +5 -0
- package/packages/scrabble-solver/src/state/hoveredWord/selectors.ts +5 -0
- package/packages/scrabble-solver/src/state/hoveredWord/slice.ts +18 -0
- package/packages/scrabble-solver/src/state/hoveredWord/types.ts +5 -0
- package/packages/scrabble-solver/src/state/i18n/index.ts +4 -0
- package/packages/scrabble-solver/src/state/i18n/initialState.ts +5 -0
- package/packages/scrabble-solver/src/state/i18n/selectors.ts +3 -0
- package/packages/scrabble-solver/src/state/i18n/slice.ts +16 -0
- package/packages/scrabble-solver/src/state/i18n/types.ts +7 -0
- package/packages/scrabble-solver/src/state/index.ts +19 -0
- package/packages/scrabble-solver/src/state/lib.ts +46 -0
- package/packages/scrabble-solver/src/state/localStorage.ts +142 -0
- package/packages/scrabble-solver/src/state/rack/index.ts +4 -0
- package/packages/scrabble-solver/src/state/rack/initialState.ts +11 -0
- package/packages/scrabble-solver/src/state/rack/selectors.ts +7 -0
- package/packages/scrabble-solver/src/state/rack/slice.ts +56 -0
- package/packages/scrabble-solver/src/state/rack/types.ts +3 -0
- package/packages/scrabble-solver/src/state/results/index.ts +4 -0
- package/packages/scrabble-solver/src/state/results/initialState.ts +13 -0
- package/packages/scrabble-solver/src/state/results/lib.ts +86 -0
- package/packages/scrabble-solver/src/state/results/selectors.ts +83 -0
- package/packages/scrabble-solver/src/state/results/slice.ts +43 -0
- package/packages/scrabble-solver/src/state/results/types.ts +10 -0
- package/packages/scrabble-solver/src/state/sagas.ts +395 -0
- package/packages/scrabble-solver/src/state/selectors.ts +52 -0
- package/packages/scrabble-solver/src/state/settings/index.ts +4 -0
- package/packages/scrabble-solver/src/state/settings/initialState.ts +16 -0
- package/packages/scrabble-solver/src/state/settings/lib.ts +42 -0
- package/packages/scrabble-solver/src/state/settings/selectors.ts +78 -0
- package/packages/scrabble-solver/src/state/settings/slice.ts +54 -0
- package/packages/scrabble-solver/src/state/settings/types.ts +13 -0
- package/packages/scrabble-solver/src/state/solve/index.ts +4 -0
- package/packages/scrabble-solver/src/state/solve/initialState.ts +12 -0
- package/packages/scrabble-solver/src/state/solve/selectors.ts +14 -0
- package/packages/scrabble-solver/src/state/solve/slice.ts +33 -0
- package/packages/scrabble-solver/src/state/solve/types.ts +10 -0
- package/packages/scrabble-solver/src/state/store.ts +38 -0
- package/packages/scrabble-solver/src/state/types.ts +27 -0
- package/packages/scrabble-solver/src/state/useTranslate.ts +32 -0
- package/packages/scrabble-solver/src/state/useTypedSelector.ts +5 -0
- package/packages/scrabble-solver/src/state/useTypedStore.ts +6 -0
- package/packages/scrabble-solver/src/state/verify/index.ts +4 -0
- package/packages/scrabble-solver/src/state/verify/initialState.ts +19 -0
- package/packages/scrabble-solver/src/state/verify/lib.test.ts +55 -0
- package/packages/scrabble-solver/src/state/verify/lib.ts +49 -0
- package/packages/scrabble-solver/src/state/verify/selectors.ts +46 -0
- package/packages/scrabble-solver/src/state/verify/slice.ts +40 -0
- package/packages/scrabble-solver/src/state/verify/types.ts +14 -0
- package/packages/scrabble-solver/src/styles/_tokens.scss +60 -0
- package/packages/scrabble-solver/src/styles/animations.scss +49 -0
- package/packages/scrabble-solver/src/styles/global.scss +61 -0
- package/packages/scrabble-solver/src/styles/mixins.scss +117 -0
- package/packages/scrabble-solver/src/styles/variables.module.scss +32 -0
- package/packages/scrabble-solver/src/styles/variables.module.scss.d.ts +27 -0
- package/packages/scrabble-solver/src/styles/variables.scss +176 -0
- package/packages/scrabble-solver/src/types/api.ts +21 -0
- package/packages/scrabble-solver/src/types/index.ts +177 -0
- package/packages/scrabble-solver/tsconfig.json +27 -0
- package/packages/scrabble-solver/tsconfig.tsbuildinfo +1 -0
- package/packages/solver/README.md +29 -0
- package/packages/solver/benchmarks/index.ts +15 -0
- package/packages/solver/benchmarks/lib.ts +31 -0
- package/packages/solver/benchmarks/renderChart.ts +165 -0
- package/packages/solver/benchmarks/results/chart.svg +65 -0
- package/packages/solver/benchmarks/runBenchmarks.ts +66 -0
- package/packages/solver/benchmarks/scenarios.ts +64 -0
- package/packages/solver/benchmarks/types.ts +16 -0
- package/packages/solver/benchmarks/updateReadme.ts +53 -0
- package/packages/solver/build/MoveGenerator.d.ts +116 -0
- package/packages/solver/build/MoveGenerator.js +686 -0
- package/packages/solver/build/index.d.ts +1 -0
- package/packages/solver/build/index.js +5 -0
- package/packages/solver/build/solve.d.ts +3 -0
- package/packages/solver/build/solve.js +8 -0
- package/packages/solver/package.json +45 -0
- package/packages/solver/src/MoveGenerator.test.ts +1009 -0
- package/packages/solver/src/MoveGenerator.ts +926 -0
- package/packages/solver/src/ReferenceSolver.ts +401 -0
- package/packages/solver/src/index.ts +1 -0
- package/packages/solver/src/solve.test.ts +225 -0
- package/packages/solver/src/solve.ts +8 -0
- package/packages/solver/tsconfig.json +10 -0
- package/packages/types/README.md +3 -0
- package/packages/types/build/Bingo.d.ts +7 -0
- package/packages/types/build/Bingo.js +2 -0
- package/packages/types/build/Board.d.ts +33 -0
- package/packages/types/build/Board.js +106 -0
- package/packages/types/build/BoardJson.d.ts +2 -0
- package/packages/types/build/BoardJson.js +2 -0
- package/packages/types/build/BoardWord.d.ts +7 -0
- package/packages/types/build/BoardWord.js +2 -0
- package/packages/types/build/Bonus.d.ts +22 -0
- package/packages/types/build/Bonus.js +33 -0
- package/packages/types/build/BonusJson.d.ts +7 -0
- package/packages/types/build/BonusJson.js +2 -0
- package/packages/types/build/BonusValue.d.ts +4 -0
- package/packages/types/build/BonusValue.js +2 -0
- package/packages/types/build/Cell.d.ts +22 -0
- package/packages/types/build/Cell.js +52 -0
- package/packages/types/build/CellJson.d.ts +7 -0
- package/packages/types/build/CellJson.js +2 -0
- package/packages/types/build/CharacterBonus.d.ts +10 -0
- package/packages/types/build/CharacterBonus.js +27 -0
- package/packages/types/build/Collision.d.ts +2 -0
- package/packages/types/build/Collision.js +2 -0
- package/packages/types/build/Config.d.ts +36 -0
- package/packages/types/build/Config.js +105 -0
- package/packages/types/build/ConfigJson.d.ts +18 -0
- package/packages/types/build/ConfigJson.js +2 -0
- package/packages/types/build/Dictionary.d.ts +6 -0
- package/packages/types/build/Dictionary.js +2 -0
- package/packages/types/build/Direction.d.ts +1 -0
- package/packages/types/build/Direction.js +2 -0
- package/packages/types/build/Game.d.ts +11 -0
- package/packages/types/build/Game.js +15 -0
- package/packages/types/build/Locale.d.ts +16 -0
- package/packages/types/build/Locale.js +20 -0
- package/packages/types/build/Result.d.ts +32 -0
- package/packages/types/build/Result.js +61 -0
- package/packages/types/build/ResultJson.d.ts +9 -0
- package/packages/types/build/ResultJson.js +2 -0
- package/packages/types/build/ShowCoordinates.d.ts +5 -0
- package/packages/types/build/ShowCoordinates.js +2 -0
- package/packages/types/build/TextDirection.d.ts +1 -0
- package/packages/types/build/TextDirection.js +2 -0
- package/packages/types/build/Tile.d.ts +15 -0
- package/packages/types/build/Tile.js +46 -0
- package/packages/types/build/TileConfig.d.ts +5 -0
- package/packages/types/build/TileConfig.js +2 -0
- package/packages/types/build/TileJson.d.ts +4 -0
- package/packages/types/build/TileJson.js +2 -0
- package/packages/types/build/WordBonus.d.ts +6 -0
- package/packages/types/build/WordBonus.js +18 -0
- package/packages/types/build/WordDefinition.d.ts +17 -0
- package/packages/types/build/WordDefinition.js +38 -0
- package/packages/types/build/WordDefinitionJson.d.ts +12 -0
- package/packages/types/build/WordDefinitionJson.js +2 -0
- package/packages/types/build/index.d.ts +29 -0
- package/packages/types/build/index.js +38 -0
- package/packages/types/build/lib/getBoardWords.d.ts +3 -0
- package/packages/types/build/lib/getBoardWords.js +10 -0
- package/packages/types/build/lib/getCells.d.ts +4 -0
- package/packages/types/build/lib/getCells.js +27 -0
- package/packages/types/build/lib/getCollidingWords.d.ts +3 -0
- package/packages/types/build/lib/getCollidingWords.js +19 -0
- package/packages/types/build/lib/getCollision.d.ts +3 -0
- package/packages/types/build/lib/getCollision.js +31 -0
- package/packages/types/build/lib/getCollisions.d.ts +3 -0
- package/packages/types/build/lib/getCollisions.js +17 -0
- package/packages/types/build/lib/getPlacedCell.d.ts +3 -0
- package/packages/types/build/lib/getPlacedCell.js +10 -0
- package/packages/types/build/lib/getWordThrough.d.ts +4 -0
- package/packages/types/build/lib/getWordThrough.js +23 -0
- package/packages/types/build/lib/getWordsInRows.d.ts +8 -0
- package/packages/types/build/lib/getWordsInRows.js +29 -0
- package/packages/types/build/lib/index.d.ts +5 -0
- package/packages/types/build/lib/index.js +21 -0
- package/packages/types/build/lib/isSameBoardWord.d.ts +2 -0
- package/packages/types/build/lib/isSameBoardWord.js +6 -0
- package/packages/types/build/lib/toBoardWord.d.ts +4 -0
- package/packages/types/build/lib/toBoardWord.js +11 -0
- package/packages/types/build/lib/transpose.d.ts +1 -0
- package/packages/types/build/lib/transpose.js +16 -0
- package/packages/types/build/type-guards/index.d.ts +10 -0
- package/packages/types/build/type-guards/index.js +23 -0
- package/packages/types/build/type-guards/isBingo.d.ts +2 -0
- package/packages/types/build/type-guards/isBingo.js +9 -0
- package/packages/types/build/type-guards/isBoardJson.d.ts +2 -0
- package/packages/types/build/type-guards/isBoardJson.js +21 -0
- package/packages/types/build/type-guards/isCellJson.d.ts +2 -0
- package/packages/types/build/type-guards/isCellJson.js +13 -0
- package/packages/types/build/type-guards/isError.d.ts +1 -0
- package/packages/types/build/type-guards/isError.js +11 -0
- package/packages/types/build/type-guards/isGame.d.ts +2 -0
- package/packages/types/build/type-guards/isGame.js +7 -0
- package/packages/types/build/type-guards/isLocale.d.ts +2 -0
- package/packages/types/build/type-guards/isLocale.js +7 -0
- package/packages/types/build/type-guards/isMultiplierBingo.d.ts +2 -0
- package/packages/types/build/type-guards/isMultiplierBingo.js +8 -0
- package/packages/types/build/type-guards/isObject.d.ts +1 -0
- package/packages/types/build/type-guards/isObject.js +7 -0
- package/packages/types/build/type-guards/isScoreBingo.d.ts +2 -0
- package/packages/types/build/type-guards/isScoreBingo.js +8 -0
- package/packages/types/build/type-guards/isTileJson.d.ts +2 -0
- package/packages/types/build/type-guards/isTileJson.js +8 -0
- package/packages/types/package.json +37 -0
- package/packages/types/src/Bingo.ts +5 -0
- package/packages/types/src/Board.test.ts +85 -0
- package/packages/types/src/Board.ts +141 -0
- package/packages/types/src/BoardJson.ts +3 -0
- package/packages/types/src/BoardWord.ts +8 -0
- package/packages/types/src/Bonus.ts +50 -0
- package/packages/types/src/BonusJson.ts +7 -0
- package/packages/types/src/BonusValue.ts +4 -0
- package/packages/types/src/Cell.ts +66 -0
- package/packages/types/src/CellJson.ts +8 -0
- package/packages/types/src/CharacterBonus.ts +29 -0
- package/packages/types/src/Collision.ts +3 -0
- package/packages/types/src/Config.ts +152 -0
- package/packages/types/src/ConfigJson.ts +19 -0
- package/packages/types/src/Dictionary.ts +7 -0
- package/packages/types/src/Direction.ts +1 -0
- package/packages/types/src/Game.ts +11 -0
- package/packages/types/src/Locale.ts +16 -0
- package/packages/types/src/Result.ts +118 -0
- package/packages/types/src/ResultJson.ts +9 -0
- package/packages/types/src/ShowCoordinates.ts +5 -0
- package/packages/types/src/TextDirection.ts +1 -0
- package/packages/types/src/Tile.ts +56 -0
- package/packages/types/src/TileConfig.ts +5 -0
- package/packages/types/src/TileJson.ts +4 -0
- package/packages/types/src/WordBonus.ts +15 -0
- package/packages/types/src/WordDefinition.ts +54 -0
- package/packages/types/src/WordDefinitionJson.ts +12 -0
- package/packages/types/src/index.ts +40 -0
- package/packages/types/src/lib/getBoardWords.ts +11 -0
- package/packages/types/src/lib/getCells.test.ts +127 -0
- package/packages/types/src/lib/getCells.ts +31 -0
- package/packages/types/src/lib/getCollidingWords.ts +25 -0
- package/packages/types/src/lib/getCollision.ts +38 -0
- package/packages/types/src/lib/getCollisions.test.ts +82 -0
- package/packages/types/src/lib/getCollisions.ts +22 -0
- package/packages/types/src/lib/getPlacedCell.ts +9 -0
- package/packages/types/src/lib/getWordThrough.ts +30 -0
- package/packages/types/src/lib/getWordsInRows.ts +34 -0
- package/packages/types/src/lib/index.ts +5 -0
- package/packages/types/src/lib/isSameBoardWord.ts +5 -0
- package/packages/types/src/lib/toBoardWord.ts +12 -0
- package/packages/types/src/lib/transpose.ts +15 -0
- package/packages/types/src/type-guards/index.ts +10 -0
- package/packages/types/src/type-guards/isBingo.ts +8 -0
- package/packages/types/src/type-guards/isBoardJson.test.ts +33 -0
- package/packages/types/src/type-guards/isBoardJson.ts +23 -0
- package/packages/types/src/type-guards/isCellJson.ts +14 -0
- package/packages/types/src/type-guards/isError.ts +9 -0
- package/packages/types/src/type-guards/isGame.ts +5 -0
- package/packages/types/src/type-guards/isLocale.ts +5 -0
- package/packages/types/src/type-guards/isMultiplierBingo.ts +7 -0
- package/packages/types/src/type-guards/isObject.ts +3 -0
- package/packages/types/src/type-guards/isScoreBingo.ts +7 -0
- package/packages/types/src/type-guards/isTileJson.ts +7 -0
- package/packages/types/tsconfig.json +10 -0
- package/packages/word-definitions/README.md +3 -0
- package/packages/word-definitions/build/crawl.d.ts +2 -0
- package/packages/word-definitions/build/crawl.js +20 -0
- package/packages/word-definitions/build/getWordDefinition.d.ts +2 -0
- package/packages/word-definitions/build/getWordDefinition.js +13 -0
- package/packages/word-definitions/build/index.d.ts +5 -0
- package/packages/word-definitions/build/index.js +21 -0
- package/packages/word-definitions/build/languages/english.d.ts +3 -0
- package/packages/word-definitions/build/languages/english.js +38 -0
- package/packages/word-definitions/build/languages/french.d.ts +3 -0
- package/packages/word-definitions/build/languages/french.js +22 -0
- package/packages/word-definitions/build/languages/german.d.ts +3 -0
- package/packages/word-definitions/build/languages/german.js +70 -0
- package/packages/word-definitions/build/languages/index.d.ts +8 -0
- package/packages/word-definitions/build/languages/index.js +44 -0
- package/packages/word-definitions/build/languages/persian.d.ts +3 -0
- package/packages/word-definitions/build/languages/persian.js +23 -0
- package/packages/word-definitions/build/languages/polish.d.ts +3 -0
- package/packages/word-definitions/build/languages/polish.js +24 -0
- package/packages/word-definitions/build/languages/romanian.d.ts +3 -0
- package/packages/word-definitions/build/languages/romanian.js +26 -0
- package/packages/word-definitions/build/languages/spanish.d.ts +3 -0
- package/packages/word-definitions/build/languages/spanish.js +39 -0
- package/packages/word-definitions/build/languages/turkish.d.ts +3 -0
- package/packages/word-definitions/build/languages/turkish.js +31 -0
- package/packages/word-definitions/build/lib/index.d.ts +3 -0
- package/packages/word-definitions/build/lib/index.js +9 -0
- package/packages/word-definitions/build/lib/normalizeDefinition.d.ts +1 -0
- package/packages/word-definitions/build/lib/normalizeDefinition.js +46 -0
- package/packages/word-definitions/build/lib/request.d.ts +6 -0
- package/packages/word-definitions/build/lib/request.js +28 -0
- package/packages/word-definitions/build/lib/unique.d.ts +1 -0
- package/packages/word-definitions/build/lib/unique.js +5 -0
- package/packages/word-definitions/build/parse.d.ts +3 -0
- package/packages/word-definitions/build/parse.js +25 -0
- package/packages/word-definitions/build/types.d.ts +4 -0
- package/packages/word-definitions/build/types.js +2 -0
- package/packages/word-definitions/package.json +43 -0
- package/packages/word-definitions/src/__tests__/expected/de-DE.hm.json +4 -0
- package/packages/word-definitions/src/__tests__/expected/de-DE.ho.json +9 -0
- package/packages/word-definitions/src/__tests__/expected/de-DE.kolla.json +4 -0
- package/packages/word-definitions/src/__tests__/expected/de-DE.vom.json +16 -0
- package/packages/word-definitions/src/__tests__/expected/en-US.awe.json +12 -0
- package/packages/word-definitions/src/__tests__/expected/en-US.oe.json +7 -0
- package/packages/word-definitions/src/__tests__/expected/en-US.pawn.json +16 -0
- package/packages/word-definitions/src/__tests__/expected/en-US.pawnee.json +6 -0
- package/packages/word-definitions/src/__tests__/expected/en-US.pean.json +9 -0
- package/packages/word-definitions/src/__tests__/expected/en-US.wiz.json +10 -0
- package/packages/word-definitions/src/__tests__/expected/en-US.zzzzqq.json +4 -0
- package/packages/word-definitions/src/__tests__/expected/es-ES.corma.json +7 -0
- package/packages/word-definitions/src/__tests__/expected/es-ES.portero.json +9 -0
- package/packages/word-definitions/src/__tests__/expected/ro-RO.aciua.json +7 -0
- package/packages/word-definitions/src/__tests__/expected/tr-TR.lojik.json +4 -0
- package/packages/word-definitions/src/__tests__/input/de-DE.hm.html +873 -0
- package/packages/word-definitions/src/__tests__/input/de-DE.ho.html +1144 -0
- package/packages/word-definitions/src/__tests__/input/de-DE.kolla.html +980 -0
- package/packages/word-definitions/src/__tests__/input/de-DE.vom.html +738 -0
- package/packages/word-definitions/src/__tests__/input/en-US.awe.json +1 -0
- package/packages/word-definitions/src/__tests__/input/en-US.oe.json +1 -0
- package/packages/word-definitions/src/__tests__/input/en-US.pawn.json +1 -0
- package/packages/word-definitions/src/__tests__/input/en-US.pawnee.json +1 -0
- package/packages/word-definitions/src/__tests__/input/en-US.pean.json +1 -0
- package/packages/word-definitions/src/__tests__/input/en-US.wiz.json +1 -0
- package/packages/word-definitions/src/__tests__/input/en-US.zzzzqq.json +1 -0
- package/packages/word-definitions/src/__tests__/input/es-ES.corma.html +762 -0
- package/packages/word-definitions/src/__tests__/input/es-ES.portero.html +764 -0
- package/packages/word-definitions/src/__tests__/input/ro-RO.aciua.html +31 -0
- package/packages/word-definitions/src/__tests__/input/tr-TR.lojik.html +1 -0
- package/packages/word-definitions/src/crawl.ts +19 -0
- package/packages/word-definitions/src/getWordDefinition.ts +11 -0
- package/packages/word-definitions/src/index.ts +5 -0
- package/packages/word-definitions/src/languages/english.ts +53 -0
- package/packages/word-definitions/src/languages/french.ts +22 -0
- package/packages/word-definitions/src/languages/german.ts +88 -0
- package/packages/word-definitions/src/languages/index.ts +8 -0
- package/packages/word-definitions/src/languages/persian.ts +24 -0
- package/packages/word-definitions/src/languages/polish.ts +24 -0
- package/packages/word-definitions/src/languages/romanian.ts +27 -0
- package/packages/word-definitions/src/languages/spanish.ts +42 -0
- package/packages/word-definitions/src/languages/turkish.ts +32 -0
- package/packages/word-definitions/src/lib/index.ts +3 -0
- package/packages/word-definitions/src/lib/normalizeDefinition.ts +53 -0
- package/packages/word-definitions/src/lib/request.ts +30 -0
- package/packages/word-definitions/src/lib/unique.ts +1 -0
- package/packages/word-definitions/src/parse.test.ts +41 -0
- package/packages/word-definitions/src/parse.ts +26 -0
- package/packages/word-definitions/src/types.ts +4 -0
- package/packages/word-definitions/tsconfig.json +10 -0
- package/packages/word-lists/README.md +3 -0
- package/packages/word-lists/build/getWordList.d.ts +2 -0
- package/packages/word-lists/build/getWordList.js +18 -0
- package/packages/word-lists/build/index.d.ts +3 -0
- package/packages/word-lists/build/index.js +21 -0
- package/packages/word-lists/build/languages/english.d.ts +2 -0
- package/packages/word-lists/build/languages/english.js +15 -0
- package/packages/word-lists/build/languages/french.d.ts +1 -0
- package/packages/word-lists/build/languages/french.js +11 -0
- package/packages/word-lists/build/languages/german.d.ts +1 -0
- package/packages/word-lists/build/languages/german.js +10 -0
- package/packages/word-lists/build/languages/index.d.ts +8 -0
- package/packages/word-lists/build/languages/index.js +44 -0
- package/packages/word-lists/build/languages/persian.d.ts +1 -0
- package/packages/word-lists/build/languages/persian.js +10 -0
- package/packages/word-lists/build/languages/polish.d.ts +1 -0
- package/packages/word-lists/build/languages/polish.js +56 -0
- package/packages/word-lists/build/languages/romanian.d.ts +1 -0
- package/packages/word-lists/build/languages/romanian.js +11 -0
- package/packages/word-lists/build/languages/spanish.d.ts +1 -0
- package/packages/word-lists/build/languages/spanish.js +11 -0
- package/packages/word-lists/build/languages/turkish.d.ts +1 -0
- package/packages/word-lists/build/languages/turkish.js +10 -0
- package/packages/word-lists/build/lib/downloadFile.d.ts +1 -0
- package/packages/word-lists/build/lib/downloadFile.js +38 -0
- package/packages/word-lists/build/lib/downloadHtml.d.ts +1 -0
- package/packages/word-lists/build/lib/downloadHtml.js +21 -0
- package/packages/word-lists/build/lib/extractWords.d.ts +1 -0
- package/packages/word-lists/build/lib/extractWords.js +17 -0
- package/packages/word-lists/build/lib/findFirstWordIndex.d.ts +1 -0
- package/packages/word-lists/build/lib/findFirstWordIndex.js +17 -0
- package/packages/word-lists/build/lib/getHash.d.ts +1 -0
- package/packages/word-lists/build/lib/getHash.js +9 -0
- package/packages/word-lists/build/lib/getTempFilepath.d.ts +1 -0
- package/packages/word-lists/build/lib/getTempFilepath.js +15 -0
- package/packages/word-lists/build/lib/getTxtWordList.d.ts +1 -0
- package/packages/word-lists/build/lib/getTxtWordList.js +17 -0
- package/packages/word-lists/build/lib/index.d.ts +10 -0
- package/packages/word-lists/build/lib/index.js +23 -0
- package/packages/word-lists/build/lib/transliterateDiacritics.d.ts +2 -0
- package/packages/word-lists/build/lib/transliterateDiacritics.js +9 -0
- package/packages/word-lists/build/lib/unique.d.ts +1 -0
- package/packages/word-lists/build/lib/unique.js +5 -0
- package/packages/word-lists/build/lib/unzip.d.ts +1 -0
- package/packages/word-lists/build/lib/unzip.js +24 -0
- package/packages/word-lists/package.json +45 -0
- package/packages/word-lists/src/getWordList.ts +17 -0
- package/packages/word-lists/src/index.ts +3 -0
- package/packages/word-lists/src/languages/english.ts +16 -0
- package/packages/word-lists/src/languages/french.ts +11 -0
- package/packages/word-lists/src/languages/german.ts +10 -0
- package/packages/word-lists/src/languages/index.ts +8 -0
- package/packages/word-lists/src/languages/persian.ts +10 -0
- package/packages/word-lists/src/languages/polish.ts +59 -0
- package/packages/word-lists/src/languages/romanian.ts +10 -0
- package/packages/word-lists/src/languages/spanish.ts +10 -0
- package/packages/word-lists/src/languages/turkish.ts +9 -0
- package/packages/word-lists/src/lib/downloadFile.ts +37 -0
- package/packages/word-lists/src/lib/downloadHtml.ts +18 -0
- package/packages/word-lists/src/lib/extractWords.ts +17 -0
- package/packages/word-lists/src/lib/findFirstWordIndex.ts +16 -0
- package/packages/word-lists/src/lib/getHash.ts +3 -0
- package/packages/word-lists/src/lib/getTempFilepath.ts +11 -0
- package/packages/word-lists/src/lib/getTxtWordList.ts +12 -0
- package/packages/word-lists/src/lib/index.ts +10 -0
- package/packages/word-lists/src/lib/transliterateDiacritics.ts +7 -0
- package/packages/word-lists/src/lib/unique.ts +1 -0
- package/packages/word-lists/src/lib/unzip.ts +18 -0
- package/packages/word-lists/tsconfig.json +10 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type Result, type ShowCoordinates } from '@scrabble-solver/types';
|
|
2
|
+
|
|
3
|
+
import { createCoordinatesComparator } from '@/lib/createCoordinatesComparator';
|
|
4
|
+
import { createKeyComparator } from '@/lib/createKeyComparator';
|
|
5
|
+
import { createRegExp } from '@/lib/createRegExp';
|
|
6
|
+
import { createSortComparator } from '@/lib/createSortComparator';
|
|
7
|
+
import { getCoordinates as getPointCoordinates } from '@/lib/getCoordinates';
|
|
8
|
+
import { type CellFilter, type ComparatorFactory, type GroupedResults, type Sort, ResultColumnId } from '@/types';
|
|
9
|
+
|
|
10
|
+
export const getCoordinates = (result: Result, showCoordinates: ShowCoordinates): string => {
|
|
11
|
+
const firstCell = result.cells[0];
|
|
12
|
+
return getPointCoordinates({ isHorizontal: result.isHorizontal(), x: firstCell.x, y: firstCell.y }, showCoordinates);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const groupResults = (
|
|
16
|
+
results: Result[] | undefined,
|
|
17
|
+
query: string,
|
|
18
|
+
cellFilters: CellFilter[],
|
|
19
|
+
): GroupedResults | undefined => {
|
|
20
|
+
if (typeof results === 'undefined') {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const regExp = createRegExp(query);
|
|
25
|
+
|
|
26
|
+
const { matching, other } = results.reduce<GroupedResults>(
|
|
27
|
+
(groupedResults, result) => {
|
|
28
|
+
const matchesQuery = () => Boolean(result.word.match(regExp));
|
|
29
|
+
|
|
30
|
+
if (resultMatchesCellFilter(result, cellFilters) && matchesQuery()) {
|
|
31
|
+
groupedResults.matching.push(result);
|
|
32
|
+
} else {
|
|
33
|
+
groupedResults.other.push(result);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return groupedResults;
|
|
37
|
+
},
|
|
38
|
+
{ matching: [], other: [] },
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
return { matching, other };
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const resultMatchesCellFilter = (result: Result, cellFilters: CellFilter[]): boolean => {
|
|
45
|
+
const excludeFilters = cellFilters.filter((filter) => filter.type === 'exclude');
|
|
46
|
+
const matchesExcludeFilters = excludeFilters.every(({ x, y }) => {
|
|
47
|
+
return result.cells.every((cell) => cell.x !== x || cell.y !== y);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
if (!matchesExcludeFilters) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const includeFilter = cellFilters.filter((filter) => filter.type === 'include');
|
|
55
|
+
const matchesIncludeFilters = includeFilter.every(({ x, y }) => {
|
|
56
|
+
return result.cells.some((cell) => cell.x === x && cell.y === y);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return matchesExcludeFilters && matchesIncludeFilters;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const comparators: Record<ResultColumnId, ComparatorFactory<Result>> = {
|
|
63
|
+
[ResultColumnId.BlanksCount]: (locale: string) => createKeyComparator('blanksCount', locale),
|
|
64
|
+
[ResultColumnId.ConsonantsCount]: (locale: string) => createKeyComparator('consonantsCount', locale),
|
|
65
|
+
[ResultColumnId.Coordinates]: (locale: string, showCoordinates: ShowCoordinates) => {
|
|
66
|
+
return createCoordinatesComparator({ getItemCoordinates: getCoordinates, locale, showCoordinates });
|
|
67
|
+
},
|
|
68
|
+
[ResultColumnId.Points]: (locale: string) => createKeyComparator('points', locale),
|
|
69
|
+
[ResultColumnId.TilesCount]: (locale: string) => createKeyComparator('tilesCount', locale),
|
|
70
|
+
[ResultColumnId.VowelsCount]: (locale: string) => createKeyComparator('vowelsCount', locale),
|
|
71
|
+
[ResultColumnId.Word]: (locale: string) => createKeyComparator('word', locale),
|
|
72
|
+
[ResultColumnId.WordsCount]: (locale: string) => createKeyComparator('wordsCount', locale),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const sortResults = (
|
|
76
|
+
results: Result[] | undefined,
|
|
77
|
+
sort: Sort,
|
|
78
|
+
locale: string,
|
|
79
|
+
showCoordinates: ShowCoordinates,
|
|
80
|
+
): Result[] | undefined => {
|
|
81
|
+
if (typeof results === 'undefined') {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return [...results].sort(createSortComparator({ comparators, locale, showCoordinates, sort }));
|
|
86
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { createSelector } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
3
|
+
import { createRegExp } from '@/lib/createRegExp';
|
|
4
|
+
|
|
5
|
+
import { selectCellFilters } from '../cellFilters';
|
|
6
|
+
import { selectLocale, selectShowCoordinates } from '../settings';
|
|
7
|
+
import type { RootState } from '../types';
|
|
8
|
+
|
|
9
|
+
import { getCoordinates, groupResults, resultMatchesCellFilter, sortResults } from './lib';
|
|
10
|
+
|
|
11
|
+
const selectResultIndex = (_: unknown, index: number): number => index;
|
|
12
|
+
|
|
13
|
+
export const selectResults = (state: RootState) => state.results;
|
|
14
|
+
|
|
15
|
+
export const selectResultCandidate = createSelector([selectResults], (results) => results.candidate);
|
|
16
|
+
|
|
17
|
+
export const selectResultsQuery = createSelector([selectResults], (results) => results.query);
|
|
18
|
+
|
|
19
|
+
export const selectResultsResults = createSelector([selectResults], (results) => results.results);
|
|
20
|
+
|
|
21
|
+
export const selectResultsSort = createSelector([selectResults], (results) => results.sort);
|
|
22
|
+
|
|
23
|
+
export const selectResultCandidateCells = createSelector(
|
|
24
|
+
[selectResultCandidate],
|
|
25
|
+
(resultCandidate) => resultCandidate?.cells ?? [],
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const selectResultCandidateTiles = createSelector(
|
|
29
|
+
[selectResultCandidate],
|
|
30
|
+
(resultCandidate) => resultCandidate?.tiles ?? [],
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const selectSortedResults = createSelector(
|
|
34
|
+
[selectResultsResults, selectResultsSort, selectLocale, selectShowCoordinates],
|
|
35
|
+
sortResults,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const selectGroupedSortedResults = createSelector(
|
|
39
|
+
[selectSortedResults, selectResultsQuery, selectCellFilters],
|
|
40
|
+
groupResults,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export const selectProcessedResults = createSelector([selectGroupedSortedResults], (results) => {
|
|
44
|
+
return results ? [...results.matching, ...results.other] : undefined;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const selectResultCandidateIndex = createSelector(
|
|
48
|
+
[selectProcessedResults, selectResultCandidate],
|
|
49
|
+
(results, candidate) => {
|
|
50
|
+
const index = results && candidate ? results.findIndex((result) => result.id === candidate.id) : -1;
|
|
51
|
+
return index === -1 ? undefined : index;
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
export const selectIsResultMatching = createSelector(
|
|
56
|
+
[selectProcessedResults, selectResultsQuery, selectCellFilters, selectResultIndex],
|
|
57
|
+
(results, query, cellFilters, index) => {
|
|
58
|
+
if (!results) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const result = results[index];
|
|
63
|
+
const regExp = createRegExp(query);
|
|
64
|
+
|
|
65
|
+
if (!regExp.test(result.word)) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return resultMatchesCellFilter(result, cellFilters);
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
export const selectResultCoordinates = createSelector(
|
|
74
|
+
[selectProcessedResults, selectShowCoordinates, selectResultIndex],
|
|
75
|
+
(results, showCoordinates, index) => {
|
|
76
|
+
if (!results) {
|
|
77
|
+
return '';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const result = results[index];
|
|
81
|
+
return getCoordinates(result, showCoordinates);
|
|
82
|
+
},
|
|
83
|
+
);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type PayloadAction, createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import { type Result } from '@scrabble-solver/types';
|
|
3
|
+
|
|
4
|
+
import { getNextSort } from '@/lib/getNextSort';
|
|
5
|
+
import { type ResultColumnId } from '@/types';
|
|
6
|
+
|
|
7
|
+
import { resultsInitialState } from './initialState';
|
|
8
|
+
|
|
9
|
+
export const resultsSlice = createSlice({
|
|
10
|
+
initialState: resultsInitialState,
|
|
11
|
+
name: 'results',
|
|
12
|
+
reducers: {
|
|
13
|
+
applyResult: (_state, _action: PayloadAction<Result>) => {
|
|
14
|
+
return resultsInitialState;
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
changeQuery: (state, action: PayloadAction<string>) => {
|
|
18
|
+
const newQuery = action.payload;
|
|
19
|
+
return { ...state, query: newQuery };
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
changeResultCandidate: (state, action: PayloadAction<Result | null>) => {
|
|
23
|
+
const candidate = action.payload;
|
|
24
|
+
return candidate === state.candidate ? state : { ...state, candidate };
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
changeResults: (state, action: PayloadAction<Result[]>) => {
|
|
28
|
+
const newResults = action.payload;
|
|
29
|
+
return {
|
|
30
|
+
...state,
|
|
31
|
+
candidate: resultsInitialState.candidate,
|
|
32
|
+
query: resultsInitialState.query,
|
|
33
|
+
results: newResults,
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
sort: (state, action: PayloadAction<ResultColumnId>) => {
|
|
38
|
+
return { ...state, sort: getNextSort(state.sort, action.payload) };
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
reset: () => resultsInitialState,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
5
|
+
|
|
6
|
+
import { type PayloadAction } from '@reduxjs/toolkit';
|
|
7
|
+
import { hasConfig, languages } from '@scrabble-solver/configs';
|
|
8
|
+
import { type Result, Board, Locale } from '@scrabble-solver/types';
|
|
9
|
+
import { call, delay, put, select, spawn, takeEvery, takeLatest } from 'redux-saga/effects';
|
|
10
|
+
|
|
11
|
+
import { LOCALE_FEATURES } from '@/i18n/constants';
|
|
12
|
+
import { loadTranslations } from '@/i18n/i18n';
|
|
13
|
+
import { memoize } from '@/lib/memoize';
|
|
14
|
+
import { waitForFirstIntent, waitForIdleOrFirstIntent } from '@/lib/waitForIdleOrFirstIntent';
|
|
15
|
+
import { findWordDefinitions, solve, verify, visit } from '@/sdk';
|
|
16
|
+
import { prefetchDictionary } from '@/solver-worker';
|
|
17
|
+
import { type VerifiedWord } from '@/types';
|
|
18
|
+
|
|
19
|
+
import { initialize, reset } from './actions';
|
|
20
|
+
import { appSlice, selectVersion } from './app';
|
|
21
|
+
import { boardSlice, selectBoard } from './board';
|
|
22
|
+
import { cellFiltersSlice, selectCellFilter } from './cellFilters';
|
|
23
|
+
import { dictionarySlice, selectDictionary } from './dictionary';
|
|
24
|
+
import { hoveredWordSlice } from './hoveredWord';
|
|
25
|
+
import { i18nSlice, selectLoadedTranslations } from './i18n';
|
|
26
|
+
import { localStorage } from './localStorage';
|
|
27
|
+
import { rackSlice, selectCharacters, selectRack } from './rack';
|
|
28
|
+
import { resultsSlice } from './results';
|
|
29
|
+
import {
|
|
30
|
+
type SettingsState,
|
|
31
|
+
selectConfig,
|
|
32
|
+
selectGame,
|
|
33
|
+
selectLocale,
|
|
34
|
+
selectLocaleAutoGroupTiles,
|
|
35
|
+
selectRemoveCellFilters,
|
|
36
|
+
settingsInitialState,
|
|
37
|
+
settingsSlice,
|
|
38
|
+
} from './settings';
|
|
39
|
+
import { guessLocale } from './settings/lib';
|
|
40
|
+
import { solveSlice } from './solve';
|
|
41
|
+
import { verifySlice } from './verify';
|
|
42
|
+
|
|
43
|
+
const SUBMIT_DELAY = 150;
|
|
44
|
+
|
|
45
|
+
const memoizedFindWordDefinitions = memoize(findWordDefinitions);
|
|
46
|
+
|
|
47
|
+
// Can't conveniently type generators for sagas yet,
|
|
48
|
+
// see: https://github.com/microsoft/TypeScript/issues/43632
|
|
49
|
+
type AnyGenerator = Generator<any, any, any>;
|
|
50
|
+
|
|
51
|
+
export function* rootSaga(): AnyGenerator {
|
|
52
|
+
yield takeEvery(boardSlice.actions.changeCellValue.type, onCellValueChange);
|
|
53
|
+
yield takeEvery([rackSlice.actions.changeCharacter.type, rackSlice.actions.changeCharacters.type], onRackValueChange);
|
|
54
|
+
yield takeEvery(resultsSlice.actions.applyResult.type, onApplyResult);
|
|
55
|
+
yield takeLatest(resultsSlice.actions.changeResultCandidate.type, onResultCandidateChange);
|
|
56
|
+
yield takeLatest([hoveredWordSlice.actions.set.type, hoveredWordSlice.actions.clear.type], onHoveredWordChange);
|
|
57
|
+
yield takeEvery(settingsSlice.actions.changeGame.type, onGameChange);
|
|
58
|
+
yield takeEvery(settingsSlice.actions.changeLocale.type, onLocaleChange);
|
|
59
|
+
yield takeLatest(dictionarySlice.actions.submit.type, onDictionarySubmit);
|
|
60
|
+
yield takeLatest(initialize.type, onInitialize);
|
|
61
|
+
yield takeLatest(reset.type, onReset);
|
|
62
|
+
yield takeLatest(solveSlice.actions.submit.type, onSolve);
|
|
63
|
+
yield takeLatest(verifySlice.actions.submit.type, onVerify);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function* onCellValueChange({ payload }: PayloadAction<{ value: string; x: number; y: number }>): AnyGenerator {
|
|
67
|
+
const filter = yield select((state) => selectCellFilter(state, payload));
|
|
68
|
+
|
|
69
|
+
if (filter) {
|
|
70
|
+
yield put(cellFiltersSlice.actions.cancel(payload));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
yield put(resultsSlice.actions.changeResultCandidate(null));
|
|
74
|
+
yield put(hoveredWordSlice.actions.clear());
|
|
75
|
+
yield put(verifySlice.actions.submit());
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function* onRackValueChange(): AnyGenerator {
|
|
79
|
+
yield put(resultsSlice.actions.changeResultCandidate(null));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function* onApplyResult({ payload: result }: PayloadAction<Result>): AnyGenerator {
|
|
83
|
+
const autoGroupTiles = yield select(selectLocaleAutoGroupTiles);
|
|
84
|
+
const removeCellFilters = yield select(selectRemoveCellFilters);
|
|
85
|
+
yield put(boardSlice.actions.applyResult(result));
|
|
86
|
+
if (removeCellFilters === 'never') {
|
|
87
|
+
yield put(cellFiltersSlice.actions.removeCells(result.cells));
|
|
88
|
+
} else {
|
|
89
|
+
yield put(cellFiltersSlice.actions.reset());
|
|
90
|
+
}
|
|
91
|
+
yield put(rackSlice.actions.removeTiles(result.tiles));
|
|
92
|
+
yield put(rackSlice.actions.groupTiles(autoGroupTiles));
|
|
93
|
+
yield put(verifySlice.actions.submit());
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function* onGameChange(): AnyGenerator {
|
|
97
|
+
const characters = yield select(selectCharacters);
|
|
98
|
+
|
|
99
|
+
if (characters.length > 0) {
|
|
100
|
+
yield put(solveSlice.actions.submit());
|
|
101
|
+
} else {
|
|
102
|
+
yield put(resultsSlice.actions.reset());
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
yield put(resultsSlice.actions.reset());
|
|
106
|
+
yield put(hoveredWordSlice.actions.clear());
|
|
107
|
+
yield* resetRack();
|
|
108
|
+
yield put(verifySlice.actions.submit());
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function* onDictionarySubmit(): AnyGenerator {
|
|
112
|
+
const { input: word } = yield select(selectDictionary);
|
|
113
|
+
const locale = yield select(selectLocale);
|
|
114
|
+
|
|
115
|
+
if (!memoizedFindWordDefinitions.hasCache(locale, word)) {
|
|
116
|
+
yield delay(SUBMIT_DELAY);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
const wordDefinitions = yield call(memoizedFindWordDefinitions, locale, word);
|
|
121
|
+
const { input: currentWord } = yield select(selectDictionary);
|
|
122
|
+
|
|
123
|
+
if (word === currentWord) {
|
|
124
|
+
yield put(dictionarySlice.actions.submitSuccess(wordDefinitions));
|
|
125
|
+
}
|
|
126
|
+
} catch (error) {
|
|
127
|
+
const { input: currentWord } = yield select(selectDictionary);
|
|
128
|
+
|
|
129
|
+
if (word === currentWord) {
|
|
130
|
+
yield put(dictionarySlice.actions.submitFailure(error));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function* onInitialize({ payload }: PayloadAction<{ version: string }>): AnyGenerator {
|
|
136
|
+
try {
|
|
137
|
+
yield* hydratePersistedState(payload.version);
|
|
138
|
+
// oxlint-disable-next-line no-empty
|
|
139
|
+
} catch {
|
|
140
|
+
} finally {
|
|
141
|
+
yield put(appSlice.actions.hydrated());
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const board = yield select(selectBoard);
|
|
145
|
+
const locale = yield select(selectLocale);
|
|
146
|
+
|
|
147
|
+
yield spawn(prefetchDictionaryOnFirstIntent);
|
|
148
|
+
yield spawn(loadLocaleTranslations, locale);
|
|
149
|
+
yield spawn(preloadTranslationsWhenIdle);
|
|
150
|
+
yield spawn(visitWhenIdle);
|
|
151
|
+
|
|
152
|
+
if (!board.isEmpty()) {
|
|
153
|
+
yield* resetRack();
|
|
154
|
+
yield put(verifySlice.actions.submit());
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function* hydratePersistedState(version: string): AnyGenerator {
|
|
159
|
+
const isTouchScreen = globalThis.matchMedia?.('(hover: none)').matches ?? false;
|
|
160
|
+
const settings: Pick<SettingsState, 'game' | 'inputMode' | 'locale'> & Partial<SettingsState> = {
|
|
161
|
+
game: settingsInitialState.game,
|
|
162
|
+
inputMode: isTouchScreen ? ('touchscreen' as const) : ('keyboard' as const),
|
|
163
|
+
locale: guessLocale(),
|
|
164
|
+
...localStorage.getSettings(),
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
if (!hasConfig(settings.game, settings.locale)) {
|
|
168
|
+
const localeDefault = Object.values(languages).find((config) => config.locale === settings.locale);
|
|
169
|
+
settings.game = localeDefault?.game ?? settingsInitialState.game;
|
|
170
|
+
settings.locale = localeDefault?.locale ?? guessLocale();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
yield put(settingsSlice.actions.init(settings));
|
|
174
|
+
yield* hydratePersistedTranslations(settings.locale, version);
|
|
175
|
+
|
|
176
|
+
const config = yield select(selectConfig);
|
|
177
|
+
const currentBoard: Board = yield select(selectBoard);
|
|
178
|
+
const board = localStorage.getBoard();
|
|
179
|
+
|
|
180
|
+
if (board) {
|
|
181
|
+
yield put(boardSlice.actions.init(board));
|
|
182
|
+
} else if (currentBoard.rows.length !== config.boardHeight || currentBoard.rows[0].length !== config.boardWidth) {
|
|
183
|
+
yield put(boardSlice.actions.init(Board.create(config.boardWidth, config.boardHeight)));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const currentRack = yield select(selectRack);
|
|
187
|
+
const rack = localStorage.getRack();
|
|
188
|
+
|
|
189
|
+
if (rack) {
|
|
190
|
+
yield put(rackSlice.actions.init(rack));
|
|
191
|
+
} else if (currentRack.length !== config.rackSize) {
|
|
192
|
+
yield put(rackSlice.actions.init(Array(config.rackSize).fill(null)));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Applied synchronously so the first post-hydration paint is already translated
|
|
197
|
+
function* hydratePersistedTranslations(locale: Locale, version: string): AnyGenerator {
|
|
198
|
+
const translations = localStorage.getTranslations(locale, version);
|
|
199
|
+
|
|
200
|
+
if (translations) {
|
|
201
|
+
yield put(i18nSlice.actions.loaded({ locale, translations }));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function* visitWhenIdle(): AnyGenerator {
|
|
206
|
+
yield call(waitForIdleOrFirstIntent);
|
|
207
|
+
const locale = yield select(selectLocale);
|
|
208
|
+
const game = yield select(selectGame);
|
|
209
|
+
|
|
210
|
+
try {
|
|
211
|
+
yield call(visit, { game, locale, referrer: document.referrer, url: location.href });
|
|
212
|
+
// oxlint-disable-next-line no-empty
|
|
213
|
+
} catch {}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function* prefetchDictionaryOnFirstIntent(): AnyGenerator {
|
|
217
|
+
yield call(waitForFirstIntent);
|
|
218
|
+
const locale = yield select(selectLocale);
|
|
219
|
+
yield call(prefetchDictionary, locale);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function* loadLocaleTranslations(locale: Locale): AnyGenerator {
|
|
223
|
+
const loaded = yield select(selectLoadedTranslations);
|
|
224
|
+
|
|
225
|
+
if (loaded[locale]) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const translations = yield call(loadTranslations, locale);
|
|
230
|
+
yield put(i18nSlice.actions.loaded({ locale, translations }));
|
|
231
|
+
|
|
232
|
+
const activeLocale = yield select(selectLocale);
|
|
233
|
+
|
|
234
|
+
if (locale === activeLocale) {
|
|
235
|
+
const version = yield select(selectVersion);
|
|
236
|
+
localStorage.setTranslations(locale, version, translations);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// The cache makes the next boot's first paint translated without waiting for a chunk download
|
|
241
|
+
function* persistTranslationsCache(locale: Locale): AnyGenerator {
|
|
242
|
+
const loaded = yield select(selectLoadedTranslations);
|
|
243
|
+
const version = yield select(selectVersion);
|
|
244
|
+
|
|
245
|
+
if (loaded[locale]) {
|
|
246
|
+
localStorage.setTranslations(locale, version, loaded[locale]);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function* preloadTranslationsWhenIdle(): AnyGenerator {
|
|
251
|
+
yield call(waitForIdleOrFirstIntent);
|
|
252
|
+
|
|
253
|
+
for (const locale of Object.values(Locale)) {
|
|
254
|
+
yield spawn(loadLocaleTranslations, locale);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function* onReset(): AnyGenerator {
|
|
259
|
+
const config = yield select(selectConfig);
|
|
260
|
+
|
|
261
|
+
yield put(boardSlice.actions.init(Board.create(config.boardWidth, config.boardHeight)));
|
|
262
|
+
yield put(cellFiltersSlice.actions.reset());
|
|
263
|
+
yield put(dictionarySlice.actions.reset());
|
|
264
|
+
yield put(hoveredWordSlice.actions.clear());
|
|
265
|
+
yield put(rackSlice.actions.reset());
|
|
266
|
+
yield put(resultsSlice.actions.reset());
|
|
267
|
+
yield put(solveSlice.actions.reset());
|
|
268
|
+
yield put(verifySlice.actions.submit());
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function* onLocaleChange({ payload: locale }: PayloadAction<Locale>): AnyGenerator {
|
|
272
|
+
yield spawn(loadLocaleTranslations, locale);
|
|
273
|
+
yield spawn(prefetchDictionary, locale);
|
|
274
|
+
yield* persistTranslationsCache(locale);
|
|
275
|
+
|
|
276
|
+
const game = yield select(selectGame);
|
|
277
|
+
|
|
278
|
+
if (!hasConfig(game, locale)) {
|
|
279
|
+
const defaultConfig = Object.values(languages).find((config) => config.locale === locale);
|
|
280
|
+
|
|
281
|
+
if (defaultConfig) {
|
|
282
|
+
yield put(settingsSlice.actions.changeGame(defaultConfig.game));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const characters = yield select(selectCharacters);
|
|
287
|
+
|
|
288
|
+
if (characters.length > 0) {
|
|
289
|
+
yield put(solveSlice.actions.submit());
|
|
290
|
+
} else {
|
|
291
|
+
yield put(resultsSlice.actions.reset());
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
yield put(dictionarySlice.actions.reset());
|
|
295
|
+
yield put(hoveredWordSlice.actions.clear());
|
|
296
|
+
yield put(resultsSlice.actions.changeResultCandidate(null));
|
|
297
|
+
yield put(verifySlice.actions.submit());
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function* onResultCandidateChange({ payload: result }: PayloadAction<Result | null>): AnyGenerator {
|
|
301
|
+
if (!result) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
yield put(hoveredWordSlice.actions.clear());
|
|
306
|
+
yield* searchDictionary(result.words);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function* onHoveredWordChange({ payload: word }: PayloadAction<VerifiedWord | undefined>): AnyGenerator {
|
|
310
|
+
if (!word) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
yield put(resultsSlice.actions.changeResultCandidate(null));
|
|
315
|
+
|
|
316
|
+
const board: Board = yield select(selectBoard);
|
|
317
|
+
const collidingWords = board.getCollidingWords(word);
|
|
318
|
+
|
|
319
|
+
yield* searchDictionary([word.word, ...collidingWords.map((collidingWord) => collidingWord.word)]);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function* searchDictionary(words: string[]): AnyGenerator {
|
|
323
|
+
const locale: Locale = yield select(selectLocale);
|
|
324
|
+
const uniqueWords = Array.from(new Set(words));
|
|
325
|
+
const input = uniqueWords.join(LOCALE_FEATURES[locale].separator);
|
|
326
|
+
|
|
327
|
+
if (!memoizedFindWordDefinitions.hasCache(locale, input)) {
|
|
328
|
+
yield delay(SUBMIT_DELAY);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
yield put(dictionarySlice.actions.changeInput(input));
|
|
332
|
+
yield put(dictionarySlice.actions.submit());
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function* onSolve(): AnyGenerator {
|
|
336
|
+
const board = yield select(selectBoard);
|
|
337
|
+
const { config } = yield select(selectConfig);
|
|
338
|
+
const locale = yield select(selectLocale);
|
|
339
|
+
const characters = yield select(selectCharacters);
|
|
340
|
+
|
|
341
|
+
if (characters.length === 0) {
|
|
342
|
+
yield put(solveSlice.actions.submitSuccess({ board, characters }));
|
|
343
|
+
yield put(resultsSlice.actions.changeResults([]));
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
try {
|
|
348
|
+
const results = yield call(solve, {
|
|
349
|
+
board: board.toJson(),
|
|
350
|
+
characters,
|
|
351
|
+
game: config.game,
|
|
352
|
+
locale,
|
|
353
|
+
});
|
|
354
|
+
yield put(resultsSlice.actions.changeResults(results));
|
|
355
|
+
yield put(solveSlice.actions.submitSuccess({ board, characters }));
|
|
356
|
+
} catch (error) {
|
|
357
|
+
yield put(resultsSlice.actions.changeResults([]));
|
|
358
|
+
yield put(solveSlice.actions.submitFailure(error));
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function* onVerify(): AnyGenerator {
|
|
363
|
+
yield delay(SUBMIT_DELAY);
|
|
364
|
+
|
|
365
|
+
const board = yield select(selectBoard);
|
|
366
|
+
const { config } = yield select(selectConfig);
|
|
367
|
+
const locale = yield select(selectLocale);
|
|
368
|
+
|
|
369
|
+
try {
|
|
370
|
+
const { invalidWords, validWords } = yield call(verify, {
|
|
371
|
+
board: board.toJson(),
|
|
372
|
+
game: config.game,
|
|
373
|
+
locale,
|
|
374
|
+
});
|
|
375
|
+
yield put(verifySlice.actions.submitSuccess({ board, invalidWords, validWords }));
|
|
376
|
+
} catch (_error) {
|
|
377
|
+
yield put(verifySlice.actions.submitFailure());
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function* resetRack(): AnyGenerator {
|
|
382
|
+
const { config } = yield select(selectConfig);
|
|
383
|
+
const rack = yield select(selectRack);
|
|
384
|
+
|
|
385
|
+
if (config.rackSize > rack.length) {
|
|
386
|
+
const differenceCount = Math.abs(config.rackSize - rack.length);
|
|
387
|
+
yield put(rackSlice.actions.init([...rack, ...Array(differenceCount).fill(null)]));
|
|
388
|
+
} else if (config.rackSize < rack.length) {
|
|
389
|
+
const nonNulls = rack.filter(Boolean).slice(0, config.rackSize);
|
|
390
|
+
const differenceCount = Math.abs(config.rackSize - nonNulls.length);
|
|
391
|
+
const autoGroupTiles = yield select(selectLocaleAutoGroupTiles);
|
|
392
|
+
yield put(rackSlice.actions.init([...nonNulls, ...Array(differenceCount).fill(null)]));
|
|
393
|
+
yield put(rackSlice.actions.groupTiles(autoGroupTiles));
|
|
394
|
+
}
|
|
395
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createSelector } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
3
|
+
import { unorderedArraysEqual } from '@/lib/unorderedArraysEqual';
|
|
4
|
+
|
|
5
|
+
import { selectBoard } from './board';
|
|
6
|
+
import { selectHoveredWord } from './hoveredWord';
|
|
7
|
+
import { getRemainingTiles } from './lib';
|
|
8
|
+
import { selectCharacters } from './rack';
|
|
9
|
+
import { selectResultsResults } from './results';
|
|
10
|
+
import { selectConfig, selectLocale } from './settings';
|
|
11
|
+
import { selectLastSolvedParameters, selectSolveError } from './solve';
|
|
12
|
+
import { selectLastVerifiedBoard } from './verify';
|
|
13
|
+
|
|
14
|
+
const selectHasBoardChanged = createSelector(
|
|
15
|
+
[selectLastSolvedParameters, selectBoard],
|
|
16
|
+
(lastSolvedParameters, board) => {
|
|
17
|
+
return !lastSolvedParameters.board.equals(board);
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const selectHaveCharactersChanged = createSelector(
|
|
22
|
+
[selectLastSolvedParameters, selectCharacters, selectLocale],
|
|
23
|
+
(lastSolvedParameters, characters, locale) => {
|
|
24
|
+
return !unorderedArraysEqual(lastSolvedParameters.characters, characters, locale);
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const selectAreResultsOutdated = createSelector(
|
|
29
|
+
[selectHasBoardChanged, selectHaveCharactersChanged],
|
|
30
|
+
(hasBoardChanged, haveCharactersChanged) => {
|
|
31
|
+
return hasBoardChanged || haveCharactersChanged;
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const selectUpToDateResults = createSelector(
|
|
36
|
+
[selectResultsResults, selectAreResultsOutdated, selectSolveError],
|
|
37
|
+
(results, areResultsOutdated, solveError) => {
|
|
38
|
+
return results && !areResultsOutdated && !solveError ? results : null;
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export const selectUpToDateHoveredWord = createSelector(
|
|
43
|
+
[selectHoveredWord, selectLastVerifiedBoard, selectBoard],
|
|
44
|
+
(hoveredWord, lastVerifiedBoard, board) => {
|
|
45
|
+
return hoveredWord && lastVerifiedBoard.equals(board) ? hoveredWord : null;
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
export const selectRemainingTiles = createSelector(
|
|
50
|
+
[selectConfig, selectBoard, selectCharacters, selectLocale],
|
|
51
|
+
getRemainingTiles,
|
|
52
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Game, Locale } from '@scrabble-solver/types';
|
|
2
|
+
|
|
3
|
+
import type { SettingsState } from './types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Deterministic defaults shared by the server render and the client's hydration render.
|
|
7
|
+
*/
|
|
8
|
+
export const settingsInitialState: SettingsState = {
|
|
9
|
+
autoGroupTiles: null,
|
|
10
|
+
game: Game.Scrabble,
|
|
11
|
+
highlightUnreachableCells: false,
|
|
12
|
+
inputMode: 'keyboard',
|
|
13
|
+
locale: Locale.EN_US,
|
|
14
|
+
removeCellFilters: 'always',
|
|
15
|
+
showCoordinates: 'original',
|
|
16
|
+
};
|