{"_id":"@cassler/use-minesweeper","_rev":"6-1589eff14d61f477a6b09b53709cc131","name":"@cassler/use-minesweeper","dist-tags":{"beta":"0.0.3","latest":"0.0.5"},"versions":{"0.0.0":{"name":"@cassler/use-minesweeper","version":"0.0.0","types":"./dist/main.d.ts","style":"./dist/style.css","main":"./dist/main.umd.js","module":"./dist/main.js","directory":"dist","exports":{".":{"import":"./dist/main.js","require":"./dist/main.umd.js"}},"scripts":{"dev":"vite","build":"tsc && vite build && tsc --project tsconfig.build.json","preview":"vite preview","prepare":"yarn build"},"dependencies":{"react":"^17.0.2","react-dom":"^17.0.2"},"devDependencies":{"@testing-library/react":"^12.1.2","@testing-library/user-event":"^13.5.0","@types/jest":"^27.4.0","@types/node":"^17.0.13","@types/react":"^17.0.33","@types/react-dom":"^17.0.10","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","@vitejs/plugin-react":"^1.0.7","autoprefixer":"^10.4.2","eslint":"^8.2.0","eslint-config-airbnb":"19.0.4","eslint-config-airbnb-typescript":"^16.1.0","eslint-plugin-import":"^2.25.3","eslint-plugin-jsx-a11y":"^6.5.1","eslint-plugin-react":"^7.28.0","eslint-plugin-react-hooks":"^4.3.0","jest":"^27.4.7","postcss":"^8.4.5","postcss-apply":"^0.12.0","tailwindcss":"^3.0.18","ts-jest":"^27.1.3","typescript":"^4.4.4","vite":"^2.7.2"},"gitHead":"afb88b6af8ef262a073c22a23fb4cb47c5d21902","description":"## Demo Quickstart","_id":"@cassler/use-minesweeper@0.0.0","_nodeVersion":"14.18.1","_npmVersion":"8.4.0","dist":{"integrity":"sha512-4T9DEFHJVJqyNt2iEPiYwXVTXMus88rtPO0ra5A/iQ1xMp3ZhNRlkf2vMkQ29GxOubvg5loxwEsQxNzsxy71rQ==","shasum":"39bbe583082191f0f067923021da838c01be6df9","tarball":"https://registry.npmjs.org/@cassler/use-minesweeper/-/use-minesweeper-0.0.0.tgz","fileCount":7,"unpackedSize":32800,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiAnpaCRA9TVsSAnZWagAALDAP/2QZdnqr+MiaqRToC7wx\nu/c8ExeVXolDU2ZggjH8ly9sUzNKBu7XUgbX2YTQzdJHptjqFbJGZs6PDYkg\nsIf1zs13l6k7paGIeZUbc79t1+sNt75TK7hY67AMjbMawc6kB7pY9S1wKz/e\nEDtPVacR+rJ2qTobtXrL8qn3qLx93aDPYtjmIzQoEoazcZkl17DVhAFrPigU\nDsuuItGN/8UiToMK3LD+sPu+E45d0DdGELwpi07bN7EUClOkC/5FskRgYn86\nSd8SuiDYO99jvWaxiXZ/8FVuEskq5GFPOAdOushHJzsyIxrgP7rKb/UV2d1u\nzR+hMsQhtTPXxeakyQsxLu7/hol78rs/aWFUbKdNQVnnCLgLlT3Jn299GLg5\nJypZeXmrJcXcP2GFsCsr08ofLJcqbGv/Fx74FSZNOIR1bb/Oesql8CIAJUGS\nR9Flq141ZYp2JdOG92V3oBQgO38hwbvJ3TtTrpXbBwr9KX5ldkJ4eEHBXChl\nDjNdFYAMEFsb0xF5vWXbzKwXr9Jo5gi2EmwY7SeM45y04h7QY7dENotHYM5/\nJBwzRPGIxr+4qxUfwGLhQq3qpoOqJ0GdDIZIksOazFZqYdX7QYxkNoev9vAj\n0As0SueU+gLHQCotNQxqmo2QcGCt+JiDNtPlD723xxpmcoKWvjsOWAU+2rFC\nl3I0\r\n=/2jt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDsS+mEl3gJ8OseYu0n9WHE1/3ocwB2xrX9R6LTzfkr3gIhALPmpmQomFqJ7Fwq1zDE0L3Hq0819TNfdU2SmU8vtEIE"}]},"_npmUser":{"name":"cassler","email":"darin@cassler.net"},"directories":{},"maintainers":[{"name":"cassler","email":"darin@cassler.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-minesweeper_0.0.0_1644329562710_0.07988458348246508"},"_hasShrinkwrap":false},"0.0.1":{"name":"@cassler/use-minesweeper","version":"0.0.1","types":"./dist/main.d.ts","style":"./dist/style.css","main":"./dist/main.umd.js","module":"./dist/main.js","directory":"dist","exports":{".":{"import":"./dist/main.js","require":"./dist/main.umd.js"}},"scripts":{"dev":"vite","build":"tsc && vite build && tsc --project tsconfig.build.json","preview":"vite preview","prepare":"yarn build"},"dependencies":{"react":"^17.0.2","react-dom":"^17.0.2"},"devDependencies":{"@testing-library/react":"^12.1.2","@testing-library/user-event":"^13.5.0","@types/jest":"^27.4.0","@types/node":"^17.0.13","@types/react":"^17.0.33","@types/react-dom":"^17.0.10","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","@vitejs/plugin-react":"^1.0.7","autoprefixer":"^10.4.2","eslint":"^8.2.0","eslint-config-airbnb":"19.0.4","eslint-config-airbnb-typescript":"^16.1.0","eslint-plugin-import":"^2.25.3","eslint-plugin-jsx-a11y":"^6.5.1","eslint-plugin-react":"^7.28.0","eslint-plugin-react-hooks":"^4.3.0","jest":"^27.4.7","postcss":"^8.4.5","postcss-apply":"^0.12.0","tailwindcss":"^3.0.18","ts-jest":"^27.1.3","typescript":"^4.4.4","vite":"^2.7.2"},"readme":"# Minesweeper React\n\n## Using in a project\n\n`yarn install @cassler/use-minesweeper`\n\nImport the full component to use directly.\n\n```jsx\nimport { MineSweeper } from '@cassler/use-minesweeper';\nimport '/node_modules/@cassler/use-minesweeper/dist/style.css';\n```\n\nOr just the hook to compose your own version:\n\n```jsx\nimport { useMineSweeper } from '@cassler/use-minesweeper'\n```\n\n| Argument | Type | Default | Required | Description |\n| -------- | ----- | ----- | ------- | --------- |\n| `size`      | `number` | 12 | false | Dimensions of gameboard along each axis in absolute units. |\n| `difficulty` | `number` | 0.25 | false | Liklihood of a bomb being on any given square. Value between 0 and 1 |\n\n## Development\n\n`yarn & yarn dev` To install dependencies and launch a dev server on Vite.\n\n`yarn build` Will transpile ES and UMD flavors of modules - both are available for consumption. Notably, [UMD modules](https://github.com/umdjs/umd) which are capable of working everywhere, be it in the client, on the server or elsewhere. This includes compatability with `require` and `import` syntaxes with special-casing to handle CommonJS compatability.\n","readmeFilename":"README.md","gitHead":"e6c023391969e8206bc0cab6393fad1aae8323d1","description":"## Using in a project","_id":"@cassler/use-minesweeper@0.0.1","_nodeVersion":"14.18.1","_npmVersion":"8.4.0","dist":{"integrity":"sha512-nMWbF9g2j9vFf8nAqEK5gsTrlkSTx9MDsJdDayosXt138YhNYwRKiEUJVFDFbKq0hYqBzhrmBSWgJRd8NjIpsA==","shasum":"f0f03639ef2ba646257208e27b02f1f07e66d5d9","tarball":"https://registry.npmjs.org/@cassler/use-minesweeper/-/use-minesweeper-0.0.1.tgz","fileCount":7,"unpackedSize":32972,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiAn2JCRA9TVsSAnZWagAAxYgP/jMMAdeFyFTgMLUgTBr3\nuTqZCVrdRqOcNvRyf/X+VbBtlSwoVlTF4vjX19GKgX+IonR9jUHeWAwr5kz+\n4CTCUADs4nJhNuoSbC5x7lIs4oiaFj1C0g9jlVVI9V80Pg1/3i9AvsWVgqOs\nNiqIM7pOx3pmlHlDBAvGK/yVKU/Ee+9aSpdImL2/QOnV9KNt7pC1f/Qt1jca\n51K4DQ9F14JFuBPOpOdGyDNZkFFHNT9CJ4ZjIKabiSqtqnB3Hw0MoAK5EVSH\nb7Fbo5Dz/QxrXxqHGVjPeg1w/UFeFoZthP+tdf0X5uuaT6C7UJB6Wf4OfPx0\n9XszVZQl0JQWk4+qBsMNF3wpOaGQdxxZwPhhaGfbxsbGBW73f3CkPprf1aaE\n4EmwHDRlQh9qP0ZSfYpDDJQ2jn7vfH6PK8pFQ4Rft7mCNzfST/WBeQboz9Pp\nkiqYUVoKhX6zng+7E4pzNXhMMVzQi/Q8jcn6xzs54JkQ3s2ZPpoS5Oy7T7Uc\nbHxkOTNLX1BWGKARxPZnxmmeuIjXX0q0zY6Hwcmbev4d5gwcIwAKzqL1MrbP\ni3DldX0hShBByEyq7tShLj+7ytg6Q5R/vjzGtBYFcVEgcVJ17knMSzRZ5tPH\nENCsAGaKMth/86cxEXQUR0hNH7mja7zxeXHTp1WGFtOYWlN0hTuNLBlIyw5f\n7pfA\r\n=Sn7A\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDzA2oGZorF+owlnl7yLMjKWnwqBd9R5oY+4UWyHqKU4gIgCth3zKfg+783XlsbwRGdhvvtzS9R0cqY7nbp+Uc90cc="}]},"_npmUser":{"name":"cassler","email":"darin@cassler.net"},"directories":{},"maintainers":[{"name":"cassler","email":"darin@cassler.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-minesweeper_0.0.1_1644330377283_0.23146356781677335"},"_hasShrinkwrap":false},"0.0.2":{"name":"@cassler/use-minesweeper","version":"0.0.2","types":"./dist/main.d.ts","style":"./dist/style.css","main":"./dist/main.umd.js","module":"./dist/main.js","directory":"dist","exports":{".":{"import":"./dist/main.js","require":"./dist/main.umd.js"}},"scripts":{"dev":"vite","build":"tsc && vite build && tsc --project tsconfig.build.json","preview":"vite preview","prepare":"yarn build"},"dependencies":{"react":"^17.0.2","react-dom":"^17.0.2"},"devDependencies":{"@testing-library/react":"^12.1.2","@testing-library/user-event":"^13.5.0","@types/jest":"^27.4.0","@types/node":"^17.0.13","@types/react":"^17.0.33","@types/react-dom":"^17.0.10","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","@vitejs/plugin-react":"^1.0.7","autoprefixer":"^10.4.2","eslint":"^8.2.0","eslint-config-airbnb":"19.0.4","eslint-config-airbnb-typescript":"^16.1.0","eslint-plugin-import":"^2.25.3","eslint-plugin-jsx-a11y":"^6.5.1","eslint-plugin-react":"^7.28.0","eslint-plugin-react-hooks":"^4.3.0","jest":"^27.4.7","postcss":"^8.4.5","postcss-apply":"^0.12.0","tailwindcss":"^3.0.18","ts-jest":"^27.1.3","typescript":"^4.4.4","vite":"^2.7.2"},"homepage":"https://github.com/cassler/use-minesweeper#readme","bugs":{"url":"https://github.com/cassler/use-minesweeper/issues"},"repository":{"url":"git+https://github.com/cassler/use-minesweeper.git"},"readme":"# Minesweeper React\n\n## Using in a project\n\n`yarn install @cassler/use-minesweeper`\n\nImport the full component to use directly.\n\n```jsx\nimport { MineSweeper } from '@cassler/use-minesweeper';\nimport '/node_modules/@cassler/use-minesweeper/dist/style.css';\n```\n\nOr just the hook to compose your own version:\n\n```jsx\nimport { useMineSweeper } from '@cassler/use-minesweeper'\n```\n\n| Argument | Type | Default | Required | Description |\n| -------- | ----- | ----- | ------- | --------- |\n| `size`      | `number` | 12 | false | Dimensions of gameboard along each axis in absolute units. |\n| `difficulty` | `number` | 0.25 | false | Liklihood of a bomb being on any given square. Value between 0 and 1 |\n\n## Development\n\n`yarn & yarn dev` To install dependencies and launch a dev server on Vite.\n\n`yarn build` Will transpile ES and UMD flavors of modules - both are available for consumption. Notably, [UMD modules](https://github.com/umdjs/umd) which are capable of working everywhere, be it in the client, on the server or elsewhere. This includes compatability with `require` and `import` syntaxes with special-casing to handle CommonJS compatability.\n","readmeFilename":"README.md","gitHead":"39e3b817b0da9bc69603e6098e343b4af4df3bb9","description":"## Using in a project","_id":"@cassler/use-minesweeper@0.0.2","_nodeVersion":"14.18.1","_npmVersion":"8.4.0","dist":{"integrity":"sha512-uUjPtaX83ESVak9yCjCvRsrR8VWU82oV1qbwlv90qAQ+DEMH5FdrIeJk5vdxCQSqDlBxnO+oS5W1Mrq4lvJfoA==","shasum":"6734ca3c1be2f1f6b491b4f6b76472513f8b4ccf","tarball":"https://registry.npmjs.org/@cassler/use-minesweeper/-/use-minesweeper-0.0.2.tgz","fileCount":7,"unpackedSize":33198,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiAn7JCRA9TVsSAnZWagAA6iUP/28LmDMgYVQg89iRIXMO\nrOny1U8rba1omzVIt3x5QsLBYsn+zqsqwrLy26uknlIrlM19zKFM9qulw3Bc\nGhy0qxfdowmI2h4YkAF/Mu70m/vVBCi6yWwnRHVcCGRP8zcCDZEXiVbu+xKU\nsVy2Ll5nW6WD3jX+Po94y9kirLhYUujlPlUNNorw+yPkofrEtlzupkyPmHsz\nHIDSp30uCAdZhjVg4+pYVlvZR+GXqPJDEXUO2BnJKXlnpBrYvniKQTAry21o\nKNhJEzmIjb2nYVaoIDkazkNjMri/SfIhBnyE9Ew1jxDb/ei9B/U8JvcdcRwu\n3Hii46kee32zKYXNc/Sm9mBa1wuj4YAlfIv3rSEjSg1eadVg0evCKZHyQwoW\nOI7pYlb+AGAzZneKpLaZLHT8he816fc0V+xqk92XLU4dAGULu2Ay0HZLHuXL\ncuTwvN7NmxOMlWQCuqBhjI+Tq8997tzWcARbXbcwA0pOSaMILq1n2FFNY+jD\n3HjvnTnN4egPd9WgDV+EoNBGzn4RUJSQMqJCjjJYCi25Z9u0/tda4L83U6jw\n6oqWCm5KEQtQjZatqrTYwCPFiAD0b4BPE0tsPHWCfVeheOOV926w38VPYtuf\nMyWYeQFaH4jq54b8uoueMxQ8yeAyRYBMm01x+r4wMEq5Hq1/XHRcyFX0/dW8\nEmd+\r\n=AT02\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAc+K0yDmgJkAJmUHVp7+jhJHtjYVECg0Hzae5eMPHhLAiEAwhHh6xYgXuk1HOkM8+vXKi4fJB3qib/clUZfuDk9Nq8="}]},"_npmUser":{"name":"cassler","email":"darin@cassler.net"},"directories":{},"maintainers":[{"name":"cassler","email":"darin@cassler.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-minesweeper_0.0.2_1644330697594_0.3830298141251993"},"_hasShrinkwrap":false},"0.0.3":{"name":"@cassler/use-minesweeper","version":"0.0.3","types":"./dist/main.d.ts","style":"./dist/style.css","main":"./dist/main.umd.js","module":"./dist/main.js","directory":"dist","exports":{".":{"import":"./dist/main.js","require":"./dist/main.umd.js"}},"scripts":{"dev":"vite","build":"tsc && vite build && tsc --project tsconfig.build.json","preview":"vite preview","prepare":"yarn build"},"dependencies":{"react":"^17.0.2","react-dom":"^17.0.2"},"devDependencies":{"@testing-library/react":"^12.1.2","@testing-library/user-event":"^13.5.0","@types/jest":"^27.4.0","@types/node":"^17.0.13","@types/react":"^17.0.33","@types/react-dom":"^17.0.10","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","@vitejs/plugin-react":"^1.0.7","autoprefixer":"^10.4.2","eslint":"^8.2.0","eslint-config-airbnb":"19.0.4","eslint-config-airbnb-typescript":"^16.1.0","eslint-plugin-import":"^2.25.3","eslint-plugin-jsx-a11y":"^6.5.1","eslint-plugin-react":"^7.28.0","eslint-plugin-react-hooks":"^4.3.0","jest":"^27.4.7","postcss":"^8.4.5","postcss-apply":"^0.12.0","tailwindcss":"^3.0.18","ts-jest":"^27.1.3","typescript":"^4.4.4","vite":"^2.7.2"},"homepage":"https://github.com/cassler/use-minesweeper#readme","bugs":{"url":"https://github.com/cassler/use-minesweeper/issues"},"repository":{"url":"git+https://github.com/cassler/use-minesweeper.git"},"readme":"# Minesweeper React\n\n## Using in a project\n\n`yarn install @cassler/use-minesweeper`\n\n### MineSweeper React component\n\nImport the full component to use directly.\n\n```jsx\nimport { MineSweeper } from '@cassler/use-minesweeper';\nimport '/node_modules/@cassler/use-minesweeper/dist/style.css';\n```\n\n| Argument | Type | Default | Required | Description |\n| -------- | ----- | ----- | ------- | --------- |\n| `size`      | `number` | 12 | false | Dimensions of gameboard along each axis in absolute units. |\n| `difficulty` | `number` | 0.25 | false | Liklihood of a bomb being on any given square. Value between 0 and 1 |\n\n### useMinesweeper Hook\n\nOr just the hook to compose your own version:\n\n```jsx\nimport { useMineSweeper, BoardContext } from '@cassler/use-minesweeper'\n```\n\nThis provides most of what you need as an object. Below is an example implementation.\n\n```tsx\nexport interface Props { size: number, difficulty: number }\nexport function MyApp({ size = 12, difficulty = 0.25 }:Props) {\n  const { ctx, getGridStyle, isItemOpen, selectItem } = useMineSweeper(size, difficulty);\n  return (\n    <BoardContext.Provider value={ctx}>\n      <div style={getGridStyle(size)}>\n        {ctx.board.map((item, idx) => (\n          <button type=\"button\" onClick={() => selectItem(idx)}>\n            {isItemOpen(idx) ? `x${item.xAxis},y${item.yAxis}` : '?'}\n          </button>\n        ))}\n      </div>\n    </BoardContext.Provider>\n  );\n}\n```\n\n`useMinsweeper` provides the following for composition. The values for `board`, `flippedItems` and\n`selectItem` are included as a single `ctx` object for ease-of-use. You can destruture these further\nif you want to use something other than `React.Context`.\n\n| key  | type | description                 |\n| ---- | ---- | --------------------------- |\n| `ctx.board` | `object[]` | All items on the board in an array, see types for details |\n| `ctx.flippedItems` | `number[]` | All currently flipped items by absolute index. |\n| `ctx.selectItem` | `(idx:number) => void` | Update state to flip selected index |\n| `getGridStyle` | `(size:number) => CSSProperties` | Provide CSS grid styles to apply to board container. |\n| `handleNewGame` | `() => void` | Resets the game state and generates a new board. |\n| `setSize` | `(size:number) => void` | Build a new board from the given axis length |\n| `setDifficulty` | `(diff:number) => void` | Provide a value between 0 and 1 to build a new board with the given difficulty factor. |\n\n\n## Development\n\n`yarn & yarn dev` To install dependencies and launch a dev server on Vite.\n\n`yarn build` Will transpile ES and UMD flavors of modules - both are available for consumption. Notably, [UMD modules](https://github.com/umdjs/umd) which are capable of working everywhere, be it in the client, on the server or elsewhere. This includes compatability with `require` and `import` syntaxes with special-casing to handle CommonJS compatability.\n","readmeFilename":"README.md","gitHead":"5ec8afc0aa6c00c6d20e8eda77ee7db1c4f12d35","description":"## Using in a project","_id":"@cassler/use-minesweeper@0.0.3","_nodeVersion":"14.18.1","_npmVersion":"8.4.0","dist":{"integrity":"sha512-iBk1qLa7VejQYi6zOn7x7Ji2rX3vSW7U3Q/cOP9nhCg7JXpcQF8Eud0qXalMxy1aicmI/rrCzbL0s77YdjIynw==","shasum":"5d4b42181892e33627b003703c2224c8a3b8f8d2","tarball":"https://registry.npmjs.org/@cassler/use-minesweeper/-/use-minesweeper-0.0.3.tgz","fileCount":7,"unpackedSize":35319,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiArnmCRA9TVsSAnZWagAACz0QAKPes5IiR9AC4z+arZDj\n21Fq8ycjaNmSsrimGlFgD2iCHcDJfwOWlKCFQJrXiycH98CSXcSMsj85PYYp\nnjLIC521e2nEfbJRMJ9rc8Qjeef3pfINRSXK+V5XwA5HvZo5g5NFy4EXxFwb\nyWYCaaZ/HXERh0F3F4pC42jhjmGjXP47XvFxgaCAIchhYd/uEFDd/pF6Q9H2\n2j/LLqmkpU6l8a+P2FeykAJNdTci+ksjVZ7GkYUdFnGBkmc0tn0gnVa7JOmh\nK4Sb+wqsL21Fj+JzB/EQYhJVYenTsewayv1XeHE6pWxjxir04JS5wLpB/aK0\nNgiKPpufXvK9IVn/MlR4VXtTSIpyVSXdRwh61I3uPRzxcIqag7wmR26jkOZN\nf8VpzBELx5r/6g7ZKVb/B4uOFBWQd2xIr/YzeV3iksICDZK352ruJi1qSz3q\nXR6IKShgX0M1gu8nMVXATyljtQimZwiWujtaIRnOFQSmrZrphcpmzEEkMzws\nLv+CxlMWKPIXOEm/2xvNi78NA2jsx/jX5Rnlb58i7DO8fHe2Ahn03JMMLR1c\nNZz8PWEYg3/HUBNfLBtj7lbBZAHXnubewRU7zh9YajzV4XIYAp9fseRg35hT\nUIX7jZ/t2ELLxphXU1dDeCJSHyT7+tV7X3zRp2Nk4Zbtjs/07fYlYJ1MffcD\nVpEd\r\n=gvIv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCVBWnFZkzIkpPaWgShOinP5yNRi6nTIXFCxtL2rO3BrwIgC6KSMAyabhhpAx8xqwnifTU0rkrusx473m58Qf7VZn8="}]},"_npmUser":{"name":"cassler","email":"darin@cassler.net"},"directories":{},"maintainers":[{"name":"cassler","email":"darin@cassler.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-minesweeper_0.0.3_1644345830043_0.8458904195304218"},"_hasShrinkwrap":false},"0.0.4":{"name":"@cassler/use-minesweeper","version":"0.0.4","types":"./dist/main.d.ts","style":"./dist/style.css","main":"./dist/main.umd.js","module":"./dist/main.js","directory":"dist","exports":{".":{"import":"./dist/main.js","require":"./dist/main.umd.js"}},"scripts":{"dev":"vite","build":"tsc && vite build && tsc --project tsconfig.build.json","preview":"vite preview","prepare":"yarn build"},"dependencies":{"react":"^17.0.2","react-dom":"^17.0.2"},"devDependencies":{"@testing-library/react":"^12.1.2","@testing-library/user-event":"^13.5.0","@types/jest":"^27.4.0","@types/node":"^17.0.13","@types/react":"^17.0.33","@types/react-dom":"^17.0.10","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","@vitejs/plugin-react":"^1.0.7","autoprefixer":"^10.4.2","eslint":"^8.2.0","eslint-config-airbnb":"19.0.4","eslint-config-airbnb-typescript":"^16.1.0","eslint-plugin-import":"^2.25.3","eslint-plugin-jsx-a11y":"^6.5.1","eslint-plugin-react":"^7.28.0","eslint-plugin-react-hooks":"^4.3.0","jest":"^27.4.7","postcss":"^8.4.5","postcss-apply":"^0.12.0","tailwindcss":"^3.0.18","ts-jest":"^27.1.3","typescript":"^4.4.4","vite":"^2.7.2"},"homepage":"https://github.com/cassler/use-minesweeper#readme","bugs":{"url":"https://github.com/cassler/use-minesweeper/issues"},"repository":{"url":"git+https://github.com/cassler/use-minesweeper.git"},"gitHead":"b8c1afb6ce911429cde2d2194cfa76d5b2726edb","description":"## Using in a project","_id":"@cassler/use-minesweeper@0.0.4","_nodeVersion":"14.18.1","_npmVersion":"8.4.0","dist":{"integrity":"sha512-8IAEaZrzsPmilW44E305c5YYplEPDAdC99Fnn3Mw0n33GBviebJgTJy2giV1cn8LSmII+0fXLGKapMdCQGU9Yw==","shasum":"aac11c756edd086279cf6c098a89e6c8f9d6c827","tarball":"https://registry.npmjs.org/@cassler/use-minesweeper/-/use-minesweeper-0.0.4.tgz","fileCount":7,"unpackedSize":35319,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiArpXCRA9TVsSAnZWagAA4uIP/ArIcsSwUU50bR/WKTw2\n/NDPVPk8TGwMpmFp1APZDQqkhtTwchIFIovVenC+DBaSjA7aoBy5VoZsG9a/\noBSIU8CConKqv7gbjh/2eTwJjJ+k2tAuU1k84deJmktl+99i64UxWUrmiN10\nQNXHF98R1o80LKjeKyMD4fTPcTdzj/pZ8cD92xsPrvEMj5LTrl3KKinCa/Y3\n6Lsd4vZUWKaR1PnRfKiMDPLU047UdW2cNrAuItXM6Cemfi5v99JxprM5niAB\nsGgyM1oCvyI7U5P1qnCliUhtWo11Dhkm/De+tukbuL/qJgPBsJH+zCT/+i7R\ntpUqXxLkIb/5qSvWi+hEzyEVCvihPn85N7Cri28WcQbi6RO235fpZtkw/zwZ\nfh5L9YQaJJGuid3nsQAWcNycNZvczNQwJ9jKvy9EXBDqcujgq7cZApoMS0aj\nh4Jwx0slAopOJFWDuTQ6VHQba2hUMnoWnssxGjFQ5bLBLmSBMKaZIcfkdlQD\nZeLSxzXZHtJRDXlcJltDOjRVyhVkG8xBBzH2FJq4hKAhSlIReK/B6Y+wpnF4\nGp+L+4doRIldOg/Zq2DjyPCXRSHZqNsVOusOIljxZDXeukdDwTP7xRKUbVjU\n94DGFtIZCNJUVvojdJP5HHPdhyFTIkDdtcRuNtLETx7AP/egCykPqlTStiul\nrYO7\r\n=Qlz4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSc9zTCp0TTiUkH5Uhct58tUX5tSqiOcNxg2FyP4SQHgIgWuP2RIE+7gKNJgKgIJZ1mhlPk/d62ykC1q4fqgRLVIg="}]},"_npmUser":{"name":"cassler","email":"darin@cassler.net"},"directories":{},"maintainers":[{"name":"cassler","email":"darin@cassler.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-minesweeper_0.0.4_1644345943830_0.7167737306668154"},"_hasShrinkwrap":false},"0.0.5":{"name":"@cassler/use-minesweeper","version":"0.0.5","types":"./dist/main.d.ts","style":"./dist/style.css","main":"./dist/main.umd.js","module":"./dist/main.js","directory":"dist","exports":{".":{"import":"./dist/main.js","require":"./dist/main.umd.js"}},"scripts":{"dev":"vite","build":"tsc && vite build && tsc --project tsconfig.build.json","preview":"vite preview","prepare":"yarn build"},"dependencies":{"@headlessui/react":"^1.4.3","react":"^17.0.2","react-dom":"^17.0.2"},"devDependencies":{"@testing-library/react":"^12.1.2","@testing-library/user-event":"^13.5.0","@types/jest":"^27.4.0","@types/node":"^17.0.13","@types/react":"^17.0.33","@types/react-dom":"^17.0.10","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","@vitejs/plugin-react":"^1.0.7","autoprefixer":"^10.4.2","eslint":"^8.2.0","eslint-config-airbnb":"19.0.4","eslint-config-airbnb-typescript":"^16.1.0","eslint-plugin-import":"^2.25.3","eslint-plugin-jsx-a11y":"^6.5.1","eslint-plugin-react":"^7.28.0","eslint-plugin-react-hooks":"^4.3.0","jest":"^27.4.7","postcss":"^8.4.5","postcss-apply":"^0.12.0","tailwindcss":"^3.0.18","ts-jest":"^27.1.3","typescript":"^4.4.4","vite":"^2.7.2"},"homepage":"https://github.com/cassler/use-minesweeper#readme","bugs":{"url":"https://github.com/cassler/use-minesweeper/issues"},"repository":{"url":"git+https://github.com/cassler/use-minesweeper.git"},"gitHead":"510c5a38598d935a535d5279ae9d37d4f2ca7882","description":"## Using in a project","_id":"@cassler/use-minesweeper@0.0.5","_nodeVersion":"14.18.1","_npmVersion":"8.4.0","dist":{"integrity":"sha512-ETC/AL7mOcmgI1f9Vhq6+Q8F9ZgO0ms7JyJ/OOdlE5uyzQLkNuwEA48UhAnVW2GQVrnQBIFPmkPKBSwwycG58A==","shasum":"cfbf6aa75ce48a798d7d4665e27f6079be89687a","tarball":"https://registry.npmjs.org/@cassler/use-minesweeper/-/use-minesweeper-0.0.5.tgz","fileCount":7,"unpackedSize":97164,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiDaquCRA9TVsSAnZWagAAt+kQAKEG4ZTynUzmOMaaoUoo\nSLVybXwfAFLIcuPco8oJSHXKCaAdnOG8sWsi/1m/m/jl4XTwEuZWBKazhzAQ\n+X4lKfnCfDMqG8HjOSnxfU3Mlgm76QP1sm4nuwFVbaIbU926gq89lRsUtua3\nQxkFgi/6oVSSI60l8ziySYC6UrM/yBAK6Y/Y7KT7e+zGrGbz23EBMlyemhlI\n7tkVFvtX6+9ciSa/SgLZLoJxwY10EqIM2iyF+kcEoAk7fwjJp7BFAH9fA5G3\nZ3jrfxnEyspCLXZpeMA1zZKJWBnPMfh6EQPTxtc8lW0ZMWjsqnJQdKoIckNZ\nXwd9ISNs8MxjJEitlXG3hTcA06VtTdHEyNyU5nD5tbwOlz4Ed7vHCFWuadiB\nkOx1CKg6fah8mMstkgQOo6yG0V30rRMzPJpKI5+E9CEA2jyJ9Gk9nG1kaBdQ\nKTMeE6DE3ZC8pBLBH3eS8R6TO/x7qcu2TM0OzV7T53FCbuO2z9NaE2ir5aQi\n7vHZmaINTle6ra7rsDQExhu/SDa3KYJYSQjBG7c8O13xHxD7hpIyUx9DiZck\nba13XRKNzkFKeZdc5+hTCKWwUV83tYl6Un/ACR9f5qLXzzWvz8c3XdtnJcd5\nnqIm1hk7jNB9MNyEEcYSmLnsETcX2wru1u3SSlVavlB0C8XtHapgYOeKDMDc\n7e34\r\n=0gIc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6O3ZYFruU5uQAEf1EQAdtvGn//E1gESUor5HE8cRouAIhAIoWEVs+KR1vTIwaBliaE1stzEl4Mc2rDkMHTfTKvDDW"}]},"_npmUser":{"name":"cassler","email":"darin@cassler.net"},"directories":{},"maintainers":[{"name":"cassler","email":"darin@cassler.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-minesweeper_0.0.5_1645062829943_0.95278507011525"},"_hasShrinkwrap":false}},"time":{"created":"2022-02-08T14:12:42.660Z","0.0.0":"2022-02-08T14:12:42.835Z","modified":"2022-04-04T22:03:18.611Z","0.0.1":"2022-02-08T14:26:17.515Z","0.0.2":"2022-02-08T14:31:37.734Z","0.0.3":"2022-02-08T18:43:50.202Z","0.0.4":"2022-02-08T18:45:43.964Z","0.0.5":"2022-02-17T01:53:50.057Z"},"maintainers":[{"name":"cassler","email":"darin@cassler.net"}],"description":"## Using in a project","readme":"# Minesweeper React\n\n## Using in a project\n\n`yarn install @cassler/use-minesweeper`\n\n### MineSweeper React component\n\nImport the full component to use directly.\n\n```jsx\nimport { MineSweeper } from '@cassler/use-minesweeper';\nimport '/node_modules/@cassler/use-minesweeper/dist/style.css';\n```\n\n| Argument | Type | Default | Required | Description |\n| -------- | ----- | ----- | ------- | --------- |\n| `size`      | `number` | 12 | false | Dimensions of gameboard along each axis in absolute units. |\n| `difficulty` | `number` | 0.25 | false | Liklihood of a bomb being on any given square. Value between 0 and 1 |\n\n### useMinesweeper Hook\n\nOr just the hook to compose your own version:\n\n```jsx\nimport { useMineSweeper, BoardContext } from '@cassler/use-minesweeper'\n```\n\nThis provides most of what you need as an object. Below is an example implementation.\n\n```tsx\nexport interface Props { size: number, difficulty: number }\nexport function MyApp({ size = 12, difficulty = 0.25 }:Props) {\n  const { ctx, getGridStyle, isItemOpen, selectItem } = useMineSweeper(size, difficulty);\n  return (\n    <BoardContext.Provider value={ctx}>\n      <div style={getGridStyle(size)}>\n        {ctx.board.map((item, idx) => (\n          <button type=\"button\" onClick={() => selectItem(idx)}>\n            {isItemOpen(idx) ? `x${item.xAxis},y${item.yAxis}` : '?'}\n          </button>\n        ))}\n      </div>\n    </BoardContext.Provider>\n  );\n}\n```\n\n`useMinsweeper` provides the following for composition. The values for `board`, `flippedItems` and\n`selectItem` are included as a single `ctx` object for ease-of-use. You can destruture these further\nif you want to use something other than `React.Context`.\n\n| key  | type | description                 |\n| ---- | ---- | --------------------------- |\n| `ctx.board` | `object[]` | All items on the board in an array, see types for details |\n| `ctx.flippedItems` | `number[]` | All currently flipped items by absolute index. |\n| `ctx.selectItem` | `(idx:number) => void` | Update state to flip selected index |\n| `getGridStyle` | `(size:number) => CSSProperties` | Provide CSS grid styles to apply to board container. |\n| `handleNewGame` | `() => void` | Resets the game state and generates a new board. |\n| `setSize` | `(size:number) => void` | Build a new board from the given axis length |\n| `setDifficulty` | `(diff:number) => void` | Provide a value between 0 and 1 to build a new board with the given difficulty factor. |\n\n\n## Development\n\n`yarn & yarn dev` To install dependencies and launch a dev server on Vite.\n\n`yarn build` Will transpile ES and UMD flavors of modules - both are available for consumption. Notably, [UMD modules](https://github.com/umdjs/umd) which are capable of working everywhere, be it in the client, on the server or elsewhere. This includes compatability with `require` and `import` syntaxes with special-casing to handle CommonJS compatability.\n","readmeFilename":"README.md","homepage":"https://github.com/cassler/use-minesweeper#readme","repository":{"url":"git+https://github.com/cassler/use-minesweeper.git"},"bugs":{"url":"https://github.com/cassler/use-minesweeper/issues"}}