@logic-pad/core 0.13.4 → 0.15.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 (77) hide show
  1. package/assets/logic-core.global.d.ts +60 -2
  2. package/dist/data/config.d.ts +7 -1
  3. package/dist/data/config.js +7 -0
  4. package/dist/data/configurable.d.ts +2 -0
  5. package/dist/data/instruction.d.ts +1 -0
  6. package/dist/data/instruction.js +3 -0
  7. package/dist/data/puzzle.js +3 -1
  8. package/dist/data/rules/banPatternRule.d.ts +1 -0
  9. package/dist/data/rules/banPatternRule.js +11 -1
  10. package/dist/data/rules/cellCountPerZoneRule.d.ts +2 -0
  11. package/dist/data/rules/cellCountPerZoneRule.js +9 -0
  12. package/dist/data/rules/cellCountRule.d.ts +1 -0
  13. package/dist/data/rules/cellCountRule.js +6 -0
  14. package/dist/data/rules/completePatternRule.d.ts +2 -0
  15. package/dist/data/rules/completePatternRule.js +9 -0
  16. package/dist/data/rules/connectAllRule.d.ts +1 -0
  17. package/dist/data/rules/connectAllRule.js +6 -0
  18. package/dist/data/rules/containsShapeRule.d.ts +1 -0
  19. package/dist/data/rules/containsShapeRule.js +11 -1
  20. package/dist/data/rules/customRule.d.ts +2 -0
  21. package/dist/data/rules/customRule.js +11 -0
  22. package/dist/data/rules/foresightRule.d.ts +2 -0
  23. package/dist/data/rules/foresightRule.js +13 -0
  24. package/dist/data/rules/lyingSymbolRule.d.ts +1 -0
  25. package/dist/data/rules/lyingSymbolRule.js +19 -0
  26. package/dist/data/rules/musicControlLine.d.ts +4 -0
  27. package/dist/data/rules/musicControlLine.js +29 -0
  28. package/dist/data/rules/musicGridRule.d.ts +2 -0
  29. package/dist/data/rules/musicGridRule.js +11 -0
  30. package/dist/data/rules/mysteryRule.d.ts +2 -0
  31. package/dist/data/rules/mysteryRule.js +11 -0
  32. package/dist/data/rules/offByXRule.d.ts +1 -0
  33. package/dist/data/rules/offByXRule.js +6 -0
  34. package/dist/data/rules/perfectionRule.d.ts +2 -0
  35. package/dist/data/rules/perfectionRule.js +9 -0
  36. package/dist/data/rules/regionAreaRule.d.ts +1 -0
  37. package/dist/data/rules/regionAreaRule.js +6 -0
  38. package/dist/data/rules/sameShapeRule.d.ts +1 -0
  39. package/dist/data/rules/sameShapeRule.js +6 -0
  40. package/dist/data/rules/symbolsPerRegionRule.d.ts +1 -0
  41. package/dist/data/rules/symbolsPerRegionRule.js +6 -0
  42. package/dist/data/rules/undercluedRule.d.ts +2 -0
  43. package/dist/data/rules/undercluedRule.js +9 -0
  44. package/dist/data/rules/uniqueShapeRule.d.ts +1 -0
  45. package/dist/data/rules/uniqueShapeRule.js +6 -0
  46. package/dist/data/rules/wrapAroundRule.d.ts +2 -0
  47. package/dist/data/rules/wrapAroundRule.js +9 -0
  48. package/dist/data/serializer/serializer_checksum.js +11 -1
  49. package/dist/data/serializer/serializer_v0.js +2 -0
  50. package/dist/data/shapes.js +11 -1
  51. package/dist/data/symbols/areaNumberSymbol.d.ts +1 -0
  52. package/dist/data/symbols/areaNumberSymbol.js +6 -0
  53. package/dist/data/symbols/customIconSymbol.d.ts +2 -0
  54. package/dist/data/symbols/customIconSymbol.js +13 -0
  55. package/dist/data/symbols/customTextSymbol.d.ts +2 -0
  56. package/dist/data/symbols/customTextSymbol.js +13 -0
  57. package/dist/data/symbols/dartSymbol.d.ts +1 -0
  58. package/dist/data/symbols/dartSymbol.js +6 -0
  59. package/dist/data/symbols/directionLinkerSymbol.d.ts +1 -5
  60. package/dist/data/symbols/directionLinkerSymbol.js +0 -3
  61. package/dist/data/symbols/focusSymbol.d.ts +1 -0
  62. package/dist/data/symbols/focusSymbol.js +6 -0
  63. package/dist/data/symbols/galaxySymbol.d.ts +1 -0
  64. package/dist/data/symbols/galaxySymbol.js +6 -0
  65. package/dist/data/symbols/hiddenSymbol.d.ts +2 -0
  66. package/dist/data/symbols/hiddenSymbol.js +10 -0
  67. package/dist/data/symbols/letterSymbol.d.ts +1 -0
  68. package/dist/data/symbols/letterSymbol.js +7 -0
  69. package/dist/data/symbols/lotusSymbol.d.ts +1 -0
  70. package/dist/data/symbols/lotusSymbol.js +6 -0
  71. package/dist/data/symbols/minesweeperSymbol.d.ts +1 -0
  72. package/dist/data/symbols/minesweeperSymbol.js +6 -0
  73. package/dist/data/symbols/myopiaSymbol.d.ts +1 -0
  74. package/dist/data/symbols/myopiaSymbol.js +5 -0
  75. package/dist/data/symbols/viewpointSymbol.d.ts +1 -0
  76. package/dist/data/symbols/viewpointSymbol.js +6 -0
  77. package/package.json +2 -2
