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
|
@@ -1,235 +0,0 @@
|
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
import PropTypes from 'prop-types';
|
|
24
|
-
import React from 'react';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Invisible SVG rectangular handle that captures drag events.
|
|
29
|
-
*/
|
|
30
|
-
export default class DraggableHandle extends React.Component {
|
|
31
|
-
|
|
32
|
-
constructor(props) {
|
|
33
|
-
super(props);
|
|
34
|
-
this.dragData = null;
|
|
35
|
-
this.innerRef = React.createRef();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
componentDidMount() {
|
|
39
|
-
if (!this.windowListeners) {
|
|
40
|
-
this.windowListeners = {
|
|
41
|
-
mouseDown: evt => this.handleMouseDown(evt),
|
|
42
|
-
mouseMove: evt => this.handleMouseMove(evt),
|
|
43
|
-
mouseUp: evt => this.handleMouseUp(evt),
|
|
44
|
-
touchStart: evt => this.handleTouchStart(evt),
|
|
45
|
-
touchMove: evt => this.handleTouchMove(evt),
|
|
46
|
-
touchEnd: evt => this.handleTouchEnd(evt),
|
|
47
|
-
touchCancel: evt => this.handleTouchCancel(evt),
|
|
48
|
-
};
|
|
49
|
-
this.innerRef.current.addEventListener('mousedown', this.windowListeners.mouseDown);
|
|
50
|
-
window.addEventListener('mousemove', this.windowListeners.mouseMove);
|
|
51
|
-
window.addEventListener('mouseup', this.windowListeners.mouseUp);
|
|
52
|
-
this.innerRef.current.addEventListener('touchstart', this.windowListeners.touchStart, { passive: false });
|
|
53
|
-
window.addEventListener('touchmove', this.windowListeners.touchMove, { passive: false });
|
|
54
|
-
window.addEventListener('touchend', this.windowListeners.touchEnd);
|
|
55
|
-
window.addEventListener('touchcancel', this.windowListeners.touchCancel);
|
|
56
|
-
}
|
|
57
|
-
this.dragData = null;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
componentWillUnmount() {
|
|
61
|
-
if (this.windowListeners) {
|
|
62
|
-
this.innerRef.current.removeEventListener('mousedown', this.windowListeners.mouseDown);
|
|
63
|
-
window.removeEventListener('mousemove', this.windowListeners.mouseMove);
|
|
64
|
-
window.removeEventListener('mouseup', this.windowListeners.mouseUp);
|
|
65
|
-
this.innerRef.current.removeEventListener('touchstart', this.windowListeners.touchStart);
|
|
66
|
-
window.removeEventListener('touchmove', this.windowListeners.touchMove);
|
|
67
|
-
window.removeEventListener('touchend', this.windowListeners.touchEnd);
|
|
68
|
-
window.removeEventListener('touchcancel', this.windowListeners.touchCancel);
|
|
69
|
-
this.windowListeners = null;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
render() {
|
|
74
|
-
let classNames = [ 'kokopu-handle', this.props.isArrowHandle ? 'kokopu-arrowDraggable' : 'kokopu-pieceDraggable' ];
|
|
75
|
-
return <rect ref={this.innerRef} className={classNames.join(' ')} x={this.props.x} y={this.props.y} width={this.props.width} height={this.props.height} />;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
handleTouchStart(evt) {
|
|
79
|
-
if (this.dragData || evt.touches.length !== 1) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
evt.preventDefault();
|
|
83
|
-
this.doInitDrag(evt.target, evt.touches[0]);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
handleTouchMove(evt) {
|
|
87
|
-
if (!this.dragData) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
evt.preventDefault();
|
|
91
|
-
if (evt.touches.length === 1) {
|
|
92
|
-
this.doUpdateDrag(evt.touches[0]);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
this.doCancelDrag();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
handleTouchEnd(evt) {
|
|
100
|
-
if (!this.dragData) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
evt.preventDefault();
|
|
104
|
-
if (evt.touches.length === 0 && evt.changedTouches.length === 1) {
|
|
105
|
-
this.doEndDrag(evt.changedTouches[0]);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
this.doCancelDrag();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
handleTouchCancel(evt) {
|
|
113
|
-
if (!this.dragData) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
evt.preventDefault();
|
|
117
|
-
this.doCancelDrag();
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
handleMouseDown(evt) {
|
|
121
|
-
if (this.dragData || evt.button !== 0) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
evt.preventDefault();
|
|
125
|
-
this.doInitDrag(evt.target, evt);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
handleMouseMove(evt) {
|
|
129
|
-
if (!this.dragData) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
evt.preventDefault();
|
|
133
|
-
this.doUpdateDrag(evt);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
handleMouseUp(evt) {
|
|
137
|
-
if (!this.dragData) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
evt.preventDefault();
|
|
141
|
-
this.doEndDrag(evt);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
doInitDrag(target, { pageX, pageY, clientX, clientY }) {
|
|
145
|
-
this.dragData = {
|
|
146
|
-
originX: pageX,
|
|
147
|
-
originY: pageY,
|
|
148
|
-
};
|
|
149
|
-
let handleBoundary = target.getBoundingClientRect();
|
|
150
|
-
let x0 = clientX - handleBoundary.left;
|
|
151
|
-
let y0 = clientY - handleBoundary.top;
|
|
152
|
-
if (this.props.onDragStart) {
|
|
153
|
-
this.props.onDragStart(x0, y0);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
doUpdateDrag({ pageX, pageY }) {
|
|
158
|
-
let { originX, originY } = this.dragData;
|
|
159
|
-
if (this.props.onDrag) {
|
|
160
|
-
this.props.onDrag(pageX - originX, pageY - originY);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
doEndDrag({ pageX, pageY }) {
|
|
165
|
-
let { originX, originY } = this.dragData;
|
|
166
|
-
this.dragData = null;
|
|
167
|
-
if (this.props.onDragStop) {
|
|
168
|
-
this.props.onDragStop(pageX - originX, pageY - originY);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
doCancelDrag() {
|
|
173
|
-
if (this.props.onDragCanceled) {
|
|
174
|
-
this.props.onDragCanceled();
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
DraggableHandle.propTypes = {
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Initial X coordinate of the handle.
|
|
184
|
-
*/
|
|
185
|
-
x: PropTypes.number.isRequired,
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Initial Y coordinate of the handle.
|
|
189
|
-
*/
|
|
190
|
-
y: PropTypes.number.isRequired,
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Width of the handle.
|
|
194
|
-
*/
|
|
195
|
-
width: PropTypes.number.isRequired,
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Height of the handle.
|
|
199
|
-
*/
|
|
200
|
-
height: PropTypes.number.isRequired,
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* `true` if the handle corresponds to a draggable arrow, `false` if it corresponds to a draggable piece.
|
|
204
|
-
*/
|
|
205
|
-
isArrowHandle: PropTypes.bool.isRequired,
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Callback invoked when the drag starts.
|
|
209
|
-
*
|
|
210
|
-
* @param {number} x0 X-coordinate (relative to the handle) at which the drag has been initiated.
|
|
211
|
-
* @param {number} y0 X-coordinate (relative to the handle) at which the drag has been initiated.
|
|
212
|
-
*/
|
|
213
|
-
onDragStart: PropTypes.func,
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Callback invoked during the drag.
|
|
217
|
-
*
|
|
218
|
-
* @param {number} dx X-coordinate of the translation vector applied during the drag.
|
|
219
|
-
* @param {number} dy Y-coordinate of the translation vector applied during the drag.
|
|
220
|
-
*/
|
|
221
|
-
onDrag: PropTypes.func,
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Callback invoked when the drag stops.
|
|
225
|
-
*
|
|
226
|
-
* @param {number} dx X-coordinate of the translation vector applied during the drag.
|
|
227
|
-
* @param {number} dy Y-coordinate of the translation vector applied during the drag.
|
|
228
|
-
*/
|
|
229
|
-
onDragStop: PropTypes.func,
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Callback invoked when the drag is canceled.
|
|
233
|
-
*/
|
|
234
|
-
onDragCanceled: PropTypes.func,
|
|
235
|
-
};
|
|
@@ -1,126 +0,0 @@
|
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
import React from 'react';
|
|
24
|
-
import * as htmlparser2 from 'htmlparser2';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Those tags cannot have any children.
|
|
29
|
-
*/
|
|
30
|
-
const NO_CHILDREN_TAGS = new Set([ 'br', 'hr', 'img' ]);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* HTML sanitizer: parse HTML string, keeping only the allowed HTML nodes, and the corresponding React object.
|
|
35
|
-
*/
|
|
36
|
-
export default class HtmlSanitizer {
|
|
37
|
-
|
|
38
|
-
constructor({ allowedTags, allowedAttributes }) {
|
|
39
|
-
this._allowedTags = allowedTags ? new Set(allowedTags) : new Set();
|
|
40
|
-
this._allowedAttributes = allowedAttributes ? new Map(Object.entries(allowedAttributes).map(([k, v]) => [k, new Set(v)])) : new Map();
|
|
41
|
-
this._keyCounter = 0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @param {string} text HTML string to be parsed.
|
|
46
|
-
* @returns {*} React object corresponding to the given HTML string. Can also be a fragment, or just a simple string if the given HTML string
|
|
47
|
-
* does not contain any HTML tag.
|
|
48
|
-
*/
|
|
49
|
-
parse(text) {
|
|
50
|
-
let dom = htmlparser2.parseDocument(text);
|
|
51
|
-
|
|
52
|
-
// Ensure that the returned object is a non-empty node type.
|
|
53
|
-
if (dom.type !== 'root') {
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Process the children of the root node.
|
|
58
|
-
let result = [];
|
|
59
|
-
dom.children.forEach(child => {
|
|
60
|
-
let childElement = this._processNode(child);
|
|
61
|
-
if (childElement) {
|
|
62
|
-
result.push(childElement);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
// Return the result.
|
|
67
|
-
if (result.length === 0) {
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
else if (result.length === 1) {
|
|
71
|
-
return result[0];
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
return <React.Fragment key={this._allocateKey()}>{result}</React.Fragment>;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
_processNode(node) {
|
|
79
|
-
if (node.type === 'text') {
|
|
80
|
-
return node.data;
|
|
81
|
-
}
|
|
82
|
-
else if (node.type === 'tag') {
|
|
83
|
-
let children = NO_CHILDREN_TAGS.has(node.name) ? undefined : node.children.map(child => this._processNode(child));
|
|
84
|
-
if (this._allowedTags.has(node.name)) {
|
|
85
|
-
let attributes = this._filterAttributes(node.name, node.attribs);
|
|
86
|
-
attributes['key'] = this._allocateKey();
|
|
87
|
-
return React.createElement(node.name, attributes, children);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
return children ? <React.Fragment key={this._allocateKey()}>{children}</React.Fragment> : undefined;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
return undefined;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
_filterAttributes(nodeName, attributes) {
|
|
99
|
-
let result = {};
|
|
100
|
-
for (let [attribute, value] of Object.entries(attributes)) {
|
|
101
|
-
if (this._isAttributeAllowed(nodeName, attribute)) {
|
|
102
|
-
result[attribute === 'class' ? 'className' : attribute] = value;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return result;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
_isAttributeAllowed(nodeName, attribute) {
|
|
109
|
-
if (attribute === 'key' && attribute === 'ref' && attribute === 'className') { // Those attributes are always forbidden.
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
let allowedAttributesForCurrent = this._allowedAttributes.get(nodeName);
|
|
113
|
-
if (allowedAttributesForCurrent && allowedAttributesForCurrent.has(attribute)) {
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
let allowedAttributesForAll = this._allowedAttributes.get('*');
|
|
117
|
-
if (allowedAttributesForAll && allowedAttributesForAll.has(attribute)) {
|
|
118
|
-
return true;
|
|
119
|
-
}
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
_allocateKey() {
|
|
124
|
-
return 'auto-' + (this._keyCounter++);
|
|
125
|
-
}
|
|
126
|
-
}
|
package/src/impl/colorsets.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
|
|
25
|
-
original: {
|
|
26
|
-
b: '#b5876b',
|
|
27
|
-
w: '#f0dec7',
|
|
28
|
-
cb: '#04f',
|
|
29
|
-
cg: '#0e0',
|
|
30
|
-
cr: '#d00',
|
|
31
|
-
cy: '#db0',
|
|
32
|
-
},
|
|
33
|
-
gray: {
|
|
34
|
-
b: '#bbbbbb',
|
|
35
|
-
w: '#f8f8f8',
|
|
36
|
-
cb: '#04f',
|
|
37
|
-
cg: '#0a0',
|
|
38
|
-
cr: '#d00',
|
|
39
|
-
cy: '#a90',
|
|
40
|
-
},
|
|
41
|
-
scid: {
|
|
42
|
-
b: '#7389b6',
|
|
43
|
-
w: '#f3f3f3',
|
|
44
|
-
cb: '#04f',
|
|
45
|
-
cg: '#0e0',
|
|
46
|
-
cr: '#d00',
|
|
47
|
-
cy: '#db0',
|
|
48
|
-
},
|
|
49
|
-
wikipedia: {
|
|
50
|
-
b: '#d18b47',
|
|
51
|
-
w: '#ffce9e',
|
|
52
|
-
cb: '#04f',
|
|
53
|
-
cg: '#0e0',
|
|
54
|
-
cr: '#d00',
|
|
55
|
-
cy: '#db0',
|
|
56
|
-
},
|
|
57
|
-
xboard: {
|
|
58
|
-
b: '#77a26d',
|
|
59
|
-
w: '#c8c365',
|
|
60
|
-
cb: '#04f',
|
|
61
|
-
cg: '#0f0',
|
|
62
|
-
cr: '#d00',
|
|
63
|
-
cy: '#ff0',
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
/*
|
|
67
|
-
* Source: http://omgchess.blogspot.fr/2015/09/chess-board-color-schemes.html
|
|
68
|
-
* Author: Gorgonian <http://omgchess.blogspot.fr/>
|
|
69
|
-
*/
|
|
70
|
-
coral: {
|
|
71
|
-
b: 'rgb(112,162,163)',
|
|
72
|
-
w: 'rgb(177,228,185)',
|
|
73
|
-
cb: '#04f',
|
|
74
|
-
cg: '#080',
|
|
75
|
-
cr: '#d00',
|
|
76
|
-
cy: '#ff0',
|
|
77
|
-
},
|
|
78
|
-
dusk: {
|
|
79
|
-
b: 'rgb(112,102,119)',
|
|
80
|
-
w: 'rgb(204,183,174)',
|
|
81
|
-
cb: '#04f',
|
|
82
|
-
cg: '#3f3',
|
|
83
|
-
cr: '#f20',
|
|
84
|
-
cy: '#ff0',
|
|
85
|
-
},
|
|
86
|
-
emerald: {
|
|
87
|
-
b: 'rgb(111,143,114)',
|
|
88
|
-
w: 'rgb(173,189,143)',
|
|
89
|
-
cb: '#04f',
|
|
90
|
-
cg: '#6f6',
|
|
91
|
-
cr: '#d00',
|
|
92
|
-
cy: '#ff0',
|
|
93
|
-
},
|
|
94
|
-
marine: {
|
|
95
|
-
b: 'rgb(111,115,210)',
|
|
96
|
-
w: 'rgb(157,172,255)',
|
|
97
|
-
cb: '#04f',
|
|
98
|
-
cg: '#6f6',
|
|
99
|
-
cr: '#f50',
|
|
100
|
-
cy: '#ff0',
|
|
101
|
-
},
|
|
102
|
-
sandcastle: {
|
|
103
|
-
b: 'rgb(184,139,74)',
|
|
104
|
-
w: 'rgb(227,193,111)',
|
|
105
|
-
cb: '#04f',
|
|
106
|
-
cg: '#0c3',
|
|
107
|
-
cr: '#d02',
|
|
108
|
-
cy: '#ff0',
|
|
109
|
-
},
|
|
110
|
-
wheat: {
|
|
111
|
-
b: 'rgb(187,190,100)',
|
|
112
|
-
w: 'rgb(234,240,206)',
|
|
113
|
-
cb: '#04f',
|
|
114
|
-
cg: '#0c3',
|
|
115
|
-
cr: '#d00',
|
|
116
|
-
cy: '#ff3',
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
};
|
package/src/impl/piecesets.js
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
/* eslint-disable camelcase */
|
|
24
|
-
|
|
25
|
-
/*
|
|
26
|
-
* Source: https://commons.wikimedia.org/wiki/Category:SVG_chess_pieces
|
|
27
|
-
* Authors: Cburnett <https://en.wikipedia.org/wiki/User:Cburnett>, Antonsusi <https://commons.wikimedia.org/wiki/User:Antonsusi>
|
|
28
|
-
* License: Creative Commons Attribution ShareAlike [CC-BY-SA]
|
|
29
|
-
*/
|
|
30
|
-
import cburnett_bb from '../sprites/cburnett-bb.png';
|
|
31
|
-
import cburnett_bk from '../sprites/cburnett-bk.png';
|
|
32
|
-
import cburnett_bn from '../sprites/cburnett-bn.png';
|
|
33
|
-
import cburnett_bp from '../sprites/cburnett-bp.png';
|
|
34
|
-
import cburnett_bq from '../sprites/cburnett-bq.png';
|
|
35
|
-
import cburnett_br from '../sprites/cburnett-br.png';
|
|
36
|
-
import cburnett_wb from '../sprites/cburnett-wb.png';
|
|
37
|
-
import cburnett_wk from '../sprites/cburnett-wk.png';
|
|
38
|
-
import cburnett_wn from '../sprites/cburnett-wn.png';
|
|
39
|
-
import cburnett_wp from '../sprites/cburnett-wp.png';
|
|
40
|
-
import cburnett_wq from '../sprites/cburnett-wq.png';
|
|
41
|
-
import cburnett_wr from '../sprites/cburnett-wr.png';
|
|
42
|
-
|
|
43
|
-
import cburnett_bx from '../sprites/cburnett-bx.png';
|
|
44
|
-
import cburnett_wx from '../sprites/cburnett-wx.png';
|
|
45
|
-
|
|
46
|
-
/*
|
|
47
|
-
* Source: http://poisson.phc.unipi.it/~monge/chess_art.php
|
|
48
|
-
* Author: Maurizio Monge <http://poisson.phc.unipi.it/~monge/>
|
|
49
|
-
* License: ?? (give credit to the author and notify him by mail when using his work in a chess program)
|
|
50
|
-
*/
|
|
51
|
-
import celtic_bb from '../sprites/celtic-bb.png';
|
|
52
|
-
import celtic_bk from '../sprites/celtic-bk.png';
|
|
53
|
-
import celtic_bn from '../sprites/celtic-bn.png';
|
|
54
|
-
import celtic_bp from '../sprites/celtic-bp.png';
|
|
55
|
-
import celtic_bq from '../sprites/celtic-bq.png';
|
|
56
|
-
import celtic_br from '../sprites/celtic-br.png';
|
|
57
|
-
import celtic_wb from '../sprites/celtic-wb.png';
|
|
58
|
-
import celtic_wk from '../sprites/celtic-wk.png';
|
|
59
|
-
import celtic_wn from '../sprites/celtic-wn.png';
|
|
60
|
-
import celtic_wp from '../sprites/celtic-wp.png';
|
|
61
|
-
import celtic_wq from '../sprites/celtic-wq.png';
|
|
62
|
-
import celtic_wr from '../sprites/celtic-wr.png';
|
|
63
|
-
import eyes_bb from '../sprites/eyes-bb.png';
|
|
64
|
-
import eyes_bk from '../sprites/eyes-bk.png';
|
|
65
|
-
import eyes_bn from '../sprites/eyes-bn.png';
|
|
66
|
-
import eyes_bp from '../sprites/eyes-bp.png';
|
|
67
|
-
import eyes_bq from '../sprites/eyes-bq.png';
|
|
68
|
-
import eyes_br from '../sprites/eyes-br.png';
|
|
69
|
-
import eyes_wb from '../sprites/eyes-wb.png';
|
|
70
|
-
import eyes_wk from '../sprites/eyes-wk.png';
|
|
71
|
-
import eyes_wn from '../sprites/eyes-wn.png';
|
|
72
|
-
import eyes_wp from '../sprites/eyes-wp.png';
|
|
73
|
-
import eyes_wq from '../sprites/eyes-wq.png';
|
|
74
|
-
import eyes_wr from '../sprites/eyes-wr.png';
|
|
75
|
-
import fantasy_bb from '../sprites/fantasy-bb.png';
|
|
76
|
-
import fantasy_bk from '../sprites/fantasy-bk.png';
|
|
77
|
-
import fantasy_bn from '../sprites/fantasy-bn.png';
|
|
78
|
-
import fantasy_bp from '../sprites/fantasy-bp.png';
|
|
79
|
-
import fantasy_bq from '../sprites/fantasy-bq.png';
|
|
80
|
-
import fantasy_br from '../sprites/fantasy-br.png';
|
|
81
|
-
import fantasy_wb from '../sprites/fantasy-wb.png';
|
|
82
|
-
import fantasy_wk from '../sprites/fantasy-wk.png';
|
|
83
|
-
import fantasy_wn from '../sprites/fantasy-wn.png';
|
|
84
|
-
import fantasy_wp from '../sprites/fantasy-wp.png';
|
|
85
|
-
import fantasy_wq from '../sprites/fantasy-wq.png';
|
|
86
|
-
import fantasy_wr from '../sprites/fantasy-wr.png';
|
|
87
|
-
import skulls_bb from '../sprites/skulls-bb.png';
|
|
88
|
-
import skulls_bk from '../sprites/skulls-bk.png';
|
|
89
|
-
import skulls_bn from '../sprites/skulls-bn.png';
|
|
90
|
-
import skulls_bp from '../sprites/skulls-bp.png';
|
|
91
|
-
import skulls_bq from '../sprites/skulls-bq.png';
|
|
92
|
-
import skulls_br from '../sprites/skulls-br.png';
|
|
93
|
-
import skulls_wb from '../sprites/skulls-wb.png';
|
|
94
|
-
import skulls_wk from '../sprites/skulls-wk.png';
|
|
95
|
-
import skulls_wn from '../sprites/skulls-wn.png';
|
|
96
|
-
import skulls_wp from '../sprites/skulls-wp.png';
|
|
97
|
-
import skulls_wq from '../sprites/skulls-wq.png';
|
|
98
|
-
import skulls_wr from '../sprites/skulls-wr.png';
|
|
99
|
-
import spatial_bb from '../sprites/spatial-bb.png';
|
|
100
|
-
import spatial_bk from '../sprites/spatial-bk.png';
|
|
101
|
-
import spatial_bn from '../sprites/spatial-bn.png';
|
|
102
|
-
import spatial_bp from '../sprites/spatial-bp.png';
|
|
103
|
-
import spatial_bq from '../sprites/spatial-bq.png';
|
|
104
|
-
import spatial_br from '../sprites/spatial-br.png';
|
|
105
|
-
import spatial_wb from '../sprites/spatial-wb.png';
|
|
106
|
-
import spatial_wk from '../sprites/spatial-wk.png';
|
|
107
|
-
import spatial_wn from '../sprites/spatial-wn.png';
|
|
108
|
-
import spatial_wp from '../sprites/spatial-wp.png';
|
|
109
|
-
import spatial_wq from '../sprites/spatial-wq.png';
|
|
110
|
-
import spatial_wr from '../sprites/spatial-wr.png';
|
|
111
|
-
|
|
112
|
-
import celtic_bx from '../sprites/celtic-bx.png';
|
|
113
|
-
import celtic_wx from '../sprites/celtic-wx.png';
|
|
114
|
-
import eyes_spatial_bx from '../sprites/eyes-spatial-bx.png';
|
|
115
|
-
import eyes_spatial_wx from '../sprites/eyes-spatial-wx.png';
|
|
116
|
-
import fantasy_bx from '../sprites/fantasy-bx.png';
|
|
117
|
-
import fantasy_wx from '../sprites/fantasy-wx.png';
|
|
118
|
-
import skulls_bx from '../sprites/skulls-bx.png';
|
|
119
|
-
import skulls_wx from '../sprites/skulls-wx.png';
|
|
120
|
-
|
|
121
|
-
export default {
|
|
122
|
-
cburnett: {
|
|
123
|
-
bb: cburnett_bb,
|
|
124
|
-
bk: cburnett_bk,
|
|
125
|
-
bn: cburnett_bn,
|
|
126
|
-
bp: cburnett_bp,
|
|
127
|
-
bq: cburnett_bq,
|
|
128
|
-
br: cburnett_br,
|
|
129
|
-
bx: cburnett_bx,
|
|
130
|
-
wb: cburnett_wb,
|
|
131
|
-
wk: cburnett_wk,
|
|
132
|
-
wn: cburnett_wn,
|
|
133
|
-
wp: cburnett_wp,
|
|
134
|
-
wq: cburnett_wq,
|
|
135
|
-
wr: cburnett_wr,
|
|
136
|
-
wx: cburnett_wx,
|
|
137
|
-
},
|
|
138
|
-
celtic: {
|
|
139
|
-
bb: celtic_bb,
|
|
140
|
-
bk: celtic_bk,
|
|
141
|
-
bn: celtic_bn,
|
|
142
|
-
bp: celtic_bp,
|
|
143
|
-
bq: celtic_bq,
|
|
144
|
-
br: celtic_br,
|
|
145
|
-
bx: celtic_bx,
|
|
146
|
-
wb: celtic_wb,
|
|
147
|
-
wk: celtic_wk,
|
|
148
|
-
wn: celtic_wn,
|
|
149
|
-
wp: celtic_wp,
|
|
150
|
-
wq: celtic_wq,
|
|
151
|
-
wr: celtic_wr,
|
|
152
|
-
wx: celtic_wx,
|
|
153
|
-
},
|
|
154
|
-
eyes: {
|
|
155
|
-
bb: eyes_bb,
|
|
156
|
-
bk: eyes_bk,
|
|
157
|
-
bn: eyes_bn,
|
|
158
|
-
bp: eyes_bp,
|
|
159
|
-
bq: eyes_bq,
|
|
160
|
-
br: eyes_br,
|
|
161
|
-
bx: eyes_spatial_bx,
|
|
162
|
-
wb: eyes_wb,
|
|
163
|
-
wk: eyes_wk,
|
|
164
|
-
wn: eyes_wn,
|
|
165
|
-
wp: eyes_wp,
|
|
166
|
-
wq: eyes_wq,
|
|
167
|
-
wr: eyes_wr,
|
|
168
|
-
wx: eyes_spatial_wx,
|
|
169
|
-
},
|
|
170
|
-
fantasy: {
|
|
171
|
-
bb: fantasy_bb,
|
|
172
|
-
bk: fantasy_bk,
|
|
173
|
-
bn: fantasy_bn,
|
|
174
|
-
bp: fantasy_bp,
|
|
175
|
-
bq: fantasy_bq,
|
|
176
|
-
br: fantasy_br,
|
|
177
|
-
bx: fantasy_bx,
|
|
178
|
-
wb: fantasy_wb,
|
|
179
|
-
wk: fantasy_wk,
|
|
180
|
-
wn: fantasy_wn,
|
|
181
|
-
wp: fantasy_wp,
|
|
182
|
-
wq: fantasy_wq,
|
|
183
|
-
wr: fantasy_wr,
|
|
184
|
-
wx: fantasy_wx,
|
|
185
|
-
},
|
|
186
|
-
skulls: {
|
|
187
|
-
bb: skulls_bb,
|
|
188
|
-
bk: skulls_bk,
|
|
189
|
-
bn: skulls_bn,
|
|
190
|
-
bp: skulls_bp,
|
|
191
|
-
bq: skulls_bq,
|
|
192
|
-
br: skulls_br,
|
|
193
|
-
bx: skulls_bx,
|
|
194
|
-
wb: skulls_wb,
|
|
195
|
-
wk: skulls_wk,
|
|
196
|
-
wn: skulls_wn,
|
|
197
|
-
wp: skulls_wp,
|
|
198
|
-
wq: skulls_wq,
|
|
199
|
-
wr: skulls_wr,
|
|
200
|
-
wx: skulls_wx,
|
|
201
|
-
},
|
|
202
|
-
spatial: {
|
|
203
|
-
bb: spatial_bb,
|
|
204
|
-
bk: spatial_bk,
|
|
205
|
-
bn: spatial_bn,
|
|
206
|
-
bp: spatial_bp,
|
|
207
|
-
bq: spatial_bq,
|
|
208
|
-
br: spatial_br,
|
|
209
|
-
bx: eyes_spatial_bx,
|
|
210
|
-
wb: spatial_wb,
|
|
211
|
-
wk: spatial_wk,
|
|
212
|
-
wn: spatial_wn,
|
|
213
|
-
wp: spatial_wp,
|
|
214
|
-
wq: spatial_wq,
|
|
215
|
-
wr: spatial_wr,
|
|
216
|
-
wx: eyes_spatial_wx,
|
|
217
|
-
},
|
|
218
|
-
};
|