├── .nvmrc ├── website ├── static │ ├── .nojekyll │ ├── img │ │ ├── auto-play.mp4 │ │ ├── docusaurus.png │ │ ├── social-card.png │ │ ├── tap-to-play.mp4 │ │ ├── scroll-to-play.mp4 │ │ └── logo.svg │ └── kifu │ │ ├── kanju-kemuri.kif │ │ ├── hashimoto-sos.kif │ │ ├── jt201409130101.kif │ │ └── 32ryu-cumbersome.kif ├── babel.config.js ├── docs │ ├── 99-legacy │ │ └── k4j-main.jpg │ ├── 07-kifu-for-js-bookmarklet │ │ ├── bookmarklet-1.jpg │ │ ├── bookmarklet-2.jpg │ │ ├── bookmarklet-3.jpg │ │ └── index.mdx │ ├── 05-integrating-with-app │ │ └── _category_.json │ ├── 03-options │ │ ├── 01-specifying-ply.mdx │ │ ├── 05-max-width.mdx │ │ ├── 02-reverse.mdx │ │ ├── 03-image-mode.mdx │ │ └── 04-tsume.mdx │ ├── 02-getting-started │ │ ├── 01-installation.md │ │ └── index.mdx │ ├── 01-intro.mdx │ └── 06-migration-from-4-to-5.md ├── blog │ ├── 2023-09-01-kifu-for-js-v5 │ │ ├── cover.png │ │ ├── k4j-main.jpg │ │ └── kifu-for-java.jpeg │ ├── 2023-09-15-v5-2-auto-play │ │ ├── cover.png │ │ └── index.mdx │ ├── 2023-09-08-v5-1-tsume-shogi │ │ ├── cover.png │ │ └── index.mdx │ ├── 2023-09-03-v5-0-3-safari-bugs │ │ ├── cover.png │ │ └── index.mdx │ ├── 2024-06-11-v5-4-1-fix-10-fu-in-mochigoma │ │ ├── cover.png │ │ └── index.mdx │ ├── 2023-09-29-v5-4-reverse-options-and-button │ │ ├── cover.png │ │ └── index.mdx │ ├── authors.yml │ └── 2023-09-22-v5-3-recover-kifu-for-java-and-flash │ │ ├── cover.png │ │ ├── kifu-for-java.jpeg │ │ └── index.mdx ├── src │ ├── pages │ │ ├── markdown-page.md │ │ ├── index.module.css │ │ └── index.tsx │ ├── components │ │ ├── HomepageFeatures │ │ │ ├── styles.module.css │ │ │ └── index.tsx │ │ ├── Script.tsx │ │ └── _ExampleKifu.tsx │ ├── theme │ │ └── MDXComponents.ts │ └── css │ │ └── custom.css ├── tsconfig.json ├── .gitignore ├── README.md ├── sidebars.js └── package.json ├── packages ├── Kifu-for-JS │ ├── .gitmodules │ ├── test │ │ ├── jestsetup.ts │ │ ├── example.html │ │ ├── testutils.ts │ │ └── htmls │ │ │ ├── kifu-for-flash-swfobject-body.html │ │ │ ├── kifu-for-java-body.html │ │ │ └── kifu-for-flash-body.html │ ├── src │ │ ├── legacy │ │ │ ├── images │ │ │ │ ├── declarations.d.ts │ │ │ │ ├── 0FU.png │ │ │ │ ├── 0GI.png │ │ │ │ ├── 0HI.png │ │ │ │ ├── 0KA.png │ │ │ │ ├── 0KE.png │ │ │ │ ├── 0KI.png │ │ │ │ ├── 0KY.png │ │ │ │ ├── 0NG.png │ │ │ │ ├── 0NK.png │ │ │ │ ├── 0NY.png │ │ │ │ ├── 0OU.png │ │ │ │ ├── 0RY.png │ │ │ │ ├── 0TO.png │ │ │ │ ├── 0UM.png │ │ │ │ ├── 1FU.png │ │ │ │ ├── 1GI.png │ │ │ │ ├── 1HI.png │ │ │ │ ├── 1KA.png │ │ │ │ ├── 1KE.png │ │ │ │ ├── 1KI.png │ │ │ │ ├── 1KY.png │ │ │ │ ├── 1NG.png │ │ │ │ ├── 1NK.png │ │ │ │ ├── 1NY.png │ │ │ │ ├── 1OU.png │ │ │ │ ├── 1RY.png │ │ │ │ ├── 1TO.png │ │ │ │ ├── 1UM.png │ │ │ │ ├── blank.png │ │ │ │ └── PieceImage.ts │ │ │ ├── Info.tsx │ │ │ ├── Comment.tsx │ │ │ ├── PieceHandGroup.tsx │ │ │ ├── Hand.tsx │ │ │ ├── LeftControl.tsx │ │ │ ├── Board.tsx │ │ │ ├── PieceHand.tsx │ │ │ └── Piece.tsx │ │ ├── public-bookmarklet.test.ts │ │ ├── lite │ │ │ ├── zumen │ │ │ │ ├── lib.ts │ │ │ │ ├── zumenCompat.ts │ │ │ │ └── Mochigonma.test.ts │ │ │ ├── utils.ts │ │ │ ├── useHaptics.ts │ │ │ ├── settings │ │ │ │ ├── Logo.tsx │ │ │ │ ├── Download.tsx │ │ │ │ └── HapticFeedback.tsx │ │ │ ├── Comment.tsx │ │ │ ├── KifuRegistry.ts │ │ │ ├── PlayButton.tsx │ │ │ ├── tsumeUtils.ts │ │ │ └── useInterval.ts │ │ ├── bookmarklet.ts │ │ ├── public-bookmarklet-on-ghpages.js │ │ ├── __snapshots__ │ │ │ └── index-legacy.test.ts.snap │ │ ├── common │ │ │ ├── stores │ │ │ │ ├── UserSetting.ts │ │ │ │ ├── ReverseMode.ts │ │ │ │ └── TsumeMode.ts │ │ │ └── ForkList.tsx │ │ ├── utils │ │ │ ├── fetchFile.ts │ │ │ └── util.tsx │ │ ├── public-bookmarklet.ts │ │ └── index-legacy.tsx │ ├── cypress │ │ ├── e2e │ │ │ ├── common │ │ │ │ └── utils.ts │ │ │ ├── lite │ │ │ │ ├── utils.ts │ │ │ │ └── bookmarklet.cy.ts │ │ │ └── legacy │ │ │ │ ├── utils.ts │ │ │ │ └── static.cy.ts │ │ ├── tsconfig.json │ │ ├── support │ │ │ ├── index.d.ts │ │ │ ├── e2e.js │ │ │ └── commands.ts │ │ └── plugins │ │ │ └── index.js │ ├── __mocks__ │ │ └── fileMock.js │ ├── examples │ │ ├── fu-10.kif │ │ ├── files │ │ │ ├── csa │ │ │ │ └── 8mai.csa │ │ │ ├── ki2 │ │ │ │ └── 9fu.ki2 │ │ │ └── kif │ │ │ │ ├── fork.kif │ │ │ │ ├── kanju-kemuri.kif │ │ │ │ ├── hashimoto-sos.kif │ │ │ │ ├── jt201409130101.kif │ │ │ │ └── 32ryu-cumbersome.kif │ │ ├── example.html │ │ ├── bundle-loader.js │ │ ├── legacy │ │ │ ├── forked.html │ │ │ └── loadJkf.html │ │ ├── nothing-to-replace.html │ │ ├── kifu-for-java-replace.html │ │ ├── kifu-for-flash-swfobject-replace.html │ │ ├── example-v4.html │ │ ├── parser-tester.html │ │ └── kifu-for-flash-replace.html │ ├── .npmignore │ ├── .prettierrc │ ├── readme-ss │ │ └── site-screenshot.png │ ├── .prettierignore │ ├── .gitignore │ ├── tsconfig.typecheck.json │ ├── tsconfig.json │ ├── cypress.config.ts │ ├── cypress.ci.config.ts │ ├── .babelrc │ ├── .eslintrc.js │ ├── jest.config.js │ ├── LICENSE.txt │ ├── README.md │ └── CHANGES.md ├── json-kifu-format │ ├── .npmignore │ ├── specification │ │ └── files │ │ │ ├── ryuou201409020101.jkf.json │ │ │ └── same_move_minimal.jkf.json │ ├── .gitignore │ ├── .prettierrc.json │ ├── test │ │ ├── files │ │ │ ├── csa │ │ │ │ ├── 8mai.csa │ │ │ │ ├── 9fu.csa │ │ │ │ ├── chudan.csa │ │ │ │ ├── formal.csa │ │ │ │ ├── noeol.csa │ │ │ │ ├── example.csa │ │ │ │ ├── 8mai_hirate.csa │ │ │ │ ├── illegal_win.csa │ │ │ │ ├── 9fu_komabetsu.csa │ │ │ │ ├── illegal_lose.csa │ │ │ │ └── 2005_YAMADA_GPS.csa │ │ │ ├── ki2 │ │ │ │ ├── 8mai.ki2 │ │ │ │ ├── 9fu.ki2 │ │ │ │ ├── fork.ki2 │ │ │ │ ├── chudan.ki2 │ │ │ │ ├── noeol.ki2 │ │ │ │ ├── 20091203.ki2 │ │ │ │ ├── denou3-1.ki2 │ │ │ │ ├── illegal.ki2 │ │ │ │ ├── 7mai.ki2u │ │ │ │ ├── fuujite.ki2u │ │ │ │ ├── kobayashi_kinsho196702.ki2 │ │ │ │ └── 8mai.ki2u │ │ │ ├── kif │ │ │ │ ├── 8mai.kif │ │ │ │ ├── 9fu.kif │ │ │ │ ├── fork.kif │ │ │ │ ├── chudan.kif │ │ │ │ ├── henka.kif │ │ │ │ ├── noeol.kif │ │ │ │ ├── ryuou4.kif │ │ │ │ ├── fork-test.kif │ │ │ │ ├── illegal.kif │ │ │ │ ├── no_henka.kif │ │ │ │ ├── fork-notime.kif │ │ │ │ ├── taichitsume.kif │ │ │ │ ├── jt201409130101.kif │ │ │ │ ├── last_comment.kif │ │ │ │ ├── 20081220kyoochi.kif │ │ │ │ ├── 32ryu-cumbersome.kif │ │ │ │ ├── kifu_for_iphone.kif │ │ │ │ ├── kiou201403160101.kif │ │ │ │ ├── oui201407080101.kif │ │ │ │ ├── ouza201410070101.kif │ │ │ │ ├── ryuou201409020101.kif │ │ │ │ ├── meijinsen_20180508_M7_10034.kif │ │ │ │ ├── doh_branch.kifu │ │ │ │ ├── last-fork.kifu │ │ │ │ ├── no_henka.kifu │ │ │ │ └── shogidokoro.kifu │ │ │ └── jkf │ │ │ │ └── same_move_minimal.jkf │ │ ├── pegjs-jest.js │ │ ├── board-serializer.js │ │ ├── debug-comment-content.html │ │ └── file.test.ts │ ├── .prettierignore │ ├── tsconfig.typecheck.json │ ├── src │ │ ├── main.ts │ │ ├── typings.d.ts │ │ ├── __snapshots__ │ │ │ └── normalizer.test.ts.snap │ │ ├── peg │ │ │ ├── __snapshots__ │ │ │ │ └── kif-parser.test.ts.snap │ │ │ └── parsers.ts │ │ └── Formats.ts │ ├── tsconfig.json │ ├── .eslintrc.js │ ├── jest.config.js │ ├── LICENSE.txt │ ├── example │ │ ├── kif-player.html │ │ ├── jkf-player.html │ │ ├── csa-player.html │ │ └── ki2-player.html │ ├── package.json │ └── webpack.config.js └── shogi.js │ ├── .prettierrc.json │ ├── .gitignore │ ├── .prettierignore │ ├── .npmignore │ ├── src │ ├── IMoveDefinition.ts │ ├── Color.test.ts │ ├── moveDefinitions.test.ts │ ├── Color.ts │ ├── presets.test.ts │ ├── polyfills.ts │ ├── moveDefinitions.ts │ ├── Kind.ts │ └── Piece.test.ts │ ├── tsconfig.typecheck.json │ ├── tsconfig.json │ ├── jest.config.js │ ├── .eslintrc.js │ ├── LISENCE.txt │ ├── README.md │ ├── test │ └── utils.ts │ ├── package.json │ └── webpack.config.js ├── .github ├── FUNDING.yml └── workflows │ ├── publish.yml │ ├── gh-pages.yml │ ├── bump.yml │ └── main.yml ├── .gitignore ├── lerna.json ├── nx.json └── package.json /.nvmrc: -------------------------------------------------------------------------------- 1 | lts/hydrogen 2 | -------------------------------------------------------------------------------- /website/static/.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: na2hiro 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .DS_Store 3 | .idea/ 4 | public/ 5 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/test/jestsetup.ts: -------------------------------------------------------------------------------- 1 | import "@testing-library/jest-dom"; 2 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/declarations.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.png"; 2 | -------------------------------------------------------------------------------- /packages/json-kifu-format/.npmignore: -------------------------------------------------------------------------------- 1 | /**/__tests__/ 2 | /.github/ 3 | /.idea/ 4 | /coverage/ 5 | /test/ 6 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "node_modules/lerna/schemas/lerna-schema.json", 3 | "version": "5.4.1" 4 | } 5 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/cypress/e2e/common/utils.ts: -------------------------------------------------------------------------------- 1 | export const comment = () => cy.findByLabelText("局面コメント"); 2 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/__mocks__/fileMock.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-undef 2 | module.exports = "file-mock"; 3 | -------------------------------------------------------------------------------- /packages/json-kifu-format/specification/files/ryuou201409020101.jkf.json: -------------------------------------------------------------------------------- 1 | ../../test/files/jkf/ryuou201409020101.jkf -------------------------------------------------------------------------------- /packages/json-kifu-format/specification/files/same_move_minimal.jkf.json: -------------------------------------------------------------------------------- 1 | ../../test/files/jkf/same_move_minimal.jkf -------------------------------------------------------------------------------- /website/static/img/auto-play.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/static/img/auto-play.mp4 -------------------------------------------------------------------------------- /website/static/img/docusaurus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/static/img/docusaurus.png -------------------------------------------------------------------------------- /website/static/img/social-card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/static/img/social-card.png -------------------------------------------------------------------------------- /website/static/img/tap-to-play.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/static/img/tap-to-play.mp4 -------------------------------------------------------------------------------- /packages/json-kifu-format/.gitignore: -------------------------------------------------------------------------------- 1 | /bundle 2 | /coverage 3 | /dist 4 | /docs 5 | /node_modules 6 | /.idea 7 | .DS_Store 8 | -------------------------------------------------------------------------------- /packages/shogi.js/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "tabWidth": 4, 4 | "bracketSpacing": false 5 | } 6 | -------------------------------------------------------------------------------- /website/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | }; 4 | -------------------------------------------------------------------------------- /website/docs/99-legacy/k4j-main.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/docs/99-legacy/k4j-main.jpg -------------------------------------------------------------------------------- /website/static/kifu/kanju-kemuri.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/static/kifu/kanju-kemuri.kif -------------------------------------------------------------------------------- /packages/Kifu-for-JS/examples/fu-10.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/examples/fu-10.kif -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/public-bookmarklet.test.ts: -------------------------------------------------------------------------------- 1 | describe("bookmarklet", () => { 2 | it.todo("test everything"); 3 | }); 4 | -------------------------------------------------------------------------------- /packages/shogi.js/.gitignore: -------------------------------------------------------------------------------- 1 | /.idea/ 2 | *.iml 3 | /bundle/ 4 | /coverage/ 5 | /cjs/ 6 | /node_modules/ 7 | docs/ 8 | .DS_Store 9 | -------------------------------------------------------------------------------- /website/static/img/scroll-to-play.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/static/img/scroll-to-play.mp4 -------------------------------------------------------------------------------- /website/static/kifu/hashimoto-sos.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/static/kifu/hashimoto-sos.kif -------------------------------------------------------------------------------- /website/static/kifu/jt201409130101.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/static/kifu/jt201409130101.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "tabWidth": 4, 4 | "bracketSpacing": false 5 | } 6 | -------------------------------------------------------------------------------- /website/static/kifu/32ryu-cumbersome.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/static/kifu/32ryu-cumbersome.kif -------------------------------------------------------------------------------- /packages/Kifu-for-JS/.npmignore: -------------------------------------------------------------------------------- 1 | /.idea/ 2 | /examples/ 3 | /test/ 4 | /**/__tests__/ 5 | /public/ 6 | /coverage/ 7 | /readme-ss/ 8 | /.github -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0FU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0FU.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0GI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0GI.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0HI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0HI.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0KA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0KA.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0KE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0KE.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0KI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0KI.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0KY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0KY.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0NG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0NG.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0NK.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0NK.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0NY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0NY.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0OU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0OU.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0RY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0RY.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0TO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0TO.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/0UM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/0UM.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1FU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1FU.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1GI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1GI.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1HI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1HI.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1KA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1KA.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1KE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1KE.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1KI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1KI.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1KY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1KY.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1NG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1NG.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1NK.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1NK.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1NY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1NY.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1OU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1OU.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1RY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1RY.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1TO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1TO.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/1UM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/1UM.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/examples/files/csa/8mai.csa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/examples/files/csa/8mai.csa -------------------------------------------------------------------------------- /packages/Kifu-for-JS/examples/files/ki2/9fu.ki2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/examples/files/ki2/9fu.ki2 -------------------------------------------------------------------------------- /packages/Kifu-for-JS/examples/files/kif/fork.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/examples/files/kif/fork.kif -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/images/blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/src/legacy/images/blank.png -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/csa/8mai.csa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/csa/8mai.csa -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/csa/9fu.csa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/csa/9fu.csa -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/ki2/8mai.ki2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/ki2/8mai.ki2 -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/ki2/9fu.ki2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/ki2/9fu.ki2 -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/ki2/fork.ki2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/ki2/fork.ki2 -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/8mai.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/8mai.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/9fu.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/9fu.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/fork.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/fork.kif -------------------------------------------------------------------------------- /website/blog/2023-09-01-kifu-for-js-v5/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/blog/2023-09-01-kifu-for-js-v5/cover.png -------------------------------------------------------------------------------- /website/blog/2023-09-15-v5-2-auto-play/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/blog/2023-09-15-v5-2-auto-play/cover.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "tabWidth": 4, 4 | "arrowParens": "always", 5 | "trailingComma": "all" 6 | } 7 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/readme-ss/site-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/readme-ss/site-screenshot.png -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/csa/chudan.csa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/csa/chudan.csa -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/csa/formal.csa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/csa/formal.csa -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/csa/noeol.csa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/csa/noeol.csa -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/ki2/chudan.ki2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/ki2/chudan.ki2 -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/ki2/noeol.ki2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/ki2/noeol.ki2 -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/chudan.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/chudan.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/henka.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/henka.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/noeol.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/noeol.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/ryuou4.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/ryuou4.kif -------------------------------------------------------------------------------- /website/blog/2023-09-01-kifu-for-js-v5/k4j-main.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/blog/2023-09-01-kifu-for-js-v5/k4j-main.jpg -------------------------------------------------------------------------------- /website/blog/2023-09-08-v5-1-tsume-shogi/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/blog/2023-09-08-v5-1-tsume-shogi/cover.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/cypress/e2e/lite/utils.ts: -------------------------------------------------------------------------------- 1 | export const backwardLite = () => cy.findByText("◀"); 2 | export const forwardLite = () => cy.findByText("▶"); 3 | -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/csa/example.csa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/csa/example.csa -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/ki2/20091203.ki2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/ki2/20091203.ki2 -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/ki2/denou3-1.ki2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/ki2/denou3-1.ki2 -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/ki2/illegal.ki2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/ki2/illegal.ki2 -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/fork-test.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/fork-test.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/illegal.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/illegal.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/no_henka.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/no_henka.kif -------------------------------------------------------------------------------- /website/blog/2023-09-03-v5-0-3-safari-bugs/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/blog/2023-09-03-v5-0-3-safari-bugs/cover.png -------------------------------------------------------------------------------- /packages/Kifu-for-JS/examples/files/kif/kanju-kemuri.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/examples/files/kif/kanju-kemuri.kif -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/lite/zumen/lib.ts: -------------------------------------------------------------------------------- 1 | export const ZenSuuji = "123456789"; 2 | export const KanSuuji = "一二三四五六七八九十"; 3 | export const scolor = "currentColor"; 4 | -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/csa/8mai_hirate.csa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/csa/8mai_hirate.csa -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/csa/illegal_win.csa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/csa/illegal_win.csa -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/fork-notime.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/fork-notime.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/taichitsume.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/taichitsume.kif -------------------------------------------------------------------------------- /packages/Kifu-for-JS/examples/files/kif/hashimoto-sos.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/examples/files/kif/hashimoto-sos.kif -------------------------------------------------------------------------------- /packages/Kifu-for-JS/examples/files/kif/jt201409130101.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/examples/files/kif/jt201409130101.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/csa/9fu_komabetsu.csa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/csa/9fu_komabetsu.csa -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/csa/illegal_lose.csa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/csa/illegal_lose.csa -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/jt201409130101.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/jt201409130101.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/last_comment.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/last_comment.kif -------------------------------------------------------------------------------- /website/blog/2023-09-01-kifu-for-js-v5/kifu-for-java.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/blog/2023-09-01-kifu-for-js-v5/kifu-for-java.jpeg -------------------------------------------------------------------------------- /website/docs/07-kifu-for-js-bookmarklet/bookmarklet-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/docs/07-kifu-for-js-bookmarklet/bookmarklet-1.jpg -------------------------------------------------------------------------------- /website/docs/07-kifu-for-js-bookmarklet/bookmarklet-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/docs/07-kifu-for-js-bookmarklet/bookmarklet-2.jpg -------------------------------------------------------------------------------- /website/docs/07-kifu-for-js-bookmarklet/bookmarklet-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/docs/07-kifu-for-js-bookmarklet/bookmarklet-3.jpg -------------------------------------------------------------------------------- /packages/Kifu-for-JS/examples/files/kif/32ryu-cumbersome.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/Kifu-for-JS/examples/files/kif/32ryu-cumbersome.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/csa/2005_YAMADA_GPS.csa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/csa/2005_YAMADA_GPS.csa -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/20081220kyoochi.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/20081220kyoochi.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/32ryu-cumbersome.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/32ryu-cumbersome.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/kifu_for_iphone.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/kifu_for_iphone.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/kiou201403160101.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/kiou201403160101.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/oui201407080101.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/oui201407080101.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/ouza201410070101.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/ouza201410070101.kif -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/ryuou201409020101.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/ryuou201409020101.kif -------------------------------------------------------------------------------- /website/blog/2024-06-11-v5-4-1-fix-10-fu-in-mochigoma/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/blog/2024-06-11-v5-4-1-fix-10-fu-in-mochigoma/cover.png -------------------------------------------------------------------------------- /website/src/pages/markdown-page.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Markdown page example 3 | --- 4 | 5 | # Markdown page example 6 | 7 | You don't need React to write simple standalone pages. 8 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/.prettierignore: -------------------------------------------------------------------------------- 1 | *.txt 2 | **/__snapshots__/* 3 | bundle/ 4 | coverage/ 5 | dist/ 6 | README.md 7 | package-lock.json 8 | package.json 9 | swfobject.js 10 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/test/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Content has been moved 4 | -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/ki2/7mai.ki2u: -------------------------------------------------------------------------------- 1 | 開始日時:2022/02/06 14:51:20 2 | 終了日時:2022/02/06 14:53:37 3 | 手合割:左七枚落ち 4 | 下手:shitate 5 | 上手:uwate 6 | 7 | △8二銀 ▲7六歩 8 | まで2手で中断 9 | -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/ki2/fuujite.ki2u: -------------------------------------------------------------------------------- 1 | 開始日時:2014/10/13 18:51:20 2 | 終了日時:2014/10/13 18:53:37 3 | 手合割:八枚落ち 4 | 下手:shitate 5 | 上手:uwate 6 | 7 | △7二金 ▲7六歩 8 | まで2手で封じ手 9 | -------------------------------------------------------------------------------- /website/blog/2023-09-29-v5-4-reverse-options-and-button/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/blog/2023-09-29-v5-4-reverse-options-and-button/cover.png -------------------------------------------------------------------------------- /website/blog/authors.yml: -------------------------------------------------------------------------------- 1 | na2hiro: 2 | name: na2hiro 3 | title: Maintainer of Kifu for JS 4 | url: https://github.com/na2hiro 5 | image_url: https://github.com/na2hiro.png 6 | 7 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/lite/utils.ts: -------------------------------------------------------------------------------- 1 | export const TURNS = [ 2 | { mark: "☗", name: "先手", komaochiName: "下手" }, 3 | { mark: "☖", name: "後手", komaochiName: "上手" }, 4 | ] as const; 5 | -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/ki2/kobayashi_kinsho196702.ki2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/ki2/kobayashi_kinsho196702.ki2 -------------------------------------------------------------------------------- /packages/shogi.js/.prettierignore: -------------------------------------------------------------------------------- 1 | /bundle/ 2 | /coverage/ 3 | /cjs/ 4 | /node_modules/ 5 | /docs/ 6 | /public/ 7 | /.github/ 8 | README.md 9 | package.json 10 | package-lock.json 11 | -------------------------------------------------------------------------------- /website/blog/2023-09-22-v5-3-recover-kifu-for-java-and-flash/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/blog/2023-09-22-v5-3-recover-kifu-for-java-and-flash/cover.png -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/meijinsen_20180508_M7_10034.kif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/packages/json-kifu-format/test/files/kif/meijinsen_20180508_M7_10034.kif -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/bookmarklet.ts: -------------------------------------------------------------------------------- 1 | const s = document.createElement("script"); 2 | s.src = "https://cdn.jsdelivr.net/npm/kifu-for-js@5/bundle/public-bookmarklet.min.js"; 3 | document.body.appendChild(s); 4 | -------------------------------------------------------------------------------- /packages/shogi.js/.npmignore: -------------------------------------------------------------------------------- 1 | .github/ 2 | bundle/ 3 | coverage/ 4 | node_modules/ 5 | src/ 6 | test/ 7 | *.iml 8 | jest.config.js 9 | npm-shrinkwrap.json 10 | tsconfig.json 11 | webpack.config.js 12 | -------------------------------------------------------------------------------- /website/blog/2023-09-22-v5-3-recover-kifu-for-java-and-flash/kifu-for-java.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/na2hiro/Kifu-for-JS/HEAD/website/blog/2023-09-22-v5-3-recover-kifu-for-java-and-flash/kifu-for-java.jpeg -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/public-bookmarklet-on-ghpages.js: -------------------------------------------------------------------------------- 1 | if (confirm("ブックマークレットが引っ越したため、変更をお願いします。\n\n説明ページを新しいタブで開きますか?")) { 2 | open("https://kifu-for-js.81.la/docs/kifu-for-js-bookmarklet", "_blank"); 3 | } 4 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | *.iml 3 | /node_modules 4 | *.swp 5 | /dist/ 6 | /bundle/ 7 | /coverage/ 8 | .DS_Store 9 | /public 10 | /src/public-bookmarklet.min.js 11 | /cypress/videos/ 12 | /cypress/screenshots/ 13 | -------------------------------------------------------------------------------- /packages/shogi.js/src/IMoveDefinition.ts: -------------------------------------------------------------------------------- 1 | interface IMoveDefinition { 2 | readonly just?: ReadonlyArray>; 3 | readonly fly?: ReadonlyArray>; 4 | } 5 | 6 | export default IMoveDefinition; 7 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/cypress/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["es5", "dom"], 5 | "types": ["cypress", "@testing-library/cypress"] 6 | }, 7 | "include": ["**/*.ts"] 8 | } 9 | -------------------------------------------------------------------------------- /website/src/components/HomepageFeatures/styles.module.css: -------------------------------------------------------------------------------- 1 | .features { 2 | display: flex; 3 | align-items: center; 4 | padding: 2rem 0; 5 | width: 100%; 6 | } 7 | 8 | .featureSvg { 9 | height: 200px; 10 | width: 200px; 11 | } 12 | -------------------------------------------------------------------------------- /packages/json-kifu-format/.prettierignore: -------------------------------------------------------------------------------- 1 | /.github/ 2 | /bundle/ 3 | /coverage/ 4 | /dist/ 5 | /docs/ 6 | /node_modules/ 7 | /public/ 8 | /packages/json-kifu-format/src/jkfplayerTest.ts 9 | README.md 10 | package-lock.json 11 | package.json 12 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/tsconfig.typecheck.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "declaration": false, 5 | "module": "commonjs", 6 | "noEmit": true, 7 | "skipLibCheck": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/shogi.js/tsconfig.typecheck.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "declaration": false, 5 | "module": "commonjs", 6 | "noEmit": true, 7 | "skipLibCheck": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/json-kifu-format/test/pegjs-jest.js: -------------------------------------------------------------------------------- 1 | var peg = require("pegjs"); 2 | module.exports = { 3 | process(src, filename, config, options) { 4 | return { 5 | code: peg.generate(src, {output: "source", format: "commonjs"}), 6 | }; 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/json-kifu-format/tsconfig.typecheck.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["./src"], 3 | "compilerOptions": { 4 | "declaration": true, 5 | "module": "commonjs", 6 | "noEmitOnError": true, 7 | "target": "es5", 8 | "skipLibCheck": true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /website/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // This file is not used in compilation. It is here just for a nice editor experience. 3 | "extends": "@tsconfig/docusaurus/tsconfig.json", 4 | "compilerOptions": { 5 | "baseUrl": ".", 6 | "experimentalDecorators": true, 7 | "target": "ES2015" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/json-kifu-format/src/main.ts: -------------------------------------------------------------------------------- 1 | import * as Shogi from "shogi.js"; 2 | import * as Formats from "./Formats"; 3 | import JKFPlayer from "./jkfplayer"; 4 | import * as Normalizer from "./normalizer"; 5 | import * as Parsers from "./peg/parsers"; 6 | 7 | export {Normalizer, JKFPlayer, Parsers, Formats, Shogi}; 8 | -------------------------------------------------------------------------------- /packages/json-kifu-format/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["./src"], 3 | "exclude": ["**/__tests__/**/*"], 4 | "compilerOptions": { 5 | "declaration": true, 6 | "module": "commonjs", 7 | "noEmitOnError": true, 8 | "target": "es5", 9 | "skipLibCheck": true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/json-kifu-format/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.pegjs" { 2 | // TODO: correctly type this. Parsed results are JSONKifuFormat but with missing properties which depends on the source format. 3 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 4 | export function parse(kifuString: string): any; 5 | } 6 | -------------------------------------------------------------------------------- /website/docs/05-integrating-with-app/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "アプリケーションに組み込む", 3 | "position": 5, 4 | "link": { 5 | "type": "generated-index", 6 | "title": "アプリケーションに組み込む", 7 | "description": "スクリプトを書いて盤面の状態を監視・操作したり、ご自身のアプリケーションに組み込んだりする方法を見ていきましょう。", 8 | "slug": "/integrating-with-app" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/shogi.js/src/Color.test.ts: -------------------------------------------------------------------------------- 1 | import Color, {colorToString} from "./Color"; 2 | 3 | describe("colorToString", function () { 4 | it("先手", () => { 5 | expect(colorToString(Color.Black)).toEqual("先手"); 6 | }); 7 | it("後手", () => { 8 | expect(colorToString(Color.White)).toEqual("後手"); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /node_modules 3 | 4 | # Production 5 | /build 6 | 7 | # Generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # Misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | -------------------------------------------------------------------------------- /packages/shogi.js/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["src/shogi.ts"], 3 | "exclude": ["**/__tests__/**/*", "**/node_modules/**/*"], 4 | "compilerOptions": { 5 | "outDir": "cjs", 6 | "declaration": true, 7 | "module": "commonjs", 8 | "noEmitOnError": true, 9 | "skipLibCheck": true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/examples/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Kifu for JS 5 | 6 | 7 | 8 | Jump to the new docs site 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/shogi.js/src/moveDefinitions.test.ts: -------------------------------------------------------------------------------- 1 | import {Kind, values} from "./Kind"; 2 | import {getMoveDefinitions} from "./moveDefinitions"; 3 | 4 | describe("move def", () => { 5 | it("snapshots", () => { 6 | for (const kind of values) { 7 | expect(getMoveDefinitions(kind as Kind)).toMatchSnapshot(kind); 8 | } 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/ki2/8mai.ki2u: -------------------------------------------------------------------------------- 1 | 開始日時:2014/10/13 18:51:20 2 | 終了日時:2014/10/13 18:53:37 3 | 手合割:八枚落ち 4 | 下手:shitate 5 | 上手:uwate 6 | 7 | △7二金 ▲7六歩 △3二金 ▲2六歩 △6四歩 ▲2五歩 8 | △6五歩 ▲2四歩 △同 歩 ▲同 飛 △2三歩 ▲2八飛 9 | △6三金 ▲3八銀 △5四金 ▲2七銀 △4二玉 ▲2六銀 10 | △4四歩 ▲2五銀 △4三玉 ▲2四歩 △同 歩 ▲同 銀 11 | △3四玉 12 | まで25手で中断 13 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/cypress/support/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | declare namespace Cypress { 4 | interface Chainable { 5 | /** 6 | * Custom command to select DOM element by data-cy attribute. 7 | * @example cy.dataCy('greeting') 8 | */ 9 | getBySel(value: string): Chainable; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /website/README.md: -------------------------------------------------------------------------------- 1 | # Kifu for JS Website 2 | 3 | Kifu for JS 公式サイトはモダンなスタティックサイトジェネレータ [Docusaurus 2](https://docusaurus.io/) で作られています。 4 | 5 | ### インストールと開発 6 | 7 | [ルートディレクトリのREADME](../README.md) を参照のこと。端的に言えば以下 8 | 9 | ```shell 10 | npm run website 11 | ``` 12 | 13 | ### リリース 14 | 15 | Cloudflare Page により Continuous Delivery がセットアップされている。 [dashboard](https://dash.cloudflare.com/) へ。 16 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/examples/bundle-loader.js: -------------------------------------------------------------------------------- 1 | var dropdown = document.getElementById("dropdown"); 2 | var bundle = new URLSearchParams(location.search).get("bundle"); 3 | if (bundle === null) bundle = dropdown.querySelector("option").value; 4 | if (bundle !== "") { 5 | document.write(' 6 | 7 | 8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/examples/legacy/loadJkf.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kifu for JS example 4 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /website/blog/2024-06-11-v5-4-1-fix-10-fu-in-mochigoma/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Kifu for JS v5.4.1 🎉 持駒歩十バグ修正" 3 | authors: na2hiro 4 | image: ./cover.png 5 | # tags: [Kifu for JS] 6 | --- 7 | 8 | Kifu for JS [v5.4.1 パッチリリース](https://github.com/na2hiro/Kifu-for-JS/releases/tag/v5.4.1)において、次のバグ修正を行いました。 9 | 10 | - 持駒に歩が十枚あるとき、"歩十"とすべきところ"歩"になってしまうバグ 11 | 12 | このバグは[おかもと (@Araiyayon)](https://x.com/Araiyayon)さんに報告いただきました。改めて感謝いたします。 13 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/lite/useHaptics.ts: -------------------------------------------------------------------------------- 1 | import { useEffect, useRef } from "react"; 2 | 3 | export default function useHaptics(tesuu: number, on = true) { 4 | const mounted = useRef(false); 5 | 6 | useEffect(() => { 7 | if (mounted.current) { 8 | if (on) { 9 | navigator.vibrate?.(1); 10 | } 11 | } else { 12 | mounted.current = true; 13 | } 14 | }, [tesuu]); 15 | } 16 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["./src"], 3 | "exclude": ["**/__tests__/**/*"], 4 | "compilerOptions": { 5 | "declaration": true, 6 | "experimentalDecorators": true, 7 | "module": "esnext", 8 | "moduleResolution": "node", 9 | "esModuleInterop": true, 10 | "noEmitOnError": true, 11 | "jsx": "react", 12 | "target": "es2015", 13 | "lib": ["es2019", "dom"] 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/lite/zumen/zumenCompat.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Compatibility layer for zumen object 3 | * TODO: inline them and remove this file and zumen object 4 | */ 5 | import { IPlaceFormat } from "json-kifu-format/src/Formats"; 6 | 7 | export function cellEqual(cell: number, place?: IPlaceFormat, reverse = false) { 8 | if (!place) return false; 9 | 10 | return reverse ? cell === place.x - 1 + (8 - (place.y - 1)) * 9 : cell === 8 - (place.x - 1) + (place.y - 1) * 9; 11 | } 12 | -------------------------------------------------------------------------------- /packages/shogi.js/src/presets.test.ts: -------------------------------------------------------------------------------- 1 | import presets, {getInitialFromPreset} from "./presets"; 2 | 3 | describe("preset", () => { 4 | it("initialized board", () => { 5 | for (const preset of presets) { 6 | expect(getInitialFromPreset(preset)).toMatchSnapshot(preset); 7 | } 8 | }); 9 | it("throws error with invalid preset name", () => { 10 | expect(() => getInitialFromPreset("invalid")).toThrowErrorMatchingSnapshot(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /website/src/pages/index.module.css: -------------------------------------------------------------------------------- 1 | /** 2 | * CSS files with the .module.css suffix will be treated as CSS modules 3 | * and scoped locally. 4 | */ 5 | 6 | .heroBanner { 7 | padding: 4rem 0; 8 | text-align: center; 9 | position: relative; 10 | overflow: hidden; 11 | } 12 | 13 | @media screen and (max-width: 996px) { 14 | .heroBanner { 15 | padding: 2rem; 16 | } 17 | } 18 | 19 | .buttons { 20 | display: flex; 21 | align-items: center; 22 | justify-content: center; 23 | } 24 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v3 12 | - uses: actions/setup-node@v3 13 | with: 14 | node-version: 16 15 | registry-url: https://registry.npmjs.org/ 16 | - run: npm install 17 | - run: lerna publish from-git --yes 18 | env: 19 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} 20 | -------------------------------------------------------------------------------- /website/static/img/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JS 6 | 7 | -------------------------------------------------------------------------------- /website/src/theme/MDXComponents.ts: -------------------------------------------------------------------------------- 1 | import MDXComponents from "@theme-original/MDXComponents"; 2 | import { KifuLite } from "kifu-for-js"; 3 | import KifuForEachMethod from "@site/src/components/_KifuForEachMethod"; 4 | import { Example1, Example2 } from "@site/src/components/_ExampleKifu"; 5 | import Script from "@site/src/components/Script"; 6 | 7 | export default { 8 | // Re-use the default mapping 9 | ...MDXComponents, 10 | KifuLite, 11 | KifuForEachMethod, 12 | Example1, 13 | Example2, 14 | Script, 15 | }; 16 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/cypress.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "cypress"; 2 | 3 | export default defineConfig({ 4 | video: false, 5 | e2e: { 6 | // We've imported your old cypress plugins here. 7 | // You may want to clean this up later by importing these. 8 | setupNodeEvents(on, config) { 9 | // eslint-disable-next-line @typescript-eslint/no-var-requires 10 | return require("./cypress/plugins/index.js")(on, config); 11 | }, 12 | baseUrl: "http://0.0.0.0:8080", 13 | }, 14 | }); 15 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/test/testutils.ts: -------------------------------------------------------------------------------- 1 | import { screen, within } from "@testing-library/react"; 2 | 3 | export const selectPiece = async (x: number, y: number) => { 4 | const board = await screen.findByTestId("board"); 5 | const pieces = await within(board).findAllByTestId("piece"); 6 | return pieces[(y - 1) * 9 + (9 - x)]; 7 | }; 8 | 9 | export async function expectCell(x: number, y: number, expected: string) { 10 | const cellElement = await selectPiece(x, y); 11 | expect(cellElement).toHaveAttribute("aria-label", expected); 12 | } 13 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/cypress.ci.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "cypress"; 2 | 3 | export default defineConfig({ 4 | video: true, 5 | e2e: { 6 | // We've imported your old cypress plugins here. 7 | // You may want to clean this up later by importing these. 8 | setupNodeEvents(on, config) { 9 | // eslint-disable-next-line @typescript-eslint/no-var-requires 10 | return require("./cypress/plugins/index.js")(on, config); 11 | }, 12 | baseUrl: "http://0.0.0.0:8081", 13 | }, 14 | }); 15 | -------------------------------------------------------------------------------- /packages/shogi.js/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | transform: { 3 | "^.+\\.tsx?$": "ts-jest", 4 | }, 5 | testRegex: "((\\.|/)(test|spec))\\.(jsx?|tsx?)$", 6 | moduleFileExtensions: ["ts", "js", "json"], 7 | coverageThreshold: { 8 | global: { 9 | branches: -1, 10 | functions: -2, 11 | lines: -1, 12 | statements: -1, 13 | }, 14 | }, 15 | collectCoverage: true, 16 | collectCoverageFrom: ["src/**", "!src/Kind.ts", "!**/__snapshots__/**", "!src/polyfills.ts"], 17 | }; 18 | -------------------------------------------------------------------------------- /website/blog/2023-09-03-v5-0-3-safari-bugs/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "v5.0.3: Safariでの表示乱れ等の修正" 3 | authors: na2hiro 4 | image: ./cover.png 5 | # tags: [Kifu for JS] 6 | --- 7 | 8 | Kifu for JS [v5.0.3](https://github.com/na2hiro/Kifu-for-JS/releases/tag/v5.0.3) (と[v5.0.2](https://github.com/na2hiro/Kifu-for-JS/releases/tag/v5.0.2)) パッチリリースにおいて、以下のバグ修正を行いました。 9 | 10 | - Safariでの表示乱れと再生時にクラッシュするバグを修正 11 | - タグ方式におけるインデント処理のバグを修正 12 | - その他表示の微調整 13 | 14 | v5リリース直後であるため、まだまだバグが見つかるかもしれません。おかしなところがありましたら [GitHub issues](https://github.com/na2hiro/Kifu-for-JS/issues) または [@na2hiro](https://twitter.com/na2hiro) までご報告ください。よろしくお願いします。 15 | -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/doh_branch.kifu: -------------------------------------------------------------------------------- 1 | #KIF version=2.0 encoding=UTF-8 2 | # ---- Kifu for Windows V7 V7.31 棋譜ファイル ---- 3 | 開始日時:2017/10/03 01:12:24 4 | 終了日時:2017/10/03 01:12:54 5 | 手合割:平手   6 | 先手: 7 | 後手: 8 | 手数----指手---------消費時間-- 9 | 1 7六歩(77) ( 0:00/00:00:00) 10 | 2 3四歩(33) ( 0:00/00:00:00) 11 | 3 2六歩(27) ( 0:00/00:00:00)+ 12 | 4 中断 ( 0:00/00:00:00) 13 | まで3手で中断 14 | 15 | 変化:3手 16 | 3 2二角成(88) ( 0:00/00:00:00) 17 | 4 同 銀(31) ( 0:00/00:00:00)+ 18 | 5 中断 ( 0:00/00:00:00) 19 | まで4手で中断 20 | 21 | 変化:4手 22 | 4 同 飛(82) ( 0:00/00:00:00) 23 | 5 中断 ( 0:00/00:00:00) 24 | まで4手で中断 25 | -------------------------------------------------------------------------------- /packages/json-kifu-format/test/files/kif/last-fork.kifu: -------------------------------------------------------------------------------- 1 | #KIF version=2.0 encoding=UTF-8 2 | # ---- Kifu for Windows V7 V7.11 棋譜ファイル ---- 3 | 開始日時:2015/08/17 00:32:18 4 | 終了日時:2015/08/17 00:32:35 5 | 手合割:平手   6 | 先手: 7 | 後手: 8 | 手数----指手---------消費時間-- 9 | 1 2六歩(27) ( 0:01/00:00:01) 10 | 2 8四歩(83) ( 0:01/00:00:01) 11 | 3 2五歩(26) ( 0:01/00:00:02) 12 | 4 8五歩(84) ( 0:00/00:00:01) 13 | 5 7八金(69) ( 0:01/00:00:03) 14 | 6 3二金(41) ( 0:01/00:00:02) 15 | 7 2四歩(25) ( 0:01/00:00:04) 16 | 8 同 歩(23) ( 0:00/00:00:02) 17 | 9 同 飛(28) ( 0:01/00:00:05) 18 | 10 2三歩打 ( 0:05/00:00:07)+ 19 | 11 中断 ( 0:01/00:00:06) 20 | まで10手で中断 21 | 22 | 変化:10手 23 | 10 1四歩(13) ( 0:01/00:00:03) 24 | 11 中断 ( 0:01/00:00:06) 25 | まで10手で中断 26 | -------------------------------------------------------------------------------- /website/blog/2023-09-08-v5-1-tsume-shogi/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Kifu for JS v5.1 🎉 詰将棋モードを追加" 3 | authors: na2hiro 4 | image: ./cover.png 5 | # tags: [Kifu for JS] 6 | --- 7 | 8 | import { KifuLite } from "kifu-for-js"; 9 | 10 | 11 | 12 | Kifu for JS [v5.1.0 マイナーリリース](https://github.com/na2hiro/Kifu-for-JS/releases/tag/v5.1.0)において、詰将棋モードが追加されました。この機能は、詰将棋の棋譜を読み込んだ際、自動的に詰将棋に適した表示に切り替えるものです。具体的には、 13 | 14 | - 「☗先手」「☖後手」ではなく「持駒」と表記 15 | - 玉方の持駒が残り全部の場合、省略する 16 | 17 | また、以下のオプションも指定することができます。 18 | 19 | - 再生するまでは解を隠す 20 | - 出典の表示 21 | - あえて玉方の持駒を表示する 22 | - 詰将棋モードのオン・オフを手動で指定 23 | 24 | 詳しくは、Docsの[詰将棋モード](/docs/options/tsume)をご覧ください。 25 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-react", 4 | [ 5 | "@babel/preset-env", 6 | { 7 | "useBuiltIns": "usage", 8 | "corejs": 3, 9 | "targets": { 10 | "browsers": ["last 2 versions", "ie >= 11"] 11 | } 12 | } 13 | ], 14 | "@babel/preset-typescript" 15 | ], 16 | "plugins": [ 17 | "syntax-dynamic-import", 18 | "transform-regenerator", 19 | [ 20 | "@babel/plugin-proposal-decorators", 21 | { 22 | "legacy": true 23 | } 24 | ] 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | es2021: true, 5 | }, 6 | extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:jest/recommended", "prettier"], 7 | parser: "@typescript-eslint/parser", 8 | parserOptions: { 9 | ecmaVersion: 13, 10 | sourceType: "module", 11 | }, 12 | plugins: ["@typescript-eslint", "jest"], 13 | ignorePatterns: [ 14 | ".eslintrc.js", 15 | "jest.config.js", 16 | "pegjs-jest.js", 17 | "webpack.config.js", 18 | "docs/", 19 | "bundle/", 20 | "dist/", 21 | "swfobject.js", 22 | ], 23 | rules: {}, 24 | }; 25 | -------------------------------------------------------------------------------- /packages/shogi.js/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | es2021: true, 5 | }, 6 | extends: [ 7 | "eslint:recommended", 8 | "plugin:@typescript-eslint/recommended", 9 | "plugin:jest/recommended", 10 | "prettier", 11 | ], 12 | parser: "@typescript-eslint/parser", 13 | parserOptions: { 14 | ecmaVersion: 13, 15 | sourceType: "module", 16 | }, 17 | plugins: ["@typescript-eslint", "jest"], 18 | ignorePatterns: [ 19 | ".eslintrc.js", 20 | "jest.config.js", 21 | "webpack.config.js", 22 | "docs/", 23 | "bundle/", 24 | "cjs/", 25 | ], 26 | rules: {}, 27 | }; 28 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/test/htmls/kifu-for-flash-swfobject-body.html: -------------------------------------------------------------------------------- 1 | Kifu for Flash Free
2 | 3 | 4 |
Flash Player 9が必要です
5 | 6 | 16 | 17 | ウィンドウの高さを変えると、コメント欄の高さが変わります。 18 | -------------------------------------------------------------------------------- /packages/json-kifu-format/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | es2021: true, 5 | }, 6 | extends: [ 7 | "eslint:recommended", 8 | "plugin:@typescript-eslint/recommended", 9 | "plugin:jest/recommended", 10 | "prettier", 11 | ], 12 | parser: "@typescript-eslint/parser", 13 | parserOptions: { 14 | ecmaVersion: 13, 15 | sourceType: "module", 16 | }, 17 | plugins: ["@typescript-eslint", "jest"], 18 | ignorePatterns: [ 19 | ".eslintrc.js", 20 | "jest.config.js", 21 | "pegjs-jest.js", 22 | "webpack.config.js", 23 | "docs/", 24 | "bundle/", 25 | "dist/", 26 | ], 27 | rules: {}, 28 | }; 29 | -------------------------------------------------------------------------------- /website/blog/2023-09-22-v5-3-recover-kifu-for-java-and-flash/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Kifu for JS v5.3 🎉 旧Kifu for Java/Flashタグを自動解釈" 3 | authors: na2hiro 4 | image: ./cover.png 5 | # tags: [Kifu for JS] 6 | --- 7 | 8 | Kifu for JS [v5.3.0 マイナーリリース](https://github.com/na2hiro/Kifu-for-JS/releases/tag/v5.3.0)において、旧Kifu for Java/Flashタグの自動解釈方式を追加しました。 9 | 10 | これは、既に作動できなくなっている旧Kifu for Javaや旧Kifu for Flashが設置されている古いページをお持ちの場合、タグを設置するだけで自動的にそれらの盤をKifu for JSに置き換えて表示することができる方式です。複雑な置換スクリプトなどを書くことなく、旧方式から手軽に移行することができます。 11 | 12 | ```html 13 | 14 | ``` 15 | 16 | これだけです。詳しくは[盤の設置方式](/docs/getting-started/loading#kifu-for-javaflashの自動解釈方式)をご覧ください。 17 | 18 | (旧Kifu for Java) 19 | 20 | ![Kifu for Javaスクリーンショット](./kifu-for-java.jpeg) 21 | -------------------------------------------------------------------------------- /packages/shogi.js/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | if (!Array.prototype.some) { 2 | Array.prototype.some = function (fun /*, thisp */) { 3 | "use strict"; 4 | 5 | if (this == null) { 6 | throw new TypeError(); 7 | } 8 | 9 | const t = Object(this), 10 | len = t.length >>> 0; 11 | 12 | if (typeof fun != "function") { 13 | throw new TypeError(); 14 | } 15 | 16 | // eslint-disable-next-line prefer-rest-params 17 | const thisp = arguments[1]; 18 | 19 | for (let i = 0; i < len; i++) { 20 | if (i in t && fun.call(thisp, t[i], i, t)) { 21 | return true; 22 | } 23 | } 24 | 25 | return false; 26 | }; 27 | } 28 | 29 | export {}; 30 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/cypress/support/e2e.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import "./commands"; 18 | 19 | // Alternatively you can use CommonJS syntax: 20 | // require('./commands') 21 | -------------------------------------------------------------------------------- /packages/json-kifu-format/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | transform: { 3 | "^.+\\.tsx?$": "ts-jest", 4 | "^.+\\.pegjs$": "/test/pegjs-jest.js", 5 | }, 6 | testRegex: "((\\.|/)(test|spec))\\.(jsx?|tsx?)$", 7 | moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], 8 | coverageThreshold: { 9 | global: { 10 | branches: -7, 11 | functions: -1, 12 | lines: -5, 13 | statements: -5, 14 | }, 15 | }, 16 | collectCoverage: true, 17 | collectCoverageFrom: [ 18 | "src/**", 19 | "!**/__snapshots__/**", 20 | "!**/*.d.ts", 21 | "!src/main.ts", 22 | "!src/peg/**", 23 | ], 24 | snapshotSerializers: ["./test/board-serializer.js"], 25 | }; 26 | -------------------------------------------------------------------------------- /packages/json-kifu-format/src/__snapshots__/normalizer.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`module Normalizer normalizeKIF same at first fork 1`] = `{"header":{},"moves":[{},{"move":{"from":{"x":7,"y":7},"piece":"FU","to":{"x":7,"y":6},"color":0}},{"move":{"from":{"x":3,"y":3},"piece":"FU","to":{"x":3,"y":4},"color":1}},{"move":{"from":{"x":2,"y":7},"piece":"FU","to":{"x":2,"y":6},"color":0},"forks":[[{"move":{"from":{"x":8,"y":8},"piece":"KA","promote":true,"to":{"x":2,"y":2},"color":0,"capture":"KA"}},{"move":{"from":{"x":3,"y":1},"piece":"GI","same":true,"color":1,"to":{"x":2,"y":2},"capture":"UM"},"forks":[[{"move":{"from":{"x":8,"y":2},"piece":"HI","same":true,"color":1,"to":{"x":2,"y":2},"capture":"UM"}},{"special":"JISHOGI"}]]},{"special":"CHUDAN"}]]},{"special":"TORYO"}]}`; 4 | -------------------------------------------------------------------------------- /website/blog/2023-09-15-v5-2-auto-play/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Kifu for JS v5.2 🎉 自動再生機能を追加" 3 | authors: na2hiro 4 | image: ./cover.png 5 | # tags: [Kifu for JS] 6 | --- 7 | 8 |

9 | 12 |

13 | 14 | Kifu for JS [v5.2.0 マイナーリリース](https://github.com/na2hiro/Kifu-for-JS/releases/tag/v5.2.0)において、自動再生機能が追加されました。 15 | 16 | * **▶ボタンを長押し**することで自動再生状態に切り替わり、自動で棋譜を鑑賞することができます。 17 | * 押したボタンは■ボタンになり、これをもう一度押すと停止します。 18 | * ◀ボタンも同様です。 19 | 20 | なおこの機能は初見では発見しづらいため、今後は将棋盤を使用する際にうまくヒントを表示する方法や、使い方ドキュメントの整備を検討していきます。 21 | 22 | ### 試してみる 23 | 24 | import { KifuLite } from "kifu-for-js"; 25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/Info.tsx: -------------------------------------------------------------------------------- 1 | import { JKFPlayer } from "json-kifu-format"; 2 | import { observer } from "mobx-react"; 3 | import * as React from "react"; 4 | 5 | export interface IProps { 6 | player: JKFPlayer; 7 | } 8 | 9 | @observer 10 | export default class Info extends React.Component { 11 | public render() { 12 | const data = this.props.player.kifu.header; 13 | const dds = []; 14 | for (const key in data) { 15 | dds.push(
{key}
); 16 | dds.push(
{data[key]}
); 17 | } 18 | 19 | return ( 20 |
21 |
{dds}
22 |
23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /website/docs/07-kifu-for-js-bookmarklet/index.mdx: -------------------------------------------------------------------------------- 1 | # Kifu for JS ブックマークレット 2 | 3 | 古いKifu for {Flash/Java}は既に動作が停止していますが、サイト運営者の手が回っておらずまだ設置されているページがある場合があります。Kifu for JSブックマークレットは、そんなページ上で訪問者が実行するだけで、Kifu for JSに置き換えて盤面を表示することができます。 4 | 5 | ## 準備 6 | 7 | 0. あらかじめ次のコードをURLとしてブックマークへ追加しておく。サイト名は任意(例:「Kifu for JS ブックマークレット」) 8 | 9 | ```javascript 10 | javascript:!function(){var s=document.createElement("script");s.src="https://cdn.jsdelivr.net/npm/kifu-for-js@5/bundle/public-bookmarklet.min.js",document.body.appendChild(s)}();void 0; 11 | ``` 12 | 13 | ## 使い方 14 | 15 | 1. 旧Kifu for Flashや旧Kifu for Javaが使われているページ ([例](https://www.ne.jp/asahi/tetsu/toybox/kurukuru/k001x.htm)) を開く 16 | 17 | ![](./bookmarklet-1.jpg) 18 | 19 | 2. ブックマークレットを選択する 20 | 21 | ![](./bookmarklet-2.jpg) 22 | 23 | 3. FlashやJava部分が置き換えられ,Kifu for JSの再生盤になる 24 | 25 | ![](./bookmarklet-3.jpg) 26 | -------------------------------------------------------------------------------- /.github/workflows/gh-pages.yml: -------------------------------------------------------------------------------- 1 | name: github pages 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | deploy: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v3 13 | 14 | - name: Setup Node 15 | uses: actions/setup-node@v3 16 | with: 17 | node-version: '16.x' 18 | 19 | - name: Cache dependencies 20 | uses: actions/cache@v4 21 | with: 22 | path: ~/.npm 23 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} 24 | restore-keys: | 25 | ${{ runner.os }}-node- 26 | - run: npm ci 27 | - run: npm run ghpages 28 | 29 | - name: Deploy 30 | uses: peaceiris/actions-gh-pages@v3 31 | with: 32 | github_token: ${{ secrets.GITHUB_TOKEN }} 33 | publish_dir: ./public 34 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/Comment.tsx: -------------------------------------------------------------------------------- 1 | import { observer } from "mobx-react"; 2 | import * as React from "react"; 3 | import { CSSProperties } from "react"; 4 | import KifuStore from "../common/stores/KifuStore"; 5 | 6 | export interface IProps { 7 | kifuStore: KifuStore; 8 | rows?: number; 9 | style?: CSSProperties; 10 | } 11 | 12 | const Comment: React.FC = ({ kifuStore, rows = 10, style }) => { 13 | const { player } = kifuStore; 14 | return ( 15 | 50 | 53 | 54 | 55 |

mobxによる状態監視の例

56 |

手数変化を受け取る

57 |
現在手目です!
58 | 65 | 66 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/common/stores/TsumeMode.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-inferrable-types */ 2 | import { isTsume, shouldHideKingsHand } from "../../lite/tsumeUtils"; 3 | import KifuStore from "./KifuStore"; 4 | import { computed, observable, reaction } from "mobx"; 5 | 6 | export default class TsumeMode { 7 | private kifuStore: KifuStore; 8 | @observable private dirty = false; 9 | 10 | constructor(kifuStore: KifuStore) { 11 | this.kifuStore = kifuStore; 12 | 13 | reaction( 14 | () => this.kifuStore.player.tesuu, 15 | () => { 16 | this.dirty = true; 17 | }, 18 | ); 19 | } 20 | 21 | @computed 22 | get enabled() { 23 | const tsumeSpecified = typeof this.kifuStore.options?.tsume !== "undefined"; 24 | if (tsumeSpecified) { 25 | return !!this.kifuStore.options?.tsume; 26 | } else { 27 | return isTsume(this.kifuStore.player); 28 | } 29 | } 30 | 31 | @computed 32 | get hideKingsHand() { 33 | if (!this.enabled) return false; 34 | 35 | const mustShow = 36 | typeof this.kifuStore.options?.tsume === "object" && (this.kifuStore.options?.tsume.kingsHand ?? false); 37 | 38 | return !mustShow && shouldHideKingsHand(this.kifuStore.player); 39 | } 40 | 41 | @computed 42 | get citation() { 43 | if (!this.enabled) return null; 44 | 45 | if (!(typeof this.kifuStore.options?.tsume === "object" && (this.kifuStore.options?.tsume.citation ?? false))) { 46 | return null; 47 | } 48 | 49 | const { header } = this.kifuStore.player.kifu; 50 | const author = header["作者"] ? header["作者"] + "作" : undefined; 51 | const title = header["作品名"] ? "「" + header["作品名"] + "」" : " "; 52 | const paper = header["発表誌"] || ""; 53 | const date = header["発表年月"] || header["発表日付"] || ""; 54 | 55 | if (!author) return null; 56 | 57 | // eslint-disable-next-line no-irregular-whitespace 58 | return `${author}${title}${paper} ${date}`; 59 | } 60 | 61 | get answerHidden() { 62 | if (!this.enabled) return false; 63 | 64 | if ( 65 | !(typeof this.kifuStore.options?.tsume === "object" && (this.kifuStore.options?.tsume.hideAnswer ?? false)) 66 | ) { 67 | return false; 68 | } 69 | 70 | return !this.dirty; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/CHANGES.md: -------------------------------------------------------------------------------- 1 | # 更新履歴 2 | 3 | 近況:目指せ Kifu for Win 4 | 5 | ## 1.2.1 (2017/10/2) 6 | 7 | - json-kifu-format 追従 8 | - 3 つ目以降の分岐が表示されないバグ修正 9 | 10 | ## 1.2.0 (2016/6/18) 11 | 12 | - CSA V2 (floodgate 等でも使用されている)に対応した json-kifu-format を使用 13 | - これから[Semantic versioning](http://semver.org/lang/ja/)を採用します. 14 | 15 | ## 1.1.5 (2016/1/17) 16 | 17 | - json-kifu-format 追従 18 | - Kifu for iPhone バグ対応 19 | - KIF で"盤面回転" "&読み込み時表示"が含まれる棋譜に対応 20 | 21 | ## 1.1.4 (2015/9/19) 22 | 23 | - Firefox ドラッグ&ドロップバグ対応 24 | 25 | ## 1.1.3 (2015/9/18) 26 | 27 | - 持ち駒の枚数表示をやめ,駒を重ねて表示 28 | - 盤面反転 29 | 30 | ## 1.1.2 (2015/9/14) 31 | 32 | - 棋譜選択による盤面表示へのブックマークレット対応 33 | 34 | ## 1.1.1 (2015/9/14) 35 | 36 | - 複数ブックマークレット対応 37 | 38 | ## 1.1.0 (2015/8/23) 39 | 40 | テストの充実した json-kifu-format 1.0 を採用するとともに,この Kifu for JS 1.1 台でテストを充実させていき,動作の安定化を目指します. 41 | 42 | - json-kifu-format 1.0 対応 43 | - CSA 対応強化 44 | - KI2 で"寄"が"直"と解釈されるバグ修正 45 | - KIF, KI2 にて二桁手数で分岐する際に読み込めないバグ修正 46 | - React-DnD 1 台対応(内部的) 47 | - browserify 化(内部的) 48 | 49 | ## 1.0.10 (2015/2/15) 50 | 51 | - 分岐棋譜入力周りの対応強化 52 | 53 | ## 1.0.9 (2015/2/14) 54 | 55 | - 棋譜入力 56 | - ドラッグ&ドロップで棋譜を入力 57 | - 最終局面なら次の手として追加,そうでなければ変化手順(分岐)として追加 58 | - 棋譜読み込み 59 | - 棋譜ファイルをドラッグ&ドロップで読み込み 60 | - 駒台の上部に対局者名を表示 61 | - ローカル読み込み時に Ajax セキュリティ制約に関する備考を表示 62 | 63 | ## 1.0.8 (2015/2/11) 64 | 65 | - React 化(内部的) 66 | - kifuforjs.js や bookmarklet.min.js を src/から out/へ移動 67 | 68 | ## 1.0.7 (2015/2/5) 69 | 70 | - "詰"だけでなく"詰み"という棋譜表記に対応 71 | - ブックマークレットの対応強化 72 | 73 | ## 1.0.6 (2014/10/26) 74 | 75 | - 変化手順に対応 76 | - 変化がある場合には変化選択ボックスが出現 77 | - Kifu for Flash 等とほぼ同じ仕様 78 | - 反則勝ち/負けへの対応 79 | - CSA での対局者等情報表示,及び終局表示対応 80 | - 読み込み失敗や棋譜解析失敗時にアラート表示 81 | 82 | ## 1.0.5 (2014/10/17) 83 | 84 | - 駒落ちや詰将棋などの,初期局面指定に対応 85 | - ブックマークレットで,Java の codebase 属性に対応.棋譜の場所をより正確に取得するように. 86 | 87 | ## 1.0.4 (2014/10/10) 88 | 89 | - 棋譜自動更新 90 | - Unicode 棋譜(kifu, ki2u)に対応.ただし CSA 等の自動判別機能はなし. 91 | - 棋譜の最後が投了等の時に,真の最終手の着手駒とコメントを表示するように 92 | 93 | ## 1.0.3 (2014/10/8) 94 | 95 | - CSA 読み込みへ対応.(バージョン 1 と 2.2) 96 | - 敵陣で金不成,玉不成と表示されるバグ 97 | 98 | ## 1.0.2 (2014/10/7) 99 | 100 | - KIF で対局中棋譜が読み込めないバグを修正 101 | 102 | ## 1.0.1 (2014/10/1) 103 | 104 | - 行コメント`#`へ対応 105 | - クレジット情報ボタン設置 106 | - TODO を issues へ移動 107 | 108 | ## 1.0.0 (2014/9/29) 109 | 110 | - バージョン番号を振った 111 | 112 | ## 有史以前 113 | 114 | - KI2, JKF 読み込みへ対応 115 | - 相対情報へ対応 116 | - MIT ライセンスを採用 117 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/examples/parser-tester.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kifu for js: Parser tester 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |
14 | 15 |
16 |
17 | 18 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/lite/settings/HapticFeedback.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import KifuStore from "../../common/stores/KifuStore"; 3 | import UserSetting from "../../common/stores/UserSetting"; 4 | 5 | type Props = { 6 | kifuStore: KifuStore; 7 | userSetting: UserSetting; 8 | }; 9 | const HapticFeedback: React.FC = ({ kifuStore, userSetting }) => { 10 | return ( 11 | !kifuStore.staticOptions && ( 12 | 48 | ) 49 | ); 50 | }; 51 | 52 | export default HapticFeedback; 53 | -------------------------------------------------------------------------------- /website/docs/06-migration-from-4-to-5.md: -------------------------------------------------------------------------------- 1 | # v4からv5への移行手順 2 | 3 | ここでは、お使いのKifu for JS v3あるいはv4を、最新版であるv5に移行する手順を説明します。 4 | 5 | * **legacy版**: Kifu for JS v4以前の、Kifu for Java/Flashとの互換性を保ったUXを持つKifu for JSのこと 6 | * **最新版**: Kifu for JS v5で導入された、スマホに最適化されたUXを持つKifu for JSのこと 7 | 8 | ## A) ` 14 | ``` 15 | 16 | ### オプション1: legacy版の使用をやめ、すべて最新版に移行する 17 | 18 | 既存ページでlegacy版で表示されている将棋再生盤を最新版に移行し、以後全て最新版を使用する場合は、読み込みスクリプトのバージョンを5に上げるだけで、最新版に移行できます。 19 | 20 | ```html 21 | 22 | ``` 23 | 24 | 次のようなコードは、最新版として動作します。 25 | 26 | ```html 27 | 28 | ``` 29 | ```html 30 | 31 | 〜 32 |
33 | ``` 34 | 35 | ### オプション2: すでにある盤はそのままに、最新版を混在させる 36 | 37 | 既存ページのレイアウトの関係などから、すでにある盤でlegacy版を使い続け、新たに設置する盤面については最新版を使いたいといった場合は、v5のlegacy版を含んだスクリプト`kifu-for-js-legacy.min.js`を読み込むようにします。 38 | 39 | ```html 40 | 41 | ``` 42 | 43 | すると、既存の記述はそのままKifu for JS legacy版として動きます。 44 | 45 | ```html 46 | 47 | ``` 48 | 49 | 新しい方式で記述された盤面については最新版として動きます。 50 | 51 | ```html 52 | 53 | ``` 54 | 55 | `load()`関数を用いる場合は、`mode: "latest"`オプションを渡すことで最新版を使うことができます。 56 | 57 | ```html 58 | 59 | ``` 60 | 61 | ## B) npmモジュールとして利用している場合 62 | 63 | v5は新旧両方のKifu for JSを提供しています。次のようにバージョンを上げ、 64 | 65 | ```shell 66 | npm install kifu-for-js@^5 67 | ``` 68 | 69 | このような既存のコードは最新版を使うようになります。 70 | 71 | ```ts 72 | import {load} from "kifu-for-js"; 73 | 74 | load("foobar.kif", "container-id") 75 | ``` 76 | 77 | legacy版を使いたい場合は、import先を変更します。 78 | 79 | ```ts 80 | import {load} from "kifu-for-js/legacy"; 81 | 82 | load("foobar.kif", "container-id") 83 | ``` 84 | 85 | ## 付録: ライブラリのバージョンとlegacy版、最新版の対応表 86 | 87 | | ライブラリのバージョン | legacy版 | 最新版 | 88 | |-------------------------------------------------------------|---------|-----| 89 | | `3.x.x`, `4.x.x` | ✅ | - | 90 | | `5.x.x` (kifu-for-js.min.js) | - | ✅ | 91 | | `5.x.x` (kifu-for-js-legacy.min.js)
`5.x.x` (npmモジュール) | ✅ | ✅ | 92 | 93 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/legacy/Piece.tsx: -------------------------------------------------------------------------------- 1 | import { observer } from "mobx-react"; 2 | import * as React from "react"; 3 | import { DragSource, DropTarget } from "react-dnd"; 4 | import { Color, colorToString, Kind, kindToString } from "shogi.js"; 5 | import KifuStore from "../common/stores/KifuStore"; 6 | import { getUrlWithReverse } from "./images/PieceImage"; 7 | 8 | export interface IProps { 9 | data: { color?: Color; kind?: Kind }; 10 | lastMove: any; // TODO 11 | x: number; 12 | y: number; 13 | kifuStore: KifuStore; 14 | 15 | connectDropTarget?: (obj: any) => Element; 16 | connectDragSource?: (obj: any) => Element; 17 | isDragging?: boolean; 18 | } 19 | 20 | function getLabel({ color, kind }: { color?: Color; kind?: Kind }) { 21 | if (typeof color === "undefined" || typeof kind === "undefined") { 22 | return "空き"; 23 | } 24 | return `${colorToString(color)} ${kindToString(kind)}`; 25 | } 26 | 27 | @DragSource( 28 | "piece", 29 | { 30 | beginDrag(props: IProps, monitor, component) { 31 | return { x: props.x, y: props.y, imgSrc: getPieceImage(props), signature: props.kifuStore.signature }; 32 | }, 33 | endDrag(props: IProps, monitor, component) { 34 | props.kifuStore.onInputMove({ from: monitor.getItem(), to: monitor.getDropResult() }); 35 | }, 36 | }, 37 | function collect(connect, monitor) { 38 | return { 39 | connectDragSource: connect.dragSource(), 40 | isDragging: monitor.isDragging(), 41 | }; 42 | }, 43 | ) 44 | @DropTarget( 45 | ["piece", "piecehand"], 46 | { 47 | drop(props: IProps, monitor, component) { 48 | return { x: props.x, y: props.y }; 49 | }, 50 | }, 51 | (connect, monitor) => ({ 52 | connectDropTarget: connect.dropTarget(), 53 | }), 54 | ) 55 | @observer 56 | export default class Piece extends React.Component { 57 | public render(): React.ReactNode { 58 | const label = getLabel(this.props.data); 59 | const div = this.props.connectDropTarget( 60 | this.props.connectDragSource( 61 |
62 | {label} 63 |
, 64 | ), 65 | ); 66 | 67 | const className = [ 68 | "kifuforjs-cell", 69 | this.props.lastMove && equalsPos(this.props.lastMove.to, this.props) ? "kifuforjs-cell--lastto" : "", 70 | ].join(" "); 71 | 72 | return {div}; 73 | } 74 | } 75 | 76 | function getPieceImage(props) { 77 | return getUrlWithReverse(props.data, props.kifuStore.reverseMode.isReversed); 78 | } 79 | 80 | function equalsPos(pos1, pos2) { 81 | return pos1.x === pos2.x && pos1.y === pos2.y; 82 | } 83 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/examples/kifu-for-flash-replace.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Kifu for Flash による棋譜再現例 6 | 17 | 18 | 19 | 読み込むスクリプト: 24 |
25 | 26 | Kifu for Flash による棋譜再現例(Flash Player 9が必要です)
28 | 29 | 別のウィンドウで開く(Unicode棋譜) 30 |
31 | 32 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 62 | 63 | 64 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /packages/Kifu-for-JS/src/index-legacy.tsx: -------------------------------------------------------------------------------- 1 | import { autorun, reaction, when } from "mobx"; 2 | import * as React from "react"; 3 | import { render } from "react-dom"; 4 | import KifuStore, { IOptions } from "./common/stores/KifuStore"; 5 | import Kifu from "./legacy/Kifu"; 6 | import KifuLite from "./lite/KifuLite"; 7 | import { onDomReady } from "./utils/util"; 8 | export const mobx = { autorun, when, reaction }; 9 | 10 | // Important to keep import of index.tsx to have the side effect to scan script tags 11 | import { getKifuStore as getKifuStoreFunc, setDefaultOptions as setDefaultOptionsFunc, defaultOptions } from "./index"; 12 | import { registry } from "./lite/KifuRegistry"; 13 | import { mergeOptions } from "./utils/optionsUtils"; 14 | 15 | export const getKifuStore = getKifuStoreFunc; 16 | export const setDefaultOptions = setDefaultOptionsFunc; 17 | 18 | export type ILegacyOptions = { 19 | mode?: "latest" | "legacy"; 20 | } & IOptions; 21 | 22 | export function loadString( 23 | kifu: string, 24 | idOrOptions?: string | ILegacyOptions, 25 | options?: ILegacyOptions, 26 | ): Promise { 27 | let id: string | undefined; 28 | if (typeof idOrOptions === "object") { 29 | options = idOrOptions; 30 | id = undefined; 31 | } else { 32 | id = idOrOptions; 33 | options = options || {}; 34 | } 35 | options.kifu = kifu; 36 | return loadCommon(id, options); 37 | } 38 | 39 | export function load( 40 | filePath: string, 41 | idOrOptions?: string | ILegacyOptions, 42 | options?: ILegacyOptions, 43 | ): Promise { 44 | let id: string | undefined; 45 | if (typeof idOrOptions === "object") { 46 | options = idOrOptions; 47 | id = undefined; 48 | } else { 49 | id = idOrOptions; 50 | options = options || {}; 51 | } 52 | options.src = filePath; 53 | return loadCommon(id, options); 54 | } 55 | 56 | function loadCommon(id: string | undefined, options: ILegacyOptions): Promise { 57 | return new Promise((resolve) => { 58 | if (!id) { 59 | id = "kifuforjs_" + Math.random().toString(36).slice(2); 60 | document.write("
"); 61 | } 62 | onDomReady(() => { 63 | const container = document.getElementById(id); 64 | if (!container) { 65 | throw new Error(`Container ${id} not found`); 66 | } 67 | const { mode, ...iOptions } = options; 68 | const kifuStore = new KifuStore(mergeOptions(iOptions, defaultOptions)); 69 | if (mode === "latest") { 70 | render(, container); 71 | } else { 72 | render(, container); 73 | } 74 | registry.register(container, kifuStore); 75 | resolve(kifuStore); 76 | }); 77 | }); 78 | } 79 | -------------------------------------------------------------------------------- /packages/shogi.js/src/Piece.test.ts: -------------------------------------------------------------------------------- 1 | import Piece from "./Piece"; 2 | 3 | describe("promote", () => { 4 | it("can be done", () => { 5 | const fu = new Piece("+FU"); 6 | fu.promote(); 7 | expect(new Piece("+TO")).toEqual(fu); 8 | }); 9 | it("is idempotent", () => { 10 | const fu = new Piece("+FU"); 11 | fu.promote(); 12 | expect(new Piece("+TO")).toEqual(fu); 13 | fu.promote(); 14 | expect(new Piece("+TO")).toEqual(fu); 15 | }); 16 | }); 17 | describe("unpromote", () => { 18 | it("can unpromote, and unpromote is idempotent", () => { 19 | const ky = new Piece("+KY"); 20 | ky.promote(); 21 | ky.unpromote(); 22 | expect(new Piece("+KY")).toEqual(ky); 23 | }); 24 | it("is idempotent", () => { 25 | const ny = new Piece("+NY"); 26 | ny.unpromote(); 27 | expect(new Piece("+KY")).toEqual(ny); 28 | ny.unpromote(); 29 | expect(new Piece("+KY")).toEqual(ny); 30 | }); 31 | }); 32 | describe("inverse", () => { 33 | it("normal", () => { 34 | const ke = new Piece("+KE"); 35 | ke.inverse(); 36 | expect(new Piece("-KE")).toEqual(ke); 37 | ke.inverse(); 38 | expect(new Piece("+KE")).toEqual(ke); 39 | }); 40 | }); 41 | describe("toCSAString", () => { 42 | it("normal", () => { 43 | const gi = new Piece("+GI"); 44 | expect(gi.toCSAString()).toBe("+GI"); 45 | }); 46 | }); 47 | describe("toSFENString", () => { 48 | it("normal", () => { 49 | expect(new Piece("+GI").toSFENString()).toBe("S"); 50 | expect(new Piece("-GI").toSFENString()).toBe("s"); 51 | expect(new Piece("+TO").toSFENString()).toBe("+P"); 52 | expect(new Piece("-TO").toSFENString()).toBe("+p"); 53 | }); 54 | }); 55 | describe("static promote", () => { 56 | it("normal", () => { 57 | expect(Piece.promote("KA")).toBe("UM"); 58 | expect(Piece.promote("UM")).toBe("UM"); 59 | expect(Piece.promote("KI")).toBe("KI"); 60 | }); 61 | }); 62 | describe("static unpromote", () => { 63 | it("normal", () => { 64 | expect(Piece.unpromote("RY")).toBe("HI"); 65 | expect(Piece.unpromote("HI")).toBe("HI"); 66 | expect(Piece.unpromote("OU")).toBe("OU"); 67 | }); 68 | }); 69 | describe("static canPromote", () => { 70 | it("normal", () => { 71 | expect(Piece.canPromote("KA")).toBe(true); 72 | expect(Piece.canPromote("UM")).toBe(false); 73 | expect(Piece.canPromote("KI")).toBe(false); 74 | }); 75 | }); 76 | describe("static fromSFENString", () => { 77 | it("normal", () => { 78 | expect(Piece.fromSFENString("S").toCSAString()).toBe("+GI"); 79 | expect(Piece.fromSFENString("s").toCSAString()).toBe("-GI"); 80 | expect(Piece.fromSFENString("+P").toCSAString()).toBe("+TO"); 81 | expect(Piece.fromSFENString("+p").toCSAString()).toBe("-TO"); 82 | }); 83 | }); 84 | --------------------------------------------------------------------------------