{"_id":"@20tab/leaflet-polydiff","name":"@20tab/leaflet-polydiff","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@20tab/leaflet-polydiff","version":"1.0.0","description":"Leaflet layer for efficient data fetching.","main":"./dist/index.js","types":"./dist/types/index.d.ts","module":"./dist/index.js","scripts":{"start":"webpack serve --open --mode development","test":"jest","e2e":"cypress open","lint":"eslint .","build:esm":"tsc","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/20tab/leaflet-polydiff.git"},"keywords":["leaflet","leaflet-plugin","leaflet-polydiff","leaflet-diff","turf","polygon","polygon-diff"],"author":{"name":"Valentino Gagliardi","email":"valentino@20tab.com","url":"https://www.20tab.com/en/"},"license":"MIT","bugs":{"url":"https://github.com/20tab/leaflet-polydiff/issues"},"homepage":"https://github.com/20tab/leaflet-polydiff#readme","devDependencies":{"@turf/bbox-polygon":"^6.5.0","@turf/difference":"^6.5.0","@turf/union":"^6.5.0","@types/jest":"^28.1.1","@types/leaflet":"^1.7.10","@types/randomcolor":"^0.5.6","@typescript-eslint/eslint-plugin":"^5.27.1","@typescript-eslint/parser":"^5.27.1","cypress":"^9.3.1","eslint":"^8.17.0","html-webpack-plugin":"^5.5.0","husky":"^8.0.1","jest":"^28.1.1","jest-environment-jsdom":"^28.1.1","leaflet":"^1.8.0","prettier":"^2.6.2","ts-jest":"^28.0.4","ts-loader":"^9.3.0","typescript":"^4.7.3","webpack":"^5.73.0","webpack-cli":"^4.9.2","webpack-dev-server":"^4.9.2"},"peerDependencies":{"@turf/bbox-polygon":"^6.5.0","@turf/difference":"^6.5.0","@turf/union":"^6.5.0","leaflet":"^1.8.0"},"jest":{"preset":"ts-jest","testEnvironment":"jsdom","testMatch":["**/__tests__/**/*.(test|spec).ts?(x)"],"collectCoverage":true,"collectCoverageFrom":["./src/**"],"coverageThreshold":{"global":{"lines":90}}},"eslintConfig":{"parser":"@typescript-eslint/parser","plugins":["@typescript-eslint"],"extends":["eslint:recommended","plugin:@typescript-eslint/recommended"],"rules":{"@typescript-eslint/consistent-type-imports":"error"}},"eslintIgnore":["node_modules","dist"],"gitHead":"0cc05435aa13505a9a57d3d3afe180e052b5a9dd","_id":"@20tab/leaflet-polydiff@1.0.0","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-VavpW/Ltty6mOq0/pxxflIDzGBwiaRrXXgkbQsxztCQ86F2RJymZVWROo/CcJmpGXMJ13w5i7wF6A3KJzyyaEg==","shasum":"0f30028d361e59bd6076922ea9e349b76bda2579","tarball":"https://registry.npmjs.org/@20tab/leaflet-polydiff/-/leaflet-polydiff-1.0.0.tgz","fileCount":12,"unpackedSize":9510,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBsGqfY4g7hTr1fc+hdQZEsE7e7fgVmQCrWSBjkZHQCoAiBKDmbRtLJcJeriSUPz4y5fdooLmNAjHw4g2Kjtx1LFsw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJin3H1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo0jw//flGrgNbfN/WQu9GaQmlDmOXVad8hbpIjG+nQNLqxDb9mUT5C\r\nJ64CkAucEjHq+sZP/6JFR9GBoan3+yVAS7iCHXVHZGgFlPrWGFmNQvMqVyr2\r\nGd8HDdBMAdcPMrRSLGWQM3oTYvWZuzp6iqzdW84qCMCr0hEAk2W4xxP3U+Pc\r\nmXaEX7GOr5DND4JqFWNHQ9clvhW8MDt57jkshoRkP7SHwaSAXGU6QArT4fVo\r\nNTD66ndm683orsAXIxCRO1EuNGhrhk07KhvzA9IVqlNmVBHZ270X8OtYpS6b\r\ntSdGgzN1k3c0mi9WEcATQdw6xdYThaWqsHRnZD1sUgkXN1qDUSR3fxpU3orO\r\n1IUv5C+J521gWRfO+iz7gElG38ZOssYgQUP+Y4qRQOJeyf5XgRb+VJvCygeC\r\ntrSqNy1L/5ZkjhD1NJVk7WqYNBAERQsB+vGPr8fcHe6rXFEDik/HrVyH0xJq\r\nxomXr2S479nYDssH6PB7IAy8j81ybrmHMK+AWvFl1pXHNbrPsrBkU3qebMFi\r\nBaRP+risp0Z9mrGMK3+wwR2q9vIX0oES2clabBO/znix/8ghieJE3zcyQ2Vx\r\nLGJvb3Wrk3pRSw7Ty8r3w4lkKvMuxDHJk7HaVai3sE6ehzkiCssyA76CH2n7\r\nLm9IY5QjWqWxeltntrRE5fqwWn+X+FOqyTA=\r\n=Lm0x\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"valentinog","email":"valentino@valentinog.com"},"directories":{},"maintainers":[{"name":"daniele20tab","email":"daniele@20tab.com"},{"name":"pauloxnet","email":"paolo@melchiorre.org"},{"name":"moreno_20tab","email":"moreno@20tab.com"},{"name":"valentinog","email":"valentino@valentinog.com"},{"name":"gabbork","email":"gabriele@20tab.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/leaflet-polydiff_1.0.0_1654616565428_0.37714217250600024"},"_hasShrinkwrap":false}},"time":{"created":"2022-06-07T15:42:45.365Z","1.0.0":"2022-06-07T15:42:45.540Z","modified":"2022-06-07T15:42:45.703Z"},"maintainers":[{"name":"daniele20tab","email":"daniele@20tab.com"},{"name":"pauloxnet","email":"paolo@melchiorre.org"},{"name":"moreno_20tab","email":"moreno@20tab.com"},{"name":"valentinog","email":"valentino@valentinog.com"},{"name":"gabbork","email":"gabriele@20tab.com"}],"description":"Leaflet layer for efficient data fetching.","homepage":"https://github.com/20tab/leaflet-polydiff#readme","keywords":["leaflet","leaflet-plugin","leaflet-polydiff","leaflet-diff","turf","polygon","polygon-diff"],"repository":{"type":"git","url":"git+https://github.com/20tab/leaflet-polydiff.git"},"author":{"name":"Valentino Gagliardi","email":"valentino@20tab.com","url":"https://www.20tab.com/en/"},"bugs":{"url":"https://github.com/20tab/leaflet-polydiff/issues"},"license":"MIT","readme":"# leaflet-polydiff\n> Leaflet layer for efficient data fetching.\n\n`leaflet-polydiff` keeps track of user movements to compute the **difference between newly visited area in the map, and the sum of all previously visited area**, thanks to [Turf.js](https://turfjs.org).\n\nThe resulting polygon can be used to make API calls to a backend, in order to optimize data fetching of GeoJSON feature.\n\n## Installation\n\nYou can install `leaflet-polydiff` with NPM:\n\n```bash\nnpm i @20tab/leaflet-polydiff\n```\n\nOr with YARN:\n\n```bash\nyarn add @20tab/leaflet-polydiff\n```\n\n## Usage\n\n`leaflet-polydiff` is distributed as an ES2015 module, and is intended to be used with a module bundler.\n\n```typescript jsx\nimport * as L from \"leaflet\";\n\nimport PolyDiff from \"@20tab/leaflet-polydiff\";\n\n/**\n * Map initialization.\n */\nconst copy =\n    \"© <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors\";\nconst url = \"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\";\nconst osm = L.tileLayer(url, { attribution: copy });\n\nconst leafletMap = L.map(\"map\", {\n    layers: [osm],\n    zoom: 15,\n    center: [43.71994, 10.948968],\n});\n\n/**\n * PolyDiff activation.\n */\n\nPolyDiff().addTo(leafletMap);\n\nleafletMap.on(\"polydiff\", (event) => {\n    // The event object will carry a diff polygon.\n    event.diff;\n});\n```\n\n## Props\n\n| Name         | Type                                                                  | Default       | Description                        |\n|--------------|-----------------------------------------------------------------------|---------------|------------------------------------|\n| eventName?   | string                                                                | \"polydiff\"    | The event name for the diff event. |\n| pane?        | [LayerOptions](https://leafletjs.com/reference.html#layer-pane) | \"overlayPane\" | See link.                          |\n| attribution? | [LayerOptions](https://leafletjs.com/reference.html#layer-pane) | null          | See link.                          |\n","readmeFilename":"README.md"}