@scrabble-solver/scrabble-solver 2.15.24 → 2.16.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +9 -9
  3. package/.next/cache/.previewinfo +1 -1
  4. package/.next/cache/.rscinfo +1 -1
  5. package/.next/cache/.tsbuildinfo +1 -1
  6. package/.next/cache/webpack/client-production/0.pack +0 -0
  7. package/.next/cache/webpack/client-production/index.pack +0 -0
  8. package/.next/cache/webpack/client-production/index.pack.old +0 -0
  9. package/.next/cache/webpack/edge-server-production/index.pack +0 -0
  10. package/.next/cache/webpack/edge-server-production/index.pack.old +0 -0
  11. package/.next/cache/webpack/server-production/0.pack +0 -0
  12. package/.next/cache/webpack/server-production/index.pack +0 -0
  13. package/.next/cache/webpack/server-production/index.pack.old +0 -0
  14. package/.next/diagnostics/framework.json +1 -1
  15. package/.next/prerender-manifest.json +4 -4
  16. package/.next/required-server-files.js +2 -1
  17. package/.next/required-server-files.json +2 -1
  18. package/.next/routes-manifest.json +1 -1
  19. package/.next/server/chunks/30.js +1 -1
  20. package/.next/server/chunks/712.js +1 -1
  21. package/.next/server/middleware-build-manifest.js +1 -1
  22. package/.next/server/pages/404.html +1 -1
  23. package/.next/server/pages/500.html +1 -1
  24. package/.next/server/pages/_app.js.nft.json +1 -1
  25. package/.next/server/pages/_error.js.nft.json +1 -1
  26. package/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
  27. package/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
  28. package/.next/server/pages/api/solve.js +1 -1
  29. package/.next/server/pages/api/solve.js.nft.json +1 -1
  30. package/.next/server/pages/api/verify.js.nft.json +1 -1
  31. package/.next/server/pages/api/visit.js.nft.json +1 -1
  32. package/.next/server/pages/index.html +1 -1
  33. package/.next/server/pages/index.js.nft.json +1 -1
  34. package/.next/server/pages/index.json +1 -1
  35. package/.next/server/pages/not-found.html +1 -1
  36. package/.next/server/webpack-api-runtime.js +1 -1
  37. package/.next/static/{f_g0t0jBAscXxDrNYOuV0 → HFiEUpdZIGYd_XKb5mCLZ}/_buildManifest.js +1 -1
  38. package/.next/static/chunks/{main-ca07941c8a544c9a.js → main-65a5015b46ca9827.js} +1 -1
  39. package/.next/static/chunks/pages/{_app-369e5cb907606ad4.js → _app-9c9aaea7b6881765.js} +4 -4
  40. package/.next/static/chunks/pages/{index-08b3b0a754095919.js → index-e9ea63e97865edcf.js} +1 -1
  41. package/.next/static/css/{500cdc9a24075d91.css → 78726ae7cf7a5497.css} +1 -1
  42. package/.next/trace +21 -21
  43. package/.next/trace-build +1 -1
  44. package/README.md +3 -3
  45. package/next.config.js +1 -0
  46. package/package.json +12 -11
  47. package/src/@types/scss.d.ts +5 -0
  48. package/src/components/Board/Board.module.scss +2 -2
  49. package/src/components/Board/components/Actions/Actions.module.scss +1 -1
  50. package/src/components/Board/components/Cell/Cell.module.scss +26 -6
  51. package/src/components/Board/components/InputPrompt/InputPrompt.module.scss +1 -1
  52. package/src/components/Button/Button.module.scss +1 -1
  53. package/src/components/Dictionary/Dictionary.module.scss +1 -1
  54. package/src/components/DictionaryInput/DictionaryInput.module.scss +1 -1
  55. package/src/components/IconButton/IconButton.module.scss +1 -1
  56. package/src/components/Loading/Loading.module.scss +1 -1
  57. package/src/components/Modal/Modal.module.scss +1 -1
  58. package/src/components/Modal/Modal.tsx +0 -1
  59. package/src/components/NotFound/NotFound.module.scss +1 -1
  60. package/src/components/PlainTiles/PlainTiles.module.scss +1 -1
  61. package/src/components/Rack/Rack.module.scss +11 -6
  62. package/src/components/Rack/components/InputPrompt/InputPrompt.module.scss +1 -1
  63. package/src/components/Rack/components/RackTile/RackTile.module.scss +1 -1
  64. package/src/components/Radio/Radio.module.scss +1 -1
  65. package/src/components/Results/Results.module.scss +1 -1
  66. package/src/components/ResultsInput/ResultsInput.module.scss +1 -1
  67. package/src/components/Solver/Solver.module.scss +1 -1
  68. package/src/components/Solver/components/InsertButton/InsertButton.module.scss +1 -1
  69. package/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.module.scss +1 -1
  70. package/src/components/Spinner/Spinner.module.scss +1 -1
  71. package/src/components/Tile/Tile.module.scss +1 -1
  72. package/src/hooks/useLocalStorage.ts +4 -52
  73. package/src/hooks/useMedia.ts +0 -1
  74. package/src/lib/isMac.ts +1 -1
  75. package/src/modals/MenuModal/MenuModal.module.scss +1 -1
  76. package/src/modals/RemainingTilesModal/components/Character/Character.module.scss +1 -1
  77. package/src/modals/ResultsModal/ResultsModal.module.scss +1 -1
  78. package/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.module.scss +1 -1
  79. package/src/pages/_app.tsx +0 -1
  80. package/src/parameters/index.ts +48 -47
  81. package/src/sdk/fetchJson.ts +3 -7
  82. package/src/service-worker/index.ts +0 -1
  83. package/src/service-worker/routeSolveRequests.ts +18 -12
  84. package/src/state/board/slice.ts +6 -4
  85. package/src/state/localStorage.ts +42 -52
  86. package/src/state/sagas.ts +1 -2
  87. package/src/state/settings/initialState.ts +7 -7
  88. package/src/styles/_tokens.scss +59 -0
  89. package/src/styles/global.scss +3 -3
  90. package/src/styles/mixins.scss +13 -12
  91. package/src/styles/variables.module.scss +53 -0
  92. package/src/styles/variables.scss +44 -41
  93. package/tsconfig.json +0 -1
  94. package/tsconfig.tsbuildinfo +1 -1
  95. /package/.next/static/{f_g0t0jBAscXxDrNYOuV0 → HFiEUpdZIGYd_XKb5mCLZ}/_ssgManifest.js +0 -0