@@ -12,6 +12,12 @@ class AreaNumberSymbol extends NumberSymbol {
12
12
  */
13
13
  constructor(x, y, number) {
14
14
  super(x, y, number);
15
+ Object.defineProperty(this, "title", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: 'Area Number'
20
+ });
15
21
  }
16
22
  get id() {
17
23
  return `number`;
@@ -4,6 +4,8 @@ import CustomSymbol from './customSymbol.js';
4
4
  export default class CustomIconSymbol extends CustomSymbol {
5
5
  readonly icon: string;
6
6
  readonly rotation: number;
7
+ readonly title = "Custom Icon Symbol";
8
+ get configExplanation(): string;
7
9
  private static readonly EXAMPLE_GRID;
8
10
  private static readonly CONFIGS;
9
11
  /**
@@ -2,6 +2,9 @@ import { ConfigType } from '../config.js';
2
2
  import GridData from '../grid.js';
3
3
  import CustomSymbol from './customSymbol.js';
4
4
  class CustomIconSymbol extends CustomSymbol {
5
+ get configExplanation() {
6
+ return 'A customizable symbol. Your provided solution may override auto-validation.';
7
+ }
5
8
  /**
6
9
  * **A custom icon symbol**
7
10
  *
@@ -26,6 +29,12 @@ class CustomIconSymbol extends CustomSymbol {
26
29
  writable: true,
27
30
  value: rotation
28
31
  });
32
+ Object.defineProperty(this, "title", {
33
+ enumerable: true,
34
+ configurable: true,
35
+ writable: true,
36
+ value: 'Custom Icon Symbol'
37
+ });
29
38
  this.icon = icon;
30
39
  this.rotation = rotation;
31
40
  }
@@ -76,6 +85,7 @@ Object.defineProperty(CustomIconSymbol, "CONFIGS", {
76
85
  placeholder: 'Enter description. Emphasize with *asterisks*.',
77
86
  field: 'description',
78
87
  description: 'Description',
88
+ explanation: 'A short descriptive text. Use *asterisks* to highlight keywords. Leave empty to hide the description.',
79
89
  configurable: true,
80
90
  },
81
91
  {
@@ -83,6 +93,7 @@ Object.defineProperty(CustomIconSymbol, "CONFIGS", {
83
93
  default: CustomIconSymbol.EXAMPLE_GRID,
84
94
  field: 'grid',
85
95
  description: 'Thumbnail Grid',
96
+ explanation: 'An example grid showing the symbol.',
86
97
  configurable: true,
87
98
  },
88
99
  {
@@ -90,6 +101,7 @@ Object.defineProperty(CustomIconSymbol, "CONFIGS", {
90
101
  default: 'MdQuestionMark',
91
102
  field: 'icon',
92
103
  description: 'Icon',
104
+ explanation: 'The icon displayed on the grid. All available icons at https://react-icons.github.io/react-icons/icons/md/',
93
105
  configurable: true,
94
106
  },
95
107
  {
@@ -97,6 +109,7 @@ Object.defineProperty(CustomIconSymbol, "CONFIGS", {
97
109
  default: 0,
98
110
  field: 'rotation',
99
111
  description: 'Rotation',
112
+ explanation: 'Rotate the symbol by the given degrees.',
100
113
  configurable: true,
101
114
  },
102
115
  ])
@@ -4,6 +4,8 @@ import CustomSymbol from './customSymbol.js';
4
4
  export default class CustomTextSymbol extends CustomSymbol {
5
5
  readonly text: string;
6
6
  readonly rotation: number;
7
+ readonly title = "Custom Text Symbol";
8
+ get configExplanation(): string;
7
9
  private static readonly EXAMPLE_GRID;
8
10
  private static readonly CONFIGS;
9
11
  /**
@@ -2,6 +2,9 @@ import { ConfigType } from '../config.js';
2
2
  import GridData from '../grid.js';
3
3
  import CustomSymbol from './customSymbol.js';
4
4
  class CustomTextSymbol extends CustomSymbol {
5
+ get configExplanation() {
6
+ return 'A customizable symbol. Your provided solution may override auto-validation.';
7
+ }
5
8
  /**
6
9
  * **A custom text symbol**
7
10
  *
@@ -26,6 +29,12 @@ class CustomTextSymbol extends CustomSymbol {
26
29
  writable: true,
27
30
  value: rotation
28
31
  });
32
+ Object.defineProperty(this, "title", {
33
+ enumerable: true,
34
+ configurable: true,
35
+ writable: true,
36
+ value: 'Custom Text Symbol'
37
+ });
29
38
  this.text = text;
30
39
  this.rotation = rotation;
31
40
  }
@@ -76,6 +85,7 @@ Object.defineProperty(CustomTextSymbol, "CONFIGS", {
76
85
  placeholder: 'Enter description. Emphasize with *asterisks*.',
77
86
  field: 'description',
78
87
  description: 'Description',
88
+ explanation: 'A short descriptive text. Use *asterisks* to highlight keywords. Leave empty to hide the description.',
79
89
  configurable: true,
80
90
  },
81
91
  {
@@ -83,6 +93,7 @@ Object.defineProperty(CustomTextSymbol, "CONFIGS", {
83
93
  default: CustomTextSymbol.EXAMPLE_GRID,
84
94
  field: 'grid',
85
95
  description: 'Thumbnail Grid',
96
+ explanation: 'An example grid showing the symbol.',
86
97
  configurable: true,
87
98
  },
88
99
  {
@@ -91,6 +102,7 @@ Object.defineProperty(CustomTextSymbol, "CONFIGS", {
91
102
  placeholder: 'Short text to be displayed on the symbol',
92
103
  field: 'text',
93
104
  description: 'Text',
105
+ explanation: 'The text displayed on the grid. You should use no more than 2 lines of 4 characters each.',
94
106
  configurable: true,
95
107
  },
96
108
  {
@@ -98,6 +110,7 @@ Object.defineProperty(CustomTextSymbol, "CONFIGS", {
98
110
  default: 0,
99
111
  field: 'rotation',
100
112
  description: 'Rotation',
113
+ explanation: 'Rotate the symbol by the given degrees.',
101
114
  configurable: true,
102
115
  },
103
116
  ])
@@ -4,6 +4,7 @@ import { Orientation } from '../primitives.js';
4
4
  import NumberSymbol from './numberSymbol.js';
5
5
  export default class DartSymbol extends NumberSymbol {
6
6
  readonly orientation: Orientation;
7
+ readonly title = "Dart";
7
8
  private static readonly CONFIGS;
8
9
  private static readonly EXAMPLE_GRID;
9
10
  /**
@@ -19,6 +19,12 @@ class DartSymbol extends NumberSymbol {
19
19
  writable: true,
20
20
  value: orientation
21
21
  });
22
+ Object.defineProperty(this, "title", {
23
+ enumerable: true,
24
+ configurable: true,
25
+ writable: true,
26
+ value: 'Dart'
27
+ });
22
28
  this.orientation = orientation;
23
29
  }
24
30
  get id() {
@@ -3,7 +3,7 @@ import GridData from '../grid.js';
3
3
  import { Direction, State } from '../primitives.js';
4
4
  import Symbol from './symbol.js';
5
5
  export type DirectionLinkerMap = Record<Direction, Direction>;
6
- export default class DirectionLinkerSymbol extends Symbol {
6
+ export default abstract class DirectionLinkerSymbol extends Symbol {
7
7
  readonly x: number;
8
8
  readonly y: number;
9
9
  private static readonly CONFIGS;
@@ -24,10 +24,6 @@ export default class DirectionLinkerSymbol extends Symbol {
24
24
  createExampleGrid(): GridData;
25
25
  private deltaCoordinate;
26
26
  validateSymbol(grid: GridData): State;
27
- copyWith({ x, y }: {
28
- x?: number;
29
- y?: number;
30
- }): this;
31
27
  private getInitialCheckedCouples;
32
28
  }
33
29
  export declare const instance: undefined;
@@ -151,9 +151,6 @@ class DirectionLinkerSymbol extends Symbol {
151
151
  }
152
152
  return grayFound ? State.Incomplete : State.Satisfied;
153
153
  }
154
- copyWith({ x, y }) {
155
- return new DirectionLinkerSymbol(x ?? this.x, y ?? this.y);
156
- }
157
154
  getInitialCheckedCouples(x, y, grid) {
158
155
  // 1x1
159
156
  if (x % 1 === 0 && y % 1 === 0) {
@@ -2,6 +2,7 @@ import { AnyConfig } from '../config.js';
2
2
  import GridData from '../grid.js';
3
3
  import NumberSymbol from './numberSymbol.js';
4
4
  export default class FocusSymbol extends NumberSymbol {
5
+ readonly title = "Focus Number";
5
6
  private static readonly CONFIGS;
6
7
  private static readonly EXAMPLE_GRID;
7
8
  /**
@@ -17,6 +17,12 @@ class FocusSymbol extends NumberSymbol {
17
17
  */
18
18
  constructor(x, y, number) {
19
19
  super(x, y, number);
20
+ Object.defineProperty(this, "title", {
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true,
24
+ value: 'Focus Number'
25
+ });
20
26
  }
21
27
  get id() {
22
28
  return `focus`;
@@ -5,6 +5,7 @@ import DirectionLinkerSymbol from './directionLinkerSymbol.js';
5
5
  export default class GalaxySymbol extends DirectionLinkerSymbol {
6
6
  readonly x: number;
7
7
  readonly y: number;
8
+ readonly title = "Galaxy";
8
9
  private static readonly linkedDirections;
9
10
  /**
10
11
  * **Galaxies are centers of rotational symmetry**
@@ -23,6 +23,12 @@ class GalaxySymbol extends DirectionLinkerSymbol {
23
23
  writable: true,
24
24
  value: y
25
25
  });
26
+ Object.defineProperty(this, "title", {
27
+ enumerable: true,
28
+ configurable: true,
29
+ writable: true,
30
+ value: 'Galaxy'
31
+ });
26
32
  super.changeDirections(GalaxySymbol.linkedDirections);
27
33
  }
28
34
  get id() {
@@ -7,6 +7,8 @@ export default class HiddenSymbol extends Symbol implements SymbolDisplayHandler
7
7
  readonly x: number;
8
8
  readonly y: number;
9
9
  readonly revealLocation: boolean;
10
+ readonly title = "Hidden Symbol Marker";
11
+ get configExplanation(): string;
10
12
  private static readonly CONFIGS;
11
13
  private static readonly EXAMPLE_GRID;
12
14
  /**
@@ -4,6 +4,9 @@ import { Color, State } from '../primitives.js';
4
4
  import CustomIconSymbol from './customIconSymbol.js';
5
5
  import Symbol from './symbol.js';
6
6
  class HiddenSymbol extends Symbol {
7
+ get configExplanation() {
8
+ return 'Other symbols in the same location will be hidden until this tile is colored correctly.';
9
+ }
7
10
  /**
8
11
  * **Hidden Symbols: color cells correctly to reveal more clues**
9
12
  *
@@ -31,6 +34,12 @@ class HiddenSymbol extends Symbol {
31
34
  writable: true,
32
35
  value: revealLocation
33
36
  });
37
+ Object.defineProperty(this, "title", {
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true,
41
+ value: 'Hidden Symbol Marker'
42
+ });
34
43
  this.revealLocation = revealLocation;
35
44
  }
36
45
  get id() {
@@ -116,6 +125,7 @@ Object.defineProperty(HiddenSymbol, "CONFIGS", {
116
125
  default: false,
117
126
  field: 'revealLocation',
118
127
  description: 'Reveal symbol location',
128
+ explanation: 'Whether to show this symbol when the tile is not yet colored correctly.',
119
129
  configurable: true,
120
130
  },
121
131
  ])
@@ -6,6 +6,7 @@ export default class LetterSymbol extends Symbol {
6
6
  readonly x: number;
7
7
  readonly y: number;
8
8
  readonly letter: string;
9
+ readonly title = "Letter";
9
10
  private static readonly CONFIGS;
10
11
  private static readonly EXAMPLE_GRID;
11
12
  /**
@@ -31,6 +31,12 @@ class LetterSymbol extends Symbol {
31
31
  writable: true,
32
32
  value: letter
33
33
  });
34
+ Object.defineProperty(this, "title", {
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true,
38
+ value: 'Letter'
39
+ });
34
40
  this.letter = letter;
35
41
  }
36
42
  get id() {
@@ -116,6 +122,7 @@ Object.defineProperty(LetterSymbol, "CONFIGS", {
116
122
  default: 'A',
117
123
  field: 'letter',
118
124
  description: 'Letter',
125
+ explanation: 'Use single uppercase letters by convention.',
119
126
  configurable: true,
120
127
  },
121
128
  ])
@@ -6,6 +6,7 @@ export default class LotusSymbol extends DirectionLinkerSymbol {
6
6
  readonly x: number;
7
7
  readonly y: number;
8
8
  readonly orientation: Orientation;
9
+ readonly title = "Lotus";
9
10
  private static readonly linkedDirectionsFromOrientation;
10
11
  /**
11
12
  * **Areas containing this symbol must be symmetrical**
@@ -30,6 +30,12 @@ class LotusSymbol extends DirectionLinkerSymbol {
30
30
  writable: true,
31
31
  value: orientation
32
32
  });
33
+ Object.defineProperty(this, "title", {
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true,
37
+ value: 'Lotus'
38
+ });
33
39
  super.changeDirections(LotusSymbol.linkedDirectionsFromOrientation[orientation]);
34
40
  }
35
41
  get id() {
@@ -2,6 +2,7 @@ import { AnyConfig } from '../config.js';
2
2
  import GridData from '../grid.js';
3
3
  import NumberSymbol from './numberSymbol.js';
4
4
  export default class MinesweeperSymbol extends NumberSymbol {
5
+ readonly title = "Minesweeper Number";
5
6
  private static readonly CONFIGS;
6
7
  private static readonly EXAMPLE_GRID;
7
8
  /**
@@ -12,6 +12,12 @@ class MinesweeperSymbol extends NumberSymbol {
12
12
  */
13
13
  constructor(x, y, number) {
14
14
  super(x, y, number);
15
+ Object.defineProperty(this, "title", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: 'Minesweeper Number'
20
+ });
15
21
  }
16
22
  get id() {
17
23
  return `minesweeper`;
@@ -5,6 +5,7 @@ import MultiEntrySymbol from './multiEntrySymbol.js';
5
5
  export default class MyopiaSymbol extends MultiEntrySymbol {
6
6
  readonly diagonals: boolean;
7
7
  readonly directions: OrientationToggle;
8
+ get title(): "Framed Myopia Arrow" | "Myopia Arrow";
8
9
  private static readonly CONFIGS;
9
10
  private static readonly EXAMPLE_GRID;
10
11
  private static readonly EXAMPLE_DIAGONAL_GRID;
@@ -4,6 +4,9 @@ import GridData from '../grid.js';
4
4
  import { Color, ORIENTATIONS, Orientation, State, orientationToggle, } from '../primitives.js';
5
5
  import MultiEntrySymbol from './multiEntrySymbol.js';
6
6
  class MyopiaSymbol extends MultiEntrySymbol {
7
+ get title() {
8
+ return this.diagonals ? 'Framed Myopia Arrow' : 'Myopia Arrow';
9
+ }
7
10
  /**
8
11
  * **Viewpoint Numbers count visible cells in the four directions**
9
12
  * @param x - The x-coordinate of the symbol.
@@ -165,6 +168,7 @@ Object.defineProperty(MyopiaSymbol, "CONFIGS", {
165
168
  default: false,
166
169
  field: 'diagonals',
167
170
  description: 'Include diagonal directions',
171
+ explanation: 'Whether to check diagonals as well. Must be enabled for diagonal arrows.',
168
172
  configurable: true,
169
173
  },
170
174
  {
@@ -172,6 +176,7 @@ Object.defineProperty(MyopiaSymbol, "CONFIGS", {
172
176
  default: orientationToggle(Orientation.Up, Orientation.Right),
173
177
  field: 'directions',
174
178
  description: 'Directions',
179
+ explanation: 'The directions in which an arrow is pointing. A dot will be displayed if no arrows are present.',
175
180
  configurable: true,
176
181
  },
177
182
  ])
@@ -2,6 +2,7 @@ import { AnyConfig } from '../config.js';
2
2
  import GridData from '../grid.js';
3
3
  import NumberSymbol from './numberSymbol.js';
4
4
  export default class ViewpointSymbol extends NumberSymbol {
5
+ readonly title = "Viewpoint Number";
5
6
  private static readonly CONFIGS;
6
7
  private static readonly EXAMPLE_GRID;
7
8
  /**
@@ -12,6 +12,12 @@ class ViewpointSymbol extends NumberSymbol {
12
12
  */
13
13
  constructor(x, y, number) {
14
14
  super(x, y, number);
15
+ Object.defineProperty(this, "title", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: 'Viewpoint Number'
20
+ });
15
21
  }
16
22
  get id() {
17
23
  return `viewpoint`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logic-pad/core",
3
- "version": "0.13.4",
3
+ "version": "0.15.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -43,7 +43,7 @@
43
43
  "scripts": {
44
44
  "build": "rimraf dist/ && bun run codegen && bunx --bun tsc && bun run typegen",
45
45
  "lint": "cd ../../ && eslint ./packages/logic-core --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
46
- "codegen": "bun ./scripts/genEntry.ts && bun ./scripts/genImports.ts",
46
+ "codegen": "bun ./scripts/genImports.ts && bun ./scripts/genEntry.ts",
47
47
  "typegen": "bun ./scripts/genTypes.ts",
48
48
  "prepublishOnly": "bun run build"
49
49
  },