{"name":"potpack","version":"2.0.0","description":"A tiny library for packing 2D rectangles (for sprite layouts)","main":"index.js","type":"module","exports":"./index.js","types":"index.d.ts","scripts":{"pretest":"eslint *.js","test":"node test.js"},"eslintConfig":{"extends":"mourner"},"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":{"@mapbox/shelf-pack":"^3.2.0","bin-pack":"^1.0.2","eslint":"^8.25.0","eslint-config-mourner":"^3.0.0","tape":"^5.6.1"},"gitHead":"49ba6c369e67f007a02e063ecfa935fcc597311d","_id":"potpack@2.0.0","_nodeVersion":"14.20.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-Q+/tYsFU9r7xoOJ+y/ZTtdVQwTWfzjbiXBDMM/JKUux3+QPP02iUuIoeBQ+Ot6oEDlC+/PGjB/5A3K7KKb7hcw==","shasum":"61f4dd2dc4b3d5e996e3698c0ec9426d0e169104","tarball":"http://registry-npm.ywwl.com/potpack/download/potpack-2.0.0.tgz","fileCount":5,"unpackedSize":7114,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCkIW/7RYP822PitlpWTVvS7rl+g2hhWy3r7pn6OB9wDQIgA1MvUPVA0seTlMhjI9vXqst569GdDq6T/AJCd9E8C98="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjTSftACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmooaQ/+MItP7zkCGB01hlrZrDRRJc+ccKjqNPkf2RkklzoP6xmyktVg\r\nTKruKTW0o/0fhhjgB50IKDHJy397BRh+lbD+kO4JY4NaPwdWV0CsWJqmwIY2\r\nUeJsHl/jtclVf3t8HXLM7EAdLZmDR5RRX64YBLdP1JzQ0MS4et5xBTbmjxEh\r\nvr7DN1DtVmuZw6pssTxxPHzf149zyQxs8BfbPvA9mNSeQi8pMlFxtapEmMHi\r\nPvBwkHpRnXomUm9WHD9h91KSkZ/olHaC2Knv4A8g3fNnyzd8Ip0w6Y/LrNNt\r\nggLzR8XnIL0DwEFIoPqW6OeCh6h9I8bDdEFO5VhLZUYN2S/6m3uxF4Qv9aUL\r\ntDQ8hJyR40FuKUXe7fwCb0WarJrXLGISPBNFLNDiZkTYtjUgAG9KmzELceYN\r\nbmdeuZZHIJFsOennTGM8rqd68oHH8bNe8A7ruvwOGEkvVu1SuhQAvz4aWdvb\r\n0Az0L7+tRpkN/dG5ha5sT1PBALAIiZxGysirJGQvcxuvJxVeTqanNx31a0Tt\r\n5Q4CBhRNGjUw93IFTijl4XL+WTVXGrdTSzfCPNmZEW/7As1Hk50mZb83Qokd\r\nB2Bt2GiUNB2FAWZEL1uoIsPgMZJrc2I5Wrcr/I6H/kIRottg8Qh8IcPt9Yfg\r\np2UaHXQcUUA6BT5bVoeKvYRPvNKtqqlakr0=\r\n=TVMX\r\n-----END PGP SIGNATURE-----\r\n","size":2932,"noattachment":false,"key":"/potpack/-/potpack-2.0.0.tgz"},"_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"directories":{},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/potpack_2.0.0_1666000877461_0.04325142832004247"},"_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":1666000877622,"_cnpm_publish_time":1666000877622,"dist-tags":{"latest":"2.1.0"}}