@@ -1,38 +1,39 @@
1
+ import variables from '@/styles/variables.module.scss';
1
2
  import { ResultColumnId } from '@/types';
2
3
 
3
4
  export const BREAKPOINTS = {
4
- xs: 480,
5
- s: 768,
6
- m: 992,
7
- l: 1200,
8
- xl: 1400,
5
+ xs: Number(variables.breakpointXs),
6
+ s: Number(variables.breakpointS),
7
+ m: Number(variables.breakpointM),
8
+ l: Number(variables.breakpointL),
9
+ xl: Number(variables.breakpointXl),
9
10
  };
10
11
 
11
12
  export const TRANSITION = 'var(--transition)';
12
13
 
13
14
  export const GITHUB_PROJECT_URL = 'https://github.com/kamilmielnik/scrabble-solver';
14
15
 
15
- export const TRANSITION_DURATION = 100;
16
- export const TRANSITION_DURATION_LONG = 250;
17
-
18
- export const COLOR_BLUE = '#c7d8f9';
19
- export const COLOR_GREEN = '#bae3ba';
20
- export const COLOR_RED = '#f7c2aa';
21
- export const COLOR_YELLOW = '#efe3ae';
22
-
23
- export const COLOR_BONUS_CHARACTER_1 = '#f7f1d6';
24
- export const COLOR_BONUS_CHARACTER_2 = '#d6ebd6';
25
- export const COLOR_BONUS_CHARACTER_3 = '#dde4f6';
26
- export const COLOR_BONUS_CHARACTER_5 = '#fbe0d4';
27
- export const COLOR_BONUS_CHARACTER_MULTIPLIER_2 = '#b8d5ed';
28
- export const COLOR_BONUS_CHARACTER_MULTIPLIER_3 = '#86aed1';
29
- export const COLOR_BONUS_CHARACTER_MULTIPLIER_4 = '#3477b2';
30
- export const COLOR_BONUS_START = '#b284b8';
31
- export const COLOR_BONUS_WORD_MULTIPLIER_2 = '#fbc997';
32
- export const COLOR_BONUS_WORD_MULTIPLIER_3 = '#f19393';
33
- export const COLOR_BONUS_WORD_MULTIPLIER_4 = '#ed5e5e';
34
- export const COLOR_FILTERED = '#444';
35
- export const COLOR_BACKGROUND = '#f4f4f4';
16
+ export const TRANSITION_DURATION = Number(variables.transitionDuration);
17
+ export const TRANSITION_DURATION_LONG = Number(variables.transitionDurationLong);
18
+
19
+ export const COLOR_BLUE = variables.colorBlue;
20
+ export const COLOR_GREEN = variables.colorGreen;
21
+ export const COLOR_RED = variables.colorRed;
22
+ export const COLOR_YELLOW = variables.colorYellow;
23
+
24
+ export const COLOR_BONUS_CHARACTER_1 = variables.colorYellowLight;
25
+ export const COLOR_BONUS_CHARACTER_2 = variables.colorGreenLight;
26
+ export const COLOR_BONUS_CHARACTER_3 = variables.colorBlueLight;
27
+ export const COLOR_BONUS_CHARACTER_5 = variables.colorRedLight;
28
+ export const COLOR_BONUS_CHARACTER_MULTIPLIER_2 = variables.colorBonusCharacterMultiplier2;
29
+ export const COLOR_BONUS_CHARACTER_MULTIPLIER_3 = variables.colorBonusCharacterMultiplier3;
30
+ export const COLOR_BONUS_CHARACTER_MULTIPLIER_4 = variables.colorBonusCharacterMultiplier4;
31
+ export const COLOR_BONUS_START = variables.colorVioletLight;
32
+ export const COLOR_BONUS_WORD_MULTIPLIER_2 = variables.colorBonusWordMultiplier2;
33
+ export const COLOR_BONUS_WORD_MULTIPLIER_3 = variables.colorBonusWordMultiplier3;
34
+ export const COLOR_BONUS_WORD_MULTIPLIER_4 = variables.colorBonusWordMultiplier4;
35
+ export const COLOR_FILTERED = variables.colorForegroundSecondary;
36
+ export const COLOR_BACKGROUND = variables.colorBackground;
36
37
 
