@mirasen/chessboard 1.0.0 → 1.0.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/CHANGELOG.md +12 -0
- package/README.md +9 -0
- package/dist/runtime/input/controller/factory.js +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @mirasen/chessboard
|
|
2
2
|
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- db4969e: Fix README
|
|
8
|
+
|
|
9
|
+
## 1.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- be927e3: Call `preventDefault()` for board-handled input events to suppress native browser behavior.
|
|
14
|
+
|
|
3
15
|
## 1.0.0
|
|
4
16
|
|
|
5
17
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -53,6 +53,15 @@ That means the board already covers a meaningful baseline chess UX instead of st
|
|
|
53
53
|
npm install @mirasen/chessboard
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
## Live examples
|
|
57
|
+
|
|
58
|
+
Interactive examples are available on the Mirasen website:
|
|
59
|
+
|
|
60
|
+
- [Examples overview](https://mirasen.io/chessboard/examples/)
|
|
61
|
+
- [Minimal interactive example](https://mirasen.io/chessboard/examples/minimal.html)
|
|
62
|
+
- [Legal moves example](https://mirasen.io/chessboard/examples/legal-moves.html)
|
|
63
|
+
- [Promotion example](https://mirasen.io/chessboard/examples/promotion.html)
|
|
64
|
+
|
|
56
65
|
## Usage
|
|
57
66
|
|
|
58
67
|
### Minimal example
|
|
@@ -11,6 +11,7 @@ export function createInteractionController(options) {
|
|
|
11
11
|
onEvent(context) {
|
|
12
12
|
internalState.surface.onEvent(context);
|
|
13
13
|
if (context.rawEvent.defaultPrevented) {
|
|
14
|
+
transmitTransientInput(internalState, context);
|
|
14
15
|
return; // The event has been handled by the surface (extensions)
|
|
15
16
|
}
|
|
16
17
|
switch (context.rawEvent.type) {
|
|
@@ -28,6 +29,10 @@ export function createInteractionController(options) {
|
|
|
28
29
|
break;
|
|
29
30
|
}
|
|
30
31
|
transmitTransientInput(internalState, context);
|
|
32
|
+
if (!context.rawEvent.defaultPrevented && context.rawEvent.cancelable) {
|
|
33
|
+
// Suppress native browser behavior for board-handled events.
|
|
34
|
+
context.rawEvent.preventDefault();
|
|
35
|
+
}
|
|
31
36
|
}
|
|
32
37
|
};
|
|
33
38
|
}
|
package/package.json
CHANGED