@logic-pad/core 0.1.6 → 0.2.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.
@@ -75,3 +75,11 @@ export declare function escape(text: string, escapeCharacters?: string): string;
75
75
  * @returns The unescaped text.
76
76
  */
77
77
  export declare function unescape(text: string, escapeCharacters?: string): string;
78
+ export declare class CachedAccess<T> {
79
+ private readonly getter;
80
+ private static readonly UNCACHED;
81
+ private cache;
82
+ private constructor();
83
+ static of<T>(getter: () => T): CachedAccess<T>;
84
+ get value(): T;
85
+ }
@@ -188,3 +188,34 @@ export function unescape(text, escapeCharacters = '=,:|') {
188
188
  }
189
189
  return result + text.substring(index);
190
190
  }
191
+ export class CachedAccess {
192
+ constructor(getter) {
193
+ Object.defineProperty(this, "getter", {
194
+ enumerable: true,
195
+ configurable: true,
196
+ writable: true,
197
+ value: getter
198
+ });
199
+ Object.defineProperty(this, "cache", {
200
+ enumerable: true,
201
+ configurable: true,
202
+ writable: true,
203
+ value: CachedAccess.UNCACHED
204
+ });
205
+ }
206
+ static of(getter) {
207
+ return new CachedAccess(getter);
208
+ }
209
+ get value() {
210
+ if (this.cache === CachedAccess.UNCACHED) {
211
+ this.cache = this.getter();
212
+ }
213
+ return this.cache;
214
+ }
215
+ }
216
+ Object.defineProperty(CachedAccess, "UNCACHED", {
217
+ enumerable: true,
218
+ configurable: true,
219
+ writable: true,
220
+ value: Symbol('uncached')
221
+ });
@@ -0,0 +1,15 @@
1
+ import GridData from '../grid.js';
2
+ import Instruction from '../instruction.js';
3
+ import Symbol from '../symbols/symbol.js';
4
+ export interface SymbolDisplayHandler {
5
+ /**
6
+ * Controls whether a symbol should be visible in the grid.
7
+ *
8
+ * @param grid The grid that is being displayed.
9
+ * @param symbol The symbol that is being displayed.
10
+ * @param editing Whether the grid is being edited.
11
+ * @returns True if the symbol should be displayed, false otherwise. The symbol will not be displayed if any handler returns false.
12
+ */
13
+ onSymbolDisplay(grid: GridData, symbol: Symbol, editing: boolean): boolean;
14
+ }
15
+ export declare function handlesSymbolDisplay<T extends Instruction>(val: T): val is T & SymbolDisplayHandler;
@@ -0,0 +1,4 @@
1
+ import { isEventHandler } from './eventHelper.js';
2
+ export function handlesSymbolDisplay(val) {
3
+ return isEventHandler(val, 'onSymbolDisplay');
4
+ }
@@ -1,8 +1,12 @@
1
1
  import GridConnections from './gridConnections.js';
2
+ import { CachedAccess } from './dataHelper.js';
2
3
  import { Color, Direction, Orientation, Position } from './primitives.js';
3
4
  import Rule from './rules/rule.js';
4
5
  import Symbol from './symbols/symbol.js';
5
6
  import TileData from './tile.js';