37
38
  export const COLOR_BONUS_CHARACTER: Record<number, string> = {
38
39
  1: COLOR_BONUS_CHARACTER_1,
@@ -53,39 +54,41 @@ export const COLOR_BONUS_WORD: Record<number, string> = {
53
54
  4: COLOR_BONUS_WORD_MULTIPLIER_4,
54
55
  };
55
56
 
56
- export const SPACING_XS = 2;
57
- export const SPACING_S = 5;
58
- export const SPACING_M = 10;
59
- export const SPACING_L = 20;
60
- export const SPACING_XL = 40;
57
+ export const SPACING_XS = Number(variables.spacingXs);
58
+ export const SPACING_S = Number(variables.spacingS);
59
+ export const SPACING_M = Number(variables.spacingM);
60
+ export const SPACING_L = Number(variables.spacingL);
61
+ export const SPACING_XL = Number(variables.spacingXl);
61
62
 
62
63
  export const COMPONENTS_SPACING = SPACING_XL;
63
64
  export const COMPONENTS_SPACING_SMALL = SPACING_L;
64
65
 
66
+ export const RACK_TILE_SIZE_MAX = 80;
67
+
65
68
  export const BOARD_CELL_ACTIONS_OFFSET = 3;
66
69
  export const BOARD_CELL_BORDER_WIDTH = 1;
67
70
  export const BOARD_TILE_FONT_SIZE_MIN = 14;
68
71
  export const BOARD_TILE_FONT_SIZE_POINTS_MIN = 10;
69
- export const BOARD_TILE_SIZE_MAX = 64;
72
+ export const BOARD_TILE_SIZE_MAX = RACK_TILE_SIZE_MAX;
70
73
 
71
- export const BORDER_COLOR = '#cdcdcd';
72
- export const BORDER_COLOR_LIGHT = '#d9d9d9';
73
- export const BORDER_RADIUS = 5;
74
- export const BORDER_WIDTH = 1;
74
+ export const BORDER_COLOR = variables.borderColor;
75
+ export const BORDER_COLOR_LIGHT = variables.borderColorLight;
76
+ export const BORDER_RADIUS = Number(variables.borderRadius);
77
+ export const BORDER_WIDTH = Number(variables.borderWidth);
75
78
 
76
- export const BUTTON_ICON_SIZE = 24;
79
+ export const BUTTON_ICON_SIZE = Number(variables.buttonIconSize);
77
80
  export const BUTTON_PADDING_VERTICAL = SPACING_M;
78
81
  export const BUTTON_HEIGHT = BUTTON_ICON_SIZE + 2 * BUTTON_PADDING_VERTICAL + 2 * BORDER_WIDTH;
79
82
 
80
- export const DICTIONARY_HEIGHT = 260;
81
- export const DICTIONARY_HEIGHT_MOBILE = 110;
83
+ export const DICTIONARY_HEIGHT = Number(variables.dictionaryHeight);
84
+ export const DICTIONARY_HEIGHT_MOBILE = Number(variables.dictionaryHeightMobile);
82
85
 
83
86
  export const LOGO_ASPECT_RATIO = 682 / 166;
84
- export const LOGO_HEIGHT = 60;
85
- export const LOGO_HEIGHT_SMALL = 48;
87
+ export const LOGO_HEIGHT = Number(variables.logoHeight);
88
+ export const LOGO_HEIGHT_SMALL = Number(variables.logoHeightSmall);
86
89
  export const LOGO_SRC = '/logo.svg';
87
90
 
88
- export const MODAL_WIDTH = 370;
91
+ export const MODAL_WIDTH = Number(variables.modalWidth);
89
92
  export const MODAL_HEADER_HEIGHT = 45;
90
93
 
91
94
  export const NAV_PADDING = SPACING_L;
@@ -119,8 +122,6 @@ export const PLAIN_TILES_VERSION_TILE_SIZE = TILE_SIZE;
119
122
  export const PROGRESS_COLOR_VALUE = 'var(--color--violet--light)';
120
123
  export const PROGRESS_COLOR_BACKGROUND = 'var(--color--inactive)';
121
124
 
122
- export const RACK_TILE_SIZE_MAX = 80;
123
-
124
125
  export const REMAINING_TILES_TILE_SIZE = 50;
125
126
 
126
127
  export const RESULTS_COLUMN_WIDTH: Record<ResultColumnId, number | undefined> = {
@@ -133,10 +134,10 @@ export const RESULTS_COLUMN_WIDTH: Record<ResultColumnId, number | undefined> =
133
134
  [ResultColumnId.Word]: undefined,
134
135
  [ResultColumnId.WordsCount]: 55,
135
136
  };
136
- export const RESULTS_ITEM_HEIGHT = 40;
137
+ export const RESULTS_ITEM_HEIGHT = Number(variables.resultsItemHeight);
137
138
 
138
139
  export const RESULTS_HEADER_HEIGHT = RESULTS_ITEM_HEIGHT;
139
140
 
140
- export const SOLVER_COLUMN_WIDTH = 580;
141
+ export const SOLVER_COLUMN_WIDTH = Number(variables.solverColumnWidth);
141
142
 
142
- export const TEXT_INPUT_HEIGHT = 40;
143
+ export const TEXT_INPUT_HEIGHT = Number(variables.textInputHeight);
@@ -1,13 +1,9 @@
1
1
  import { fetch } from './fetch';
2
2
 
3
3
  export const fetchJson = async <T>(input: RequestInfo | URL, init?: RequestInit): Promise<T> => {
4
- const response = await fetch(input, {
5
- ...init,
6
- headers: {
7
- 'Content-Type': 'application/json',
8
- ...init?.headers,
9
- },
10
- });
4
+ const headers = new Headers(init?.headers);
5
+ headers.set('Content-Type', 'application/json');
11
6
 
7
+ const response = await fetch(input, { ...init, headers });
12
8
  return response.json();
13
9
  };
@@ -18,7 +18,6 @@ self.addEventListener('activate', () => {
18
18
  });
19
19
 
20
20
  cleanupOutdatedCaches();
21
- // eslint-disable-next-line no-underscore-dangle
22
21
  precacheAndRoute(self.__WB_MANIFEST);
23
22
  routeSolveRequests();
24
23
  routeVerifyRequests();
@@ -19,18 +19,6 @@ const MIN_MEASUREMENTS = 5;
19
19
  const localDurations: number[] = [];
20
20
  const serverDurations: number[] = [];
21
21
 
22
- const isSlowDevice = (): boolean | undefined => {
23
- if (localDurations.length < MIN_MEASUREMENTS || serverDurations.length < MIN_MEASUREMENTS) {
24
- return undefined;
25
- }
26
-
27
- const count = Math.min(localDurations.length, serverDurations.length);
28
- const local = localDurations.slice(0, count).sort().slice(1, -1);
29
- const server = serverDurations.slice(0, count).sort().slice(1, -1);
30
-
31
- return average(local) > average(server);
32
- };
33
-
34
22
  export const routeSolveRequests = () => {
35
23
  registerRoute(
36
24
  ({ url }) => url.origin === location.origin && url.pathname === '/api/solve',
@@ -83,3 +71,21 @@ export const routeSolveRequests = () => {
83
71
  'POST',
84
72
  );
85
73
  };
74
+
75
+ const isSlowDevice = (): boolean | undefined => {
76
+ if (localDurations.length < MIN_MEASUREMENTS || serverDurations.length < MIN_MEASUREMENTS) {
77
+ return undefined;
78
+ }
79
+
80
+ const count = Math.min(localDurations.length, serverDurations.length);
81
+ const local = localDurations
82
+ .slice(0, count)
83
+ .sort((a, b) => a - b)
84
+ .slice(1, -1);
85
+ const server = localDurations
86
+ .slice(0, count)
87
+ .sort((a, b) => a - b)
88
+ .slice(1, -1);
89
+
90
+ return average(local) > average(server);
91
+ };
@@ -16,7 +16,7 @@ export const boardSlice = createSlice({
16
16
  const result = action.payload;
17
17
 
18
18
  result.cells.forEach((cell) => {
19
- newBoard.updateCell(cell.x, cell.y, () => new Cell({ ...cell, isEmpty: false }));
19
+ newBoard.updateCell(cell.x, cell.y, () => new Cell({ isEmpty: false, tile: cell.tile, x: cell.x, y: cell.y }));
20
20
  });
21
21
 
22
22
  return newBoard;
@@ -34,7 +34,7 @@ export const boardSlice = createSlice({
34
34
  const tile = isEmpty ? Tile.Null : new Tile({ character: value });
35
35
 
36
36
  newBoard.updateCell(x, y, (cell) => {
37
- return new Cell({ ...cell, isEmpty, tile });
37
+ return new Cell({ isEmpty, tile, x: cell.x, y: cell.y });
38
38
  });
39
39
 
40
40
  return newBoard;
@@ -50,8 +50,10 @@ export const boardSlice = createSlice({
50
50
  const { x, y } = action.payload;
51
51
 
52
52
  newBoard.updateCell(x, y, (cell) => {
53
- const tile = cell.isEmpty ? cell.tile : new Tile({ ...cell.tile, isBlank: !cell.tile.isBlank });
54
- return new Cell({ ...cell, tile });
53
+ const tile = cell.isEmpty
54
+ ? cell.tile
55
+ : new Tile({ isBlank: !cell.tile.isBlank, character: cell.tile.character });
56
+ return new Cell({ isEmpty: cell.isEmpty, tile, x: cell.x, y: cell.y });
55
57
  });
56
58
 
57
59
  return newBoard;
@@ -1,28 +1,49 @@
1
- import { Board, type BoardJson, type Game, type Locale, type ShowCoordinates } from '@scrabble-solver/types';
1
+ import { Board, type BoardJson } from '@scrabble-solver/types';
2
2
  import store2 from 'store2';
3
3
 
4
- import type { AutoGroupTiles, InputMode, Rack, RemoveCellFilters } from '@/types';
4
+ import type { Rack } from '@/types';
5
+
6
+ import type { SettingsState } from './settings/types';
5
7
 
6
- const AUTO_GROUP_TILES = 'auto-group-tiles';
7
8
  const BOARD = 'board';
8
- const GAME_ID = 'config-id';
9
- const INPUT_MODE = 'input-mode';
10
- const REMOVE_CELL_FILTERS = 'remove-cell-filters';
11
- const LOCALE = 'locale';
12
9
  const RACK = 'rack';
13
- const SHOW_COORDINATES = 'show-coordinates';
10
+ const SETTINGS = 'settings';
11
+
12
+ const LEGACY_KEYS: Record<keyof SettingsState, string> = {
13
+ autoGroupTiles: 'auto-group-tiles',
14
+ game: 'config-id',
15
+ inputMode: 'input-mode',
16
+ locale: 'locale',
17
+ removeCellFilters: 'remove-cell-filters',
18
+ showCoordinates: 'show-coordinates',
19
+ };
14
20
 
15
21
  const store = store2.namespace('scrabble-solver');
16
22
 
17
- export const localStorage = {
18
- getAutoGroupTiles(): AutoGroupTiles | undefined {
19
- return store.get(AUTO_GROUP_TILES) as AutoGroupTiles | undefined;
20
- },
21
-
22
- setAutoGroupTiles(autoGroupTiles: AutoGroupTiles | undefined): void {
23
- store.set(AUTO_GROUP_TILES, autoGroupTiles, true);
24
- },
23
+ /**
24
+ * Introduced in 2.15.26 on 2026/04/27.
25
+ * Life expectancy: 1y.
26
+ */
27
+ const migrateLegacySettings = (): Partial<SettingsState> => {
28
+ const settings: Partial<SettingsState> = {};
29
+ let hasLegacy = false;
30
+
31
+ for (const [setting, legacyKey] of Object.entries(LEGACY_KEYS) as [keyof SettingsState, string][]) {
32
+ if (store.has(legacyKey)) {
33
+ settings[setting] = store.get(legacyKey);
34
+ store.remove(legacyKey);
35
+ hasLegacy = true;
36
+ }
37
+ }
38
+
39
+ if (hasLegacy) {
40
+ store.set(SETTINGS, settings, true);
41
+ }
42
+
43
+ return settings;
44
+ };
25
45
 
46
+ export const localStorage = {
26
47
  getBoard(): Board | undefined {
27
48
  const serialized = store.get(BOARD) as string | undefined;
28
49
  return serialized ? Board.fromJson(JSON.parse(serialized) as BoardJson) : undefined;
@@ -33,30 +54,6 @@ export const localStorage = {
33
54
  store.set(BOARD, serialized, true);
34
55
  },
35
56
 
36
- getGame(): Game | undefined {
37
- return store.get(GAME_ID) as Game | undefined;
38
- },
39
-
40
- setGame(game: Game | undefined): void {
41
- store.set(GAME_ID, game, true);
42
- },
43
-
44
- getInputMode(): InputMode | undefined {
45
- return store.get(INPUT_MODE) as InputMode | undefined;
46
- },
47
-
48
- setInputMode(inputMode: InputMode | undefined): void {
49
- store.set(INPUT_MODE, inputMode, true);
50
- },
51
-
52
- getLocale(): Locale | undefined {
53
- return store.get(LOCALE) as Locale | undefined;
54
- },
55
-
56
- setLocale(locale: Locale | undefined): void {
57
- store.set(LOCALE, locale, true);
58
- },
59
-
60
57
  getRack(): Rack | undefined {
61
58
  return store.get(RACK) as Rack | undefined;
62
59
  },
@@ -65,19 +62,12 @@ export const localStorage = {
65
62
  store.set(RACK, rack, true);
66
63
  },
67
64
 
68
- getShowCoordinates(): ShowCoordinates | undefined {
69
- return store.get(SHOW_COORDINATES) as ShowCoordinates | undefined;
70
- },
71
-
72
- setShowCoordinates(showCoordinates: ShowCoordinates | undefined): void {
73
- store.set(SHOW_COORDINATES, showCoordinates, true);
74
- },
75
-
76
- getRemoveCellFilters(): RemoveCellFilters | undefined {
77
- return store.get(REMOVE_CELL_FILTERS) as RemoveCellFilters | undefined;
65
+ getSettings(): Partial<SettingsState> {
66
+ const stored = store.get(SETTINGS) as Partial<SettingsState> | undefined;
67
+ return stored ?? migrateLegacySettings();
78
68
  },
79
69
 
80
- setRemoveCellFilters(removeCellFilters: RemoveCellFilters | undefined): void {
81
- store.set(REMOVE_CELL_FILTERS, removeCellFilters, true);
70
+ setSettings(settings: SettingsState): void {
71
+ store.set(SETTINGS, settings, true);
82
72
  },
83
73
  };
@@ -1,4 +1,4 @@
1
- /* eslint-disable max-lines, no-implicit-globals */
1
+ /* eslint-disable max-lines */
2
2
  /* eslint-disable @typescript-eslint/no-unsafe-argument */
3
3
  /* eslint-disable @typescript-eslint/no-unsafe-call */
4
4
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
@@ -35,7 +35,6 @@ const memoizedFindWordDefinitions = memoize(findWordDefinitions);
35
35
 
36
36
  // Can't conveniently type generators for sagas yet,
37
37
  // see: https://github.com/microsoft/TypeScript/issues/43632
38
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
38
  type AnyGenerator = Generator<any, any, any>;
40
39
 
41
40
  export function* rootSaga(): AnyGenerator {
@@ -5,14 +5,14 @@ import { localStorage } from '../localStorage';
5
5
  import { guessLocale } from './lib';
6
6
  import type { SettingsState } from './types';
7
7
 
8
- const localStorageAutoGroupTiles = localStorage.getAutoGroupTiles();
9
8
  const isTouchScreen = typeof globalThis.matchMedia !== 'undefined' && globalThis.matchMedia('(hover: none)').matches;
10
9
 
11
10
  export const settingsInitialState: SettingsState = {
12
- autoGroupTiles: typeof localStorageAutoGroupTiles === 'undefined' ? 'left' : localStorageAutoGroupTiles,
13
- game: localStorage.getGame() ?? Game.Scrabble,
14
- inputMode: localStorage.getInputMode() ?? (isTouchScreen ? 'touchscreen' : 'keyboard'),
15
- locale: localStorage.getLocale() ?? guessLocale(),
16
- showCoordinates: localStorage.getShowCoordinates() ?? 'hidden',
17
- removeCellFilters: localStorage.getRemoveCellFilters() ?? 'always',
11
+ autoGroupTiles: null,
12
+ game: Game.Scrabble,
13
+ inputMode: isTouchScreen ? 'touchscreen' : 'keyboard',
14
+ locale: guessLocale(),
15
+ removeCellFilters: 'always',
16
+ showCoordinates: 'hidden',
17
+ ...localStorage.getSettings(),
18
18
  };
@@ -0,0 +1,59 @@
1
+ @use 'sass:math';
2
+
3
+ @function strip-unit($value) {
4
+ @return math.div($value, $value * 0 + 1);
5
+ }
6
+
7
+ $breakpoint-xs: 480px;
8
+ $breakpoint-s: 768px;
9
+ $breakpoint-m: 992px;
10
+ $breakpoint-l: 1200px;
11
+ $breakpoint-xl: 1400px;
12
+
13
+ $border-color: #cdcdcd;
14
+ $border-color-light: #d9d9d9;
15
+ $border-radius: 5px;
16
+ $border-width: 1px;
17
+
18
+ $color-blue: #c7d8f9;
19
+ $color-blue-light: #dde4f6;
20
+ $color-green: #bae3ba;
21
+ $color-green-light: #d6ebd6;
22
+ $color-red: #f7c2aa;
23
+ $color-red-light: #fbe0d4;
24
+ $color-violet: #78387f;
25
+ $color-violet-light: #b284b8;
26
+ $color-yellow: #efe3ae;
27
+ $color-yellow-light: #f7f1d6;
28
+
29
+ $color-background: #f4f4f4;
30
+ $color-foreground: #222;
31
+ $color-foreground-secondary: #444;
32
+ $color-inactive: #cdcdcd;
33
+
34
+ $color-bonus-character-multiplier-2: #b8d5ed;
35
+ $color-bonus-character-multiplier-3: #86aed1;
36
+ $color-bonus-character-multiplier-4: #3477b2;
37
+ $color-bonus-word-multiplier-2: #fbc997;
38
+ $color-bonus-word-multiplier-3: #f19393;
39
+ $color-bonus-word-multiplier-4: #ed5e5e;
40
+
41
+ $spacing-xs: 2px;
42
+ $spacing-s: 5px;
43
+ $spacing-m: 10px;
44
+ $spacing-l: 20px;
45
+ $spacing-xl: 40px;
46
+ $spacing-xxl: 80px;
47
+
48
+ $transition-duration: 100ms;
49
+ $transition-duration-long: 250ms;
50
+
51
+ $button-icon-size: 24px;
52
+ $dictionary-height: 260px;
53
+ $dictionary-height-mobile: 110px;
54
+ $logo-height: 60px;
55
+ $logo-height-small: 48px;
56
+ $modal-width: 370px;
57
+ $results-item-height: 40px;
58
+ $solver-column-width: 580px;
59
+ $text-input-height: 40px;
@@ -1,7 +1,7 @@
1
- @import 'normalize.css';
1
+ @use 'normalize.css';
2
2
 
3
- @import './mixins';
4
- @import './variables';
3
+ @use './mixins' as *;
4
+ @use './variables';
5
5
 
6
6
  *,
7
7
  *:after,
@@ -1,15 +1,16 @@
1
- @import 'include-media';
2
-
3
- $breakpoints: (
4
- xs: 480px,
5
- s: 768px,
6
- m: 992px,
7
- l: 1200px,
8
- xl: 1400px,
9
- );
10
-
11
- $media-expressions: (
12
- touch: '(hover: none)',
1
+ @use 'styles/tokens' as *;
2
+
3
+ @forward 'include-media' with (
4
+ $breakpoints: (
5
+ xs: $breakpoint-xs,
6
+ s: $breakpoint-s,
7
+ m: $breakpoint-m,
8
+ l: $breakpoint-l,
9
+ xl: $breakpoint-xl,
10
+ ),
11
+ $media-expressions: (
12
+ touch: '(hover: none)',
13
+ )
13
14
  );
14
15
 
15
16
  @mixin scrollbars {
@@ -0,0 +1,53 @@
1
+ @use 'styles/tokens' as *;
2
+
3
+ :export {
4
+ breakpointXs: strip-unit($breakpoint-xs);
5
+ breakpointS: strip-unit($breakpoint-s);
6
+ breakpointM: strip-unit($breakpoint-m);
7
+ breakpointL: strip-unit($breakpoint-l);
8
+ breakpointXl: strip-unit($breakpoint-xl);
9
+
10
+ borderColor: $border-color;
11
+ borderColorLight: $border-color-light;
12
+ borderRadius: strip-unit($border-radius);
13
+ borderWidth: strip-unit($border-width);
14
+
15
+ colorBlue: $color-blue;
16
+ colorBlueLight: $color-blue-light;
17
+ colorGreen: $color-green;
18
+ colorGreenLight: $color-green-light;
19
+ colorRed: $color-red;
20
+ colorRedLight: $color-red-light;
21
+ colorVioletLight: $color-violet-light;
22
+ colorYellow: $color-yellow;
23
+ colorYellowLight: $color-yellow-light;
24
+
25
+ colorBackground: $color-background;
26
+ colorForegroundSecondary: $color-foreground-secondary;
27
+
28
+ colorBonusCharacterMultiplier2: $color-bonus-character-multiplier-2;
29
+ colorBonusCharacterMultiplier3: $color-bonus-character-multiplier-3;
30
+ colorBonusCharacterMultiplier4: $color-bonus-character-multiplier-4;
31
+ colorBonusWordMultiplier2: $color-bonus-word-multiplier-2;
32
+ colorBonusWordMultiplier3: $color-bonus-word-multiplier-3;
33
+ colorBonusWordMultiplier4: $color-bonus-word-multiplier-4;
34
+
35
+ spacingXs: strip-unit($spacing-xs);
36
+ spacingS: strip-unit($spacing-s);
37
+ spacingM: strip-unit($spacing-m);
38
+ spacingL: strip-unit($spacing-l);
39
+ spacingXl: strip-unit($spacing-xl);
40
+
41
+ transitionDuration: strip-unit($transition-duration);
42
+ transitionDurationLong: strip-unit($transition-duration-long);
43
+
44
+ buttonIconSize: strip-unit($button-icon-size);
45
+ dictionaryHeight: strip-unit($dictionary-height);
46
+ dictionaryHeightMobile: strip-unit($dictionary-height-mobile);
47
+ logoHeight: strip-unit($logo-height);
48
+ logoHeightSmall: strip-unit($logo-height-small);
49
+ modalWidth: strip-unit($modal-width);
50
+ resultsItemHeight: strip-unit($results-item-height);
51
+ solverColumnWidth: strip-unit($solver-column-width);
52
+ textInputHeight: strip-unit($text-input-height);
53
+ }