{"name":"potpack","version":"1.0.0","description":"A tiny library for packing 2D rectangles (for sprite layouts)","main":"index","module":"index.mjs","unpkg":"index.js","jsdelivr":"index.js","files":["index.mjs","index.js"],"scripts":{"pretest":"eslint index.mjs","test":"tape -r esm test.js","build":"rollup -c","start":"rollup -w","prepublishOnly":"npm run build"},"eslintConfig":{"extends":"mourner","parserOptions":{"sourceType":"module"},"rules":{"no-var":"error","prefer-const":"error"}},"repository":{"type":"git","url":"git+https://github.com/mapbox/potpack.git"},"keywords":["algorithms","sprites","bin packing","geometry","rectangles"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","bugs":{"url":"https://github.com/mapbox/potpack/issues"},"homepage":"https://mapbox.github.io/potpack/","devDependencies":{"eslint":"^5.4.0","eslint-config-mourner":"^2.0.3","esm":"^3.0.80","rollup":"^0.64.1","rollup-plugin-buble":"^0.19.2","tape":"^4.9.1"},"gitHead":"18384ee81dff89b050384639ee2816669fc47865","_id":"potpack@1.0.0","_npmVersion":"6.4.0","_nodeVersion":"8.11.4","_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"dist":{"integrity":"sha512-omcYiQZYfzOMB6oZN9wJoBPVFPZq0MJGRyv8D1Efv3JBG5hoY/suyprKFjPl0F60AwVx7gW3sIgAY0CeRvWSjg==","shasum":"c7e9eec8b9898f95bf1412e95e213e606bea7a60","tarball":"http://registry-npm.ywwl.com/potpack/download/potpack-1.0.0.tgz","fileCount":5,"unpackedSize":9757,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbfps9CRA9TVsSAnZWagAA9YwP/RRlzY7Ko+ovvYNq0NLh\n3KjTXOqEH6bg6lLzXkg3CVS+cuqHkuKRLXzUf7fQR9hRJIY7MXf52g/DH9DE\nHO+H2YSxCJ3VLjzRaB5ViYRf0KEAAjB6kXZeLAhXoPmkPuAtAJCnf4fjMM+a\n9EXCrPQ2QAcMr8g/s1SK1zf3cAJgwhee34h0766MROXY/bZCf4jZHCL2TUGA\nlQlKpJu/o+Qmx8H/LX8jmAak4Cl712WbKosIMDw6ESNXfnQhGMMQZflC+As+\nmmidoT3767DAhxEnfBrRwp3/MNp35qqB+BE6yJi7M2PZqylndW2X/hU73JsM\n6XtQz/oecsJ1VQvUU3uu3LA7Dx8tPLXXb+s8ROrXvX0PA3Agr1kYCwJIpzny\nErmnNd8rYDQyizCGwmO7mFK17Vwyt9TEDuqaNFVEaFElkLhT9wS7rb2cALqu\n+UAGM+bRH8JdKT1zFCEdjwY4kiWi/cy4HKCHAQvOe1pRJ9WJt47x1uGc+Jw8\nevRRlt7PJnoow0Jav6HMnbsc4Adzq/XVoRii4UaiNdsek0y5epD//INbAQMZ\nlzf+a0OT+2bP1jENluciOViu2NNZNfG+1Swat8ul9urxCYfUA1axV3cO2asF\n7Sfpn3mLlAnd9GuYBp4HPG17vtJ+aPSCWgK2qVxWIzFCnzjjmedEL2TC5pVS\njzdI\r\n=fF4D\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5gpYVlmXD9x+vBAl38yvgh9p7G8TjlCLYilUdTmmfwQIgcGJ1jqgM0ONMy3xUkk5963xewTlwn0jEvT3awFHQcfw="}],"size":3063,"noattachment":false,"key":"/potpack/-/potpack-1.0.0.tgz"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/potpack_1.0.0_1535023932602_0.6474571596817398"},"_hasShrinkwrap":false,"readme":"# potpack\n\nA tiny JavaScript library for packing 2D rectangles into a near-square container,\nwhich is useful for generating CSS sprites and WebGL textures. Similar to [shelf-pack](https://github.com/mapbox/shelf-pack),\nbut static (you can't add items once a layout is generated), and aims for maximal space utilization.\n\nA variation of algorithms used in\n[rectpack2D](https://github.com/TeamHypersomnia/rectpack2D) and\n[bin-pack](https://github.com/bryanburgers/bin-pack),\nwhich are in turn based on\n[this article by Blackpawn](http://blackpawn.com/texts/lightmaps/default.html).\n\n## [Demo](https://mapbox.github.io/potpack/)\n\n## Example usage\n\n```js\nimport potpack from 'potpack';\n\nconst boxes = [\n    {w: 300, h: 50},\n    {w: 100, h: 200},\n    ...\n];\n\nconst {w, h, fill} = potpack(boxes);\n// w and h are resulting container's width and height;\n// fill is the space utilization value (0 to 1), higher is better\n\n// potpack mutates the boxes array: it's sorted by height,\n// and box objects are augmented with x, y coordinates:\nboxes[0]; // {w: 300, h: 50,  x: 100, y: 0}\nboxes[1]; // {w: 100, h: 200, x: 0,   y: 0}\n```\n\n## Install\n\nInstall with NPM: `npm install potpack`.\n\nPotpack is provided as a ES module, so it's only supported on modern browsers, excluding IE:\n\n```html\n<script type=\"module\">\nimport potpack from 'https://cdn.skypack.dev/potpack';\n...\n</script>\n```\n\nIn Node, you can't use `require` — only `import` in ESM-capable versions (v12.15+):\n\n```js\nimport potpack from 'potpack';\n```\n","publish_time":1535023932709,"_cnpm_publish_time":1535023932709,"dist-tags":{"latest":"2.1.0"}}