@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @mirasen/chessboard
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - be927e3: Call `preventDefault()` for board-handled input events to suppress native browser behavior.
8
+
3
9
  ## 1.0.0
4
10
 
5
11
  ### Major Changes
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  [![NPM Version](https://img.shields.io/npm/v/%40mirasen%2Fchessboard)](https://www.npmjs.com/package/@mirasen/chessboard)
2
2
  [![CI](https://github.com/mirasen-io/chessboard/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mirasen-io/chessboard/actions/workflows/ci.yml)
3
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mirasen-io_chessboard&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=mirasen-io_chessboard)
4
+ [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=mirasen-io_chessboard&metric=coverage)](https://sonarcloud.io/summary/new_code?id=mirasen-io_chessboard)
3
5
  [![License](https://img.shields.io/npm/l/@mirasen/chessboard)](./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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mirasen/chessboard",
3
3
  "description": "Framework-agnostic TypeScript chessboard platform with real chess interaction built in.",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Mirasen",