@logic-pad/core 0.23.1 → 0.23.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/README.md CHANGED
@@ -8,7 +8,7 @@ This package is part of Logic Pad. [Bun >=v1.1.0](https://bun.sh/) is required f
8
8
 
9
9
  ```bash
10
10
  # 1. Clone this repository
11
- git clone https://github.com/hlysine/logic-pad.git
11
+ git clone https://github.com/logic-pad/logic-pad.git
12
12
 
13
13
  # 2. Restore dependencies
14
14
  cd logic-pad
@@ -2333,6 +2333,9 @@ declare global {
2333
2333
  * first iteration indicates that the grid is unsolvable. Yielding `null` on the second iteration indicates that the
2334
2334
  * solution is unique.
2335
2335
  *
2336
+ * If the solve finds the trivial solution of not filling any tiles, such as in the case of an underclued grid with
2337
+ * too many alternate solutions, it must yield the solution instead of yielding `null`.
2338
+ *
2336
2339
  * In the current UI implementation, the solver will be terminated after yielding `null`, or after 2 iterations if
2337
2340
  * `null` is never yielded. The solver should perform any necessary cleanup in the `finally` block of the generator.
2338
2341
  *
@@ -116,7 +116,6 @@ export function resize(array, newSize, defaultValue) {
116
116
  * @param values The values to compare.
117
117
  * @returns Whether all the values are equal.
118
118
  */
119
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
120
119
  export function allEqual(...values) {
121
120
  return values.every(value => value === values[0]);
122
121
  }
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
2
1
  export function isEventHandler(val, event) {
3
2
  if (typeof val !== 'object' || val === null || val === undefined)
4
3
  return false;
@@ -27,7 +27,6 @@ export default class StreamCompressor extends CompressorBase {
27
27
  }
28
28
  async decompress(input) {
29
29
  await ensureCompressionStream();
30
- // eslint-disable-next-line @typescript-eslint/no-deprecated
31
30
  const bytes = Uint8Array.from(atob(input), c => c.charCodeAt(0));
32
31
  const cs = new DecompressionStream(this.algorithm);
33
32
  const writer = cs.writable.getWriter();
@@ -97,7 +97,6 @@ class AutoSolver extends Solver {
97
97
  }
98
98
  }
99
99
  async solveOne(generator) {
100
- // eslint-disable-next-line no-unreachable-loop
101
100
  for await (const grid of generator) {
102
101
  return grid;
103
102
  }
@@ -293,12 +293,12 @@ onmessage = e => {
293
293
  let count = 0;
294
294
  solve(grid, solution => {
295
295
  // if (count === 0) console.timeLog('Solve time', 'First solution');
296
- if (solution) {
297
- if (solution.resetTiles().colorEquals(solution)) {
298
- postMessage(null);
299
- return false;
300
- }
301
- }
296
+ // if (solution) {
297
+ // if (solution.resetTiles().colorEquals(solution)) {
298
+ // postMessage(null);
299
+ // return false;
300
+ // }
301
+ // }
302
302
  postMessage(Serializer.stringifyGrid(solution));
303
303
  count += 1;
304
304
  return count < 2;
@@ -78,9 +78,8 @@ class CspuzSolver extends EventIteratingSolver {
78
78
  }
79
79
  async isEnvironmentSupported() {
80
80
  try {
81
- const abortController = new AbortController();
82
- for await (const _ of this.solve(GridData.create(['.']), abortController.signal)) {
83
- abortController.abort();
81
+ for await (const _ of this.solve(GridData.create(['.']))) {
82
+ // do nothing
84
83
  }
85
84
  return true;
86
85
  }
@@ -30,12 +30,7 @@ function postSolution(grid, solverResult) {
30
30
  }
31
31
  return tiles;
32
32
  });
33
- if (solution.resetTiles().colorEquals(solution)) {
34
- postMessage(null);
35
- }
36
- else {
37
- postMessage(Serializer.stringifyGrid(solution));
38
- }
33
+ postMessage(Serializer.stringifyGrid(solution));
39
34
  }
40
35
  }
41
36
  onmessage = e => {
@@ -32,6 +32,9 @@ export default abstract class Solver {
32
32
  * first iteration indicates that the grid is unsolvable. Yielding `null` on the second iteration indicates that the
33
33
  * solution is unique.
34
34
  *
35
+ * If the solve finds the trivial solution of not filling any tiles, such as in the case of an underclued grid with
36
+ * too many alternate solutions, it must yield the solution instead of yielding `null`.
37
+ *
35
38
  * In the current UI implementation, the solver will be terminated after yielding `null`, or after 2 iterations if
36
39
  * `null` is never yielded. The solver should perform any necessary cleanup in the `finally` block of the generator.
37
40
  *
@@ -115,11 +115,11 @@ onmessage = e => {
115
115
  const grid = Serializer.parseGrid(e.data);
116
116
  let count = 0;
117
117
  solve(grid, solution => {
118
- if (solution) {
119
- if (solution.resetTiles().colorEquals(solution)) {
120
- solution = null;
121
- }
122
- }
118
+ // if (solution) {
119
+ // if (solution.resetTiles().colorEquals(solution)) {
120
+ // solution = null;
121
+ // }
122
+ // }
123
123
  postMessage(solution ? Serializer.stringifyGrid(solution) : null);
124
124
  count += 1;
125
125
  return count < 2;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@logic-pad/core",
3
- "version": "0.23.1",
3
+ "version": "0.23.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
7
7
  "assets"
8
8
  ],
9
- "homepage": "https://github.com/hlysine/logic-pad",
9
+ "homepage": "https://github.com/logic-pad/logic-pad",
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/hlysine/logic-pad.git"
12
+ "url": "https://github.com/logic-pad/logic-pad.git"
13
13
  },
14
14
  "keywords": [
15
15
  "logic",
@@ -42,13 +42,13 @@
42
42
  },
43
43
  "scripts": {
44
44
  "build": "rimraf dist/ && bun run codegen && bunx --bun tsc && bun run typegen",
45
- "lint": "cd ../../ && eslint ./packages/logic-core --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
46
45
  "codegen": "bun ./scripts/genImports.ts && bun ./scripts/genEntry.ts",
47
46
  "typegen": "bun ./scripts/genTypes.ts",
48
47
  "prepublishOnly": "bun run build"
49
48
  },
50
49
  "engines": {
51
- "bun": ">=1.1.0"
50
+ "bun": ">=1.1.0",
51
+ "node": ">=23.11.0"
52
52
  },
53
53
  "dependencies": {
54
54
  "compression-streams-polyfill": "^0.1.7",