@mirasen/chessboard 1.0.0 → 1.0.1
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 +6 -0
- package/README.md +11 -0
- package/dist/runtime/input/controller/factory.js +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/@mirasen/chessboard)
|
|
2
2
|
[](https://github.com/mirasen-io/chessboard/actions/workflows/ci.yml)
|
|
3
|
+
[](https://sonarcloud.io/summary/new_code?id=mirasen-io_chessboard)
|
|
4
|
+
[](https://sonarcloud.io/summary/new_code?id=mirasen-io_chessboard)
|
|
3
5
|
[](./LICENSE)
|
|
4
6
|
|
|
5
7
|
# @mirasen/chessboard
|
|
@@ -53,6 +55,15 @@ That means the board already covers a meaningful baseline chess UX instead of st
|
|
|
53
55
|
npm install @mirasen/chessboard
|
|
54
56
|
```
|
|
55
57
|
|
|
58
|
+
## Live examples
|
|
59
|
+
|
|
60
|
+
Interactive examples are available on the Mirasen website:
|
|
61
|
+
|
|
62
|
+
- [Examples overview](https://mirasen.io/chessboard/examples/)
|
|
63
|
+
- [Minimal interactive example](https://mirasen.io/chessboard/examples/minimal.html)
|
|
64
|
+
- [Legal moves example](https://mirasen.io/chessboard/examples/legal-moves.html)
|
|
65
|
+
- [Promotion example](https://mirasen.io/chessboard/examples/promotion.html)
|
|
66
|
+
|
|
56
67
|
## Usage
|
|
57
68
|
|
|
58
69
|
### 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