kokopu-react 1.11.0 → 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 -268
- 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 -232
- 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,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,13 +17,13 @@
|
|
|
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
|
-
import React from 'react';
|
|
24
|
-
import { pgnRead } from 'kokopu';
|
|
23
|
+
import * as React from 'react';
|
|
24
|
+
import { pgnRead, Node as GameNode } from 'kokopu';
|
|
25
25
|
|
|
26
|
-
import { Chessboard, Movetext } from '../../src/index';
|
|
26
|
+
import { Chessboard, Movetext, MovetextProps, MoveSelectEventOrigin } from '../../src/index';
|
|
27
27
|
import { buildComponentDemoCode } from './util';
|
|
28
28
|
|
|
29
29
|
import Box from '@mui/material/Box';
|
|
@@ -41,9 +41,18 @@ import game1 from './game-1.pgn';
|
|
|
41
41
|
import game2 from './game-2.pgn';
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
interface PageState {
|
|
45
|
+
pgn: string;
|
|
46
|
+
selection: string;
|
|
47
|
+
interactionMode: 'none' | 'selectMove';
|
|
48
|
+
withPopup: boolean;
|
|
49
|
+
withMove: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
45
52
|
|
|
46
|
-
|
|
53
|
+
export default class Page extends React.Component<object, PageState> {
|
|
54
|
+
|
|
55
|
+
constructor(props: object) {
|
|
47
56
|
super(props);
|
|
48
57
|
this.state = {
|
|
49
58
|
pgn: game1,
|
|
@@ -65,25 +74,25 @@ export default class Page extends React.Component {
|
|
|
65
74
|
);
|
|
66
75
|
}
|
|
67
76
|
|
|
68
|
-
renderControls() {
|
|
77
|
+
private renderControls() {
|
|
69
78
|
return (<>
|
|
70
79
|
<Stack direction="row" spacing={2} alignItems="center">
|
|
71
80
|
<ButtonGroup color="primary" size="small">
|
|
72
|
-
<Button onClick={() => this.
|
|
73
|
-
<Button onClick={() => this.
|
|
81
|
+
<Button onClick={() => this.setState({ pgn: game1, selection: '28b' })}>Game 1</Button>
|
|
82
|
+
<Button onClick={() => this.setState({ pgn: game2, selection: '15b' })}>Game 2</Button>
|
|
74
83
|
</ButtonGroup>
|
|
75
84
|
</Stack>
|
|
76
85
|
<Box>
|
|
77
86
|
<Typography gutterBottom>Interaction mode</Typography>
|
|
78
|
-
<RadioGroup value={this.state.interactionMode} onChange={evt => this.
|
|
79
|
-
<FormControlLabel value="" control={<Radio color="primary" />} label="None" />
|
|
87
|
+
<RadioGroup value={this.state.interactionMode} onChange={evt => this.setState({ interactionMode: evt.target.value as PageState['interactionMode'] })}>
|
|
88
|
+
<FormControlLabel value="none" control={<Radio color="primary" />} label="None" />
|
|
80
89
|
<FormControlLabel value="selectMove" control={<Radio color="primary" />} label="Select moves" />
|
|
81
90
|
</RadioGroup>
|
|
82
91
|
</Box>
|
|
83
92
|
</>);
|
|
84
93
|
}
|
|
85
94
|
|
|
86
|
-
renderMovetext() {
|
|
95
|
+
private renderMovetext() {
|
|
87
96
|
return (
|
|
88
97
|
<Box>
|
|
89
98
|
<Movetext
|
|
@@ -91,20 +100,20 @@ export default class Page extends React.Component {
|
|
|
91
100
|
selection={this.state.selection}
|
|
92
101
|
pieceSymbols="figurines"
|
|
93
102
|
diagramVisible={false}
|
|
94
|
-
interactionMode={this.
|
|
103
|
+
interactionMode={this.getMovetextInterationMode()}
|
|
95
104
|
onMoveSelected={(nodeId, evtOrigin) => this.handleMoveSelected(nodeId, evtOrigin)}
|
|
96
105
|
/>
|
|
97
106
|
</Box>
|
|
98
107
|
);
|
|
99
108
|
}
|
|
100
109
|
|
|
101
|
-
renderCode() {
|
|
102
|
-
|
|
110
|
+
private renderCode() {
|
|
111
|
+
const attributes: string[] = [];
|
|
103
112
|
attributes.push('game={pgn}');
|
|
104
113
|
attributes.push('pieceSymbols="figurines"');
|
|
105
114
|
attributes.push('diagramVisible={false}');
|
|
106
115
|
attributes.push(`selection="${this.state.selection}"`);
|
|
107
|
-
switch(this.state.interactionMode) {
|
|
116
|
+
switch (this.state.interactionMode) {
|
|
108
117
|
case 'selectMove':
|
|
109
118
|
attributes.push('interactionMode="selectMove"');
|
|
110
119
|
attributes.push('onMoveSelected={nodeId => handleMoveSelected(nodeId)}');
|
|
@@ -112,48 +121,54 @@ export default class Page extends React.Component {
|
|
|
112
121
|
default:
|
|
113
122
|
break;
|
|
114
123
|
}
|
|
115
|
-
|
|
124
|
+
const pgnDeclaration = 'const pgn = `\n' + this.state.pgn.trim() + '`;\n\n';
|
|
116
125
|
return <pre className="kokopu-demoCode">{pgnDeclaration + buildComponentDemoCode('Movetext', attributes)}</pre>;
|
|
117
126
|
}
|
|
118
127
|
|
|
119
|
-
renderNavigationBoard() {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
128
|
+
private renderNavigationBoard() {
|
|
129
|
+
const button = <Button size="small" onClick={() => this.setState({ withPopup: !this.state.withPopup })}>{this.state.withPopup ? 'Reduce' : 'Open'}</Button>;
|
|
130
|
+
const { position, move, csl, cal } = this.getCurrentPositionAndAnnotations();
|
|
131
|
+
const content = this.state.withPopup ?
|
|
132
|
+
<Stack><Chessboard position={position} move={move} squareMarkers={csl} arrowMarkers={cal} animated={true} />{button}</Stack> :
|
|
133
|
+
button;
|
|
123
134
|
return <Paper className="kokopu-fixedPopup" elevation={3}>{content}</Paper>;
|
|
124
135
|
}
|
|
125
136
|
|
|
126
|
-
handleMoveSelected(nodeId, evtOrigin) {
|
|
137
|
+
private handleMoveSelected(nodeId: string | undefined, evtOrigin: MoveSelectEventOrigin) {
|
|
127
138
|
if (nodeId) {
|
|
128
|
-
this.
|
|
139
|
+
this.setState({ selection: nodeId, withMove: evtOrigin === 'key-next' });
|
|
129
140
|
}
|
|
130
141
|
}
|
|
131
142
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
newState[attributeName] = newValue;
|
|
139
|
-
if (attributeName2) {
|
|
140
|
-
newState[attributeName2] = newValue2;
|
|
143
|
+
private getMovetextInterationMode(): MovetextProps['interactionMode'] {
|
|
144
|
+
switch (this.state.interactionMode) {
|
|
145
|
+
case 'selectMove':
|
|
146
|
+
return this.state.interactionMode;
|
|
147
|
+
default:
|
|
148
|
+
return undefined;
|
|
141
149
|
}
|
|
142
|
-
this.setState(newState);
|
|
143
150
|
}
|
|
144
151
|
|
|
145
|
-
getCurrentPositionAndAnnotations() {
|
|
146
|
-
|
|
152
|
+
private getCurrentPositionAndAnnotations() {
|
|
153
|
+
const game = pgnRead(this.state.pgn, 0);
|
|
147
154
|
if (this.state.selection === 'start') {
|
|
148
|
-
|
|
149
|
-
return {
|
|
155
|
+
const mainVariation = game.mainVariation();
|
|
156
|
+
return {
|
|
157
|
+
position: mainVariation.initialPosition(),
|
|
158
|
+
move: undefined,
|
|
159
|
+
csl: mainVariation.tag('csl'),
|
|
160
|
+
cal: mainVariation.tag('cal'),
|
|
161
|
+
};
|
|
150
162
|
}
|
|
151
163
|
else {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
164
|
+
const node = game.findById(this.state.selection) as GameNode;
|
|
165
|
+
return {
|
|
166
|
+
position: this.state.withMove ? node.positionBefore() : node.position(),
|
|
167
|
+
move: this.state.withMove ? node.notation() : undefined,
|
|
168
|
+
csl: node.tag('csl'),
|
|
169
|
+
cal: node.tag('cal'),
|
|
170
|
+
};
|
|
157
171
|
}
|
|
158
172
|
}
|
|
173
|
+
|
|
159
174
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
declare module '*.pgn' {
|
|
24
|
+
const pgnText: string;
|
|
25
|
+
export default pgnText;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare module '*.png' {
|
|
29
|
+
const path: string;
|
|
30
|
+
export default path;
|
|
31
|
+
}
|
package/doc_src/demo/demo.css
CHANGED
|
@@ -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-demoCode {
|
|
@@ -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,9 +17,9 @@
|
|
|
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
|
-
export function buildComponentDemoCode(componentName, attributes) {
|
|
23
|
+
export function buildComponentDemoCode(componentName: string, attributes: string[]) {
|
|
24
24
|
return attributes.length === 0 ? `<${componentName} />` : `<${componentName} ${attributes.join(' ')} />`;
|
|
25
25
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Kokopu-React version 2.0.0 introduces some breaking changes with regard to the previous versions.
|
|
2
|
+
Those changes may require some fixes or adjustments in your codebase when upgrading Kokopu-React
|
|
3
|
+
from 1.x to 2.0.0 (or any subsequent version).
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
PropTypes
|
|
8
|
+
---------
|
|
9
|
+
|
|
10
|
+
As of 2.0.0, `Chessboard.propTypes`, `Movetext.propTypes`, etc... are no longer available, as component parameter type validation
|
|
11
|
+
is ensured through TypeScript. If your codebase includes references to the `propTypes` property of any Kokopu-React component,
|
|
12
|
+
you must remove those references.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
SquareSize parameters
|
|
17
|
+
---------------------
|
|
18
|
+
|
|
19
|
+
Before 2.0.0, it was possible to define the square size of the `Chessboard` components through a string, i.e. for instance to write
|
|
20
|
+
things such as `<Chessboard squareSize="32" />`. As of 2.0.0, a strict type-checking policy is enforced to avoid unexpected type
|
|
21
|
+
conversions leading to hard-to-debug behaviors. As a consequence, the value passed to the square size parameter must be a number,
|
|
22
|
+
i.e. for instance:
|
|
23
|
+
|
|
24
|
+
```plain
|
|
25
|
+
<Chessboard squareSize={32} />
|
|
26
|
+
```
|
|
@@ -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,17 +17,17 @@
|
|
|
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
|
import React from 'react';
|
|
24
24
|
import Styled from 'react-styleguidist/lib/client/rsg-components/Styled';
|
|
25
25
|
|
|
26
|
-
import logo from './kokopu-react-logo.png';
|
|
27
|
-
|
|
28
26
|
import './theming.css';
|
|
29
27
|
|
|
30
28
|
|
|
29
|
+
/* eslint-disable react/prop-types */
|
|
30
|
+
|
|
31
31
|
const styles = ({ color, fontFamily, fontSize }) => ({
|
|
32
32
|
logo: {
|
|
33
33
|
color: color.base,
|
|
@@ -41,7 +41,7 @@ const styles = ({ color, fontFamily, fontSize }) => ({
|
|
|
41
41
|
function LogoRenderer({ classes, children }) {
|
|
42
42
|
return (<>
|
|
43
43
|
<div className="kokopu-logo">
|
|
44
|
-
<img src=
|
|
44
|
+
<img src="kokopu-react-logo.png" />
|
|
45
45
|
</div>
|
|
46
46
|
<h1 className={classes.logo}>{children}</h1>
|
|
47
47
|
</>);
|
|
@@ -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-logo {
|
|
@@ -27,3 +27,9 @@
|
|
|
27
27
|
footer {
|
|
28
28
|
display: none !important;
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
#changelog h2 {
|
|
32
|
+
font-size: inherit;
|
|
33
|
+
font-weight: bold;
|
|
34
|
+
margin-top: 24px;
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kokopu-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A React-based library to create and display chessboard and chess-related components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chess",
|
|
@@ -18,65 +18,72 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"dist/lib",
|
|
20
20
|
"doc_src",
|
|
21
|
-
"graphic_test_src",
|
|
22
|
-
"scripts/clean-graphic-output.js",
|
|
23
21
|
"scripts/docker-compose.yml",
|
|
22
|
+
"scripts/test-graphic.tsconfig.json",
|
|
24
23
|
"scripts/test-graphic.webpack.config.js",
|
|
25
24
|
"scripts/test-headless.webpack.config.js",
|
|
26
25
|
"src",
|
|
27
26
|
"test",
|
|
28
|
-
".
|
|
29
|
-
".
|
|
30
|
-
".
|
|
27
|
+
".eslintrc.yml",
|
|
28
|
+
".nycrc.yml",
|
|
29
|
+
"tsconfig.json"
|
|
31
30
|
],
|
|
32
31
|
"peerDependencies": {
|
|
33
|
-
"kokopu": "^4.0
|
|
32
|
+
"kokopu": "^4.3.0",
|
|
34
33
|
"react": "17.x.x || 18.x.x"
|
|
35
34
|
},
|
|
36
35
|
"dependencies": {
|
|
37
|
-
"htmlparser2": "^8.0.1"
|
|
38
|
-
"prop-types": "^15.8.1"
|
|
36
|
+
"htmlparser2": "^8.0.1"
|
|
39
37
|
},
|
|
40
38
|
"devDependencies": {
|
|
41
|
-
"@babel/cli": "^7.20.7",
|
|
42
|
-
"@babel/core": "^7.20.12",
|
|
43
39
|
"@babel/preset-env": "^7.20.2",
|
|
44
40
|
"@babel/preset-react": "^7.18.6",
|
|
45
|
-
"@emotion/react": "^11.10.
|
|
46
|
-
"@emotion/styled": "^11.10.
|
|
47
|
-
"@mui/material": "^5.11.
|
|
41
|
+
"@emotion/react": "^11.10.6",
|
|
42
|
+
"@emotion/styled": "^11.10.6",
|
|
43
|
+
"@mui/material": "^5.11.10",
|
|
44
|
+
"@types/react": "^18.0.28",
|
|
45
|
+
"@types/react-dom": "^18.0.11",
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
|
47
|
+
"@typescript-eslint/parser": "^5.53.0",
|
|
48
48
|
"babel-loader": "^9.1.2",
|
|
49
|
-
"babel-plugin-istanbul": "^6.1.1",
|
|
50
49
|
"copy-webpack-plugin": "^11.0.0",
|
|
50
|
+
"copyfiles": "^2.4.1",
|
|
51
|
+
"coverage-istanbul-loader": "^3.0.5",
|
|
51
52
|
"css-loader": "^6.7.3",
|
|
52
|
-
"eslint": "^8.
|
|
53
|
+
"eslint": "^8.34.0",
|
|
53
54
|
"eslint-plugin-react": "^7.32.2",
|
|
54
55
|
"html-webpack-plugin": "^5.5.0",
|
|
55
56
|
"img-diff-js": "^0.5.2",
|
|
56
|
-
"kokopu": "^4.
|
|
57
|
+
"kokopu": "^4.4.0",
|
|
57
58
|
"mocha": "^10.2.0",
|
|
58
59
|
"null-loader": "^4.0.1",
|
|
59
60
|
"nyc": "^15.1.0",
|
|
60
61
|
"react": "^18.2.0",
|
|
62
|
+
"react-docgen-typescript": "^2.2.2",
|
|
61
63
|
"react-dom": "^18.2.0",
|
|
62
|
-
"react-styleguidist": "^13.
|
|
63
|
-
"
|
|
64
|
+
"react-styleguidist": "^13.1.1",
|
|
65
|
+
"rimraf": "^4.1.2",
|
|
66
|
+
"selenium-webdriver": "^4.8.1",
|
|
64
67
|
"ssh2-sftp-client": "^9.0.4",
|
|
65
68
|
"style-loader": "^3.3.1",
|
|
69
|
+
"ts-loader": "^9.4.2",
|
|
70
|
+
"typescript": "^4.9.5",
|
|
66
71
|
"unit.js": "^2.1.1",
|
|
67
72
|
"webpack": "^5.75.0",
|
|
68
73
|
"webpack-cli": "^5.0.1"
|
|
69
74
|
},
|
|
70
75
|
"scripts": {
|
|
71
|
-
"lint": "eslint doc_src
|
|
72
|
-
"preunit": "webpack --config scripts/test-headless.webpack.config.js && webpack --config scripts/test-graphic.webpack.config.js &&
|
|
76
|
+
"lint": "eslint doc_src src test",
|
|
77
|
+
"preunit": "npm run build:lib && webpack --config scripts/test-headless.webpack.config.js && webpack --config scripts/test-graphic.webpack.config.js && rimraf build/graphic_output",
|
|
73
78
|
"unit": "nyc mocha --bail --sort",
|
|
74
79
|
"test": "npm run lint && npm run unit",
|
|
75
80
|
"test_env:start": "docker-compose -p kokopu-react-test-env -f scripts/docker-compose.yml up -d",
|
|
76
81
|
"test_env:stop": "docker-compose -p kokopu-react-test-env -f scripts/docker-compose.yml down",
|
|
77
|
-
"build": "
|
|
78
|
-
"
|
|
79
|
-
"
|
|
82
|
+
"build": "npm run build:lib && npm run build:doc",
|
|
83
|
+
"build:doc": "rimraf dist/docs && styleguidist build --config scripts/doc.styleguide.config.js && copyfiles -u 2 'doc_src/theming/*.png' dist/docs",
|
|
84
|
+
"build:lib": "rimraf dist/lib && tsc && copyfiles -u 1 'src/**/*.{css,png,woff,woff2}' dist/lib",
|
|
85
|
+
"start": "styleguidist server --open --config scripts/doc.styleguide.config.js",
|
|
86
|
+
"clean": "rimraf build dist",
|
|
80
87
|
"predeploy": "npm run test && npm run build",
|
|
81
88
|
"deploy": "npm publish && node scripts/deploy.js"
|
|
82
89
|
}
|
|
@@ -2,7 +2,7 @@ version: "3.7"
|
|
|
2
2
|
|
|
3
3
|
services:
|
|
4
4
|
web-client:
|
|
5
|
-
image: selenium/standalone-firefox:4.
|
|
5
|
+
image: selenium/standalone-firefox:4.8.0-20230210 # https://github.com/SeleniumHQ/docker-selenium to get the latest version
|
|
6
6
|
shm_size: '2gb'
|
|
7
7
|
ports:
|
|
8
8
|
- 4444:4444 # http://localhost:4444 (driver)
|
|
@@ -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
|
const fs = require('fs');
|
|
@@ -25,23 +25,28 @@ const path = require('path');
|
|
|
25
25
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
26
26
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
27
27
|
|
|
28
|
-
// List all the
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
// List all the files corresponding to /test/graphic_test_app/{number}_*/*.tsx, each of them corresponding to a entry.
|
|
29
|
+
const items = fs.readdirSync('./test/graphic_test_app', { withFileTypes: true })
|
|
30
|
+
.filter(file => file.isDirectory() && /^\d+_/.test(file.name))
|
|
31
|
+
.flatMap(file => fs.readdirSync(`./test/graphic_test_app/${file.name}`)
|
|
32
|
+
.filter(subFile => path.extname(subFile) === '.tsx')
|
|
33
|
+
.map(subFile => `${file.name}/${path.basename(subFile, '.tsx')}`)
|
|
34
|
+
);
|
|
35
|
+
const entries = {};
|
|
31
36
|
items.forEach(item => {
|
|
32
|
-
entries[item] = `./
|
|
37
|
+
entries[item] = `./test/graphic_test_app/${item}`;
|
|
33
38
|
});
|
|
34
39
|
|
|
35
40
|
// Define the outputs.
|
|
36
|
-
|
|
41
|
+
const plugins = items.map(item => new HtmlWebpackPlugin({
|
|
37
42
|
title: 'Test ' + item,
|
|
38
43
|
chunks: [ item ],
|
|
39
44
|
filename: item + '/index.html',
|
|
40
45
|
}));
|
|
41
46
|
plugins.push(new CopyWebpackPlugin({
|
|
42
47
|
patterns: [
|
|
43
|
-
{ from: './
|
|
44
|
-
{ from: './
|
|
48
|
+
{ from: './test/graphic_test_app/common/heartbeat.txt', to: 'heartbeat.txt' },
|
|
49
|
+
{ from: './test/graphic_test_app/common/smiley.png', to: 'smiley.png' },
|
|
45
50
|
],
|
|
46
51
|
}));
|
|
47
52
|
|
|
@@ -52,25 +57,33 @@ module.exports = {
|
|
|
52
57
|
output: {
|
|
53
58
|
path: path.resolve(__dirname, '../build/test_graphic'),
|
|
54
59
|
hashFunction: "xxhash64", // FIXME The default hash function used by Webpack has been removed from OpenSSL.
|
|
60
|
+
clean: true,
|
|
55
61
|
},
|
|
56
62
|
plugins: plugins,
|
|
57
63
|
module: {
|
|
58
64
|
rules: [
|
|
59
65
|
{
|
|
60
66
|
test: /\.js$/i,
|
|
61
|
-
use:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
use: 'coverage-istanbul-loader',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
test: /\.tsx?$/i,
|
|
71
|
+
use: [
|
|
72
|
+
'coverage-istanbul-loader',
|
|
73
|
+
{
|
|
74
|
+
loader: 'ts-loader',
|
|
75
|
+
options: {
|
|
76
|
+
configFile: path.resolve(__dirname, 'test-graphic.tsconfig.json'),
|
|
77
|
+
},
|
|
65
78
|
},
|
|
66
|
-
|
|
79
|
+
],
|
|
67
80
|
},
|
|
68
81
|
{
|
|
69
82
|
test: /\.css$/i,
|
|
70
|
-
use: ['style-loader', 'css-loader'],
|
|
83
|
+
use: [ 'style-loader', 'css-loader' ],
|
|
71
84
|
},
|
|
72
85
|
{
|
|
73
|
-
test: /\.(png|woff|woff2
|
|
86
|
+
test: /\.(png|woff|woff2)$/i,
|
|
74
87
|
type: 'asset/resource',
|
|
75
88
|
},
|
|
76
89
|
{
|
|
@@ -78,5 +91,8 @@ module.exports = {
|
|
|
78
91
|
type: 'asset/source',
|
|
79
92
|
},
|
|
80
93
|
],
|
|
81
|
-
}
|
|
94
|
+
},
|
|
95
|
+
resolve: {
|
|
96
|
+
extensions: [ '.js', '.ts', '.tsx' ],
|
|
97
|
+
},
|
|
82
98
|
};
|
|
@@ -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
|
const path = require('path');
|
|
@@ -26,7 +26,7 @@ module.exports = {
|
|
|
26
26
|
mode: 'development',
|
|
27
27
|
devtool: 'inline-source-map',
|
|
28
28
|
entry: {
|
|
29
|
-
index: './
|
|
29
|
+
index: './dist/lib/index',
|
|
30
30
|
},
|
|
31
31
|
output: {
|
|
32
32
|
path: path.resolve(__dirname, '../build/test_headless'),
|
|
@@ -34,17 +34,13 @@ module.exports = {
|
|
|
34
34
|
type: 'commonjs2',
|
|
35
35
|
},
|
|
36
36
|
hashFunction: "xxhash64", // FIXME The default hash function used by Webpack has been removed from OpenSSL.
|
|
37
|
+
clean: true,
|
|
37
38
|
},
|
|
38
39
|
module: {
|
|
39
40
|
rules: [
|
|
40
41
|
{
|
|
41
42
|
test: /\.js$/i,
|
|
42
|
-
use:
|
|
43
|
-
loader: 'babel-loader',
|
|
44
|
-
options: {
|
|
45
|
-
plugins: [ 'istanbul' ],
|
|
46
|
-
},
|
|
47
|
-
},
|
|
43
|
+
use: 'coverage-istanbul-loader',
|
|
48
44
|
},
|
|
49
45
|
{
|
|
50
46
|
test: /\.css$/i,
|
|
@@ -55,5 +51,5 @@ module.exports = {
|
|
|
55
51
|
use: 'null-loader',
|
|
56
52
|
},
|
|
57
53
|
],
|
|
58
|
-
}
|
|
54
|
+
},
|
|
59
55
|
};
|
|
@@ -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 {
|