@logic-pad/core 0.1.2 → 0.1.4

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
@@ -1,19 +1,31 @@
1
1
  # @logic-pad/core
2
2
 
3
- The core API of Logic Pad. This library is not bundled, so you need to import each `js` file individually.
3
+ The core API of Logic Pad.
4
4
 
5
5
  ## Developing Logic Core
6
6
 
7
- [Bun >=v1.1.0](https://bun.sh/) is required for this project.
7
+ This package is part of Logic Pad. [Bun >=v1.1.0](https://bun.sh/) is required for this package.
8
8
 
9
9
  ```bash
10
10
  # 1. Clone this repository
11
- git clone https://github.com/hlysine/logic-core.git
11
+ git clone https://github.com/hlysine/logic-pad.git
12
12
 
13
13
  # 2. Restore dependencies
14
- cd logic-core
14
+ cd logic-pad
15
+ bun install
16
+ cd packages/logic-core
15
17
  bun install
16
18
 
17
19
  # 3. Build the library
18
20
  bun build
19
21
  ```
22
+
23
+ To test your changes in realtime in Logic Pad, simply run Logic Pad using the Vite dev server.
24
+
25
+ ```bash
26
+ # In the logic-pad directory
27
+ bun run dev
28
+ ```
29
+
30
+ Note that Logic Pad bundles the `src` directory of this package directly with Vite instead of using the transpiled
31
+ code in the `dist` output folder, which is for publishing only.
@@ -34,7 +34,7 @@ class BacktrackSolver extends Solver {
34
34
  });
35
35
  }
36
36
  async *solve(grid) {
37
- const worker = new Worker(new URL('./backtrackWorker.js', import.meta.url), {
37
+ const worker = new Worker(new URL(`./backtrackWorker.js`, import.meta.url), {
38
38
  type: 'module',
39
39
  });
40
40
  try {
@@ -27,15 +27,14 @@ export default class MyopiaBTModule extends BTModule {
27
27
  while (grid.isInBound(pos.x, pos.y)) {
28
28
  const curTile = grid.getTile(pos.x, pos.y);
29
29
  if (connected) {
30
- if (tile === curTile) {
30
+ if (tile === curTile || curTile === BTTile.NonExist) {
31
31
  min += 1;
32
32
  }
33
33
  else {
34
34
  connected = false;
35
35
  }
36
36
  }
37
- if (getOppositeColor(tile) === curTile ||
38
- curTile === BTTile.NonExist) {
37
+ if (getOppositeColor(tile) === curTile) {
39
38
  stopped = true;
40
39
  break;
41
40
  }
package/package.json CHANGED
@@ -1,11 +1,25 @@
1
1
  {
2
2
  "name": "@logic-pad/core",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
7
7
  "assets"
8
8
  ],
9
+ "homepage": "https://github.com/hlysine/logic-pad",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/hlysine/logic-pad.git"
13
+ },
14
+ "keywords": [
15
+ "logic",
16
+ "puzzle",
17
+ "game",
18
+ "solver",
19
+ "logic-pad",
20
+ "grid"
21
+ ],
22
+ "license": "AGPL-3.0-only",
9
23
  "main": "./dist/logic-core.umd.cjs",
10
24
  "module": "./dist/logic-core.js",
11
25
  "exports": {
@@ -28,7 +42,7 @@
28
42
  },
29
43
  "scripts": {
30
44
  "build": "rimraf dist/ && bun run codegen && bunx --bun tsc && bun run typegen",
31
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
45
+ "lint": "cd ../../ && eslint ./packages/logic-core --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
32
46
  "codegen": "bun ./scripts/genEntry.ts && bun ./scripts/genImports.ts",
33
47
  "typegen": "bun ./scripts/genTypes.ts",
34
48
  "prepublishOnly": "bun run build"