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
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
* This module contains the exceptions used by the library.
|
|
23
|
+
* @module
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Exception thrown when an invalid argument is passed to a function or a component.
|
|
27
|
+
*/
|
|
28
|
+
export class IllegalArgument {
|
|
29
|
+
constructor(functionOrComponentName, argumentName) {
|
|
30
|
+
this.functionOrComponentName = functionOrComponentName;
|
|
31
|
+
this.argumentName = argumentName;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @ignore
|
|
35
|
+
*/
|
|
36
|
+
toString() {
|
|
37
|
+
return `Illegal argument '${this.argumentName}' in function or component ${this.functionOrComponentName}`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exception.js","sourceRoot":"","sources":["../../src/exception.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;gFAmBgF;AAGhF;;;GAGG;AAGH;;GAEG;AACH,MAAM,OAAO,eAAe;IAQ3B,YAAY,uBAA+B,EAAE,YAAoB;QAChE,IAAI,CAAC,uBAAuB,GAAG,uBAAuB,CAAC;QACvD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,QAAQ;QACP,OAAO,qBAAqB,IAAI,CAAC,YAAY,8BAA8B,IAAI,CAAC,uBAAuB,EAAE,CAAC;IAC3G,CAAC;CACD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module defines the localizable strings used by the library.
|
|
3
|
+
*/
|
|
4
|
+
export declare namespace i18n {
|
|
5
|
+
let LINE: string;
|
|
6
|
+
let INVALID_FEN_ERROR_TITLE: string;
|
|
7
|
+
let INVALID_NOTATION_ERROR_TITLE: string;
|
|
8
|
+
let PIECE_SYMBOLS: {
|
|
9
|
+
K: string;
|
|
10
|
+
Q: string;
|
|
11
|
+
R: string;
|
|
12
|
+
B: string;
|
|
13
|
+
N: string;
|
|
14
|
+
P: string;
|
|
15
|
+
};
|
|
16
|
+
let ANNOTATED_BY: string;
|
|
17
|
+
let INVALID_PGN_ERROR_TITLE: string;
|
|
18
|
+
}
|
package/dist/lib/i18n.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
/******************************************************************************
|
|
1
|
+
/* -------------------------------------------------------------------------- *
|
|
8
2
|
* *
|
|
9
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
10
4
|
* Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
@@ -23,29 +17,22 @@ exports["default"] = void 0;
|
|
|
23
17
|
* Public License along with this program. If not, see *
|
|
24
18
|
* <http://www.gnu.org/licenses/>. *
|
|
25
19
|
* *
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
'
|
|
39
|
-
|
|
40
|
-
'R': 'R',
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
ANNOTATED_BY: 'Annotated by {0}',
|
|
46
|
-
INVALID_PGN_ERROR_TITLE: 'Invalid PGN string.',
|
|
47
|
-
INVALID_GAME_ATTRIBUTE_ERROR_MESSAGE: 'Invalid "game" attribute.',
|
|
48
|
-
INVALID_GAME_INDEX_ATTRIBUTE_ERROR_MESSAGE: 'Invalid "game index" attribute.'
|
|
49
|
-
};
|
|
50
|
-
var _default = i18n;
|
|
51
|
-
exports["default"] = _default;
|
|
20
|
+
* -------------------------------------------------------------------------- */
|
|
21
|
+
/**
|
|
22
|
+
* This module defines the localizable strings used by the library.
|
|
23
|
+
*/
|
|
24
|
+
export var i18n;
|
|
25
|
+
(function (i18n) {
|
|
26
|
+
/* eslint-disable prefer-const */
|
|
27
|
+
// WARNING: all those constants must be declared with "let" to allow them to be re-defined if necessary by consumer codes.
|
|
28
|
+
// Error box
|
|
29
|
+
i18n.LINE = 'line {0}';
|
|
30
|
+
// Chessboard
|
|
31
|
+
i18n.INVALID_FEN_ERROR_TITLE = 'Invalid FEN string.';
|
|
32
|
+
i18n.INVALID_NOTATION_ERROR_TITLE = 'Invalid move notation.';
|
|
33
|
+
// Movetext
|
|
34
|
+
i18n.PIECE_SYMBOLS = { 'K': 'K', 'Q': 'Q', 'R': 'R', 'B': 'B', 'N': 'N', 'P': 'P' };
|
|
35
|
+
i18n.ANNOTATED_BY = 'Annotated by {0}';
|
|
36
|
+
i18n.INVALID_PGN_ERROR_TITLE = 'Invalid PGN string.';
|
|
37
|
+
})(i18n || (i18n = {}));
|
|
38
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;gFAmBgF;AAGhF;;GAEG;AACH,MAAM,KAAW,IAAI,CAiBpB;AAjBD,WAAiB,IAAI;IAErB,iCAAiC;IACjC,0HAA0H;IAE1H,YAAY;IACD,SAAI,GAAG,UAAU,CAAC;IAE7B,aAAa;IACF,4BAAuB,GAAG,qBAAqB,CAAC;IAChD,iCAA4B,GAAG,wBAAwB,CAAC;IAEnE,WAAW;IACA,kBAAa,GAAG,EAAE,GAAG,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG,EAAE,GAAG,EAAC,GAAG,EAAE,CAAC;IACzE,iBAAY,GAAG,kBAAkB,CAAC;IAClC,4BAAuB,GAAG,qBAAqB,CAAC;AAE3D,CAAC,EAjBgB,IAAI,KAAJ,IAAI,QAiBpB"}
|
|
@@ -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-symbolCircle {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AnnotationSymbol } from '../types';
|
|
3
|
+
import './AnnotationSymbolShape.css';
|
|
4
|
+
interface AnnotationSymbolShapeProps {
|
|
5
|
+
/**
|
|
6
|
+
* X-coordinate of the center of the symbol.
|
|
7
|
+
*/
|
|
8
|
+
x: number;
|
|
9
|
+
/**
|
|
10
|
+
* Y-coordinate of the center of the symbol.
|
|
11
|
+
*/
|
|
12
|
+
y: number;
|
|
13
|
+
/**
|
|
14
|
+
* Size of the symbol (i.e. size of square in which the symbol is rendered).
|
|
15
|
+
*/
|
|
16
|
+
size: number;
|
|
17
|
+
/**
|
|
18
|
+
* Symbol code.
|
|
19
|
+
*/
|
|
20
|
+
symbol: AnnotationSymbol;
|
|
21
|
+
/**
|
|
22
|
+
* [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) to use to colorize the shape (for example: `'green'`, `'#ff0000'`...).
|
|
23
|
+
*/
|
|
24
|
+
color: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Symbol of a text marker.
|
|
28
|
+
*/
|
|
29
|
+
export declare function AnnotationSymbolShape({ x, y, size, symbol, color }: AnnotationSymbolShapeProps): JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = ArrowTip;
|
|
7
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
-
/******************************************************************************
|
|
1
|
+
/* -------------------------------------------------------------------------- *
|
|
11
2
|
* *
|
|
12
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
13
4
|
* Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
@@ -26,31 +17,26 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
26
17
|
* Public License along with this program. If not, see *
|
|
27
18
|
* <http://www.gnu.org/licenses/>. *
|
|
28
19
|
* *
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
* -------------------------------------------------------------------------- */
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import './AnnotationSymbolShape.css';
|
|
23
|
+
const SHAPE_THICKNESS_FACTOR = 0.1;
|
|
24
|
+
const DOT_RADIUS_FACTOR = 0.15;
|
|
25
|
+
const CIRCLE_RADIUS_FACTOR = 0.425;
|
|
31
26
|
/**
|
|
32
|
-
*
|
|
27
|
+
* Symbol of a text marker.
|
|
33
28
|
*/
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
export function AnnotationSymbolShape({ x, y, size, symbol, color }) {
|
|
30
|
+
if (symbol === 'dot') {
|
|
31
|
+
return React.createElement("circle", { cx: x, cy: y, r: size * DOT_RADIUS_FACTOR, fill: color });
|
|
32
|
+
}
|
|
33
|
+
else if (symbol === 'circle') {
|
|
34
|
+
const thickness = size * SHAPE_THICKNESS_FACTOR;
|
|
35
|
+
return React.createElement("circle", { className: "kokopu-symbolCircle", cx: x, cy: y, r: size * CIRCLE_RADIUS_FACTOR, stroke: color, strokeWidth: thickness });
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const text = symbol === 'plus' ? '+' : symbol === 'times' ? '\u00d7' : symbol;
|
|
39
|
+
return React.createElement("text", { className: "kokopu-symbolText", x: x, y: y, fill: color, fontSize: size }, text);
|
|
40
|
+
}
|
|
46
41
|
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* ID of the element.
|
|
50
|
-
*/
|
|
51
|
-
id: _propTypes["default"].string.isRequired,
|
|
52
|
-
/**
|
|
53
|
-
* Color to use to colorize the shape (for example: `'green'`, `'#ff0000'`...).
|
|
54
|
-
*/
|
|
55
|
-
color: _propTypes["default"].string.isRequired
|
|
56
|
-
};
|
|
42
|
+
//# sourceMappingURL=AnnotationSymbolShape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationSymbolShape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@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './arrow.css';
|
|
3
|
+
export interface ArrowMarkerIconProps {
|
|
4
|
+
/**
|
|
5
|
+
* Width and height (in pixels) of the icon.
|
|
6
|
+
*/
|
|
7
|
+
size: number;
|
|
8
|
+
/**
|
|
9
|
+
* [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) to use to colorize the icon (for example: `'green'`, `'#ff0000'`...).
|
|
10
|
+
*/
|
|
11
|
+
color: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* SVG icon representing an arrow marker.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ArrowMarkerIcon extends React.Component<ArrowMarkerIconProps> {
|
|
17
|
+
static defaultProps: Partial<ArrowMarkerIconProps>;
|
|
18
|
+
private arrowTipId;
|
|
19
|
+
render(): JSX.Element;
|
|
20
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* -------------------------------------------------------------------------- *
|
|
2
|
+
* *
|
|
3
|
+
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
+
* Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
|
+
* *
|
|
6
|
+
* This program is free software: you can redistribute it and/or *
|
|
7
|
+
* modify it under the terms of the GNU Lesser General Public License *
|
|
8
|
+
* as published by the Free Software Foundation, either version 3 of *
|
|
9
|
+
* the License, or (at your option) any later version. *
|
|
10
|
+
* *
|
|
11
|
+
* This program is distributed in the hope that it will be useful, *
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
14
|
+
* GNU Lesser General Public License for more details. *
|
|
15
|
+
* *
|
|
16
|
+
* You should have received a copy of the GNU Lesser General *
|
|
17
|
+
* Public License along with this program. If not, see *
|
|
18
|
+
* <http://www.gnu.org/licenses/>. *
|
|
19
|
+
* *
|
|
20
|
+
* -------------------------------------------------------------------------- */
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import { IllegalArgument } from '../exception';
|
|
23
|
+
import { sanitizeString, sanitizeBoundedInteger } from '../sanitization';
|
|
24
|
+
import { generateRandomId } from '../util';
|
|
25
|
+
import { MIN_SQUARE_SIZE, MAX_SQUARE_SIZE } from '../types';
|
|
26
|
+
import { ArrowTip } from './ArrowTip';
|
|
27
|
+
import './arrow.css';
|
|
28
|
+
const ARROW_THICKNESS_FACTOR = 0.2;
|
|
29
|
+
/**
|
|
30
|
+
* SVG icon representing an arrow marker.
|
|
31
|
+
*/
|
|
32
|
+
export class ArrowMarkerIcon extends React.Component {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
this.arrowTipId = generateRandomId();
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
// Sanitize the inputs.
|
|
39
|
+
const size = sanitizeBoundedInteger(this.props.size, MIN_SQUARE_SIZE, MAX_SQUARE_SIZE, () => new IllegalArgument('ArrowMarkerIcon', 'size'));
|
|
40
|
+
const color = sanitizeString(this.props.color);
|
|
41
|
+
// Render the component.
|
|
42
|
+
const halfThickness = size * ARROW_THICKNESS_FACTOR / 2;
|
|
43
|
+
const viewBox = `0 0 ${size} ${size}`;
|
|
44
|
+
return (React.createElement("svg", { className: "kokopu-arrowMarkerIcon", viewBox: viewBox, width: size, height: size },
|
|
45
|
+
React.createElement("defs", null,
|
|
46
|
+
React.createElement(ArrowTip, { id: this.arrowTipId, color: this.props.color })),
|
|
47
|
+
React.createElement("line", { className: "kokopu-arrow", x1: halfThickness, y1: size / 2, x2: size - halfThickness * 3, y2: size / 2, stroke: color, strokeWidth: halfThickness * 2, markerEnd: `url(#${this.arrowTipId})` })));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
ArrowMarkerIcon.defaultProps = {
|
|
51
|
+
color: 'currentcolor',
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=ArrowMarkerIcon.js.map
|
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,IAAC,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAI,CACpD;YACP,8BAAM,SAAS,EAAC,cAAc,EAAC,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,IAAI,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,GAAG,aAAa,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EACxH,WAAW,EAAE,aAAa,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,IAAI,CAAC,UAAU,GAAG,GAAI,CACrE,CACN,CAAC;IACH,CAAC;;AAxBM,4BAAY,GAAkC;IACpD,KAAK,EAAE,cAAc;CACrB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface ArrowTipProps {
|
|
3
|
+
/**
|
|
4
|
+
* ID of the element.
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) to use to colorize the shape (for example: `'green'`, `'#ff0000'`...).
|
|
9
|
+
*/
|
|
10
|
+
color: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Tip of the arrow markers.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ArrowTip({ id, color }: ArrowTipProps): JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* -------------------------------------------------------------------------- *
|
|
2
|
+
* *
|
|
3
|
+
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
+
* Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
|
+
* *
|
|
6
|
+
* This program is free software: you can redistribute it and/or *
|
|
7
|
+
* modify it under the terms of the GNU Lesser General Public License *
|
|
8
|
+
* as published by the Free Software Foundation, either version 3 of *
|
|
9
|
+
* the License, or (at your option) any later version. *
|
|
10
|
+
* *
|
|
11
|
+
* This program is distributed in the hope that it will be useful, *
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
14
|
+
* GNU Lesser General Public License for more details. *
|
|
15
|
+
* *
|
|
16
|
+
* You should have received a copy of the GNU Lesser General *
|
|
17
|
+
* Public License along with this program. If not, see *
|
|
18
|
+
* <http://www.gnu.org/licenses/>. *
|
|
19
|
+
* *
|
|
20
|
+
* -------------------------------------------------------------------------- */
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
/**
|
|
23
|
+
* Tip of the arrow markers.
|
|
24
|
+
*/
|
|
25
|
+
export function ArrowTip({ id, color }) {
|
|
26
|
+
return (React.createElement("marker", { id: id, markerWidth: 4, markerHeight: 4, refX: 2.5, refY: 2, orient: "auto" },
|
|
27
|
+
React.createElement("path", { fill: color, d: "M 4,2 L 0,4 L 1,2 L 0,0 Z" })));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=ArrowTip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrowTip.js","sourceRoot":"","sources":["../../../src/icons/ArrowTip.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;gFAmBgF;AAGhF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiB/B;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,EAAE,EAAE,EAAE,KAAK,EAAiB;IACpD,OAAO,CACN,gCAAQ,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAC,MAAM;QACjF,8BAAM,IAAI,EAAE,KAAK,EAAE,CAAC,EAAC,2BAA2B,GAAG,CAC3C,CACT,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface SquareMarkerIconProps {
|
|
3
|
+
/**
|
|
4
|
+
* Width and height (in pixels) of the icon.
|
|
5
|
+
*/
|
|
6
|
+
size: number;
|
|
7
|
+
/**
|
|
8
|
+
* [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) to use to colorize the icon (for example: `'green'`, `'#ff0000'`...).
|
|
9
|
+
*/
|
|
10
|
+
color: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* SVG icon representing a square marker.
|
|
14
|
+
*/
|
|
15
|
+
export declare function SquareMarkerIcon({ size, color }: SquareMarkerIconProps): JSX.Element;
|
|
16
|
+
export declare namespace SquareMarkerIcon {
|
|
17
|
+
var defaultProps: Partial<SquareMarkerIconProps>;
|
|
18
|
+
}
|
|
@@ -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,26 +17,27 @@
|
|
|
17
17
|
* Public License along with this program. If not, see *
|
|
18
18
|
* <http://www.gnu.org/licenses/>. *
|
|
19
19
|
* *
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// Chessboard
|
|
29
|
-
INVALID_FEN_ERROR_TITLE: 'Invalid FEN string.',
|
|
30
|
-
INVALID_NOTATION_ERROR_TITLE: 'Invalid move notation.',
|
|
31
|
-
INVALID_POSITION_ATTRIBUTE_ERROR_MESSAGE: 'Invalid "position" attribute.',
|
|
32
|
-
INVALID_MOVE_ATTRIBUTE_ERROR_MESSAGE: 'Invalid "move" attribute.',
|
|
33
|
-
|
|
34
|
-
// Movetext
|
|
35
|
-
PIECE_SYMBOLS: { 'K':'K', 'Q':'Q', 'R':'R', 'B':'B', 'N':'N', 'P':'P' },
|
|
36
|
-
ANNOTATED_BY: 'Annotated by {0}',
|
|
37
|
-
INVALID_PGN_ERROR_TITLE: 'Invalid PGN string.',
|
|
38
|
-
INVALID_GAME_ATTRIBUTE_ERROR_MESSAGE: 'Invalid "game" attribute.',
|
|
39
|
-
INVALID_GAME_INDEX_ATTRIBUTE_ERROR_MESSAGE: 'Invalid "game index" attribute.',
|
|
20
|
+
* -------------------------------------------------------------------------- */
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import { IllegalArgument } from '../exception';
|
|
23
|
+
import { sanitizeString, sanitizeBoundedInteger } from '../sanitization';
|
|
24
|
+
import { MIN_SQUARE_SIZE, MAX_SQUARE_SIZE } from '../types';
|
|
25
|
+
const SQUARE_MARGIN_FACTOR = 0.1;
|
|
26
|
+
const defaultProps = {
|
|
27
|
+
color: 'currentcolor',
|
|
40
28
|
};
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
/**
|
|
30
|
+
* SVG icon representing a square marker.
|
|
31
|
+
*/
|
|
32
|
+
export function SquareMarkerIcon({ size, color }) {
|
|
33
|
+
// Sanitize the inputs.
|
|
34
|
+
size = sanitizeBoundedInteger(size, MIN_SQUARE_SIZE, MAX_SQUARE_SIZE, () => new IllegalArgument('SquareMarkerIcon', 'size'));
|
|
35
|
+
color = sanitizeString(color);
|
|
36
|
+
// Render the component.
|
|
37
|
+
const margin = Math.round(size * SQUARE_MARGIN_FACTOR);
|
|
38
|
+
const viewBox = `0 0 ${size} ${size}`;
|
|
39
|
+
return (React.createElement("svg", { className: "kokopu-squareMarkerIcon", viewBox: viewBox, width: size, height: size },
|
|
40
|
+
React.createElement("rect", { x: margin, y: margin, width: size - margin * 2, height: size - margin * 2, fill: color })));
|
|
41
|
+
}
|
|
42
|
+
SquareMarkerIcon.defaultProps = defaultProps;
|
|
43
|
+
//# sourceMappingURL=SquareMarkerIcon.js.map
|
|
@@ -0,0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AC;AAED,gBAAgB,CAAC,YAAY,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AnnotationSymbol } from '../types';
|
|
3
|
+
export interface TextMarkerIconProps {
|
|
4
|
+
/**
|
|
5
|
+
* Width and height (in pixels) of the icon.
|
|
6
|
+
*/
|
|
7
|
+
size: number;
|
|
8
|
+
/**
|
|
9
|
+
* Symbol to represent on the icon.
|
|
10
|
+
*/
|
|
11
|
+
symbol: AnnotationSymbol;
|
|
12
|
+
/**
|
|
13
|
+
* [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) to use to colorize the icon (for example: `'green'`, `'#ff0000'`...).
|
|
14
|
+
*/
|
|
15
|
+
color: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* SVG icon representing a text marker.
|
|
19
|
+
*/
|
|
20
|
+
export declare function TextMarkerIcon({ size, symbol, color }: TextMarkerIconProps): JSX.Element;
|
|
21
|
+
export declare namespace TextMarkerIcon {
|
|
22
|
+
var defaultProps: Partial<TextMarkerIconProps>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* -------------------------------------------------------------------------- *
|
|
2
|
+
* *
|
|
3
|
+
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
+
* Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
|
+
* *
|
|
6
|
+
* This program is free software: you can redistribute it and/or *
|
|
7
|
+
* modify it under the terms of the GNU Lesser General Public License *
|
|
8
|
+
* as published by the Free Software Foundation, either version 3 of *
|
|
9
|
+
* the License, or (at your option) any later version. *
|
|
10
|
+
* *
|
|
11
|
+
* This program is distributed in the hope that it will be useful, *
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
14
|
+
* GNU Lesser General Public License for more details. *
|
|
15
|
+
* *
|
|
16
|
+
* You should have received a copy of the GNU Lesser General *
|
|
17
|
+
* Public License along with this program. If not, see *
|
|
18
|
+
* <http://www.gnu.org/licenses/>. *
|
|
19
|
+
* *
|
|
20
|
+
* -------------------------------------------------------------------------- */
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import { IllegalArgument } from '../exception';
|
|
23
|
+
import { sanitizeString, sanitizeBoundedInteger } from '../sanitization';
|
|
24
|
+
import { MIN_SQUARE_SIZE, MAX_SQUARE_SIZE, isAnnotationSymbol } from '../types';
|
|
25
|
+
import { AnnotationSymbolShape } from './AnnotationSymbolShape';
|
|
26
|
+
const defaultProps = {
|
|
27
|
+
color: 'currentcolor',
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* SVG icon representing a text marker.
|
|
31
|
+
*/
|
|
32
|
+
export function TextMarkerIcon({ size, symbol, color }) {
|
|
33
|
+
// Sanitize the inputs.
|
|
34
|
+
size = sanitizeBoundedInteger(size, MIN_SQUARE_SIZE, MAX_SQUARE_SIZE, () => new IllegalArgument('TextMarkerIcon', 'size'));
|
|
35
|
+
if (!isAnnotationSymbol(symbol)) {
|
|
36
|
+
throw new IllegalArgument('TextMarkerIcon', 'symbol');
|
|
37
|
+
}
|
|
38
|
+
color = sanitizeString(color);
|
|
39
|
+
// Render the component.
|
|
40
|
+
const viewBox = `0 0 ${size} ${size}`;
|
|
41
|
+
return (React.createElement("svg", { className: "kokopu-textMarkerIcon", viewBox: viewBox, width: size, height: size },
|
|
42
|
+
React.createElement(AnnotationSymbolShape, { x: size / 2, y: size / 2, size: size, symbol: symbol, color: color })));
|
|
43
|
+
}
|
|
44
|
+
TextMarkerIcon.defaultProps = defaultProps;
|
|
45
|
+
//# sourceMappingURL=TextMarkerIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextMarkerIcon.js","sourceRoot":"","sources":["../../../src/icons/TextMarkerIcon.tsx"],"names":[],"mappings":"AAAA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|
|
@@ -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-arrow {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { i18n } from './i18n';
|
|
2
|
+
export * as exception from './exception';
|
|
3
|
+
export { Colorset, Pieceset, PieceSymbolMapping, AnnotationColor, AnnotationSymbol, SquareMarkerSet, TextMarkerSet, ArrowMarkerSet, isPieceSymbolMapping, isAnnotationColor, isAnnotationSymbol, flattenSquareMarkers, flattenTextMarkers, flattenArrowMarkers, parseSquareMarkers, parseTextMarkers, parseArrowMarkers } from './types';
|
|
4
|
+
export { ErrorBox, ErrorBoxProps } from './errorbox/ErrorBox';
|
|
5
|
+
export { SquareMarkerIcon, SquareMarkerIconProps } from './icons/SquareMarkerIcon';
|
|
6
|
+
export { TextMarkerIcon, TextMarkerIconProps } from './icons/TextMarkerIcon';
|
|
7
|
+
export { ArrowMarkerIcon, ArrowMarkerIconProps } from './icons/ArrowMarkerIcon';
|
|
8
|
+
export { Chessboard, ChessboardProps, SmallScreenLimit } from './chessboard/Chessboard';
|
|
9
|
+
export { formatMove, moveFormatter } from './movetext/moveFormatter';
|
|
10
|
+
export { Movetext, MovetextProps, MoveSelectEventOrigin } from './movetext/Movetext';
|