next-chessground 0.12.2 → 0.13.3

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/dist/index.es.js CHANGED
@@ -6351,29 +6351,7 @@ const useDisclosure = (initialState = false) => {
6351
6351
  };
6352
6352
 
6353
6353
  const cgProps = props => {
6354
- const cgProps = {};
6355
-
6356
- if (props.viewOnly) {
6357
- cgProps.draggable = false;
6358
- cgProps.movable = {
6359
- free: false
6360
- };
6361
- cgProps.drawable = {
6362
- enabled: false
6363
- };
6364
- }
6365
-
6366
- if (props.readOnly) {
6367
- cgProps.draggable = false;
6368
- cgProps.movable = {
6369
- free: false
6370
- };
6371
- cgProps.drawable = {
6372
- enabled: false
6373
- };
6374
- cgProps.coordinates = false;
6375
- } // normalize orientation for Chessground
6376
-
6354
+ const cgProps = {}; // normalize orientation for Chessground
6377
6355
 
6378
6356
  if (props.orientation) {
6379
6357
  cgProps.orientation = props.orientation;
@@ -6411,6 +6389,27 @@ const cgProps = props => {
6411
6389
  };
6412
6390
  }
6413
6391
 
6392
+ if (props.viewOnly) {
6393
+ cgProps.draggable = false;
6394
+ cgProps.movable = {
6395
+ free: false
6396
+ };
6397
+ cgProps.drawable = {
6398
+ enabled: false
6399
+ };
6400
+ }
6401
+
6402
+ if (props.readOnly) {
6403
+ cgProps.draggable = false;
6404
+ cgProps.movable = {
6405
+ free: false
6406
+ };
6407
+ cgProps.drawable = {
6408
+ enabled: false
6409
+ };
6410
+ cgProps.coordinates = false;
6411
+ }
6412
+
6414
6413
  return cgProps;
6415
6414
  };
6416
6415
 
@@ -6438,7 +6437,8 @@ const Chessboard = (props, ref) => {
6438
6437
  const move = onMove(from, to, promotion);
6439
6438
 
6440
6439
  if (!move) {
6441
- return show();
6440
+ show();
6441
+ return false;
6442
6442
  }
6443
6443
 
6444
6444
  if (theme.playSounds) {
@@ -6468,6 +6468,11 @@ const Chessboard = (props, ref) => {
6468
6468
  }
6469
6469
  };
6470
6470
 
6471
+ useEffect(() => {
6472
+ if (typeof props.setPromoting === 'function') {
6473
+ props.setPromoting(isOpen);
6474
+ }
6475
+ }, [isOpen]);
6471
6476
  return /*#__PURE__*/React.createElement("div", {
6472
6477
  className: mergeClassNames('chessground', theme.highlight && 'highlight', theme.board, theme.pieces)
6473
6478
  }, /*#__PURE__*/React.createElement(Chessground$1, _extends({
@@ -6894,6 +6899,9 @@ const NextEditor = (props, ref) => {
6894
6899
  role: null,
6895
6900
  color: null
6896
6901
  });
6902
+ useEffect(() => {
6903
+ setFen(props.fen);
6904
+ }, [props.fen]);
6897
6905
  useEffect(() => {
6898
6906
  if (typeof props.onSelect === 'function') {
6899
6907
  props.onSelect(fen);
package/dist/index.js CHANGED
@@ -6360,29 +6360,7 @@ const useDisclosure = (initialState = false) => {
6360
6360
  };
6361
6361
 
6362
6362
  const cgProps = props => {
6363
- const cgProps = {};
6364
-
6365
- if (props.viewOnly) {
6366
- cgProps.draggable = false;
6367
- cgProps.movable = {
6368
- free: false
6369
- };
6370
- cgProps.drawable = {
6371
- enabled: false
6372
- };
6373
- }
6374
-
6375
- if (props.readOnly) {
6376
- cgProps.draggable = false;
6377
- cgProps.movable = {
6378
- free: false
6379
- };
6380
- cgProps.drawable = {
6381
- enabled: false
6382
- };
6383
- cgProps.coordinates = false;
6384
- } // normalize orientation for Chessground
6385
-
6363
+ const cgProps = {}; // normalize orientation for Chessground
6386
6364
 
6387
6365
  if (props.orientation) {
6388
6366
  cgProps.orientation = props.orientation;
@@ -6420,6 +6398,27 @@ const cgProps = props => {
6420
6398
  };
6421
6399
  }
6422
6400
 
6401
+ if (props.viewOnly) {
6402
+ cgProps.draggable = false;
6403
+ cgProps.movable = {
6404
+ free: false
6405
+ };
6406
+ cgProps.drawable = {
6407
+ enabled: false
6408
+ };
6409
+ }
6410
+
6411
+ if (props.readOnly) {
6412
+ cgProps.draggable = false;
6413
+ cgProps.movable = {
6414
+ free: false
6415
+ };
6416
+ cgProps.drawable = {
6417
+ enabled: false
6418
+ };
6419
+ cgProps.coordinates = false;
6420
+ }
6421
+
6423
6422
  return cgProps;
6424
6423
  };
6425
6424
 
@@ -6447,7 +6446,8 @@ const Chessboard = (props, ref) => {
6447
6446
  const move = onMove(from, to, promotion);
6448
6447
 
6449
6448
  if (!move) {
6450
- return show();
6449
+ show();
6450
+ return false;
6451
6451
  }
6452
6452
 
6453
6453
  if (theme.playSounds) {
@@ -6477,6 +6477,11 @@ const Chessboard = (props, ref) => {
6477
6477
  }
6478
6478
  };
6479
6479
 
6480
+ React.useEffect(() => {
6481
+ if (typeof props.setPromoting === 'function') {
6482
+ props.setPromoting(isOpen);
6483
+ }
6484
+ }, [isOpen]);
6480
6485
  return /*#__PURE__*/React__default['default'].createElement("div", {
6481
6486
  className: mergeClassNames('chessground', theme.highlight && 'highlight', theme.board, theme.pieces)
6482
6487
  }, /*#__PURE__*/React__default['default'].createElement(Chessground$1, _extends({
@@ -6903,6 +6908,9 @@ const NextEditor = (props, ref) => {
6903
6908
  role: null,
6904
6909
  color: null
6905
6910
  });
6911
+ React.useEffect(() => {
6912
+ setFen(props.fen);
6913
+ }, [props.fen]);
6906
6914
  React.useEffect(() => {
6907
6915
  if (typeof props.onSelect === 'function') {
6908
6916
  props.onSelect(fen);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-chessground",
3
- "version": "0.12.2",
3
+ "version": "0.13.3",
4
4
  "description": "React and Next wrapper for Chessground with chessboard and pieces out of the box",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",