kokopu-react 1.11.1 → 2.0.0
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/.eslintrc.yml +84 -0
- package/.nycrc.yml +0 -1
- package/README.md +1 -1
- package/{src/css/chessboard.css → dist/lib/chessboard/Chessboard.css} +2 -2
- package/dist/lib/chessboard/Chessboard.d.ts +171 -0
- package/dist/lib/chessboard/Chessboard.js +365 -0
- package/dist/lib/chessboard/Chessboard.js.map +1 -0
- package/dist/lib/chessboard/ChessboardImpl.d.ts +119 -0
- package/dist/lib/chessboard/ChessboardImpl.js +471 -0
- package/dist/lib/chessboard/ChessboardImpl.js.map +1 -0
- package/dist/lib/chessboard/Draggable.d.ts +62 -0
- package/dist/lib/chessboard/Draggable.js +157 -0
- package/dist/lib/chessboard/Draggable.js.map +1 -0
- package/dist/lib/chessboard/Motion.d.ts +28 -0
- package/dist/lib/chessboard/Motion.js +74 -0
- package/dist/lib/chessboard/Motion.js.map +1 -0
- package/dist/lib/chessboard/colorsets.d.ts +5 -0
- package/dist/lib/{impl → chessboard}/colorsets.js +43 -47
- package/dist/lib/chessboard/colorsets.js.map +1 -0
- package/dist/lib/chessboard/piecesets.d.ts +5 -0
- package/dist/lib/chessboard/piecesets.js +214 -0
- package/dist/lib/chessboard/piecesets.js.map +1 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-bb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-bk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-bn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-bp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-bq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-br.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-bx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wr.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-bb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-bk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-bn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-bp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-bq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-br.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-bx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wr.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-bb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-bk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-bn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-bp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-bq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-br.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-spatial-bx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-spatial-wx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-wb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-wk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-wn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-wp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-wq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-wr.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-bb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-bk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-bn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-bp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-bq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-br.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-bx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wr.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-bb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-bk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-bn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-bp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-bq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-br.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-bx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wr.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-bb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-bk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-bn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-bp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-bq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-br.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-wb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-wk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-wn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-wp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-wq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-wr.png +0 -0
- package/dist/lib/{css/error_box.css → errorbox/ErrorBox.css} +2 -2
- package/dist/lib/errorbox/ErrorBox.d.ts +28 -0
- package/dist/lib/errorbox/ErrorBox.js +84 -0
- package/dist/lib/errorbox/ErrorBox.js.map +1 -0
- package/dist/lib/exception.d.ts +18 -0
- package/dist/lib/exception.js +40 -0
- package/dist/lib/exception.js.map +1 -0
- package/dist/lib/i18n.d.ts +18 -0
- package/dist/lib/i18n.js +20 -33
- package/dist/lib/i18n.js.map +1 -0
- package/{src/css/symbol.css → dist/lib/icons/AnnotationSymbolShape.css} +2 -2
- package/dist/lib/icons/AnnotationSymbolShape.d.ts +30 -0
- package/dist/lib/{impl/ArrowTip.js → icons/AnnotationSymbolShape.js} +21 -35
- package/dist/lib/icons/AnnotationSymbolShape.js.map +1 -0
- package/dist/lib/icons/ArrowMarkerIcon.d.ts +20 -0
- package/dist/lib/icons/ArrowMarkerIcon.js +53 -0
- package/dist/lib/icons/ArrowMarkerIcon.js.map +1 -0
- package/dist/lib/icons/ArrowTip.d.ts +16 -0
- package/dist/lib/icons/ArrowTip.js +29 -0
- package/dist/lib/icons/ArrowTip.js.map +1 -0
- package/dist/lib/icons/SquareMarkerIcon.d.ts +18 -0
- package/{src/i18n.js → dist/lib/icons/SquareMarkerIcon.js} +24 -23
- package/dist/lib/icons/SquareMarkerIcon.js.map +1 -0
- package/dist/lib/icons/TextMarkerIcon.d.ts +23 -0
- package/dist/lib/icons/TextMarkerIcon.js +45 -0
- package/dist/lib/icons/TextMarkerIcon.js.map +1 -0
- package/{src/css → dist/lib/icons}/arrow.css +2 -2
- package/dist/lib/index.d.ts +10 -0
- package/dist/lib/index.js +31 -105
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/{css/movetext.css → movetext/Movetext.css} +2 -2
- package/dist/lib/movetext/Movetext.d.ts +136 -0
- package/dist/lib/movetext/Movetext.js +167 -0
- package/dist/lib/movetext/Movetext.js.map +1 -0
- package/dist/lib/movetext/MovetextImpl.d.ts +85 -0
- package/dist/lib/movetext/MovetextImpl.js +411 -0
- package/dist/lib/movetext/MovetextImpl.js.map +1 -0
- package/dist/lib/{fonts → movetext/fonts}/chessalpha.woff +0 -0
- package/dist/lib/{fonts → movetext/fonts}/chessalpha.woff2 +0 -0
- package/dist/lib/{css → movetext}/fonts.css +4 -4
- package/dist/lib/movetext/htmlFilter.d.ts +7 -0
- package/dist/lib/movetext/htmlFilter.js +169 -0
- package/dist/lib/movetext/htmlFilter.js.map +1 -0
- package/dist/lib/movetext/moveFormatter.d.ts +20 -0
- package/dist/lib/movetext/moveFormatter.js +93 -0
- package/dist/lib/movetext/moveFormatter.js.map +1 -0
- package/dist/lib/sanitization.d.ts +6 -0
- package/dist/lib/sanitization.js +39 -0
- package/dist/lib/sanitization.js.map +1 -0
- package/dist/lib/types.d.ts +151 -0
- package/dist/lib/types.js +162 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/util.d.ts +2 -0
- package/dist/lib/util.js +36 -0
- package/dist/lib/util.js.map +1 -0
- package/doc_src/demo/{PageChessboardBase.js → PageChessboardBase.tsx} +30 -24
- package/doc_src/demo/{PageChessboardInteraction.js → PageChessboardInteraction.tsx} +95 -66
- package/doc_src/demo/{PageChessboardMove.js → PageChessboardMove.tsx} +66 -54
- package/doc_src/demo/{PageChessboardSmallScreens.js → PageChessboardSmallScreens.tsx} +23 -14
- package/doc_src/demo/{PageMovetextBase.js → PageMovetextBase.tsx} +62 -49
- package/doc_src/demo/{PageMovetextInteraction.js → PageMovetextInteraction.tsx} +58 -43
- package/doc_src/demo/decs.d.ts +31 -0
- package/doc_src/demo/demo.css +2 -2
- package/doc_src/demo/{util.js → util.ts} +3 -3
- package/doc_src/migrate_to_2.md +26 -0
- package/doc_src/theming/LogoRenderer.js +5 -5
- package/doc_src/theming/theming.css +8 -2
- package/package.json +31 -24
- package/scripts/docker-compose.yml +1 -1
- package/scripts/test-graphic.tsconfig.json +7 -0
- package/scripts/test-graphic.webpack.config.js +33 -17
- package/scripts/test-headless.webpack.config.js +6 -10
- package/{dist/lib/css/chessboard.css → src/chessboard/Chessboard.css} +2 -2
- package/src/chessboard/Chessboard.tsx +575 -0
- package/src/chessboard/ChessboardImpl.tsx +632 -0
- package/src/chessboard/Draggable.tsx +252 -0
- package/src/{impl/Motion.js → chessboard/Motion.tsx} +37 -27
- package/src/chessboard/colorsets.ts +134 -0
- package/src/chessboard/piecesets.ts +229 -0
- package/src/{sprites → chessboard/sprites}/cburnett-bb.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-bk.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-bn.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-bp.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-bq.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-br.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-bx.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wb.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wk.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wn.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wp.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wq.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wr.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wx.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-bb.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-bk.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-bn.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-bp.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-bq.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-br.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-bx.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wb.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wk.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wn.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wp.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wq.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wr.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wx.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-bb.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-bk.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-bn.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-bp.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-bq.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-br.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-spatial-bx.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-spatial-wx.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-wb.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-wk.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-wn.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-wp.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-wq.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-wr.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-bb.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-bk.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-bn.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-bp.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-bq.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-br.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-bx.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wb.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wk.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wn.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wp.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wq.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wr.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wx.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-bb.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-bk.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-bn.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-bp.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-bq.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-br.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-bx.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wb.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wk.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wn.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wp.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wq.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wr.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wx.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-bb.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-bk.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-bn.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-bp.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-bq.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-br.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-wb.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-wk.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-wn.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-wp.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-wq.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-wr.png +0 -0
- package/src/decs.d.ts +26 -0
- package/src/{css/error_box.css → errorbox/ErrorBox.css} +2 -2
- package/src/errorbox/ErrorBox.tsx +129 -0
- package/src/exception.ts +51 -0
- package/src/i18n.ts +43 -0
- package/{dist/lib/css/symbol.css → src/icons/AnnotationSymbolShape.css} +2 -2
- package/src/{impl/TextSymbol.js → icons/AnnotationSymbolShape.tsx} +32 -30
- package/src/{ArrowMarkerIcon.js → icons/ArrowMarkerIcon.tsx} +39 -36
- package/src/{impl/ArrowTip.js → icons/ArrowTip.tsx} +20 -20
- package/src/{SquareMarkerIcon.js → icons/SquareMarkerIcon.tsx} +35 -28
- package/src/{TextMarkerIcon.js → icons/TextMarkerIcon.tsx} +40 -32
- package/{dist/lib/css → src/icons}/arrow.css +2 -2
- package/src/index.ts +38 -0
- package/src/{css/movetext.css → movetext/Movetext.css} +2 -2
- package/src/movetext/Movetext.tsx +278 -0
- package/src/movetext/MovetextImpl.tsx +493 -0
- package/src/{fonts → movetext/fonts}/chessalpha.woff +0 -0
- package/src/{fonts → movetext/fonts}/chessalpha.woff2 +0 -0
- package/src/{css → movetext}/fonts.css +4 -4
- package/src/movetext/htmlFilter.tsx +188 -0
- package/src/{formatmove.js → movetext/moveFormatter.tsx} +39 -26
- package/src/sanitization.ts +51 -0
- package/src/types.ts +311 -0
- package/src/util.ts +39 -0
- package/test/.eslintrc.yml +3 -3
- package/test/{1_markers.js → 01_types.js} +89 -4
- package/test/{2_chessboard_util.js → 02_chessboard_util.js} +16 -7
- package/test/{3_marker_icons_graphic.js → 03_error_box_graphic.js} +20 -14
- package/test/04_marker_icons_graphic.js +49 -0
- package/test/05_chessboard_graphic.js +92 -0
- package/test/06_chessboard_animation.js +71 -0
- package/test/07_chessboard_interaction.js +130 -0
- package/test/08_chessboard_play_moves.js +98 -0
- package/test/{7_movetext_graphic.js → 09_movetext_graphic.js} +32 -16
- package/test/{8_movetext_interaction.js → 10_movetext_interaction.js} +18 -23
- package/test/common/graphic.js +67 -33
- package/test/graphic_references/03_error_box_graphic/base/cut_beginning_of_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/cut_end_of_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/cut_on_line_breaks.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/error_index_not_integer.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/full.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/minimal.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/missing_error_index.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/missing_error_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/negative_error_index.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/single_character_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/too_large_error_index.png +0 -0
- package/test/graphic_references/03_error_box_graphic/localization/default.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/colorized_arrow.png +0 -0
- package/test/{references/01_marker_icons/1.png → graphic_references/04_marker_icons_graphic/base/colorized_square.png} +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/colorized_symbol.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/colorized_text.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/default_arrow.png +0 -0
- package/test/{references/01_marker_icons/0.png → graphic_references/04_marker_icons_graphic/base/default_square.png} +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/default_text.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/invalid_arrow_size.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/invalid_square_size.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/invalid_symbol.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/invalid_text_size.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/wrapped_arrow.png +0 -0
- package/test/{references/01_marker_icons/2.png → graphic_references/04_marker_icons_graphic/base/wrapped_square.png} +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/wrapped_symbol.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/wrapped_text.png +0 -0
- package/test/{references/04_chessboard_annotations/4.png → graphic_references/05_chessboard_graphic/annotations/overlap.png} +0 -0
- package/test/{references/04_chessboard_annotations/5.png → graphic_references/05_chessboard_graphic/annotations/overlap_and_flip.png} +0 -0
- package/test/{references/04_chessboard_annotations/0.png → graphic_references/05_chessboard_graphic/annotations/with_coordinates.png} +0 -0
- package/test/{references/04_chessboard_annotations/1.png → graphic_references/05_chessboard_graphic/annotations/with_coordinates_and_flip.png} +0 -0
- package/test/{references/04_chessboard_annotations/2.png → graphic_references/05_chessboard_graphic/annotations/without_coordinates.png} +0 -0
- package/test/{references/04_chessboard_annotations/3.png → graphic_references/05_chessboard_graphic/annotations/without_coordinates_and_flip.png} +0 -0
- package/test/{references/02_chessboard_simple/0.png → graphic_references/05_chessboard_graphic/base/default.png} +0 -0
- package/test/{references/02_chessboard_simple/1.png → graphic_references/05_chessboard_graphic/base/empty.png} +0 -0
- package/test/{references/02_chessboard_simple/3.png → graphic_references/05_chessboard_graphic/base/from_fen.png} +0 -0
- package/test/{references/02_chessboard_simple/4.png → graphic_references/05_chessboard_graphic/base/from_kokopu_object.png} +0 -0
- package/test/{references/02_chessboard_simple/2.png → graphic_references/05_chessboard_graphic/base/parsing_error.png} +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/wrong_position_type.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960_with_move.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant_with_fen.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/special_code.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_with_std_initial_position.png +0 -0
- package/test/{references/03_chessboard_flipped/2.png → graphic_references/05_chessboard_graphic/chess_variants/variant_without_std_initial_position.png} +0 -0
- package/test/{references/03_chessboard_flipped/0.png → graphic_references/05_chessboard_graphic/flipped/default.png} +0 -0
- package/test/{references/03_chessboard_flipped/1.png → graphic_references/05_chessboard_graphic/flipped/empty.png} +0 -0
- package/test/{references/03_chessboard_flipped/3.png → graphic_references/05_chessboard_graphic/flipped/from_fen.png} +0 -0
- package/test/{references/03_chessboard_flipped/4.png → graphic_references/05_chessboard_graphic/flipped/from_kokopu_object.png} +0 -0
- package/test/graphic_references/05_chessboard_graphic/flipped/parsing_error.png +0 -0
- package/test/{references/05_chessboard_move/4.png → graphic_references/05_chessboard_graphic/move/capture.png} +0 -0
- package/test/{references/05_chessboard_move/5.png → graphic_references/05_chessboard_graphic/move/castling_move.png} +0 -0
- package/test/{references/05_chessboard_move/0.png → graphic_references/05_chessboard_graphic/move/default.png} +0 -0
- package/test/{references/05_chessboard_move/6.png → graphic_references/05_chessboard_graphic/move/en-passant.png} +0 -0
- package/test/{references/05_chessboard_move/1.png → graphic_references/05_chessboard_graphic/move/no_move_arrow.png} +0 -0
- package/test/{references/05_chessboard_move/2.png → graphic_references/05_chessboard_graphic/move/parsing_error.png} +0 -0
- package/test/{references/05_chessboard_move/7.png → graphic_references/05_chessboard_graphic/move/promotion.png} +0 -0
- package/test/{references/05_chessboard_move/3.png → graphic_references/05_chessboard_graphic/move/with_forced_move_arrow_and_flip.png} +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/wrong_move_arrow_color_type.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/wrong_move_type.png +0 -0
- package/test/{references/07_chessboard_theme/3.png → graphic_references/05_chessboard_graphic/theme/custom_1.png} +0 -0
- package/test/{references/07_chessboard_theme/4.png → graphic_references/05_chessboard_graphic/theme/custom_2.png} +0 -0
- package/test/{references/07_chessboard_theme/5.png → graphic_references/05_chessboard_graphic/theme/custom_3.png} +0 -0
- package/test/{references/07_chessboard_theme/6.png → graphic_references/05_chessboard_graphic/theme/custom_4.png} +0 -0
- package/test/{references/07_chessboard_theme/7.png → graphic_references/05_chessboard_graphic/theme/custom_5.png} +0 -0
- package/test/{references/07_chessboard_theme/8.png → graphic_references/05_chessboard_graphic/theme/custom_6.png} +0 -0
- package/test/{references/07_chessboard_theme/0.png → graphic_references/05_chessboard_graphic/theme/default.png} +0 -0
- package/test/{references/07_chessboard_theme/1.png → graphic_references/05_chessboard_graphic/theme/large.png} +0 -0
- package/test/{references/07_chessboard_theme/2.png → graphic_references/05_chessboard_graphic/theme/small.png} +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/wrong_colorset.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/wrong_pieceset.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/wrong_square_size_type.png +0 -0
- package/test/{references/06a_chessboard_animated_move/2.png → graphic_references/06_chessboard_animation/base_1/capture.png} +0 -0
- package/test/{references/06a_chessboard_animated_move/3.png → graphic_references/06_chessboard_animation/base_1/castling_move.png} +0 -0
- package/test/{references/06a_chessboard_animated_move/4.png → graphic_references/06_chessboard_animation/base_1/en-passant.png} +0 -0
- package/test/{references/06a_chessboard_animated_move/0.png → graphic_references/06_chessboard_animation/base_1/move_1.png} +0 -0
- package/test/{references/06a_chessboard_animated_move/1.png → graphic_references/06_chessboard_animation/base_1/move_2.png} +0 -0
- package/test/{references/06a_chessboard_animated_move/5.png → graphic_references/06_chessboard_animation/base_1/promotion.png} +0 -0
- package/test/{references/06b_chessboard_animated_move/2.png → graphic_references/06_chessboard_animation/base_2/capture.png} +0 -0
- package/test/{references/06b_chessboard_animated_move/3.png → graphic_references/06_chessboard_animation/base_2/castling_move.png} +0 -0
- package/test/{references/06b_chessboard_animated_move/4.png → graphic_references/06_chessboard_animation/base_2/en-passant.png} +0 -0
- package/test/{references/06b_chessboard_animated_move/0.png → graphic_references/06_chessboard_animation/base_2/move_1.png} +0 -0
- package/test/{references/06b_chessboard_animated_move/1.png → graphic_references/06_chessboard_animation/base_2/move_2.png} +0 -0
- package/test/{references/06b_chessboard_animated_move/5.png → graphic_references/06_chessboard_animation/base_2/promotion.png} +0 -0
- package/test/{references/06c_chessboard_animated_move/2.png → graphic_references/06_chessboard_animation/base_3/capture.png} +0 -0
- package/test/{references/06c_chessboard_animated_move/3.png → graphic_references/06_chessboard_animation/base_3/castling_move.png} +0 -0
- package/test/{references/06c_chessboard_animated_move/4.png → graphic_references/06_chessboard_animation/base_3/en-passant.png} +0 -0
- package/test/{references/06c_chessboard_animated_move/0.png → graphic_references/06_chessboard_animation/base_3/move_1.png} +0 -0
- package/test/{references/06c_chessboard_animated_move/1.png → graphic_references/06_chessboard_animation/base_3/move_2.png} +0 -0
- package/test/{references/06c_chessboard_animated_move/5.png → graphic_references/06_chessboard_animation/base_3/promotion.png} +0 -0
- package/test/graphic_references/06_chessboard_animation/on_redraw/final_state.png +0 -0
- package/test/graphic_references/06_chessboard_animation/on_redraw/initial_state.png +0 -0
- package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/base_1.png +0 -0
- package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/base_2.png +0 -0
- package/test/{references/10_chessboard_edit_arrows/null_vector.png → graphic_references/07_chessboard_interaction/edit_arrows/from_==_to.png} +0 -0
- package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/out_of_board.png +0 -0
- package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/over_arrow_marker.png +0 -0
- package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/over_square_marker.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/error/edit_color_not_set.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/error/wrong_interaction_mode.png +0 -0
- package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/after_move.png +0 -0
- package/test/{references/09_chessboard_move_pieces/null_vector.png → graphic_references/07_chessboard_interaction/move_pieces/from_==_to.png} +0 -0
- package/test/{references/09_chessboard_move_pieces/empty_square.png → graphic_references/07_chessboard_interaction/move_pieces/move_empty_square.png} +0 -0
- package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/out_of_board.png +0 -0
- package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/over_arrow_marker.png +0 -0
- package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/over_empty.png +0 -0
- package/test/{references/09_chessboard_move_pieces/over_non_empty_1.png → graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_1.png} +0 -0
- package/test/{references/09_chessboard_move_pieces/over_non_empty_2.png → graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_2.png} +0 -0
- package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/over_square_marker.png +0 -0
- package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/over_text_marker.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/castling_move.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/chess960_ambiguous_king_move.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/chess960_castling_move_1.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/chess960_castling_move_2.png +0 -0
- package/test/{references/11_chessboard_play_moves/chess960_non_kxr_castling.png → graphic_references/08_chessboard_play_moves/base/chess960_non-kxr_castling.png} +0 -0
- package/test/{references/11_chessboard_play_moves/null_vector.png → graphic_references/08_chessboard_play_moves/base/from_==_to.png} +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/illegal_move.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/illegal_position.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/out_of_board.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/regular_move_1.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/regular_move_2.png +0 -0
- package/test/{references/10_chessboard_edit_arrows/edit_color_not_set.png → graphic_references/08_chessboard_play_moves/base/wrong_color_moved.png} +0 -0
- package/test/{references/12_chessboard_play_promotions → graphic_references/08_chessboard_play_moves/promotions}/antichess_promotion.png +0 -0
- package/test/{references/12_chessboard_play_promotions → graphic_references/08_chessboard_play_moves/promotions}/cancel_promotion.png +0 -0
- package/test/{references/12_chessboard_play_promotions → graphic_references/08_chessboard_play_moves/promotions}/regular_promotion_1.png +0 -0
- package/test/{references/12_chessboard_play_promotions → graphic_references/08_chessboard_play_moves/promotions}/regular_promotion_2.png +0 -0
- package/test/{references/13_movetext_simple/0.png → graphic_references/09_movetext_graphic/base/game_1.png} +0 -0
- package/test/{references/13_movetext_simple/1.png → graphic_references/09_movetext_graphic/base/game_2.png} +0 -0
- package/test/{references/13_movetext_simple/2.png → graphic_references/09_movetext_graphic/base/game_3.png} +0 -0
- package/test/{references/13_movetext_simple/3.png → graphic_references/09_movetext_graphic/base/game_4.png} +0 -0
- package/test/{references/14_movetext_error/2.png → graphic_references/09_movetext_graphic/error/pgn_parsing_error_1.png} +0 -0
- package/test/{references/14_movetext_error/3.png → graphic_references/09_movetext_graphic/error/pgn_parsing_error_2.png} +0 -0
- package/test/{references/14_movetext_error/0.png → graphic_references/09_movetext_graphic/error/wrong_game_index_1.png} +0 -0
- package/test/{references/14_movetext_error/1.png → graphic_references/09_movetext_graphic/error/wrong_game_index_2.png} +0 -0
- package/test/graphic_references/09_movetext_graphic/error/wrong_game_index_type.png +0 -0
- package/test/graphic_references/09_movetext_graphic/error/wrong_game_type.png +0 -0
- package/test/{references/15_movetext_html/2.png → graphic_references/09_movetext_graphic/html/filtered_tags_and_attributes.png} +0 -0
- package/test/{references/15_movetext_html/1.png → graphic_references/09_movetext_graphic/html/html_in_comments.png} +0 -0
- package/test/{references/15_movetext_html/0.png → graphic_references/09_movetext_graphic/html/html_in_headers.png} +0 -0
- package/test/{references/16_movetext_options/1.png → graphic_references/09_movetext_graphic/options/custom_piece_symbols.png} +0 -0
- package/test/{references/16_movetext_options/2.png → graphic_references/09_movetext_graphic/options/figurine_piece_symbols_and_diagram_options.png} +0 -0
- package/test/{references/16_movetext_options/3.png → graphic_references/09_movetext_graphic/options/hidden_diagrams.png} +0 -0
- package/test/{references/16_movetext_options/0.png → graphic_references/09_movetext_graphic/options/localized_piece_symbols.png} +0 -0
- package/test/graphic_references/09_movetext_graphic/options/wrong_diagram_options_1.png +0 -0
- package/test/graphic_references/09_movetext_graphic/options/wrong_diagram_options_2.png +0 -0
- package/test/graphic_references/10_movetext_interaction/error/wrong_interaction_mode.png +0 -0
- package/test/{references/17_movetext_interaction/0.png → graphic_references/10_movetext_interaction/select_moves/click_on_disabled.png} +0 -0
- package/test/{references/17_movetext_interaction/1.png → graphic_references/10_movetext_interaction/select_moves/click_on_unselected.png} +0 -0
- package/test/{references/17_movetext_interaction/2.png → graphic_references/10_movetext_interaction/select_moves/click_on_with_variations.png} +0 -0
- package/test/graphic_test_app/.eslintrc.yml +5 -0
- package/test/graphic_test_app/03_error_box_graphic/base.tsx +46 -0
- package/{scripts/clean-graphic-output.js → test/graphic_test_app/03_error_box_graphic/localization.tsx} +10 -7
- package/{graphic_test_src/01_marker_icons.js → test/graphic_test_app/04_marker_icons_graphic/base.tsx} +15 -7
- package/{graphic_test_src/04_chessboard_annotations.js → test/graphic_test_app/05_chessboard_graphic/annotations.tsx} +23 -14
- package/{graphic_test_src/02_chessboard_simple.js → test/graphic_test_app/05_chessboard_graphic/base.tsx} +6 -6
- package/test/graphic_test_app/05_chessboard_graphic/chess_variants.tsx +35 -0
- package/{graphic_test_src/03_chessboard_flipped.js → test/graphic_test_app/05_chessboard_graphic/flipped.tsx} +5 -5
- package/{graphic_test_src/05_chessboard_move.js → test/graphic_test_app/05_chessboard_graphic/move.tsx} +9 -8
- package/{graphic_test_src/07_chessboard_theme.js → test/graphic_test_app/05_chessboard_graphic/theme.tsx} +14 -11
- package/{graphic_test_src/06a_chessboard_animated_move.js → test/graphic_test_app/06_chessboard_animation/base_1.tsx} +5 -5
- package/{graphic_test_src/06b_chessboard_animated_move.js → test/graphic_test_app/06_chessboard_animation/base_2.tsx} +5 -5
- package/{graphic_test_src/06c_chessboard_animated_move.js → test/graphic_test_app/06_chessboard_animation/base_3.tsx} +5 -5
- package/test/graphic_test_app/06_chessboard_animation/on_redraw.tsx +49 -0
- package/{graphic_test_src/08_chessboard_click_squares.js → test/graphic_test_app/07_chessboard_interaction/click_squares.tsx} +7 -6
- package/{graphic_test_src/10_chessboard_edit_arrows.js → test/graphic_test_app/07_chessboard_interaction/edit_arrows.tsx} +7 -7
- package/test/graphic_test_app/07_chessboard_interaction/error.tsx +30 -0
- package/{graphic_test_src/09_chessboard_move_pieces.js → test/graphic_test_app/07_chessboard_interaction/move_pieces.tsx} +7 -6
- package/{graphic_test_src/11_chessboard_play_moves.js → test/graphic_test_app/08_chessboard_play_moves/base.tsx} +6 -6
- package/{graphic_test_src/12_chessboard_play_promotions.js → test/graphic_test_app/08_chessboard_play_moves/promotions.tsx} +6 -6
- package/{graphic_test_src/13_movetext_simple.js → test/graphic_test_app/09_movetext_graphic/base.tsx} +8 -8
- package/{graphic_test_src/14_movetext_error.js → test/graphic_test_app/09_movetext_graphic/error.tsx} +10 -9
- package/{graphic_test_src/15_movetext_html.js → test/graphic_test_app/09_movetext_graphic/html.tsx} +7 -7
- package/{graphic_test_src/16_movetext_options.js → test/graphic_test_app/09_movetext_graphic/options.tsx} +9 -6
- package/test/graphic_test_app/10_movetext_interaction/error.tsx +31 -0
- package/{graphic_test_src/17_movetext_interaction.js → test/graphic_test_app/10_movetext_interaction/select_moves.tsx} +7 -7
- package/test/graphic_test_app/common/decs.d.ts +26 -0
- package/{graphic_test_src → test/graphic_test_app}/common/dummy.pgn +0 -0
- package/{graphic_test_src → test/graphic_test_app}/common/games.pgn +1 -1
- package/{graphic_test_src → test/graphic_test_app}/common/heartbeat.txt +0 -0
- package/{graphic_test_src → test/graphic_test_app}/common/smiley.png +0 -0
- package/{graphic_test_src → test/graphic_test_app}/common/test_app.css +11 -2
- package/{graphic_test_src/common/test_app.js → test/graphic_test_app/common/test_app.tsx} +62 -14
- package/tsconfig.json +15 -0
- package/.babelrc +0 -3
- package/dist/lib/ArrowMarkerIcon.js +0 -85
- package/dist/lib/Chessboard.js +0 -1276
- package/dist/lib/ErrorBox.js +0 -125
- package/dist/lib/Movetext.js +0 -805
- package/dist/lib/SquareMarkerIcon.js +0 -69
- package/dist/lib/TextMarkerIcon.js +0 -74
- package/dist/lib/formatmove.js +0 -107
- package/dist/lib/impl/DraggableHandle.js +0 -277
- package/dist/lib/impl/HtmlSanitizer.js +0 -145
- package/dist/lib/impl/Motion.js +0 -109
- package/dist/lib/impl/TextSymbol.js +0 -89
- package/dist/lib/impl/piecesets.js +0 -219
- package/dist/lib/impl/util.js +0 -71
- package/dist/lib/markers.js +0 -144
- package/doc_src/.eslintrc.yml +0 -2
- package/src/Chessboard.js +0 -1034
- package/src/ErrorBox.js +0 -132
- package/src/Movetext.js +0 -671
- package/src/impl/DraggableHandle.js +0 -235
- package/src/impl/HtmlSanitizer.js +0 -126
- package/src/impl/colorsets.js +0 -119
- package/src/impl/piecesets.js +0 -218
- package/src/impl/util.js +0 -68
- package/src/index.js +0 -31
- package/src/markers.js +0 -115
- package/test/4_chessboard_graphic.js +0 -49
- package/test/5_chessboard_interaction.js +0 -135
- package/test/6_chessboard_play_moves.js +0 -107
- package/test/references/01_marker_icons/10.png +0 -0
- package/test/references/01_marker_icons/3.png +0 -0
- package/test/references/01_marker_icons/4.png +0 -0
- package/test/references/01_marker_icons/5.png +0 -0
- package/test/references/01_marker_icons/6.png +0 -0
- package/test/references/01_marker_icons/7.png +0 -0
- package/test/references/01_marker_icons/8.png +0 -0
- package/test/references/01_marker_icons/9.png +0 -0
- package/test/references/02_chessboard_simple/5.png +0 -0
- package/test/references/05_chessboard_move/8.png +0 -0
- package/test/references/11_chessboard_play_moves/wrong_color.png +0 -0
- package/test/references/14_movetext_error/4.png +0 -0
package/.eslintrc.yml
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
env:
|
|
2
|
+
browser: true
|
|
3
|
+
es2021: true
|
|
4
|
+
|
|
5
|
+
plugins:
|
|
6
|
+
- '@typescript-eslint'
|
|
7
|
+
- react
|
|
8
|
+
|
|
9
|
+
settings:
|
|
10
|
+
react:
|
|
11
|
+
version: 18.2.0
|
|
12
|
+
|
|
13
|
+
extends:
|
|
14
|
+
- 'eslint:recommended'
|
|
15
|
+
- 'plugin:@typescript-eslint/recommended'
|
|
16
|
+
- 'plugin:react/recommended'
|
|
17
|
+
|
|
18
|
+
parser: '@typescript-eslint/parser'
|
|
19
|
+
|
|
20
|
+
parserOptions:
|
|
21
|
+
ecmaVersion: 12
|
|
22
|
+
sourceType: module
|
|
23
|
+
|
|
24
|
+
rules:
|
|
25
|
+
|
|
26
|
+
# Style
|
|
27
|
+
indent: [ error, tab, { SwitchCase: 1 }]
|
|
28
|
+
linebreak-style: [ error, unix ]
|
|
29
|
+
quotes: [ error, single ]
|
|
30
|
+
semi: [ error, always ]
|
|
31
|
+
camelcase: [ error ]
|
|
32
|
+
no-trailing-spaces: [ error ]
|
|
33
|
+
|
|
34
|
+
# Additional rules (possible errors)
|
|
35
|
+
no-console: [ error ]
|
|
36
|
+
|
|
37
|
+
# Additional rules (best practices)
|
|
38
|
+
curly: [ error, all ]
|
|
39
|
+
eqeqeq: [ error, always ]
|
|
40
|
+
no-alert: [ error ]
|
|
41
|
+
no-confusing-arrow: [ error ]
|
|
42
|
+
no-constructor-return: [ error ]
|
|
43
|
+
no-duplicate-imports: [ error ]
|
|
44
|
+
no-eval: [ error ]
|
|
45
|
+
no-extend-native: [ error ]
|
|
46
|
+
no-floating-decimal: [ error ]
|
|
47
|
+
no-implicit-coercion: [ error ]
|
|
48
|
+
no-implied-eval: [ error ]
|
|
49
|
+
no-invalid-this: [ error ]
|
|
50
|
+
no-labels: [ error ]
|
|
51
|
+
no-lone-blocks: [ error ]
|
|
52
|
+
no-loop-func: [ error ]
|
|
53
|
+
no-new: [ error ]
|
|
54
|
+
no-new-func: [ error ]
|
|
55
|
+
no-new-wrappers: [ error ]
|
|
56
|
+
no-octal-escape: [ error ]
|
|
57
|
+
no-return-assign: [ error, always ]
|
|
58
|
+
no-script-url: [ error ]
|
|
59
|
+
no-self-compare: [ error ]
|
|
60
|
+
no-throw-literal: [ error ]
|
|
61
|
+
no-unmodified-loop-condition: [ error ]
|
|
62
|
+
no-unused-expressions: [ error ]
|
|
63
|
+
no-useless-computed-key: [ error ]
|
|
64
|
+
no-useless-concat: [ error ]
|
|
65
|
+
no-useless-rename: [ error ]
|
|
66
|
+
no-useless-return: [ error ]
|
|
67
|
+
no-var: [ error ]
|
|
68
|
+
no-warning-comments: [ warn, { location: anywhere, terms: [ TODO ] }]
|
|
69
|
+
prefer-arrow-callback: [ error ]
|
|
70
|
+
prefer-const: [ error ]
|
|
71
|
+
prefer-regex-literals: [ error ]
|
|
72
|
+
prefer-rest-params: [ error ]
|
|
73
|
+
rest-spread-spacing: [ error ]
|
|
74
|
+
|
|
75
|
+
# Additional rules (typescript)
|
|
76
|
+
'@typescript-eslint/no-shadow': [ error, { builtinGlobals: true }]
|
|
77
|
+
|
|
78
|
+
# Relaxed rules
|
|
79
|
+
no-constant-condition: [ error, { checkLoops: false }]
|
|
80
|
+
|
|
81
|
+
# Relaxed rules (typescript)
|
|
82
|
+
'@typescript-eslint/no-non-null-assertion': [ off ]
|
|
83
|
+
'@typescript-eslint/no-namespace': [ off ]
|
|
84
|
+
'@typescript-eslint/no-empty-function': [ error, { allow: [ private-constructors, protected-constructors ] }]
|
package/.nycrc.yml
CHANGED
package/README.md
CHANGED
|
@@ -33,6 +33,6 @@ import { Chessboard } from 'kokopu-react';
|
|
|
33
33
|
createRoot(document.body).render(<Chessboard />);
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-