7
+ import MusicGridRule from './rules/musicGridRule.js';
8
+ import CompletePatternRule from './rules/completePatternRule.js';
9
+ import UndercluedRule from './rules/undercluedRule.js';
6
10
  export default class GridData {
7
11
  readonly width: number;
8
12
  readonly height: number;
@@ -10,6 +14,9 @@ export default class GridData {
10
14
  readonly connections: GridConnections;
11
15
  readonly symbols: ReadonlyMap<string, readonly Symbol[]>;
12
16
  readonly rules: readonly Rule[];
17
+ readonly musicGrid: CachedAccess<MusicGridRule | undefined>;
18
+ readonly completePattern: CachedAccess<CompletePatternRule | undefined>;
19
+ readonly underclued: CachedAccess<UndercluedRule | undefined>;
13
20
  /**
14
21
  * Create a new grid with tiles, connections, symbols and rules.
15
22
  * @param width The width of the grid.
package/dist/data/grid.js CHANGED
@@ -2,8 +2,8 @@ import { handlesGridChange } from './events/onGridChange.js';
2
2
  import { handlesGridResize } from './events/onGridResize.js';
3
3
  import { handlesSetGrid } from './events/onSetGrid.js';
4
4
  import GridConnections from './gridConnections.js';
5
- import { array, move } from './dataHelper.js';
6
- import { Color } from './primitives.js';
5
+ import { CachedAccess, array, move } from './dataHelper.js';
6
+ import { Color, MajorRule, } from './primitives.js';
7
7
  import TileData from './tile.js';
8
8
  const NEIGHBOR_OFFSETS = [
9
9
  { x: -1, y: 0 },
@@ -12,6 +12,7 @@ const NEIGHBOR_OFFSETS = [
12
12
  { x: 0, y: 1 },
13
13
  ];
14
14
  export default class GridData {
15
+ /* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
15
16
  /**
16
17
  * Create a new grid with tiles, connections, symbols and rules.
17
18
  * @param width The width of the grid.
@@ -58,6 +59,26 @@ export default class GridData {
58
59
  writable: true,
59
60
  value: void 0
60
61
  });
62
+ // Important rules are cached for quick access
63
+ /* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
64
+ Object.defineProperty(this, "musicGrid", {
65
+ enumerable: true,
66
+ configurable: true,
67
+ writable: true,
68
+ value: CachedAccess.of(() => this.findRule(rule => rule.id === MajorRule.MusicGrid))
69
+ });
70
+ Object.defineProperty(this, "completePattern", {
71
+ enumerable: true,
72
+ configurable: true,
73
+ writable: true,
74
+ value: CachedAccess.of(() => this.findRule(rule => rule.id === MajorRule.CompletePattern))
75
+ });
76
+ Object.defineProperty(this, "underclued", {
77
+ enumerable: true,
78
+ configurable: true,
79
+ writable: true,
80
+ value: CachedAccess.of(() => this.findRule(rule => rule.id === MajorRule.Underclued))
81
+ });
61
82
  this.width = width;
62
83
  this.height = height;
63
84
  this.tiles = tiles ?? array(width, height, () => TileData.empty());
@@ -9,6 +9,7 @@ export default abstract class Instruction extends Configurable {
9
9
  */
10
10
  get validateWithSolution(): boolean;
11
11
  get necessaryForCompletion(): boolean;
12
+ get visibleWhenSolving(): boolean;
12
13
  /**
13
14
  * Check if this instruction is equal to another instruction by comparing their IDs and configs.
14
15
  *
@@ -9,6 +9,9 @@ export default class Instruction extends Configurable {
9
9
  get necessaryForCompletion() {
10
10
  return true;
11
11
  }
12
+ get visibleWhenSolving() {
13
+ return true;
14
+ }
12
15
  /**
13
16
  * Check if this instruction is equal to another instruction by comparing their IDs and configs.
14
17
  *
@@ -8,6 +8,14 @@ export interface Edge {
8
8
  readonly x2: number;
9
9
  readonly y2: number;
10
10
  }
11
+ /**
12
+ * Major rules are frequently referenced in grids to provide additional UI.
13
+ */
14
+ export declare enum MajorRule {
15
+ MusicGrid = "music",
16
+ CompletePattern = "complete_pattern",
17
+ Underclued = "underclued"
18
+ }
11
19
  export declare enum State {
12
20
  Error = "error",
13
21
  Satisfied = "satisfied",
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Major rules are frequently referenced in grids to provide additional UI.
3
+ */
4
+ export var MajorRule;
5
+ (function (MajorRule) {
6
+ MajorRule["MusicGrid"] = "music";
7
+ MajorRule["CompletePattern"] = "complete_pattern";
8
+ MajorRule["Underclued"] = "underclued";
9
+ })(MajorRule || (MajorRule = {}));
1
10
  export var State;
2
11
  (function (State) {
3
12
  State["Error"] = "error";
@@ -1,5 +1,5 @@
1
1
  import GridData from '../grid.js';
2
- import { State } from '../primitives.js';
2
+ import { MajorRule, State } from '../primitives.js';
3
3
  import Rule from './rule.js';
4
4
  class CompletePatternRule extends Rule {
5
5
  /**
@@ -11,7 +11,7 @@ class CompletePatternRule extends Rule {
11
11
  super();
12
12
  }
13
13
  get id() {
14
- return `complete_pattern`;
14
+ return MajorRule.CompletePattern;
15
15
  }
16
16
  get explanation() {
17
17
  return `Complete the pattern`;
@@ -21,6 +21,7 @@ export default class ForesightRule extends Rule {
21
21
  get searchVariants(): SearchVariant[];
22
22
  validateGrid(_grid: GridData): RuleState;
23
23
  get necessaryForCompletion(): boolean;
24
+ get isSingleton(): boolean;
24
25
  copyWith({ count, regenInterval, startFull, }: {
25
26
  count?: number;
26
27
  regenInterval?: number;
@@ -55,6 +55,9 @@ class ForesightRule extends Rule {
55
55
  get necessaryForCompletion() {
56
56
  return false;
57
57
  }
58
+ get isSingleton() {
59
+ return true;
60
+ }
58
61
  copyWith({ count, regenInterval, startFull, }) {
59
62
  return new ForesightRule(count ?? this.count, regenInterval ?? this.regenInterval, startFull ?? this.startFull);
60
63
  }
@@ -1,7 +1,7 @@
1
1
  import { ConfigType } from '../config.js';
2
2
  import GridData from '../grid.js';
3
3
  import { resize } from '../dataHelper.js';
4
- import { Color, State } from '../primitives.js';
4
+ import { Color, MajorRule, State } from '../primitives.js';
5
5
  import CustomIconSymbol from '../symbols/customIconSymbol.js';
6
6
  import { ControlLine, Row } from './musicControlLine.js';
7
7
  import Rule from './rule.js';
@@ -39,7 +39,7 @@ class MusicGridRule extends Rule {
39
39
  this.track = track;
40
40
  }
41
41
  get id() {
42
- return `music`;
42
+ return MajorRule.MusicGrid;
43
43
  }
44
44
  get explanation() {
45
45
  return `*Music Grid:* Listen to the solution`;
@@ -22,6 +22,7 @@ export default class OffByXRule extends Rule implements SymbolValidationHandler
22
22
  get searchVariants(): SearchVariant[];
23
23
  validateGrid(_grid: GridData): RuleState;
24
24
  onSymbolValidation(grid: GridData, symbol: Symbol, _validator: (grid: GridData) => State): State | undefined;
25
+ get isSingleton(): boolean;
25
26
  copyWith({ number }: {
26
27
  number?: number;
27
28
  }): this;
@@ -63,6 +63,9 @@ class OffByXRule extends Rule {
63
63
  return undefined;
64
64
  }
65
65
  }
66
+ get isSingleton() {
67
+ return true;
68
+ }
66
69
  copyWith({ number }) {
67
70
  return new OffByXRule(number ?? this.number);
68
71
  }
@@ -9,7 +9,6 @@ export default abstract class Rule extends Instruction {
9
9
  abstract validateGrid(grid: GridData): RuleState;
10
10
  abstract get searchVariants(): SearchVariant[];
11
11
  searchVariant(): SearchVariant;
12
- get visibleWhenSolving(): boolean;
13
12
  /**
14
13
  * Whether only one instance of this rule is allowed in a grid.
15
14
  */
@@ -6,9 +6,6 @@ export default class Rule extends Instruction {
6
6
  rule: this,
7
7
  };
8
8
  }
9
- get visibleWhenSolving() {
10
- return true;
11
- }
12
9
  /**
13
10
  * Whether only one instance of this rule is allowed in a grid.
14
11
  */
@@ -136,7 +136,9 @@ class SymbolsPerRegionRule extends Rule {
136
136
  static countAllSymbolsOfPosition(grid, x, y) {
137
137
  let count = 0;
138
138
  for (const symbolKind of grid.symbols.values()) {
139
- if (symbolKind.some(symbol => Math.floor(symbol.x) === x && Math.floor(symbol.y) === y)) {
139
+ if (symbolKind.some(symbol => Math.floor(symbol.x) === x &&
140
+ Math.floor(symbol.y) === y &&
141
+ symbol.necessaryForCompletion)) {
140
142
  count++;
141
143
  }
142
144
  }
@@ -1,5 +1,5 @@
1
1
  import GridData from '../grid.js';
2
- import { State } from '../primitives.js';
2
+ import { MajorRule, State } from '../primitives.js';
3
3
  import AreaNumberSymbol from '../symbols/areaNumberSymbol.js';
4
4
  import CustomTextSymbol from '../symbols/customTextSymbol.js';
5
5
  import Rule from './rule.js';
@@ -13,7 +13,7 @@ class UndercluedRule extends Rule {
13
13
  super();
14
14
  }
15
15
  get id() {
16
- return `underclued`;
16
+ return MajorRule.Underclued;
17
17
  }
18
18
  get explanation() {
19
19
  return `*Underclued Grid:* Mark only what is definitely true`;
@@ -0,0 +1,36 @@
1
+ import { AnyConfig } from '../config.js';
2
+ import { SymbolDisplayHandler } from '../events/onSymbolDisplay.js';
3
+ import GridData from '../grid.js';
4
+ import { Color, State } from '../primitives.js';
5
+ import Symbol from './symbol.js';
6
+ export default class HiddenSymbol extends Symbol implements SymbolDisplayHandler {
7
+ readonly x: number;
8
+ readonly y: number;
9
+ readonly color: Color;
10
+ private static readonly CONFIGS;
11
+ private static readonly EXAMPLE_GRID;
12
+ /**
13
+ * **Hidden Symbols: color cells correctly to reveal more clues**
14
+ *
15
+ * @param x - The x-coordinate of the symbol.
16
+ * @param y - The y-coordinate of the symbol.
17
+ * @param color - The target color of the cell.
18
+ */
19
+ constructor(x: number, y: number, color: Color);
20
+ get id(): string;
21
+ get explanation(): string;
22
+ get configs(): readonly AnyConfig[] | null;
23
+ createExampleGrid(): GridData;
24
+ get necessaryForCompletion(): boolean;
25
+ get visibleWhenSolving(): boolean;
26
+ get sortOrder(): number;
27
+ validateSymbol(grid: GridData): State;
28
+ onSymbolDisplay(grid: GridData, symbol: Symbol, editing: boolean): boolean;
29
+ copyWith({ x, y, color, }: {
30
+ x?: number;
31
+ y?: number;
32
+ color?: Color;
33
+ }): this;
34
+ withColor(color: Color): this;
35
+ }
36
+ export declare const instance: HiddenSymbol;
@@ -0,0 +1,119 @@
1
+ import { ConfigType } from '../config.js';
2
+ import GridData from '../grid.js';
3
+ import { Color, State } from '../primitives.js';
4
+ import CustomIconSymbol from './customIconSymbol.js';
5
+ import Symbol from './symbol.js';
6
+ class HiddenSymbol extends Symbol {
7
+ /**
8
+ * **Hidden Symbols: color cells correctly to reveal more clues**
9
+ *
10
+ * @param x - The x-coordinate of the symbol.
11
+ * @param y - The y-coordinate of the symbol.
12
+ * @param color - The target color of the cell.
13
+ */
14
+ constructor(x, y, color) {
15
+ super(x, y);
16
+ Object.defineProperty(this, "x", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: x
21
+ });
22
+ Object.defineProperty(this, "y", {
23
+ enumerable: true,
24
+ configurable: true,
25
+ writable: true,
26
+ value: y
27
+ });
28
+ Object.defineProperty(this, "color", {
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true,
32
+ value: color
33
+ });
34
+ this.color = color;
35
+ }
36
+ get id() {
37
+ return `hidden`;
38
+ }
39
+ get explanation() {
40
+ return '*Hidden Symbols*: color cells correctly to reveal more clues';
41
+ }
42
+ get configs() {
43
+ return HiddenSymbol.CONFIGS;
44
+ }
45
+ createExampleGrid() {
46
+ return HiddenSymbol.EXAMPLE_GRID;
47
+ }
48
+ get necessaryForCompletion() {
49
+ return false;
50
+ }
51
+ get visibleWhenSolving() {
52
+ return false;
53
+ }
54
+ get sortOrder() {
55
+ return 0;
56
+ }
57
+ validateSymbol(grid) {
58
+ const thisX = Math.floor(this.x);
59
+ const thisY = Math.floor(this.y);
60
+ return grid.getTile(thisX, thisY).color === this.color
61
+ ? State.Satisfied
62
+ : State.Incomplete;
63
+ }
64
+ onSymbolDisplay(grid, symbol, editing) {
65
+ if (symbol.id === this.id || editing)
66
+ return true;
67
+ const thisX = Math.floor(this.x);
68
+ const thisY = Math.floor(this.y);
69
+ const symX = Math.floor(symbol.x);
70
+ const symY = Math.floor(symbol.y);
71
+ if (thisX !== symX || thisY !== symY)
72
+ return true;
73
+ return grid.getTile(thisX, thisY).color === this.color;
74
+ }
75
+ copyWith({ x, y, color, }) {
76
+ return new HiddenSymbol(x ?? this.x, y ?? this.y, color ?? this.color);
77
+ }
78
+ withColor(color) {
79
+ return this.copyWith({ color });
80
+ }
81
+ }
82
+ Object.defineProperty(HiddenSymbol, "CONFIGS", {
83
+ enumerable: true,
84
+ configurable: true,
85
+ writable: true,
86
+ value: Object.freeze([
87
+ {
88
+ type: ConfigType.Number,
89
+ default: 0,
90
+ field: 'x',
91
+ description: 'X',
92
+ configurable: false,
93
+ },
94
+ {
95
+ type: ConfigType.Number,
96
+ default: 0,
97
+ field: 'y',
98
+ description: 'Y',
99
+ configurable: false,
100
+ },
101
+ {
102
+ type: ConfigType.Color,
103
+ default: Color.Light,
104
+ field: 'color',
105
+ allowGray: true,
106
+ description: 'Show on color',
107
+ configurable: true,
108
+ },
109
+ ])
110
+ });
111
+ Object.defineProperty(HiddenSymbol, "EXAMPLE_GRID", {
112
+ enumerable: true,
113
+ configurable: true,
114
+ writable: true,
115
+ value: Object.freeze(GridData.create(['w']).addSymbol(new CustomIconSymbol('', GridData.create(['.']), 0, 0, 'MdHideSource') // Not using HiddenSymbol here because it is meant to be hidden in non-edit mode
116
+ ))
117
+ });
118
+ export default HiddenSymbol;
119
+ export const instance = new HiddenSymbol(0, 0, Color.Light);
@@ -8,7 +8,14 @@ export default abstract class Symbol extends Instruction implements GridResizeHa
8
8
  constructor(x: number, y: number);
9
9
  abstract validateSymbol(grid: GridData): State;
10
10
  onGridResize(_grid: GridData, mode: 'insert' | 'remove', direction: 'row' | 'column', index: number): this | null;
11
+ /**
12
+ * The step size for the x and y coordinates of the symbol.
13
+ */
11
14
  get placementStep(): number;
15
+ /**
16
+ * The order in which symbols are displayed on the instruction list. Lower values are displayed first.
17
+ */
18
+ get sortOrder(): number;
12
19
  withX(x: number): this;
13
20
  withY(y: number): this;
14
21
  withPosition(x: number, y: number): this;
@@ -35,9 +35,18 @@ export default class Symbol extends Instruction {
35
35
  });
36
36
  }
37
37
  }
38
+ /**
39
+ * The step size for the x and y coordinates of the symbol.
40
+ */
38
41
  get placementStep() {
39
42
  return 0.5;
40
43
  }
44
+ /**
45
+ * The order in which symbols are displayed on the instruction list. Lower values are displayed first.
46
+ */
47
+ get sortOrder() {
48
+ return this.id.charCodeAt(0);
49
+ }
41
50
  withX(x) {
42
51
  return this.copyWith({ x });
43
52
  }
@@ -3,6 +3,7 @@ export { instance as CustomIconSymbol } from './customIconSymbol.js';
3
3
  export { instance as CustomTextSymbol } from './customTextSymbol.js';
4
4
  export { instance as DartSymbol } from './dartSymbol.js';
5
5
  export { instance as GalaxySymbol } from './galaxySymbol.js';
6
+ export { instance as HiddenSymbol } from './hiddenSymbol.js';
6
7
  export { instance as LetterSymbol } from './letterSymbol.js';
7
8
  export { instance as LotusSymbol } from './lotusSymbol.js';
8
9
  export { instance as MinesweeperSymbol } from './minesweeperSymbol.js';
@@ -7,6 +7,7 @@ export { instance as CustomIconSymbol } from './customIconSymbol.js';
7
7
  export { instance as CustomTextSymbol } from './customTextSymbol.js';
8
8
  export { instance as DartSymbol } from './dartSymbol.js';
9
9
  export { instance as GalaxySymbol } from './galaxySymbol.js';
10
+ export { instance as HiddenSymbol } from './hiddenSymbol.js';
10
11
  export { instance as LetterSymbol } from './letterSymbol.js';
11
12
  export { instance as LotusSymbol } from './lotusSymbol.js';
12
13
  export { instance as MinesweeperSymbol } from './minesweeperSymbol.js';
package/dist/index.d.ts CHANGED
@@ -1,16 +1,17 @@
1
1
  import { ConfigType, configEquals } from './data/config.js';
2
2
  import Configurable from './data/configurable.js';
3
- import { allEqual, array, directionToRotation, escape, maxBy, minBy, move, orientationToRotation, resize, unescape } from './data/dataHelper.js';
3
+ import { CachedAccess, allEqual, array, directionToRotation, escape, maxBy, minBy, move, orientationToRotation, resize, unescape } from './data/dataHelper.js';
4
4
  import { isEventHandler } from './data/events/eventHelper.js';
5
5
  import { handlesFinalValidation } from './data/events/onFinalValidation.js';
6
6
  import { handlesGridChange } from './data/events/onGridChange.js';
7
7
  import { handlesGridResize } from './data/events/onGridResize.js';
8
8
  import { handlesSetGrid } from './data/events/onSetGrid.js';
9
+ import { handlesSymbolDisplay } from './data/events/onSymbolDisplay.js';
9
10
  import { handlesSymbolValidation } from './data/events/onSymbolValidation.js';
10
11
  import GridData from './data/grid.js';
11
12
  import GridConnections from './data/gridConnections.js';
12
13
  import Instruction from './data/instruction.js';
13
- import { COMPARISONS, Color, Comparison, DIRECTIONS, Direction, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle } from './data/primitives.js';
14
+ import { COMPARISONS, Color, Comparison, DIRECTIONS, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle } from './data/primitives.js';
14
15
  import { MetadataSchema, PuzzleSchema } from './data/puzzle.js';
15
16
  import BanPatternRule from './data/rules/banPatternRule.js';
16
17
  import CellCountRule from './data/rules/cellCountRule.js';
@@ -81,6 +82,7 @@ import CustomTextSymbol from './data/symbols/customTextSymbol.js';
81
82
  import DartSymbol from './data/symbols/dartSymbol.js';
82
83
  import DirectionLinkerSymbol from './data/symbols/directionLinkerSymbol.js';
83
84
  import GalaxySymbol from './data/symbols/galaxySymbol.js';
85
+ import HiddenSymbol from './data/symbols/hiddenSymbol.js';
84
86
  import { allSymbols } from './data/symbols/index.js';
85
87
  import LetterSymbol from './data/symbols/letterSymbol.js';
86
88
  import LotusSymbol from './data/symbols/lotusSymbol.js';
@@ -93,4 +95,4 @@ import ViewpointSymbol from './data/symbols/viewpointSymbol.js';
93
95
  import TileData from './data/tile.js';
94
96
  import TileConnections from './data/tileConnections.js';
95
97
  import validateGrid, { aggregateState, applyFinalOverrides } from './data/validate.js';
96
- export { ConfigType, configEquals, Configurable, allEqual, array, directionToRotation, escape, maxBy, minBy, move, orientationToRotation, resize, unescape, isEventHandler, handlesFinalValidation, handlesGridChange, handlesGridResize, handlesSetGrid, handlesSymbolValidation, GridData, GridConnections, Instruction, COMPARISONS, Color, Comparison, DIRECTIONS, Direction, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle, MetadataSchema, PuzzleSchema, BanPatternRule, CellCountRule, CompletePatternRule, ConnectAllRule, CustomRule, ForesightRule, allRules, ControlLine, Row, MusicGridRule, MysteryRule, OffByXRule, RegionAreaRule, RegionShapeRule, Rule, SameShapeRule, SymbolsPerRegionRule, UndercluedRule, UniqueShapeRule, Serializer, Compressor, CompressorBase, DeflateCompressor, GzipCompressor, StreamCompressor, SerializerBase, SerializerV0, getShapeVariants, normalizeShape, positionsToShape, shapeEquals, tilesToShape, allSolvers, BacktrackSolver, BTModule, BTGridData, BTTile, IntArray2D, colorToBTTile, createOneTileResult, getOppositeColor, BanPatternBTModule, CellCountBTModule, ConnectAllBTModule, RegionAreaBTModule, RegionShapeBTModule, SameShapeBTModule, SymbolsPerRegionBTModule, UniqueShapeBTModule, AreaNumberBTModule, DartBTModule, DirectionLinkerBTModule, GalaxyBTModule, LetterBTModule, LotusBTModule, MinesweeperBTModule, MyopiaBTModule, ViewpointBTModule, Solver, UndercluedSolver, AreaNumberModule, CellCountModule, ConnectAllModule, DartModule, allZ3Modules, LetterModule, MyopiaModule, RegionAreaModule, ViewpointModule, Z3Module, convertDirection, Z3Solver, Z3SolverContext, AreaNumberSymbol, CustomIconSymbol, CustomSymbol, CustomTextSymbol, DartSymbol, DirectionLinkerSymbol, GalaxySymbol, allSymbols, LetterSymbol, LotusSymbol, MinesweeperSymbol, MultiEntrySymbol, MyopiaSymbol, NumberSymbol, Symbol, ViewpointSymbol, TileData, TileConnections, validateGrid, aggregateState, applyFinalOverrides, };
98
+ export { ConfigType, configEquals, Configurable, CachedAccess, allEqual, array, directionToRotation, escape, maxBy, minBy, move, orientationToRotation, resize, unescape, isEventHandler, handlesFinalValidation, handlesGridChange, handlesGridResize, handlesSetGrid, handlesSymbolDisplay, handlesSymbolValidation, GridData, GridConnections, Instruction, COMPARISONS, Color, Comparison, DIRECTIONS, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle, MetadataSchema, PuzzleSchema, BanPatternRule, CellCountRule, CompletePatternRule, ConnectAllRule, CustomRule, ForesightRule, allRules, ControlLine, Row, MusicGridRule, MysteryRule, OffByXRule, RegionAreaRule, RegionShapeRule, Rule, SameShapeRule, SymbolsPerRegionRule, UndercluedRule, UniqueShapeRule, Serializer, Compressor, CompressorBase, DeflateCompressor, GzipCompressor, StreamCompressor, SerializerBase, SerializerV0, getShapeVariants, normalizeShape, positionsToShape, shapeEquals, tilesToShape, allSolvers, BacktrackSolver, BTModule, BTGridData, BTTile, IntArray2D, colorToBTTile, createOneTileResult, getOppositeColor, BanPatternBTModule, CellCountBTModule, ConnectAllBTModule, RegionAreaBTModule, RegionShapeBTModule, SameShapeBTModule, SymbolsPerRegionBTModule, UniqueShapeBTModule, AreaNumberBTModule, DartBTModule, DirectionLinkerBTModule, GalaxyBTModule, LetterBTModule, LotusBTModule, MinesweeperBTModule, MyopiaBTModule, ViewpointBTModule, Solver, UndercluedSolver, AreaNumberModule, CellCountModule, ConnectAllModule, DartModule, allZ3Modules, LetterModule, MyopiaModule, RegionAreaModule, ViewpointModule, Z3Module, convertDirection, Z3Solver, Z3SolverContext, AreaNumberSymbol, CustomIconSymbol, CustomSymbol, CustomTextSymbol, DartSymbol, DirectionLinkerSymbol, GalaxySymbol, HiddenSymbol, allSymbols, LetterSymbol, LotusSymbol, MinesweeperSymbol, MultiEntrySymbol, MyopiaSymbol, NumberSymbol, Symbol, ViewpointSymbol, TileData, TileConnections, validateGrid, aggregateState, applyFinalOverrides, };
package/dist/index.js CHANGED
@@ -3,17 +3,18 @@
3
3
  // noinspection JSUnusedGlobalSymbols
4
4
  import { ConfigType, configEquals } from './data/config.js';
5
5
  import Configurable from './data/configurable.js';
6
- import { allEqual, array, directionToRotation, escape, maxBy, minBy, move, orientationToRotation, resize, unescape } from './data/dataHelper.js';
6
+ import { CachedAccess, allEqual, array, directionToRotation, escape, maxBy, minBy, move, orientationToRotation, resize, unescape } from './data/dataHelper.js';
7
7
  import { isEventHandler } from './data/events/eventHelper.js';
8
8
  import { handlesFinalValidation } from './data/events/onFinalValidation.js';
9
9
  import { handlesGridChange } from './data/events/onGridChange.js';
10
10
  import { handlesGridResize } from './data/events/onGridResize.js';
11
11
  import { handlesSetGrid } from './data/events/onSetGrid.js';
12
+ import { handlesSymbolDisplay } from './data/events/onSymbolDisplay.js';
12
13
  import { handlesSymbolValidation } from './data/events/onSymbolValidation.js';
13
14
  import GridData from './data/grid.js';
14
15
  import GridConnections from './data/gridConnections.js';
15
16
  import Instruction from './data/instruction.js';
16
- import { COMPARISONS, Color, Comparison, DIRECTIONS, Direction, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle } from './data/primitives.js';
17
+ import { COMPARISONS, Color, Comparison, DIRECTIONS, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle } from './data/primitives.js';
17
18
  import { MetadataSchema, PuzzleSchema } from './data/puzzle.js';
18
19
  import BanPatternRule from './data/rules/banPatternRule.js';
19
20
  import CellCountRule from './data/rules/cellCountRule.js';
@@ -84,6 +85,7 @@ import CustomTextSymbol from './data/symbols/customTextSymbol.js';
84
85
  import DartSymbol from './data/symbols/dartSymbol.js';
85
86
  import DirectionLinkerSymbol from './data/symbols/directionLinkerSymbol.js';
86
87
  import GalaxySymbol from './data/symbols/galaxySymbol.js';
88
+ import HiddenSymbol from './data/symbols/hiddenSymbol.js';
87
89
  import { allSymbols } from './data/symbols/index.js';
88
90
  import LetterSymbol from './data/symbols/letterSymbol.js';
89
91
  import LotusSymbol from './data/symbols/lotusSymbol.js';
@@ -96,4 +98,4 @@ import ViewpointSymbol from './data/symbols/viewpointSymbol.js';
96
98
  import TileData from './data/tile.js';
97
99
  import TileConnections from './data/tileConnections.js';
98
100
  import validateGrid, { aggregateState, applyFinalOverrides } from './data/validate.js';
99
- export { ConfigType, configEquals, Configurable, allEqual, array, directionToRotation, escape, maxBy, minBy, move, orientationToRotation, resize, unescape, isEventHandler, handlesFinalValidation, handlesGridChange, handlesGridResize, handlesSetGrid, handlesSymbolValidation, GridData, GridConnections, Instruction, COMPARISONS, Color, Comparison, DIRECTIONS, Direction, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle, MetadataSchema, PuzzleSchema, BanPatternRule, CellCountRule, CompletePatternRule, ConnectAllRule, CustomRule, ForesightRule, allRules, ControlLine, Row, MusicGridRule, MysteryRule, OffByXRule, RegionAreaRule, RegionShapeRule, Rule, SameShapeRule, SymbolsPerRegionRule, UndercluedRule, UniqueShapeRule, Serializer, Compressor, CompressorBase, DeflateCompressor, GzipCompressor, StreamCompressor, SerializerBase, SerializerV0, getShapeVariants, normalizeShape, positionsToShape, shapeEquals, tilesToShape, allSolvers, BacktrackSolver, BTModule, BTGridData, BTTile, IntArray2D, colorToBTTile, createOneTileResult, getOppositeColor, BanPatternBTModule, CellCountBTModule, ConnectAllBTModule, RegionAreaBTModule, RegionShapeBTModule, SameShapeBTModule, SymbolsPerRegionBTModule, UniqueShapeBTModule, AreaNumberBTModule, DartBTModule, DirectionLinkerBTModule, GalaxyBTModule, LetterBTModule, LotusBTModule, MinesweeperBTModule, MyopiaBTModule, ViewpointBTModule, Solver, UndercluedSolver, AreaNumberModule, CellCountModule, ConnectAllModule, DartModule, allZ3Modules, LetterModule, MyopiaModule, RegionAreaModule, ViewpointModule, Z3Module, convertDirection, Z3Solver, Z3SolverContext, AreaNumberSymbol, CustomIconSymbol, CustomSymbol, CustomTextSymbol, DartSymbol, DirectionLinkerSymbol, GalaxySymbol, allSymbols, LetterSymbol, LotusSymbol, MinesweeperSymbol, MultiEntrySymbol, MyopiaSymbol, NumberSymbol, Symbol, ViewpointSymbol, TileData, TileConnections, validateGrid, aggregateState, applyFinalOverrides, };
101
+ export { ConfigType, configEquals, Configurable, CachedAccess, allEqual, array, directionToRotation, escape, maxBy, minBy, move, orientationToRotation, resize, unescape, isEventHandler, handlesFinalValidation, handlesGridChange, handlesGridResize, handlesSetGrid, handlesSymbolDisplay, handlesSymbolValidation, GridData, GridConnections, Instruction, COMPARISONS, Color, Comparison, DIRECTIONS, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle, MetadataSchema, PuzzleSchema, BanPatternRule, CellCountRule, CompletePatternRule, ConnectAllRule, CustomRule, ForesightRule, allRules, ControlLine, Row, MusicGridRule, MysteryRule, OffByXRule, RegionAreaRule, RegionShapeRule, Rule, SameShapeRule, SymbolsPerRegionRule, UndercluedRule, UniqueShapeRule, Serializer, Compressor, CompressorBase, DeflateCompressor, GzipCompressor, StreamCompressor, SerializerBase, SerializerV0, getShapeVariants, normalizeShape, positionsToShape, shapeEquals, tilesToShape, allSolvers, BacktrackSolver, BTModule, BTGridData, BTTile, IntArray2D, colorToBTTile, createOneTileResult, getOppositeColor, BanPatternBTModule, CellCountBTModule, ConnectAllBTModule, RegionAreaBTModule, RegionShapeBTModule, SameShapeBTModule, SymbolsPerRegionBTModule, UniqueShapeBTModule, AreaNumberBTModule, DartBTModule, DirectionLinkerBTModule, GalaxyBTModule, LetterBTModule, LotusBTModule, MinesweeperBTModule, MyopiaBTModule, ViewpointBTModule, Solver, UndercluedSolver, AreaNumberModule, CellCountModule, ConnectAllModule, DartModule, allZ3Modules, LetterModule, MyopiaModule, RegionAreaModule, ViewpointModule, Z3Module, convertDirection, Z3Solver, Z3SolverContext, AreaNumberSymbol, CustomIconSymbol, CustomSymbol, CustomTextSymbol, DartSymbol, DirectionLinkerSymbol, GalaxySymbol, HiddenSymbol, allSymbols, LetterSymbol, LotusSymbol, MinesweeperSymbol, MultiEntrySymbol, MyopiaSymbol, NumberSymbol, Symbol, ViewpointSymbol, TileData, TileConnections, validateGrid, aggregateState, applyFinalOverrides, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logic-pad/core",
3
- "version": "0.1.6",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",