kokopu-react 1.11.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.yml +84 -0
- package/.nycrc.yml +0 -1
- package/README.md +1 -1
- package/{src/css/chessboard.css → dist/lib/chessboard/Chessboard.css} +2 -2
- package/dist/lib/chessboard/Chessboard.d.ts +171 -0
- package/dist/lib/chessboard/Chessboard.js +365 -0
- package/dist/lib/chessboard/Chessboard.js.map +1 -0
- package/dist/lib/chessboard/ChessboardImpl.d.ts +119 -0
- package/dist/lib/chessboard/ChessboardImpl.js +471 -0
- package/dist/lib/chessboard/ChessboardImpl.js.map +1 -0
- package/dist/lib/chessboard/Draggable.d.ts +62 -0
- package/dist/lib/chessboard/Draggable.js +157 -0
- package/dist/lib/chessboard/Draggable.js.map +1 -0
- package/dist/lib/chessboard/Motion.d.ts +28 -0
- package/dist/lib/chessboard/Motion.js +74 -0
- package/dist/lib/chessboard/Motion.js.map +1 -0
- package/dist/lib/chessboard/colorsets.d.ts +5 -0
- package/dist/lib/{impl → chessboard}/colorsets.js +43 -47
- package/dist/lib/chessboard/colorsets.js.map +1 -0
- package/dist/lib/chessboard/piecesets.d.ts +5 -0
- package/dist/lib/chessboard/piecesets.js +214 -0
- package/dist/lib/chessboard/piecesets.js.map +1 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-bb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-bk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-bn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-bp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-bq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-br.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-bx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wr.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/cburnett-wx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-bb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-bk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-bn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-bp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-bq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-br.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-bx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wr.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/celtic-wx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-bb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-bk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-bn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-bp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-bq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-br.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-spatial-bx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-spatial-wx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-wb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-wk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-wn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-wp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-wq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/eyes-wr.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-bb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-bk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-bn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-bp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-bq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-br.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-bx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wr.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/fantasy-wx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-bb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-bk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-bn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-bp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-bq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-br.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-bx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wr.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/skulls-wx.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-bb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-bk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-bn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-bp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-bq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-br.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-wb.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-wk.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-wn.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-wp.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-wq.png +0 -0
- package/dist/lib/{sprites → chessboard/sprites}/spatial-wr.png +0 -0
- package/dist/lib/{css/error_box.css → errorbox/ErrorBox.css} +2 -2
- package/dist/lib/errorbox/ErrorBox.d.ts +28 -0
- package/dist/lib/errorbox/ErrorBox.js +84 -0
- package/dist/lib/errorbox/ErrorBox.js.map +1 -0
- package/dist/lib/exception.d.ts +18 -0
- package/dist/lib/exception.js +40 -0
- package/dist/lib/exception.js.map +1 -0
- package/dist/lib/i18n.d.ts +18 -0
- package/dist/lib/i18n.js +20 -33
- package/dist/lib/i18n.js.map +1 -0
- package/{src/css/symbol.css → dist/lib/icons/AnnotationSymbolShape.css} +2 -2
- package/dist/lib/icons/AnnotationSymbolShape.d.ts +30 -0
- package/dist/lib/{impl/ArrowTip.js → icons/AnnotationSymbolShape.js} +21 -35
- package/dist/lib/icons/AnnotationSymbolShape.js.map +1 -0
- package/dist/lib/icons/ArrowMarkerIcon.d.ts +20 -0
- package/dist/lib/icons/ArrowMarkerIcon.js +53 -0
- package/dist/lib/icons/ArrowMarkerIcon.js.map +1 -0
- package/dist/lib/icons/ArrowTip.d.ts +16 -0
- package/dist/lib/icons/ArrowTip.js +29 -0
- package/dist/lib/icons/ArrowTip.js.map +1 -0
- package/dist/lib/icons/SquareMarkerIcon.d.ts +18 -0
- package/{src/i18n.js → dist/lib/icons/SquareMarkerIcon.js} +24 -23
- package/dist/lib/icons/SquareMarkerIcon.js.map +1 -0
- package/dist/lib/icons/TextMarkerIcon.d.ts +23 -0
- package/dist/lib/icons/TextMarkerIcon.js +45 -0
- package/dist/lib/icons/TextMarkerIcon.js.map +1 -0
- package/{src/css → dist/lib/icons}/arrow.css +2 -2
- package/dist/lib/index.d.ts +10 -0
- package/dist/lib/index.js +31 -105
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/{css/movetext.css → movetext/Movetext.css} +2 -2
- package/dist/lib/movetext/Movetext.d.ts +136 -0
- package/dist/lib/movetext/Movetext.js +167 -0
- package/dist/lib/movetext/Movetext.js.map +1 -0
- package/dist/lib/movetext/MovetextImpl.d.ts +85 -0
- package/dist/lib/movetext/MovetextImpl.js +411 -0
- package/dist/lib/movetext/MovetextImpl.js.map +1 -0
- package/dist/lib/{fonts → movetext/fonts}/chessalpha.woff +0 -0
- package/dist/lib/{fonts → movetext/fonts}/chessalpha.woff2 +0 -0
- package/dist/lib/{css → movetext}/fonts.css +4 -4
- package/dist/lib/movetext/htmlFilter.d.ts +7 -0
- package/dist/lib/movetext/htmlFilter.js +169 -0
- package/dist/lib/movetext/htmlFilter.js.map +1 -0
- package/dist/lib/movetext/moveFormatter.d.ts +20 -0
- package/dist/lib/movetext/moveFormatter.js +93 -0
- package/dist/lib/movetext/moveFormatter.js.map +1 -0
- package/dist/lib/sanitization.d.ts +6 -0
- package/dist/lib/sanitization.js +39 -0
- package/dist/lib/sanitization.js.map +1 -0
- package/dist/lib/types.d.ts +151 -0
- package/dist/lib/types.js +162 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/util.d.ts +2 -0
- package/dist/lib/util.js +36 -0
- package/dist/lib/util.js.map +1 -0
- package/doc_src/demo/{PageChessboardBase.js → PageChessboardBase.tsx} +30 -24
- package/doc_src/demo/{PageChessboardInteraction.js → PageChessboardInteraction.tsx} +95 -66
- package/doc_src/demo/{PageChessboardMove.js → PageChessboardMove.tsx} +66 -54
- package/doc_src/demo/{PageChessboardSmallScreens.js → PageChessboardSmallScreens.tsx} +23 -14
- package/doc_src/demo/{PageMovetextBase.js → PageMovetextBase.tsx} +62 -49
- package/doc_src/demo/{PageMovetextInteraction.js → PageMovetextInteraction.tsx} +58 -43
- package/doc_src/demo/decs.d.ts +31 -0
- package/doc_src/demo/demo.css +2 -2
- package/doc_src/demo/{util.js → util.ts} +3 -3
- package/doc_src/migrate_to_2.md +26 -0
- package/doc_src/theming/LogoRenderer.js +5 -5
- package/doc_src/theming/theming.css +8 -2
- package/package.json +31 -24
- package/scripts/docker-compose.yml +1 -1
- package/scripts/test-graphic.tsconfig.json +7 -0
- package/scripts/test-graphic.webpack.config.js +33 -17
- package/scripts/test-headless.webpack.config.js +6 -10
- package/{dist/lib/css/chessboard.css → src/chessboard/Chessboard.css} +2 -2
- package/src/chessboard/Chessboard.tsx +575 -0
- package/src/chessboard/ChessboardImpl.tsx +632 -0
- package/src/chessboard/Draggable.tsx +252 -0
- package/src/{impl/Motion.js → chessboard/Motion.tsx} +37 -27
- package/src/chessboard/colorsets.ts +134 -0
- package/src/chessboard/piecesets.ts +229 -0
- package/src/{sprites → chessboard/sprites}/cburnett-bb.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-bk.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-bn.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-bp.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-bq.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-br.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-bx.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wb.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wk.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wn.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wp.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wq.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wr.png +0 -0
- package/src/{sprites → chessboard/sprites}/cburnett-wx.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-bb.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-bk.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-bn.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-bp.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-bq.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-br.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-bx.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wb.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wk.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wn.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wp.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wq.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wr.png +0 -0
- package/src/{sprites → chessboard/sprites}/celtic-wx.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-bb.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-bk.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-bn.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-bp.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-bq.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-br.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-spatial-bx.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-spatial-wx.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-wb.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-wk.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-wn.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-wp.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-wq.png +0 -0
- package/src/{sprites → chessboard/sprites}/eyes-wr.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-bb.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-bk.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-bn.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-bp.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-bq.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-br.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-bx.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wb.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wk.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wn.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wp.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wq.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wr.png +0 -0
- package/src/{sprites → chessboard/sprites}/fantasy-wx.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-bb.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-bk.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-bn.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-bp.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-bq.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-br.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-bx.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wb.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wk.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wn.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wp.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wq.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wr.png +0 -0
- package/src/{sprites → chessboard/sprites}/skulls-wx.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-bb.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-bk.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-bn.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-bp.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-bq.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-br.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-wb.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-wk.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-wn.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-wp.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-wq.png +0 -0
- package/src/{sprites → chessboard/sprites}/spatial-wr.png +0 -0
- package/src/decs.d.ts +26 -0
- package/src/{css/error_box.css → errorbox/ErrorBox.css} +2 -2
- package/src/errorbox/ErrorBox.tsx +129 -0
- package/src/exception.ts +51 -0
- package/src/i18n.ts +43 -0
- package/{dist/lib/css/symbol.css → src/icons/AnnotationSymbolShape.css} +2 -2
- package/src/{impl/TextSymbol.js → icons/AnnotationSymbolShape.tsx} +32 -30
- package/src/{ArrowMarkerIcon.js → icons/ArrowMarkerIcon.tsx} +39 -36
- package/src/{impl/ArrowTip.js → icons/ArrowTip.tsx} +20 -20
- package/src/{SquareMarkerIcon.js → icons/SquareMarkerIcon.tsx} +35 -28
- package/src/{TextMarkerIcon.js → icons/TextMarkerIcon.tsx} +40 -32
- package/{dist/lib/css → src/icons}/arrow.css +2 -2
- package/src/index.ts +38 -0
- package/src/{css/movetext.css → movetext/Movetext.css} +2 -2
- package/src/movetext/Movetext.tsx +278 -0
- package/src/movetext/MovetextImpl.tsx +493 -0
- package/src/{fonts → movetext/fonts}/chessalpha.woff +0 -0
- package/src/{fonts → movetext/fonts}/chessalpha.woff2 +0 -0
- package/src/{css → movetext}/fonts.css +4 -4
- package/src/movetext/htmlFilter.tsx +188 -0
- package/src/{formatmove.js → movetext/moveFormatter.tsx} +39 -26
- package/src/sanitization.ts +51 -0
- package/src/types.ts +311 -0
- package/src/util.ts +39 -0
- package/test/.eslintrc.yml +3 -3
- package/test/{1_markers.js → 01_types.js} +89 -4
- package/test/{2_chessboard_util.js → 02_chessboard_util.js} +16 -7
- package/test/{3_marker_icons_graphic.js → 03_error_box_graphic.js} +20 -14
- package/test/04_marker_icons_graphic.js +49 -0
- package/test/05_chessboard_graphic.js +92 -0
- package/test/06_chessboard_animation.js +71 -0
- package/test/07_chessboard_interaction.js +130 -0
- package/test/08_chessboard_play_moves.js +98 -0
- package/test/{7_movetext_graphic.js → 09_movetext_graphic.js} +32 -16
- package/test/{8_movetext_interaction.js → 10_movetext_interaction.js} +18 -23
- package/test/common/graphic.js +67 -33
- package/test/graphic_references/03_error_box_graphic/base/cut_beginning_of_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/cut_end_of_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/cut_on_line_breaks.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/error_index_not_integer.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/full.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/minimal.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/missing_error_index.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/missing_error_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/negative_error_index.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/single_character_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/too_large_error_index.png +0 -0
- package/test/graphic_references/03_error_box_graphic/localization/default.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/colorized_arrow.png +0 -0
- package/test/{references/01_marker_icons/1.png → graphic_references/04_marker_icons_graphic/base/colorized_square.png} +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/colorized_symbol.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/colorized_text.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/default_arrow.png +0 -0
- package/test/{references/01_marker_icons/0.png → graphic_references/04_marker_icons_graphic/base/default_square.png} +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/default_text.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/invalid_arrow_size.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/invalid_square_size.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/invalid_symbol.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/invalid_text_size.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/wrapped_arrow.png +0 -0
- package/test/{references/01_marker_icons/2.png → graphic_references/04_marker_icons_graphic/base/wrapped_square.png} +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/wrapped_symbol.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/wrapped_text.png +0 -0
- package/test/{references/04_chessboard_annotations/4.png → graphic_references/05_chessboard_graphic/annotations/overlap.png} +0 -0
- package/test/{references/04_chessboard_annotations/5.png → graphic_references/05_chessboard_graphic/annotations/overlap_and_flip.png} +0 -0
- package/test/{references/04_chessboard_annotations/0.png → graphic_references/05_chessboard_graphic/annotations/with_coordinates.png} +0 -0
- package/test/{references/04_chessboard_annotations/1.png → graphic_references/05_chessboard_graphic/annotations/with_coordinates_and_flip.png} +0 -0
- package/test/{references/04_chessboard_annotations/2.png → graphic_references/05_chessboard_graphic/annotations/without_coordinates.png} +0 -0
- package/test/{references/04_chessboard_annotations/3.png → graphic_references/05_chessboard_graphic/annotations/without_coordinates_and_flip.png} +0 -0
- package/test/{references/02_chessboard_simple/0.png → graphic_references/05_chessboard_graphic/base/default.png} +0 -0
- package/test/{references/02_chessboard_simple/1.png → graphic_references/05_chessboard_graphic/base/empty.png} +0 -0
- package/test/{references/02_chessboard_simple/3.png → graphic_references/05_chessboard_graphic/base/from_fen.png} +0 -0
- package/test/{references/02_chessboard_simple/4.png → graphic_references/05_chessboard_graphic/base/from_kokopu_object.png} +0 -0
- package/test/{references/02_chessboard_simple/2.png → graphic_references/05_chessboard_graphic/base/parsing_error.png} +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/wrong_position_type.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960_with_move.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant_with_fen.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/special_code.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_with_std_initial_position.png +0 -0
- package/test/{references/03_chessboard_flipped/2.png → graphic_references/05_chessboard_graphic/chess_variants/variant_without_std_initial_position.png} +0 -0
- package/test/{references/03_chessboard_flipped/0.png → graphic_references/05_chessboard_graphic/flipped/default.png} +0 -0
- package/test/{references/03_chessboard_flipped/1.png → graphic_references/05_chessboard_graphic/flipped/empty.png} +0 -0
- package/test/{references/03_chessboard_flipped/3.png → graphic_references/05_chessboard_graphic/flipped/from_fen.png} +0 -0
- package/test/{references/03_chessboard_flipped/4.png → graphic_references/05_chessboard_graphic/flipped/from_kokopu_object.png} +0 -0
- package/test/graphic_references/05_chessboard_graphic/flipped/parsing_error.png +0 -0
- package/test/{references/05_chessboard_move/4.png → graphic_references/05_chessboard_graphic/move/capture.png} +0 -0
- package/test/{references/05_chessboard_move/5.png → graphic_references/05_chessboard_graphic/move/castling_move.png} +0 -0
- package/test/{references/05_chessboard_move/0.png → graphic_references/05_chessboard_graphic/move/default.png} +0 -0
- package/test/{references/05_chessboard_move/6.png → graphic_references/05_chessboard_graphic/move/en-passant.png} +0 -0
- package/test/{references/05_chessboard_move/1.png → graphic_references/05_chessboard_graphic/move/no_move_arrow.png} +0 -0
- package/test/{references/05_chessboard_move/2.png → graphic_references/05_chessboard_graphic/move/parsing_error.png} +0 -0
- package/test/{references/05_chessboard_move/7.png → graphic_references/05_chessboard_graphic/move/promotion.png} +0 -0
- package/test/{references/05_chessboard_move/3.png → graphic_references/05_chessboard_graphic/move/with_forced_move_arrow_and_flip.png} +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/wrong_move_arrow_color_type.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/wrong_move_type.png +0 -0
- package/test/{references/07_chessboard_theme/3.png → graphic_references/05_chessboard_graphic/theme/custom_1.png} +0 -0
- package/test/{references/07_chessboard_theme/4.png → graphic_references/05_chessboard_graphic/theme/custom_2.png} +0 -0
- package/test/{references/07_chessboard_theme/5.png → graphic_references/05_chessboard_graphic/theme/custom_3.png} +0 -0
- package/test/{references/07_chessboard_theme/6.png → graphic_references/05_chessboard_graphic/theme/custom_4.png} +0 -0
- package/test/{references/07_chessboard_theme/7.png → graphic_references/05_chessboard_graphic/theme/custom_5.png} +0 -0
- package/test/{references/07_chessboard_theme/8.png → graphic_references/05_chessboard_graphic/theme/custom_6.png} +0 -0
- package/test/{references/07_chessboard_theme/0.png → graphic_references/05_chessboard_graphic/theme/default.png} +0 -0
- package/test/{references/07_chessboard_theme/1.png → graphic_references/05_chessboard_graphic/theme/large.png} +0 -0
- package/test/{references/07_chessboard_theme/2.png → graphic_references/05_chessboard_graphic/theme/small.png} +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/wrong_colorset.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/wrong_pieceset.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/wrong_square_size_type.png +0 -0
- package/test/{references/06a_chessboard_animated_move/2.png → graphic_references/06_chessboard_animation/base_1/capture.png} +0 -0
- package/test/{references/06a_chessboard_animated_move/3.png → graphic_references/06_chessboard_animation/base_1/castling_move.png} +0 -0
- package/test/{references/06a_chessboard_animated_move/4.png → graphic_references/06_chessboard_animation/base_1/en-passant.png} +0 -0
- package/test/{references/06a_chessboard_animated_move/0.png → graphic_references/06_chessboard_animation/base_1/move_1.png} +0 -0
- package/test/{references/06a_chessboard_animated_move/1.png → graphic_references/06_chessboard_animation/base_1/move_2.png} +0 -0
- package/test/{references/06a_chessboard_animated_move/5.png → graphic_references/06_chessboard_animation/base_1/promotion.png} +0 -0
- package/test/{references/06b_chessboard_animated_move/2.png → graphic_references/06_chessboard_animation/base_2/capture.png} +0 -0
- package/test/{references/06b_chessboard_animated_move/3.png → graphic_references/06_chessboard_animation/base_2/castling_move.png} +0 -0
- package/test/{references/06b_chessboard_animated_move/4.png → graphic_references/06_chessboard_animation/base_2/en-passant.png} +0 -0
- package/test/{references/06b_chessboard_animated_move/0.png → graphic_references/06_chessboard_animation/base_2/move_1.png} +0 -0
- package/test/{references/06b_chessboard_animated_move/1.png → graphic_references/06_chessboard_animation/base_2/move_2.png} +0 -0
- package/test/{references/06b_chessboard_animated_move/5.png → graphic_references/06_chessboard_animation/base_2/promotion.png} +0 -0
- package/test/{references/06c_chessboard_animated_move/2.png → graphic_references/06_chessboard_animation/base_3/capture.png} +0 -0
- package/test/{references/06c_chessboard_animated_move/3.png → graphic_references/06_chessboard_animation/base_3/castling_move.png} +0 -0
- package/test/{references/06c_chessboard_animated_move/4.png → graphic_references/06_chessboard_animation/base_3/en-passant.png} +0 -0
- package/test/{references/06c_chessboard_animated_move/0.png → graphic_references/06_chessboard_animation/base_3/move_1.png} +0 -0
- package/test/{references/06c_chessboard_animated_move/1.png → graphic_references/06_chessboard_animation/base_3/move_2.png} +0 -0
- package/test/{references/06c_chessboard_animated_move/5.png → graphic_references/06_chessboard_animation/base_3/promotion.png} +0 -0
- package/test/graphic_references/06_chessboard_animation/on_redraw/final_state.png +0 -0
- package/test/graphic_references/06_chessboard_animation/on_redraw/initial_state.png +0 -0
- package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/base_1.png +0 -0
- package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/base_2.png +0 -0
- package/test/{references/10_chessboard_edit_arrows/null_vector.png → graphic_references/07_chessboard_interaction/edit_arrows/from_==_to.png} +0 -0
- package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/out_of_board.png +0 -0
- package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/over_arrow_marker.png +0 -0
- package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/over_square_marker.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/error/edit_color_not_set.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/error/wrong_interaction_mode.png +0 -0
- package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/after_move.png +0 -0
- package/test/{references/09_chessboard_move_pieces/null_vector.png → graphic_references/07_chessboard_interaction/move_pieces/from_==_to.png} +0 -0
- package/test/{references/09_chessboard_move_pieces/empty_square.png → graphic_references/07_chessboard_interaction/move_pieces/move_empty_square.png} +0 -0
- package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/out_of_board.png +0 -0
- package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/over_arrow_marker.png +0 -0
- package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/over_empty.png +0 -0
- package/test/{references/09_chessboard_move_pieces/over_non_empty_1.png → graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_1.png} +0 -0
- package/test/{references/09_chessboard_move_pieces/over_non_empty_2.png → graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_2.png} +0 -0
- package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/over_square_marker.png +0 -0
- package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/over_text_marker.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/castling_move.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/chess960_ambiguous_king_move.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/chess960_castling_move_1.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/chess960_castling_move_2.png +0 -0
- package/test/{references/11_chessboard_play_moves/chess960_non_kxr_castling.png → graphic_references/08_chessboard_play_moves/base/chess960_non-kxr_castling.png} +0 -0
- package/test/{references/11_chessboard_play_moves/null_vector.png → graphic_references/08_chessboard_play_moves/base/from_==_to.png} +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/illegal_move.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/illegal_position.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/out_of_board.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/regular_move_1.png +0 -0
- package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/regular_move_2.png +0 -0
- package/test/{references/10_chessboard_edit_arrows/edit_color_not_set.png → graphic_references/08_chessboard_play_moves/base/wrong_color_moved.png} +0 -0
- package/test/{references/12_chessboard_play_promotions → graphic_references/08_chessboard_play_moves/promotions}/antichess_promotion.png +0 -0
- package/test/{references/12_chessboard_play_promotions → graphic_references/08_chessboard_play_moves/promotions}/cancel_promotion.png +0 -0
- package/test/{references/12_chessboard_play_promotions → graphic_references/08_chessboard_play_moves/promotions}/regular_promotion_1.png +0 -0
- package/test/{references/12_chessboard_play_promotions → graphic_references/08_chessboard_play_moves/promotions}/regular_promotion_2.png +0 -0
- package/test/{references/13_movetext_simple/0.png → graphic_references/09_movetext_graphic/base/game_1.png} +0 -0
- package/test/{references/13_movetext_simple/1.png → graphic_references/09_movetext_graphic/base/game_2.png} +0 -0
- package/test/{references/13_movetext_simple/2.png → graphic_references/09_movetext_graphic/base/game_3.png} +0 -0
- package/test/{references/13_movetext_simple/3.png → graphic_references/09_movetext_graphic/base/game_4.png} +0 -0
- package/test/{references/14_movetext_error/2.png → graphic_references/09_movetext_graphic/error/pgn_parsing_error_1.png} +0 -0
- package/test/{references/14_movetext_error/3.png → graphic_references/09_movetext_graphic/error/pgn_parsing_error_2.png} +0 -0
- package/test/{references/14_movetext_error/0.png → graphic_references/09_movetext_graphic/error/wrong_game_index_1.png} +0 -0
- package/test/{references/14_movetext_error/1.png → graphic_references/09_movetext_graphic/error/wrong_game_index_2.png} +0 -0
- package/test/graphic_references/09_movetext_graphic/error/wrong_game_index_type.png +0 -0
- package/test/graphic_references/09_movetext_graphic/error/wrong_game_type.png +0 -0
- package/test/{references/15_movetext_html/2.png → graphic_references/09_movetext_graphic/html/filtered_tags_and_attributes.png} +0 -0
- package/test/{references/15_movetext_html/1.png → graphic_references/09_movetext_graphic/html/html_in_comments.png} +0 -0
- package/test/{references/15_movetext_html/0.png → graphic_references/09_movetext_graphic/html/html_in_headers.png} +0 -0
- package/test/{references/16_movetext_options/1.png → graphic_references/09_movetext_graphic/options/custom_piece_symbols.png} +0 -0
- package/test/{references/16_movetext_options/2.png → graphic_references/09_movetext_graphic/options/figurine_piece_symbols_and_diagram_options.png} +0 -0
- package/test/{references/16_movetext_options/3.png → graphic_references/09_movetext_graphic/options/hidden_diagrams.png} +0 -0
- package/test/{references/16_movetext_options/0.png → graphic_references/09_movetext_graphic/options/localized_piece_symbols.png} +0 -0
- package/test/graphic_references/09_movetext_graphic/options/wrong_diagram_options_1.png +0 -0
- package/test/graphic_references/09_movetext_graphic/options/wrong_diagram_options_2.png +0 -0
- package/test/graphic_references/10_movetext_interaction/error/wrong_interaction_mode.png +0 -0
- package/test/{references/17_movetext_interaction/0.png → graphic_references/10_movetext_interaction/select_moves/click_on_disabled.png} +0 -0
- package/test/{references/17_movetext_interaction/1.png → graphic_references/10_movetext_interaction/select_moves/click_on_unselected.png} +0 -0
- package/test/{references/17_movetext_interaction/2.png → graphic_references/10_movetext_interaction/select_moves/click_on_with_variations.png} +0 -0
- package/test/graphic_test_app/.eslintrc.yml +5 -0
- package/test/graphic_test_app/03_error_box_graphic/base.tsx +46 -0
- package/{scripts/clean-graphic-output.js → test/graphic_test_app/03_error_box_graphic/localization.tsx} +10 -7
- package/{graphic_test_src/01_marker_icons.js → test/graphic_test_app/04_marker_icons_graphic/base.tsx} +15 -7
- package/{graphic_test_src/04_chessboard_annotations.js → test/graphic_test_app/05_chessboard_graphic/annotations.tsx} +23 -14
- package/{graphic_test_src/02_chessboard_simple.js → test/graphic_test_app/05_chessboard_graphic/base.tsx} +6 -6
- package/test/graphic_test_app/05_chessboard_graphic/chess_variants.tsx +35 -0
- package/{graphic_test_src/03_chessboard_flipped.js → test/graphic_test_app/05_chessboard_graphic/flipped.tsx} +5 -5
- package/{graphic_test_src/05_chessboard_move.js → test/graphic_test_app/05_chessboard_graphic/move.tsx} +9 -8
- package/{graphic_test_src/07_chessboard_theme.js → test/graphic_test_app/05_chessboard_graphic/theme.tsx} +14 -11
- package/{graphic_test_src/06a_chessboard_animated_move.js → test/graphic_test_app/06_chessboard_animation/base_1.tsx} +5 -5
- package/{graphic_test_src/06b_chessboard_animated_move.js → test/graphic_test_app/06_chessboard_animation/base_2.tsx} +5 -5
- package/{graphic_test_src/06c_chessboard_animated_move.js → test/graphic_test_app/06_chessboard_animation/base_3.tsx} +5 -5
- package/test/graphic_test_app/06_chessboard_animation/on_redraw.tsx +49 -0
- package/{graphic_test_src/08_chessboard_click_squares.js → test/graphic_test_app/07_chessboard_interaction/click_squares.tsx} +7 -6
- package/{graphic_test_src/10_chessboard_edit_arrows.js → test/graphic_test_app/07_chessboard_interaction/edit_arrows.tsx} +7 -7
- package/test/graphic_test_app/07_chessboard_interaction/error.tsx +30 -0
- package/{graphic_test_src/09_chessboard_move_pieces.js → test/graphic_test_app/07_chessboard_interaction/move_pieces.tsx} +7 -6
- package/{graphic_test_src/11_chessboard_play_moves.js → test/graphic_test_app/08_chessboard_play_moves/base.tsx} +6 -6
- package/{graphic_test_src/12_chessboard_play_promotions.js → test/graphic_test_app/08_chessboard_play_moves/promotions.tsx} +6 -6
- package/{graphic_test_src/13_movetext_simple.js → test/graphic_test_app/09_movetext_graphic/base.tsx} +8 -8
- package/{graphic_test_src/14_movetext_error.js → test/graphic_test_app/09_movetext_graphic/error.tsx} +10 -9
- package/{graphic_test_src/15_movetext_html.js → test/graphic_test_app/09_movetext_graphic/html.tsx} +7 -7
- package/{graphic_test_src/16_movetext_options.js → test/graphic_test_app/09_movetext_graphic/options.tsx} +9 -6
- package/test/graphic_test_app/10_movetext_interaction/error.tsx +31 -0
- package/{graphic_test_src/17_movetext_interaction.js → test/graphic_test_app/10_movetext_interaction/select_moves.tsx} +7 -7
- package/test/graphic_test_app/common/decs.d.ts +26 -0
- package/{graphic_test_src → test/graphic_test_app}/common/dummy.pgn +0 -0
- package/{graphic_test_src → test/graphic_test_app}/common/games.pgn +1 -1
- package/{graphic_test_src → test/graphic_test_app}/common/heartbeat.txt +0 -0
- package/{graphic_test_src → test/graphic_test_app}/common/smiley.png +0 -0
- package/{graphic_test_src → test/graphic_test_app}/common/test_app.css +11 -2
- package/{graphic_test_src/common/test_app.js → test/graphic_test_app/common/test_app.tsx} +62 -14
- package/tsconfig.json +15 -0
- package/.babelrc +0 -3
- package/dist/lib/ArrowMarkerIcon.js +0 -85
- package/dist/lib/Chessboard.js +0 -1276
- package/dist/lib/ErrorBox.js +0 -125
- package/dist/lib/Movetext.js +0 -805
- package/dist/lib/SquareMarkerIcon.js +0 -69
- package/dist/lib/TextMarkerIcon.js +0 -74
- package/dist/lib/formatmove.js +0 -107
- package/dist/lib/impl/DraggableHandle.js +0 -277
- package/dist/lib/impl/HtmlSanitizer.js +0 -145
- package/dist/lib/impl/Motion.js +0 -109
- package/dist/lib/impl/TextSymbol.js +0 -89
- package/dist/lib/impl/piecesets.js +0 -219
- package/dist/lib/impl/util.js +0 -71
- package/dist/lib/markers.js +0 -144
- package/doc_src/.eslintrc.yml +0 -2
- package/src/Chessboard.js +0 -1034
- package/src/ErrorBox.js +0 -132
- package/src/Movetext.js +0 -671
- package/src/impl/DraggableHandle.js +0 -235
- package/src/impl/HtmlSanitizer.js +0 -126
- package/src/impl/colorsets.js +0 -119
- package/src/impl/piecesets.js +0 -218
- package/src/impl/util.js +0 -68
- package/src/index.js +0 -31
- package/src/markers.js +0 -115
- package/test/4_chessboard_graphic.js +0 -49
- package/test/5_chessboard_interaction.js +0 -135
- package/test/6_chessboard_play_moves.js +0 -107
- package/test/references/01_marker_icons/10.png +0 -0
- package/test/references/01_marker_icons/3.png +0 -0
- package/test/references/01_marker_icons/4.png +0 -0
- package/test/references/01_marker_icons/5.png +0 -0
- package/test/references/01_marker_icons/6.png +0 -0
- package/test/references/01_marker_icons/7.png +0 -0
- package/test/references/01_marker_icons/8.png +0 -0
- package/test/references/01_marker_icons/9.png +0 -0
- package/test/references/02_chessboard_simple/5.png +0 -0
- package/test/references/05_chessboard_move/8.png +0 -0
- package/test/references/11_chessboard_play_moves/wrong_color.png +0 -0
- package/test/references/14_movetext_error/4.png +0 -0
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = SquareMarkerIcon;
|
|
7
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _util = require("./impl/util");
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
/******************************************************************************
|
|
12
|
-
* *
|
|
13
|
-
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
14
|
-
* Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
15
|
-
* *
|
|
16
|
-
* This program is free software: you can redistribute it and/or *
|
|
17
|
-
* modify it under the terms of the GNU Lesser General Public License *
|
|
18
|
-
* as published by the Free Software Foundation, either version 3 of *
|
|
19
|
-
* the License, or (at your option) any later version. *
|
|
20
|
-
* *
|
|
21
|
-
* This program is distributed in the hope that it will be useful, *
|
|
22
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
23
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
24
|
-
* GNU Lesser General Public License for more details. *
|
|
25
|
-
* *
|
|
26
|
-
* You should have received a copy of the GNU Lesser General *
|
|
27
|
-
* Public License along with this program. If not, see *
|
|
28
|
-
* <http://www.gnu.org/licenses/>. *
|
|
29
|
-
* *
|
|
30
|
-
******************************************************************************/
|
|
31
|
-
|
|
32
|
-
var SQUARE_MARGIN_FACTOR = 0.1;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* SVG icon representing a square marker.
|
|
36
|
-
*/
|
|
37
|
-
function SquareMarkerIcon(props) {
|
|
38
|
-
var size = (0, _util.sanitizeInteger)(props.size, _util.MIN_SQUARE_SIZE, _util.MAX_SQUARE_SIZE);
|
|
39
|
-
if (isNaN(size)) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
var margin = Math.round(size * SQUARE_MARGIN_FACTOR);
|
|
43
|
-
var viewBox = "0 0 ".concat(size, " ").concat(size);
|
|
44
|
-
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
45
|
-
className: "kokopu-squareMarkerIcon",
|
|
46
|
-
viewBox: viewBox,
|
|
47
|
-
width: size,
|
|
48
|
-
height: size
|
|
49
|
-
}, /*#__PURE__*/_react["default"].createElement("rect", {
|
|
50
|
-
x: margin,
|
|
51
|
-
y: margin,
|
|
52
|
-
width: size - margin * 2,
|
|
53
|
-
height: size - margin * 2,
|
|
54
|
-
fill: props.color
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
57
|
-
SquareMarkerIcon.propTypes = {
|
|
58
|
-
/**
|
|
59
|
-
* Width and height (in pixels) of the icon.
|
|
60
|
-
*/
|
|
61
|
-
size: _propTypes["default"].number.isRequired,
|
|
62
|
-
/**
|
|
63
|
-
* Color to use to colorize the icon (for example: `'green'`, `'#ff0000'`...).
|
|
64
|
-
*/
|
|
65
|
-
color: _propTypes["default"].string
|
|
66
|
-
};
|
|
67
|
-
SquareMarkerIcon.defaultProps = {
|
|
68
|
-
color: 'currentcolor'
|
|
69
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = TextMarkerIcon;
|
|
7
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _util = require("./impl/util");
|
|
10
|
-
var _TextSymbol = _interopRequireDefault(require("./impl/TextSymbol"));
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
/******************************************************************************
|
|
13
|
-
* *
|
|
14
|
-
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
15
|
-
* Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
16
|
-
* *
|
|
17
|
-
* This program is free software: you can redistribute it and/or *
|
|
18
|
-
* modify it under the terms of the GNU Lesser General Public License *
|
|
19
|
-
* as published by the Free Software Foundation, either version 3 of *
|
|
20
|
-
* the License, or (at your option) any later version. *
|
|
21
|
-
* *
|
|
22
|
-
* This program is distributed in the hope that it will be useful, *
|
|
23
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
24
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
25
|
-
* GNU Lesser General Public License for more details. *
|
|
26
|
-
* *
|
|
27
|
-
* You should have received a copy of the GNU Lesser General *
|
|
28
|
-
* Public License along with this program. If not, see *
|
|
29
|
-
* <http://www.gnu.org/licenses/>. *
|
|
30
|
-
* *
|
|
31
|
-
******************************************************************************/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* SVG icon representing a text marker.
|
|
35
|
-
*/
|
|
36
|
-
function TextMarkerIcon(props) {
|
|
37
|
-
var size = (0, _util.sanitizeInteger)(props.size, _util.MIN_SQUARE_SIZE, _util.MAX_SQUARE_SIZE);
|
|
38
|
-
if (isNaN(size) || !(0, _util.isValidSymbol)(props.symbol)) {
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
var viewBox = "0 0 ".concat(size, " ").concat(size);
|
|
42
|
-
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
43
|
-
className: "kokopu-textMarkerIcon",
|
|
44
|
-
viewBox: viewBox,
|
|
45
|
-
width: size,
|
|
46
|
-
height: size
|
|
47
|
-
}, /*#__PURE__*/_react["default"].createElement(_TextSymbol["default"], {
|
|
48
|
-
x: size / 2,
|
|
49
|
-
y: size / 2,
|
|
50
|
-
size: size,
|
|
51
|
-
symbol: props.symbol,
|
|
52
|
-
color: props.color
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
TextMarkerIcon.propTypes = {
|
|
56
|
-
/**
|
|
57
|
-
* Width and height (in pixels) of the icon.
|
|
58
|
-
*/
|
|
59
|
-
size: _propTypes["default"].number.isRequired,
|
|
60
|
-
/**
|
|
61
|
-
* Symbol to represent on the icon. Must be one of:
|
|
62
|
-
* - any letter from A to Z (either upper-case or lower-case),
|
|
63
|
-
* - any digit from 0 to 9,
|
|
64
|
-
* - any symbol code among `'plus'`, `'times'`, `'dot'`, or `'circle'`.
|
|
65
|
-
*/
|
|
66
|
-
symbol: _propTypes["default"].string.isRequired,
|
|
67
|
-
/**
|
|
68
|
-
* Color to use to colorize the icon (for example: `'green'`, `'#ff0000'`...).
|
|
69
|
-
*/
|
|
70
|
-
color: _propTypes["default"].string
|
|
71
|
-
};
|
|
72
|
-
TextMarkerIcon.defaultProps = {
|
|
73
|
-
color: 'currentcolor'
|
|
74
|
-
};
|
package/dist/lib/formatmove.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.formatMove = formatMove;
|
|
7
|
-
exports.moveFormatter = moveFormatter;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _i18n = _interopRequireDefault(require("./i18n"));
|
|
10
|
-
require("./css/fonts.css");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
/******************************************************************************
|
|
13
|
-
* *
|
|
14
|
-
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
15
|
-
* Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
16
|
-
* *
|
|
17
|
-
* This program is free software: you can redistribute it and/or *
|
|
18
|
-
* modify it under the terms of the GNU Lesser General Public License *
|
|
19
|
-
* as published by the Free Software Foundation, either version 3 of *
|
|
20
|
-
* the License, or (at your option) any later version. *
|
|
21
|
-
* *
|
|
22
|
-
* This program is distributed in the hope that it will be useful, *
|
|
23
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
24
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
25
|
-
* GNU Lesser General Public License for more details. *
|
|
26
|
-
* *
|
|
27
|
-
* You should have received a copy of the GNU Lesser General *
|
|
28
|
-
* Public License along with this program. If not, see *
|
|
29
|
-
* <http://www.gnu.org/licenses/>. *
|
|
30
|
-
* *
|
|
31
|
-
******************************************************************************/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Render the given SAN notation according to the given piece symbol style.
|
|
35
|
-
*
|
|
36
|
-
* @param {string|object} pieceSymbols See {@link moveFormatter}.
|
|
37
|
-
* @param {string} notation SAN notation.
|
|
38
|
-
* @returns {string|React.ReactFragment}
|
|
39
|
-
*/
|
|
40
|
-
function formatMove(pieceSymbols, notation) {
|
|
41
|
-
var formatter = moveFormatter(pieceSymbols);
|
|
42
|
-
return formatter(notation);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Return a callback capable of rendering a SAN notation using the given piece symbol style.
|
|
47
|
-
*
|
|
48
|
-
* @param {string|object} pieceSymbols `'native'`, `'localized'`, `'figurines'`, or an object defining a string-valued properties
|
|
49
|
-
* for each English piece symbol.
|
|
50
|
-
* @returns {function(string)} Callback returning either a string or a React fragment.
|
|
51
|
-
*/
|
|
52
|
-
function moveFormatter(pieceSymbols) {
|
|
53
|
-
if (pieceSymbols === 'localized') {
|
|
54
|
-
var mapping = _i18n["default"].PIECE_SYMBOLS;
|
|
55
|
-
return function (notation) {
|
|
56
|
-
return notation.replace(/[KQRBNP]/g, function (match) {
|
|
57
|
-
return mapping[match];
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
} else if (pieceSymbols === 'figurines') {
|
|
61
|
-
return function (notation) {
|
|
62
|
-
return figurineNotation('alpha', notation);
|
|
63
|
-
};
|
|
64
|
-
} else if (pieceSymbols !== 'native' && pieceSymbols && ['K', 'Q', 'R', 'B', 'N', 'P'].every(function (p) {
|
|
65
|
-
return typeof pieceSymbols[p] === 'string';
|
|
66
|
-
})) {
|
|
67
|
-
return function (notation) {
|
|
68
|
-
return notation.replace(/[KQRBNP]/g, function (match) {
|
|
69
|
-
return pieceSymbols[match];
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
} else {
|
|
73
|
-
return function (notation) {
|
|
74
|
-
return notation;
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Decompose the given string into piece symbol characters and sections of non piece symbol characters, and transform the piece symbols into
|
|
81
|
-
* React objects represented with the given chess font.
|
|
82
|
-
*
|
|
83
|
-
* @ignore
|
|
84
|
-
*/
|
|
85
|
-
function figurineNotation(fontName, text) {
|
|
86
|
-
var result = [];
|
|
87
|
-
var beginOfText = 0;
|
|
88
|
-
var pieceSymbolIndex = 0;
|
|
89
|
-
for (var pos = 0; pos < text.length; ++pos) {
|
|
90
|
-
var currentChar = text.charAt(pos);
|
|
91
|
-
if (currentChar === 'K' || currentChar === 'Q' || currentChar === 'R' || currentChar === 'B' || currentChar === 'N' || currentChar === 'P') {
|
|
92
|
-
if (pos > beginOfText) {
|
|
93
|
-
result.push(text.substring(beginOfText, pos));
|
|
94
|
-
}
|
|
95
|
-
beginOfText = pos + 1;
|
|
96
|
-
var key = 'symbol-' + pieceSymbolIndex++;
|
|
97
|
-
result.push( /*#__PURE__*/_react["default"].createElement("span", {
|
|
98
|
-
className: 'kokopu-font-' + fontName,
|
|
99
|
-
key: key
|
|
100
|
-
}, currentChar));
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (beginOfText < text.length) {
|
|
104
|
-
result.push(text.substring(beginOfText));
|
|
105
|
-
}
|
|
106
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, result);
|
|
107
|
-
}
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
17
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
18
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
19
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
20
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
22
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
23
|
-
/**
|
|
24
|
-
* Invisible SVG rectangular handle that captures drag events.
|
|
25
|
-
*/
|
|
26
|
-
var DraggableHandle = /*#__PURE__*/function (_React$Component) {
|
|
27
|
-
_inherits(DraggableHandle, _React$Component);
|
|
28
|
-
var _super = _createSuper(DraggableHandle);
|
|
29
|
-
function DraggableHandle(props) {
|
|
30
|
-
var _this;
|
|
31
|
-
_classCallCheck(this, DraggableHandle);
|
|
32
|
-
_this = _super.call(this, props);
|
|
33
|
-
_this.dragData = null;
|
|
34
|
-
_this.innerRef = /*#__PURE__*/_react["default"].createRef();
|
|
35
|
-
return _this;
|
|
36
|
-
}
|
|
37
|
-
_createClass(DraggableHandle, [{
|
|
38
|
-
key: "componentDidMount",
|
|
39
|
-
value: function componentDidMount() {
|
|
40
|
-
var _this2 = this;
|
|
41
|
-
if (!this.windowListeners) {
|
|
42
|
-
this.windowListeners = {
|
|
43
|
-
mouseDown: function mouseDown(evt) {
|
|
44
|
-
return _this2.handleMouseDown(evt);
|
|
45
|
-
},
|
|
46
|
-
mouseMove: function mouseMove(evt) {
|
|
47
|
-
return _this2.handleMouseMove(evt);
|
|
48
|
-
},
|
|
49
|
-
mouseUp: function mouseUp(evt) {
|
|
50
|
-
return _this2.handleMouseUp(evt);
|
|
51
|
-
},
|
|
52
|
-
touchStart: function touchStart(evt) {
|
|
53
|
-
return _this2.handleTouchStart(evt);
|
|
54
|
-
},
|
|
55
|
-
touchMove: function touchMove(evt) {
|
|
56
|
-
return _this2.handleTouchMove(evt);
|
|
57
|
-
},
|
|
58
|
-
touchEnd: function touchEnd(evt) {
|
|
59
|
-
return _this2.handleTouchEnd(evt);
|
|
60
|
-
},
|
|
61
|
-
touchCancel: function touchCancel(evt) {
|
|
62
|
-
return _this2.handleTouchCancel(evt);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
this.innerRef.current.addEventListener('mousedown', this.windowListeners.mouseDown);
|
|
66
|
-
window.addEventListener('mousemove', this.windowListeners.mouseMove);
|
|
67
|
-
window.addEventListener('mouseup', this.windowListeners.mouseUp);
|
|
68
|
-
this.innerRef.current.addEventListener('touchstart', this.windowListeners.touchStart, {
|
|
69
|
-
passive: false
|
|
70
|
-
});
|
|
71
|
-
window.addEventListener('touchmove', this.windowListeners.touchMove, {
|
|
72
|
-
passive: false
|
|
73
|
-
});
|
|
74
|
-
window.addEventListener('touchend', this.windowListeners.touchEnd);
|
|
75
|
-
window.addEventListener('touchcancel', this.windowListeners.touchCancel);
|
|
76
|
-
}
|
|
77
|
-
this.dragData = null;
|
|
78
|
-
}
|
|
79
|
-
}, {
|
|
80
|
-
key: "componentWillUnmount",
|
|
81
|
-
value: function componentWillUnmount() {
|
|
82
|
-
if (this.windowListeners) {
|
|
83
|
-
this.innerRef.current.removeEventListener('mousedown', this.windowListeners.mouseDown);
|
|
84
|
-
window.removeEventListener('mousemove', this.windowListeners.mouseMove);
|
|
85
|
-
window.removeEventListener('mouseup', this.windowListeners.mouseUp);
|
|
86
|
-
this.innerRef.current.removeEventListener('touchstart', this.windowListeners.touchStart);
|
|
87
|
-
window.removeEventListener('touchmove', this.windowListeners.touchMove);
|
|
88
|
-
window.removeEventListener('touchend', this.windowListeners.touchEnd);
|
|
89
|
-
window.removeEventListener('touchcancel', this.windowListeners.touchCancel);
|
|
90
|
-
this.windowListeners = null;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}, {
|
|
94
|
-
key: "render",
|
|
95
|
-
value: function render() {
|
|
96
|
-
var classNames = ['kokopu-handle', this.props.isArrowHandle ? 'kokopu-arrowDraggable' : 'kokopu-pieceDraggable'];
|
|
97
|
-
return /*#__PURE__*/_react["default"].createElement("rect", {
|
|
98
|
-
ref: this.innerRef,
|
|
99
|
-
className: classNames.join(' '),
|
|
100
|
-
x: this.props.x,
|
|
101
|
-
y: this.props.y,
|
|
102
|
-
width: this.props.width,
|
|
103
|
-
height: this.props.height
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}, {
|
|
107
|
-
key: "handleTouchStart",
|
|
108
|
-
value: function handleTouchStart(evt) {
|
|
109
|
-
if (this.dragData || evt.touches.length !== 1) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
evt.preventDefault();
|
|
113
|
-
this.doInitDrag(evt.target, evt.touches[0]);
|
|
114
|
-
}
|
|
115
|
-
}, {
|
|
116
|
-
key: "handleTouchMove",
|
|
117
|
-
value: function handleTouchMove(evt) {
|
|
118
|
-
if (!this.dragData) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
evt.preventDefault();
|
|
122
|
-
if (evt.touches.length === 1) {
|
|
123
|
-
this.doUpdateDrag(evt.touches[0]);
|
|
124
|
-
} else {
|
|
125
|
-
this.doCancelDrag();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}, {
|
|
129
|
-
key: "handleTouchEnd",
|
|
130
|
-
value: function handleTouchEnd(evt) {
|
|
131
|
-
if (!this.dragData) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
evt.preventDefault();
|
|
135
|
-
if (evt.touches.length === 0 && evt.changedTouches.length === 1) {
|
|
136
|
-
this.doEndDrag(evt.changedTouches[0]);
|
|
137
|
-
} else {
|
|
138
|
-
this.doCancelDrag();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}, {
|
|
142
|
-
key: "handleTouchCancel",
|
|
143
|
-
value: function handleTouchCancel(evt) {
|
|
144
|
-
if (!this.dragData) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
evt.preventDefault();
|
|
148
|
-
this.doCancelDrag();
|
|
149
|
-
}
|
|
150
|
-
}, {
|
|
151
|
-
key: "handleMouseDown",
|
|
152
|
-
value: function handleMouseDown(evt) {
|
|
153
|
-
if (this.dragData || evt.button !== 0) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
evt.preventDefault();
|
|
157
|
-
this.doInitDrag(evt.target, evt);
|
|
158
|
-
}
|
|
159
|
-
}, {
|
|
160
|
-
key: "handleMouseMove",
|
|
161
|
-
value: function handleMouseMove(evt) {
|
|
162
|
-
if (!this.dragData) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
evt.preventDefault();
|
|
166
|
-
this.doUpdateDrag(evt);
|
|
167
|
-
}
|
|
168
|
-
}, {
|
|
169
|
-
key: "handleMouseUp",
|
|
170
|
-
value: function handleMouseUp(evt) {
|
|
171
|
-
if (!this.dragData) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
evt.preventDefault();
|
|
175
|
-
this.doEndDrag(evt);
|
|
176
|
-
}
|
|
177
|
-
}, {
|
|
178
|
-
key: "doInitDrag",
|
|
179
|
-
value: function doInitDrag(target, _ref) {
|
|
180
|
-
var pageX = _ref.pageX,
|
|
181
|
-
pageY = _ref.pageY,
|
|
182
|
-
clientX = _ref.clientX,
|
|
183
|
-
clientY = _ref.clientY;
|
|
184
|
-
this.dragData = {
|
|
185
|
-
originX: pageX,
|
|
186
|
-
originY: pageY
|
|
187
|
-
};
|
|
188
|
-
var handleBoundary = target.getBoundingClientRect();
|
|
189
|
-
var x0 = clientX - handleBoundary.left;
|
|
190
|
-
var y0 = clientY - handleBoundary.top;
|
|
191
|
-
if (this.props.onDragStart) {
|
|
192
|
-
this.props.onDragStart(x0, y0);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}, {
|
|
196
|
-
key: "doUpdateDrag",
|
|
197
|
-
value: function doUpdateDrag(_ref2) {
|
|
198
|
-
var pageX = _ref2.pageX,
|
|
199
|
-
pageY = _ref2.pageY;
|
|
200
|
-
var _this$dragData = this.dragData,
|
|
201
|
-
originX = _this$dragData.originX,
|
|
202
|
-
originY = _this$dragData.originY;
|
|
203
|
-
if (this.props.onDrag) {
|
|
204
|
-
this.props.onDrag(pageX - originX, pageY - originY);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}, {
|
|
208
|
-
key: "doEndDrag",
|
|
209
|
-
value: function doEndDrag(_ref3) {
|
|
210
|
-
var pageX = _ref3.pageX,
|
|
211
|
-
pageY = _ref3.pageY;
|
|
212
|
-
var _this$dragData2 = this.dragData,
|
|
213
|
-
originX = _this$dragData2.originX,
|
|
214
|
-
originY = _this$dragData2.originY;
|
|
215
|
-
this.dragData = null;
|
|
216
|
-
if (this.props.onDragStop) {
|
|
217
|
-
this.props.onDragStop(pageX - originX, pageY - originY);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}, {
|
|
221
|
-
key: "doCancelDrag",
|
|
222
|
-
value: function doCancelDrag() {
|
|
223
|
-
if (this.props.onDragCanceled) {
|
|
224
|
-
this.props.onDragCanceled();
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}]);
|
|
228
|
-
return DraggableHandle;
|
|
229
|
-
}(_react["default"].Component);
|
|
230
|
-
exports["default"] = DraggableHandle;
|
|
231
|
-
DraggableHandle.propTypes = {
|
|
232
|
-
/**
|
|
233
|
-
* Initial X coordinate of the handle.
|
|
234
|
-
*/
|
|
235
|
-
x: _propTypes["default"].number.isRequired,
|
|
236
|
-
/**
|
|
237
|
-
* Initial Y coordinate of the handle.
|
|
238
|
-
*/
|
|
239
|
-
y: _propTypes["default"].number.isRequired,
|
|
240
|
-
/**
|
|
241
|
-
* Width of the handle.
|
|
242
|
-
*/
|
|
243
|
-
width: _propTypes["default"].number.isRequired,
|
|
244
|
-
/**
|
|
245
|
-
* Height of the handle.
|
|
246
|
-
*/
|
|
247
|
-
height: _propTypes["default"].number.isRequired,
|
|
248
|
-
/**
|
|
249
|
-
* `true` if the handle corresponds to a draggable arrow, `false` if it corresponds to a draggable piece.
|
|
250
|
-
*/
|
|
251
|
-
isArrowHandle: _propTypes["default"].bool.isRequired,
|
|
252
|
-
/**
|
|
253
|
-
* Callback invoked when the drag starts.
|
|
254
|
-
*
|
|
255
|
-
* @param {number} x0 X-coordinate (relative to the handle) at which the drag has been initiated.
|
|
256
|
-
* @param {number} y0 X-coordinate (relative to the handle) at which the drag has been initiated.
|
|
257
|
-
*/
|
|
258
|
-
onDragStart: _propTypes["default"].func,
|
|
259
|
-
/**
|
|
260
|
-
* Callback invoked during the drag.
|
|
261
|
-
*
|
|
262
|
-
* @param {number} dx X-coordinate of the translation vector applied during the drag.
|
|
263
|
-
* @param {number} dy Y-coordinate of the translation vector applied during the drag.
|
|
264
|
-
*/
|
|
265
|
-
onDrag: _propTypes["default"].func,
|
|
266
|
-
/**
|
|
267
|
-
* Callback invoked when the drag stops.
|
|
268
|
-
*
|
|
269
|
-
* @param {number} dx X-coordinate of the translation vector applied during the drag.
|
|
270
|
-
* @param {number} dy Y-coordinate of the translation vector applied during the drag.
|
|
271
|
-
*/
|
|
272
|
-
onDragStop: _propTypes["default"].func,
|
|
273
|
-
/**
|
|
274
|
-
* Callback invoked when the drag is canceled.
|
|
275
|
-
*/
|
|
276
|
-
onDragCanceled: _propTypes["default"].func
|
|
277
|
-
};
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var htmlparser2 = _interopRequireWildcard(require("htmlparser2"));
|
|
9
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
13
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
17
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
18
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
20
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
21
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
22
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
23
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
24
|
-
/**
|
|
25
|
-
* Those tags cannot have any children.
|
|
26
|
-
*/
|
|
27
|
-
var NO_CHILDREN_TAGS = new Set(['br', 'hr', 'img']);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* HTML sanitizer: parse HTML string, keeping only the allowed HTML nodes, and the corresponding React object.
|
|
31
|
-
*/
|
|
32
|
-
var HtmlSanitizer = /*#__PURE__*/function () {
|
|
33
|
-
function HtmlSanitizer(_ref) {
|
|
34
|
-
var allowedTags = _ref.allowedTags,
|
|
35
|
-
allowedAttributes = _ref.allowedAttributes;
|
|
36
|
-
_classCallCheck(this, HtmlSanitizer);
|
|
37
|
-
this._allowedTags = allowedTags ? new Set(allowedTags) : new Set();
|
|
38
|
-
this._allowedAttributes = allowedAttributes ? new Map(Object.entries(allowedAttributes).map(function (_ref2) {
|
|
39
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
|
40
|
-
k = _ref3[0],
|
|
41
|
-
v = _ref3[1];
|
|
42
|
-
return [k, new Set(v)];
|
|
43
|
-
})) : new Map();
|
|
44
|
-
this._keyCounter = 0;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @param {string} text HTML string to be parsed.
|
|
49
|
-
* @returns {*} React object corresponding to the given HTML string. Can also be a fragment, or just a simple string if the given HTML string
|
|
50
|
-
* does not contain any HTML tag.
|
|
51
|
-
*/
|
|
52
|
-
_createClass(HtmlSanitizer, [{
|
|
53
|
-
key: "parse",
|
|
54
|
-
value: function parse(text) {
|
|
55
|
-
var _this = this;
|
|
56
|
-
var dom = htmlparser2.parseDocument(text);
|
|
57
|
-
|
|
58
|
-
// Ensure that the returned object is a non-empty node type.
|
|
59
|
-
if (dom.type !== 'root') {
|
|
60
|
-
return undefined;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Process the children of the root node.
|
|
64
|
-
var result = [];
|
|
65
|
-
dom.children.forEach(function (child) {
|
|
66
|
-
var childElement = _this._processNode(child);
|
|
67
|
-
if (childElement) {
|
|
68
|
-
result.push(childElement);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// Return the result.
|
|
73
|
-
if (result.length === 0) {
|
|
74
|
-
return undefined;
|
|
75
|
-
} else if (result.length === 1) {
|
|
76
|
-
return result[0];
|
|
77
|
-
} else {
|
|
78
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
|
|
79
|
-
key: this._allocateKey()
|
|
80
|
-
}, result);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}, {
|
|
84
|
-
key: "_processNode",
|
|
85
|
-
value: function _processNode(node) {
|
|
86
|
-
var _this2 = this;
|
|
87
|
-
if (node.type === 'text') {
|
|
88
|
-
return node.data;
|
|
89
|
-
} else if (node.type === 'tag') {
|
|
90
|
-
var children = NO_CHILDREN_TAGS.has(node.name) ? undefined : node.children.map(function (child) {
|
|
91
|
-
return _this2._processNode(child);
|
|
92
|
-
});
|
|
93
|
-
if (this._allowedTags.has(node.name)) {
|
|
94
|
-
var attributes = this._filterAttributes(node.name, node.attribs);
|
|
95
|
-
attributes['key'] = this._allocateKey();
|
|
96
|
-
return /*#__PURE__*/_react["default"].createElement(node.name, attributes, children);
|
|
97
|
-
} else {
|
|
98
|
-
return children ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
|
|
99
|
-
key: this._allocateKey()
|
|
100
|
-
}, children) : undefined;
|
|
101
|
-
}
|
|
102
|
-
} else {
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}, {
|
|
107
|
-
key: "_filterAttributes",
|
|
108
|
-
value: function _filterAttributes(nodeName, attributes) {
|
|
109
|
-
var result = {};
|
|
110
|
-
for (var _i2 = 0, _Object$entries = Object.entries(attributes); _i2 < _Object$entries.length; _i2++) {
|
|
111
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2),
|
|
112
|
-
attribute = _Object$entries$_i[0],
|
|
113
|
-
value = _Object$entries$_i[1];
|
|
114
|
-
if (this._isAttributeAllowed(nodeName, attribute)) {
|
|
115
|
-
result[attribute === 'class' ? 'className' : attribute] = value;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return result;
|
|
119
|
-
}
|
|
120
|
-
}, {
|
|
121
|
-
key: "_isAttributeAllowed",
|
|
122
|
-
value: function _isAttributeAllowed(nodeName, attribute) {
|
|
123
|
-
if (attribute === 'key' && attribute === 'ref' && attribute === 'className') {
|
|
124
|
-
// Those attributes are always forbidden.
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
var allowedAttributesForCurrent = this._allowedAttributes.get(nodeName);
|
|
128
|
-
if (allowedAttributesForCurrent && allowedAttributesForCurrent.has(attribute)) {
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
var allowedAttributesForAll = this._allowedAttributes.get('*');
|
|
132
|
-
if (allowedAttributesForAll && allowedAttributesForAll.has(attribute)) {
|
|
133
|
-
return true;
|
|
134
|
-
}
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
}, {
|
|
138
|
-
key: "_allocateKey",
|
|
139
|
-
value: function _allocateKey() {
|
|
140
|
-
return 'auto-' + this._keyCounter++;
|
|
141
|
-
}
|
|
142
|
-
}]);
|
|
143
|
-
return HtmlSanitizer;
|
|
144
|
-
}();
|
|
145
|
-
exports["default"] = HtmlSanitizer;
|