|
|
37
37
|
|
|
38
38
|
More examples available in [documentation & live-demo](https://kokopu-react.yo35.org/).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/* -------------------------------------------------------------------------- *
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
4
|
* Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* Public License along with this program. If not, see *
|
|
18
18
|
* <http://www.gnu.org/licenses/>. *
|
|
19
19
|
* *
|
|
20
|
-
|
|
20
|
+
* -------------------------------------------------------------------------- */
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
.kokopu-coordinate {
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MoveDescriptor, Position, Square } from 'kokopu';
|
|
3
|
+
import { Colorset, Pieceset, AnnotationColor, SquareMarkerSet, TextMarkerSet, ArrowMarkerSet } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Define a limit applicable to the parameters of a {@link Chessboard} on small-screen devices.
|
|
6
|
+
*/
|
|
7
|
+
export interface SmallScreenLimit {
|
|
8
|
+
width: number;
|
|
9
|
+
squareSize?: number;
|
|
10
|
+
coordinateVisible?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ChessboardProps {
|
|
13
|
+
/**
|
|
14
|
+
* Displayed position. Can be a [kokopu.Position](https://kokopu.yo35.org/docs/current/classes/Position.html) object,
|
|
15
|
+
* a [FEN string](https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation),
|
|
16
|
+
* `'start'` (usual starting position), or `'empty'` (empty board).
|
|
17
|
+
*
|
|
18
|
+
* Optionally, the FEN string can be prefixed with `'variant:'`, `variant` corresponding to one of the
|
|
19
|
+
* [game variant](https://kokopu.yo35.org/docs/current/types/GameVariant.html) supported by Kokopu. For instance:
|
|
20
|
+
* `'chess960:nrkbqrbn/pppppppp/8/8/8/8/PPPPPPPP/NRKBQRBN w KQkq - 0 1'`.
|
|
21
|
+
*/
|
|
22
|
+
position: Position | string;
|
|
23
|
+
/**
|
|
24
|
+
* Displayed move (optional), defined either as a [kokopu.MoveDescriptor](https://kokopu.yo35.org/docs/current/classes/MoveDescriptor.html) object
|
|
25
|
+
* or as a [SAN string](https://en.wikipedia.org/wiki/Algebraic_notation_(chess)) (e.g. `'Nf3'`). In both cases, it must represent
|
|
26
|
+
* a legal move in position defined in attribute `position`.
|
|
27
|
+
*/
|
|
28
|
+
move?: MoveDescriptor | string;
|
|
29
|
+
/**
|
|
30
|
+
* Square markers, defined as a {@link SquareMarkerSet} (e.g. `{ e4: 'g', d5: 'r' }`) or as a comma-separated CSL string (e.g. `'Rd5,Ge4'`).
|
|
31
|
+
*/
|
|
32
|
+
squareMarkers?: SquareMarkerSet | string;
|
|
33
|
+
/**
|
|
34
|
+
* Text markers, defined as a {@link TextMarkerSet} (e.g. `{ e4: { symbol: 'A', color: 'g' }, d5: { symbol: 'z', color: 'r' }}`)
|
|
35
|
+
* or as a comma-separated CTL string (e.g. `'Rzd5,GAe4'`).
|
|
36
|
+
*/
|
|
37
|
+
textMarkers?: TextMarkerSet | string;
|
|
38
|
+
/**
|
|
39
|
+
* Arrow markers, defined as a {@link ArrowMarkerSet} (e.g. `{ e2e4: 'g', g8f6: 'r', g8h6: 'y' }`)
|
|
40
|
+
* or as a comma-separated CAL string (e.g. `'Ge2e4,Rg8f6,Yg8h6'`).
|
|
41
|
+
*/
|
|
42
|
+
arrowMarkers?: ArrowMarkerSet | string;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the board is flipped (i.e. seen from Black's point of view) or not.
|
|
45
|
+
*/
|
|
46
|
+
flipped: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Size of the squares (in pixels). Must be an integer between `Chessboard.minSquareSize()` and `Chessboard.maxSquareSize()`.
|
|
49
|
+
*/
|
|
50
|
+
squareSize: number;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the row and column coordinates are visible or not.
|
|
53
|
+
*/
|
|
54
|
+
coordinateVisible: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Whether moves are highlighted with an arrow or not.
|
|
57
|
+
*/
|
|
58
|
+
moveArrowVisible: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Color of the move arrow.
|
|
61
|
+
*/
|
|
62
|
+
moveArrowColor: AnnotationColor;
|
|
63
|
+
/**
|
|
64
|
+
* Whether moves are animated or not.
|
|
65
|
+
*/
|
|
66
|
+
animated: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Color theme ID. Must be a property of `Chessboard.colorsets()`.
|
|
69
|
+
*/
|
|
70
|
+
colorset: string;
|
|
71
|
+
/**
|
|
72
|
+
* Piece theme ID. Must be a property of `Chessboard.piecesets()`.
|
|
73
|
+
*/
|
|
74
|
+
pieceset: string;
|
|
75
|
+
/**
|
|
76
|
+
* Limits applicable on small-screen devices. For instance, if set to
|
|
77
|
+
* ```
|
|
78
|
+
* [
|
|
79
|
+
* { width: 768, squareSize: 40 },
|
|
80
|
+
* { width: 375, squareSize: 24, coordinateVisible: false }
|
|
81
|
+
* ]
|
|
82
|
+
* ```
|
|
83
|
+
* then on screens with resolution ≤768 pixels, the square size will be limited to 40 (whatever the value
|
|
84
|
+
* of the `squareSize` attribute); in addition, on screens with resolution ≤375 pixels, the square size
|
|
85
|
+
* will be limited to 24 and the row and column coordinates will always be hidden (whatever the value of the
|
|
86
|
+
* `coordinateVisible` attribute).
|
|
87
|
+
*/
|
|
88
|
+
smallScreenLimits?: SmallScreenLimit[];
|
|
89
|
+
/**
|
|
90
|
+
* Type of action allowed with the mouse on the chessboard. If undefined, then the user cannot interact with the component.
|
|
91
|
+
*
|
|
92
|
+
* - `'movePieces'` allows the user to drag & drop the chess pieces from one square to another (regardless of the chess rules),
|
|
93
|
+
* - `'clickSquares'` allows the user to click on squares,
|
|
94
|
+
* - `'editArrows'` allows the user to draw arrow markers from one square to another (warning: attribute `editedArrowColor` must be set),
|
|
95
|
+
* - `'playMoves'` allows the user to play legal chess moves (thus no interaction is possible if the displayed position is not legal).
|
|
96
|
+
*/
|
|
97
|
+
interactionMode?: 'movePieces' | 'clickSquares' | 'editArrows' | 'playMoves';
|
|
98
|
+
/**
|
|
99
|
+
* Color of the edited arrow. Mandatory if `interactionMode === 'editArrows'`, ignored otherwise.
|
|
100
|
+
*/
|
|
101
|
+
editedArrowColor?: AnnotationColor;
|
|
102
|
+
/**
|
|
103
|
+
* Callback invoked when a piece is moved through drag&drop (only if `interactionMode` is set to `'movePieces'`).
|
|
104
|
+
*/
|
|
105
|
+
onPieceMoved?: (from: Square, to: Square) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Callback invoked when the user clicks on a square (only if `interactionMode` is set to `'clickSquares'`).
|
|
108
|
+
*/
|
|
109
|
+
onSquareClicked?: (square: Square) => void;
|
|
110
|
+
/**
|
|
111
|
+
* Callback invoked when an arrow is dragged (only if `interactionMode` is set to `'editArrows'`).
|
|
112
|
+
*/
|
|
113
|
+
onArrowEdited?: (from: Square, to: Square) => void;
|
|
114
|
+
/**
|
|
115
|
+
* Callback invoked when a move is played (only if `interactionMode` is set to `'playMoves'`).
|
|
116
|
+
*/
|
|
117
|
+
onMovePlayed?: (move: string) => void;
|
|
118
|
+
}
|
|
119
|
+
interface ChessboardState {
|
|
120
|
+
windowWidth: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* SVG image representing a chessboard diagram. Optionally, the user may interact with the board (move pieces, click on squares...).
|
|
124
|
+
* Annotations such as square markers or arrows can also be added to the board.
|
|
125
|
+
*/
|
|
126
|
+
export declare class Chessboard extends React.Component<ChessboardProps, ChessboardState> {
|
|
127
|
+
static defaultProps: Partial<ChessboardProps>;
|
|
128
|
+
private windowResizeListener;
|
|
129
|
+
constructor(props: ChessboardProps);
|
|
130
|
+
componentDidMount(): void;
|
|
131
|
+
componentWillUnmount(): void;
|
|
132
|
+
private handleWindowResize;
|
|
133
|
+
render(): JSX.Element;
|
|
134
|
+
private getInteractionModeAndValidateEditedArrowColor;
|
|
135
|
+
/**
|
|
136
|
+
* Return the size of the chessboard, assuming it is built with the given attributes.
|
|
137
|
+
*/
|
|
138
|
+
static size(squareSize: number, coordinateVisible: boolean, smallScreenLimits?: SmallScreenLimit[]): {
|
|
139
|
+
width: number;
|
|
140
|
+
height: number;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Return the maximum square size that would allow the chessboard to fit in a rectangle of size `width x height`.
|
|
144
|
+
*/
|
|
145
|
+
static adaptSquareSize(width: number, height: number, coordinateVisible: boolean, smallScreenLimits?: SmallScreenLimit[]): number;
|
|
146
|
+
/**
|
|
147
|
+
* Minimum square size (inclusive).
|
|
148
|
+
*
|
|
149
|
+
* @public
|
|
150
|
+
*/
|
|
151
|
+
static minSquareSize(): number;
|
|
152
|
+
/**
|
|
153
|
+
* Maximum square size (inclusive).
|
|
154
|
+
*
|
|
155
|
+
* @public
|
|
156
|
+
*/
|
|
157
|
+
static maxSquareSize(): number;
|
|
158
|
+
/**
|
|
159
|
+
* Available colorsets for theming.
|
|
160
|
+
*
|
|
161
|
+
* @public
|
|
162
|
+
*/
|
|
163
|
+
static colorsets(): Record<string, Colorset>;
|
|
164
|
+
/**
|
|
165
|
+
* Available piecesets for theming.
|
|
166
|
+
*
|
|
167
|
+
* @public
|
|
168
|
+
*/
|
|
169
|
+
static piecesets(): Record<string, Pieceset>;
|
|
170
|
+
}
|
|
171
|
+
export {};
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
/* -------------------------------------------------------------------------- *
|
|
2
|
+
* *
|
|
3
|
+
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
+
* Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
|
+
* *
|
|
6
|
+
* This program is free software: you can redistribute it and/or *
|
|
7
|
+
* modify it under the terms of the GNU Lesser General Public License *
|
|
8
|
+
* as published by the Free Software Foundation, either version 3 of *
|
|
9
|
+
* the License, or (at your option) any later version. *
|
|
10
|
+
* *
|
|
11
|
+
* This program is distributed in the hope that it will be useful, *
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
14
|
+
* GNU Lesser General Public License for more details. *
|
|
15
|
+
* *
|
|
16
|
+
* You should have received a copy of the GNU Lesser General *
|
|
17
|
+
* Public License along with this program. If not, see *
|
|
18
|
+
* <http://www.gnu.org/licenses/>. *
|
|
19
|
+
* *
|
|
20
|
+
* -------------------------------------------------------------------------- */
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import { exception as kokopuException, MoveDescriptor, Position, isSquare, isSquareCouple, isGameVariant } from 'kokopu';
|
|
23
|
+
import { IllegalArgument } from '../exception';
|
|
24
|
+
import { i18n } from '../i18n';
|
|
25
|
+
import { sanitizeString, sanitizeBoolean, sanitizeInteger, sanitizeBoundedInteger, sanitizeOptional } from '../sanitization';
|
|
26
|
+
import { MIN_SQUARE_SIZE, MAX_SQUARE_SIZE, isAnnotationColor, isAnnotationSymbol, parseSquareMarkers, parseTextMarkers, parseArrowMarkers } from '../types';
|
|
27
|
+
import { colorsets } from './colorsets';
|
|
28
|
+
import { piecesets } from './piecesets';
|
|
29
|
+
import { ChessboardImpl, chessboardSize } from './ChessboardImpl';
|
|
30
|
+
import { ErrorBox } from '../errorbox/ErrorBox';
|
|
31
|
+
/**
|
|
32
|
+
* SVG image representing a chessboard diagram. Optionally, the user may interact with the board (move pieces, click on squares...).
|
|
33
|
+
* Annotations such as square markers or arrows can also be added to the board.
|
|
34
|
+
*/
|
|
35
|
+
export class Chessboard extends React.Component {
|
|
36
|
+
constructor(props) {
|
|
37
|
+
super(props);
|
|
38
|
+
this.windowResizeListener = () => this.handleWindowResize();
|
|
39
|
+
this.state = {
|
|
40
|
+
windowWidth: window.innerWidth,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
componentDidMount() {
|
|
44
|
+
window.addEventListener('resize', this.windowResizeListener);
|
|
45
|
+
}
|
|
46
|
+
componentWillUnmount() {
|
|
47
|
+
window.removeEventListener('resize', this.windowResizeListener);
|
|
48
|
+
}
|
|
49
|
+
handleWindowResize() {
|
|
50
|
+
this.setState({ windowWidth: window.innerWidth });
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
|
+
// Validate the position and move attributes.
|
|
54
|
+
const positionInfo = parsePosition(this.props.position);
|
|
55
|
+
if (positionInfo.error) {
|
|
56
|
+
return React.createElement(ErrorBox, { title: i18n.INVALID_FEN_ERROR_TITLE, message: positionInfo.message });
|
|
57
|
+
}
|
|
58
|
+
const position = positionInfo.position;
|
|
59
|
+
const moveInfo = parseMove(position, this.props.move);
|
|
60
|
+
if (moveInfo.error) {
|
|
61
|
+
return React.createElement(ErrorBox, { title: i18n.INVALID_NOTATION_ERROR_TITLE, message: moveInfo.message });
|
|
62
|
+
}
|
|
63
|
+
const move = moveInfo.move;
|
|
64
|
+
// Validate the markers
|
|
65
|
+
const sqm = parseMarkers(this.props.squareMarkers, 'squareMarkers', parseSquareMarkers, isSquare, isAnnotationColor);
|
|
66
|
+
const txtm = parseMarkers(this.props.textMarkers, 'textMarkers', parseTextMarkers, isSquare, isTextMarkerElement);
|
|
67
|
+
const arm = parseMarkers(this.props.arrowMarkers, 'arrowMarkers', parseArrowMarkers, isSquareCouple, isAnnotationColor);
|
|
68
|
+
// Validate the appearance attributes.
|
|
69
|
+
const flipped = sanitizeBoolean(this.props.flipped);
|
|
70
|
+
const squareSize = sanitizeBoundedInteger(this.props.squareSize, MIN_SQUARE_SIZE, MAX_SQUARE_SIZE, () => new IllegalArgument('Chessboard', 'squareSize'));
|
|
71
|
+
const coordinateVisible = sanitizeBoolean(this.props.coordinateVisible);
|
|
72
|
+
const moveArrowVisible = sanitizeBoolean(this.props.moveArrowVisible);
|
|
73
|
+
if (!isAnnotationColor(this.props.moveArrowColor)) {
|
|
74
|
+
throw new IllegalArgument('Chessboard', 'moveArrowColor');
|
|
75
|
+
}
|
|
76
|
+
const animated = sanitizeBoolean(this.props.animated);
|
|
77
|
+
const colorset = colorsets[this.props.colorset];
|
|
78
|
+
if (!colorset) {
|
|
79
|
+
throw new IllegalArgument('Chessboard', 'colorset');
|
|
80
|
+
}
|
|
81
|
+
const pieceset = piecesets[this.props.pieceset];
|
|
82
|
+
if (!pieceset) {
|
|
83
|
+
throw new IllegalArgument('Chessboard', 'pieceset');
|
|
84
|
+
}
|
|
85
|
+
// Validate and enforce the small-screen limits.
|
|
86
|
+
const smallScreenLimits = sanitizeSmallScreenLimits(this.props.smallScreenLimits, () => new IllegalArgument('Chessboard', 'smallScreenLimits'));
|
|
87
|
+
const actualSquareSize = computeSquareSizeForSmallScreens(squareSize, smallScreenLimits, this.state.windowWidth);
|
|
88
|
+
const actualCoordinateVisible = computeCoordinateVisibleForSmallScreens(coordinateVisible, smallScreenLimits, this.state.windowWidth);
|
|
89
|
+
// Validate the interaction attributes and the callbacks.
|
|
90
|
+
const interactionMode = this.getInteractionModeAndValidateEditedArrowColor();
|
|
91
|
+
const { onPieceMoved, onSquareClicked, onArrowEdited, onMovePlayed } = this.props;
|
|
92
|
+
// Build a key so that a new `ChessboardImpl` component is instantiated each time the position or the move changes
|
|
93
|
+
// (mandatory to ensure that the move animation works properly and that the internal state of the component remains consistent).
|
|
94
|
+
const key = `${position.variant()}|${position.fen()}|${move ? position.notation(move) : ''}`;
|
|
95
|
+
return (React.createElement(ChessboardImpl, { key: key, position: position, move: move, squareMarkers: sqm, textMarkers: txtm, arrowMarkers: arm, flipped: flipped, squareSize: actualSquareSize, coordinateVisible: actualCoordinateVisible, moveArrowVisible: moveArrowVisible, moveArrowColor: this.props.moveArrowColor, animated: animated, colorset: colorset, pieceset: pieceset, interactionMode: interactionMode, editedArrowColor: this.props.editedArrowColor, onPieceMoved: onPieceMoved, onSquareClicked: onSquareClicked, onArrowEdited: onArrowEdited, onMovePlayed: onMovePlayed }));
|
|
96
|
+
}
|
|
97
|
+
getInteractionModeAndValidateEditedArrowColor() {
|
|
98
|
+
const interactionMode = sanitizeOptional(this.props.interactionMode, sanitizeString);
|
|
99
|
+
if (interactionMode === undefined || interactionMode === 'movePieces' || interactionMode === 'clickSquares' || interactionMode === 'playMoves') {
|
|
100
|
+
return interactionMode;
|
|
101
|
+
}
|
|
102
|
+
else if (interactionMode === 'editArrows') {
|
|
103
|
+
if (!isAnnotationColor(this.props.editedArrowColor)) {
|
|
104
|
+
throw new IllegalArgument('Chessboard', 'editedArrowColor');
|
|
105
|
+
}
|
|
106
|
+
return interactionMode;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
throw new IllegalArgument('Chessboard', 'interactionMode');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Return the size of the chessboard, assuming it is built with the given attributes.
|
|
114
|
+
*/
|
|
115
|
+
static size(squareSize, coordinateVisible, smallScreenLimits) {
|
|
116
|
+
// Sanitize the arguments.
|
|
117
|
+
squareSize = sanitizeBoundedInteger(squareSize, MIN_SQUARE_SIZE, MAX_SQUARE_SIZE, () => new IllegalArgument('Chessboard.size()', 'squareSize'));
|
|
118
|
+
coordinateVisible = sanitizeBoolean(coordinateVisible);
|
|
119
|
+
const limits = sanitizeSmallScreenLimits(smallScreenLimits, () => new IllegalArgument('Chessboard.size()', 'smallScreenLimits'));
|
|
120
|
+
// Enforce small-screen limits, if any.
|
|
121
|
+
if (typeof window !== 'undefined') {
|
|
122
|
+
squareSize = computeSquareSizeForSmallScreens(squareSize, limits, window.innerWidth);
|
|
123
|
+
coordinateVisible = computeCoordinateVisibleForSmallScreens(coordinateVisible, limits, window.innerWidth);
|
|
124
|
+
}
|
|
125
|
+
// Compute the dimensions.
|
|
126
|
+
return chessboardSize(squareSize, coordinateVisible);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Return the maximum square size that would allow the chessboard to fit in a rectangle of size `width x height`.
|
|
130
|
+
*/
|
|
131
|
+
static adaptSquareSize(width, height, coordinateVisible, smallScreenLimits) {
|
|
132
|
+
// Sanitize the arguments.
|
|
133
|
+
width = sanitizeInteger(width, () => new IllegalArgument('Chessboard.adaptSquareSize()', 'width'));
|
|
134
|
+
height = sanitizeInteger(height, () => new IllegalArgument('Chessboard.adaptSquareSize()', 'height'));
|
|
135
|
+
coordinateVisible = sanitizeBoolean(coordinateVisible);
|
|
136
|
+
const limits = sanitizeSmallScreenLimits(smallScreenLimits, () => new IllegalArgument('Chessboard.adaptSquareSize()', 'smallScreenLimits'));
|
|
137
|
+
// Enforce small-screen limits, if any.
|
|
138
|
+
let maxSquareSize = MAX_SQUARE_SIZE;
|
|
139
|
+
if (typeof window !== 'undefined') {
|
|
140
|
+
maxSquareSize = computeSquareSizeForSmallScreens(maxSquareSize, limits, window.innerWidth);
|
|
141
|
+
coordinateVisible = computeCoordinateVisibleForSmallScreens(coordinateVisible, limits, window.innerWidth);
|
|
142
|
+
}
|
|
143
|
+
function isAdapted(squareSize) {
|
|
144
|
+
const { width: actualWidth, height: actualHeight } = chessboardSize(squareSize, coordinateVisible);
|
|
145
|
+
return actualWidth <= width && actualHeight <= height;
|
|
146
|
+
}
|
|
147
|
+
// Check min/max bounds.
|
|
148
|
+
if (isAdapted(maxSquareSize)) {
|
|
149
|
+
return maxSquareSize;
|
|
150
|
+
}
|
|
151
|
+
else if (!isAdapted(MIN_SQUARE_SIZE)) {
|
|
152
|
+
return MIN_SQUARE_SIZE;
|
|
153
|
+
}
|
|
154
|
+
// Dichotomic search, between a (inclusive) and b (exclusive).
|
|
155
|
+
let a = MIN_SQUARE_SIZE;
|
|
156
|
+
let b = maxSquareSize;
|
|
157
|
+
while (a + 1 < b) {
|
|
158
|
+
const mid = Math.floor((a + b) / 2);
|
|
159
|
+
if (isAdapted(mid)) {
|
|
160
|
+
a = mid;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
b = mid;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return a;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Minimum square size (inclusive).
|
|
170
|
+
*
|
|
171
|
+
* @public
|
|
172
|
+
*/
|
|
173
|
+
static minSquareSize() {
|
|
174
|
+
return MIN_SQUARE_SIZE;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Maximum square size (inclusive).
|
|
178
|
+
*
|
|
179
|
+
* @public
|
|
180
|
+
*/
|
|
181
|
+
static maxSquareSize() {
|
|
182
|
+
return MAX_SQUARE_SIZE;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Available colorsets for theming.
|
|
186
|
+
*
|
|
187
|
+
* @public
|
|
188
|
+
*/
|
|
189
|
+
static colorsets() {
|
|
190
|
+
return colorsets;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Available piecesets for theming.
|
|
194
|
+
*
|
|
195
|
+
* @public
|
|
196
|
+
*/
|
|
197
|
+
static piecesets() {
|
|
198
|
+
return piecesets;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
Chessboard.defaultProps = {
|
|
202
|
+
position: 'start',
|
|
203
|
+
flipped: false,
|
|
204
|
+
squareSize: 40,
|
|
205
|
+
coordinateVisible: true,
|
|
206
|
+
moveArrowVisible: true,
|
|
207
|
+
moveArrowColor: 'b',
|
|
208
|
+
animated: false,
|
|
209
|
+
colorset: 'original',
|
|
210
|
+
pieceset: 'cburnett',
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Compute the actual square size taking into account the given small-screen limits and window width.
|
|
214
|
+
*/
|
|
215
|
+
function computeSquareSizeForSmallScreens(squareSize, smallScreenLimits, windowWidth) {
|
|
216
|
+
const maximumSquareSize = computeSmallScreenLimits(smallScreenLimits, windowWidth, limit => limit.squareSize);
|
|
217
|
+
return maximumSquareSize === undefined ? squareSize : Math.min(squareSize, maximumSquareSize);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Compute the actual square size taking into account the given small-screen limits and window width.
|
|
221
|
+
*/
|
|
222
|
+
function computeCoordinateVisibleForSmallScreens(coordinateVisible, smallScreenLimits, windowWidth) {
|
|
223
|
+
const maximumCoordinateVisible = computeSmallScreenLimits(smallScreenLimits, windowWidth, limit => limit.coordinateVisible);
|
|
224
|
+
return maximumCoordinateVisible === undefined ? coordinateVisible : coordinateVisible && maximumCoordinateVisible;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Compute the limit applicable to the given window width.
|
|
228
|
+
*/
|
|
229
|
+
function computeSmallScreenLimits(smallScreenLimits, windowWidth, getter) {
|
|
230
|
+
let bestWidth = Infinity;
|
|
231
|
+
let bestAttributeValue = undefined;
|
|
232
|
+
for (const limit of smallScreenLimits) {
|
|
233
|
+
// Discard the limits not applicable to the current window width (`windowWidth <= limit.width` must hold)
|
|
234
|
+
// and those for which the target attribute is not defined.
|
|
235
|
+
if (windowWidth > limit.width || getter(limit) === undefined) {
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
// Find the limit with the smallest width among those applicable.
|
|
239
|
+
if (limit.width < bestWidth) {
|
|
240
|
+
bestWidth = limit.width;
|
|
241
|
+
bestAttributeValue = getter(limit);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return bestAttributeValue;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Try to interpret the given object as a chess position.
|
|
248
|
+
*/
|
|
249
|
+
function parsePosition(position) {
|
|
250
|
+
if (position instanceof Position) {
|
|
251
|
+
return { error: false, position: position };
|
|
252
|
+
}
|
|
253
|
+
else if (position === 'start' || position === 'empty') {
|
|
254
|
+
return { error: false, position: new Position(position) };
|
|
255
|
+
}
|
|
256
|
+
else if (typeof position === 'string') {
|
|
257
|
+
try {
|
|
258
|
+
const { variant, fen } = splitGameVariantAndFEN(position);
|
|
259
|
+
const result = new Position(variant, 'empty');
|
|
260
|
+
result.fen(fen);
|
|
261
|
+
return { error: false, position: result };
|
|
262
|
+
}
|
|
263
|
+
catch (e) {
|
|
264
|
+
// istanbul ignore else
|
|
265
|
+
if (e instanceof kokopuException.InvalidFEN) {
|
|
266
|
+
return { error: true, message: e.message };
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
throw e;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
throw new IllegalArgument('Chessboard', 'position');
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Look for an optional 'chess-variant:' prefix in the position attribute.
|
|
279
|
+
*/
|
|
280
|
+
function splitGameVariantAndFEN(position) {
|
|
281
|
+
const separatorIndex = position.indexOf(':');
|
|
282
|
+
if (separatorIndex < 0) {
|
|
283
|
+
return { variant: 'regular', fen: position };
|
|
284
|
+
}
|
|
285
|
+
const variant = position.substring(0, separatorIndex);
|
|
286
|
+
return isGameVariant(variant) ? { variant: variant, fen: position.substring(separatorIndex + 1) } : { variant: 'regular', fen: position };
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Try to interpret the given object `move` as a move descriptor based on the given position.
|
|
290
|
+
*/
|
|
291
|
+
function parseMove(position, move) {
|
|
292
|
+
if (move === undefined || move === null) {
|
|
293
|
+
return { error: false, move: undefined };
|
|
294
|
+
}
|
|
295
|
+
else if (move instanceof MoveDescriptor) {
|
|
296
|
+
return { error: false, move: move };
|
|
297
|
+
}
|
|
298
|
+
else if (typeof move === 'string') {
|
|
299
|
+
try {
|
|
300
|
+
return { error: false, move: position.notation(move) };
|
|
301
|
+
}
|
|
302
|
+
catch (e) {
|
|
303
|
+
// istanbul ignore else
|
|
304
|
+
if (e instanceof kokopuException.InvalidNotation) {
|
|
305
|
+
return { error: true, message: e.message };
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
throw e;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
throw new IllegalArgument('Chessboard', 'move');
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Try to interpret the given object as a list of markers.
|
|
318
|
+
*/
|
|
319
|
+
function parseMarkers(markers, argumentName, parse, isValidKey, isValidValue) {
|
|
320
|
+
if (markers === undefined || markers === null) {
|
|
321
|
+
return undefined;
|
|
322
|
+
}
|
|
323
|
+
else if (typeof markers === 'string') {
|
|
324
|
+
return parse(markers);
|
|
325
|
+
}
|
|
326
|
+
else if (typeof markers === 'object') {
|
|
327
|
+
const result = {};
|
|
328
|
+
Object.entries(markers).forEach(([key, value]) => {
|
|
329
|
+
if (isValidKey(key) && isValidValue(value)) {
|
|
330
|
+
result[key] = value;
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
return result;
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
throw new IllegalArgument('Chessboard', argumentName);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
function isTextMarkerElement(value) {
|
|
340
|
+
if (typeof value !== 'object' || value === null) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
return isAnnotationSymbol(value.symbol) && isAnnotationColor(value.color);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Sanitization method for the small-screen limits parameter.
|
|
347
|
+
*/
|
|
348
|
+
function sanitizeSmallScreenLimits(smallScreenLimits, exceptionBuilder) {
|
|
349
|
+
if (smallScreenLimits === undefined || smallScreenLimits === null) {
|
|
350
|
+
return [];
|
|
351
|
+
}
|
|
352
|
+
else if (!Array.isArray(smallScreenLimits)) {
|
|
353
|
+
throw exceptionBuilder();
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
return smallScreenLimits.map(smallScreenLimit => {
|
|
357
|
+
return {
|
|
358
|
+
width: sanitizeInteger(smallScreenLimit.width, exceptionBuilder),
|
|
359
|
+
squareSize: sanitizeOptional(smallScreenLimit.squareSize, val => sanitizeBoundedInteger(val, MIN_SQUARE_SIZE, MAX_SQUARE_SIZE, exceptionBuilder)),
|
|
360
|
+
coordinateVisible: sanitizeOptional(smallScreenLimit.coordinateVisible, sanitizeBoolean),
|
|
361
|
+
};
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
//# sourceMappingURL=Chessboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chessboard.js","sourceRo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