cm-chessboard 8.12.4 → 8.12.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-chessboard",
3
- "version": "8.12.4",
3
+ "version": "8.12.5",
4
4
  "description": "A JavaScript chessboard which is lightweight, ES6 module based, responsive, SVG rendered and without dependencies.",
5
5
  "keywords": [
6
6
  "chess",
@@ -28,6 +28,33 @@ Removes markers from the board.
28
28
  Only set `type` to remove all markers of `type` from the board. Set `type` to `undefined`, to remove all types
29
29
  of markers from a square. Call without parameters to remove all markers from the board.
30
30
 
31
+ ## Marker type identity
32
+
33
+ Marker types are matched by **object reference**, not by structural
34
+ equality. Two type objects that only *look* the same are intentionally
35
+ treated as different types — this lets you have several visually
36
+ identical marker types that can be managed independently.
37
+
38
+ Always keep your marker types as module-level constants and pass the
39
+ **same reference** to `addMarker` and `removeMarkers`:
40
+
41
+ ```js
42
+ // ✅ works — same reference
43
+ const myType = {class: "marker-frame", slice: "markerFrame"}
44
+ board.addMarker(myType, "e4")
45
+ board.removeMarkers(myType) // removed
46
+
47
+ // ❌ silently does nothing — different reference, even though the
48
+ // object looks identical
49
+ board.addMarker({class: "marker-frame", slice: "markerFrame"}, "e4")
50
+ board.removeMarkers({class: "marker-frame", slice: "markerFrame"})
51
+ ```
52
+
53
+ The same applies to the exported `MARKER_TYPE.*` constants: import them
54
+ once and reuse that reference — don't clone them (e.g. via
55
+ `JSON.parse(JSON.stringify(...))` or a framework store that
56
+ deep-copies), or `removeMarkers` won't find a match.
57
+
31
58
  ## Create your own custom markers
32
59
 
33
60
  Just create an object like `const myMarker = {class: "markerCssClass", slice: "markerSliceId"}`, where `class` is the