{"name":"potpack","version":"1.0.1","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":"5cd03cc54ce7f935e6e40cd375e62291bf382d05","_id":"potpack@1.0.1","_npmVersion":"6.4.0","_nodeVersion":"8.11.4","_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"dist":{"integrity":"sha512-15vItUAbViaYrmaB/Pbw7z6qX2xENbFSTA7Ii4tgbPtasxm5v6ryKhKtL91tpWovDJzTiZqdwzhcFBCwiMVdVw==","shasum":"d1b1afd89e4c8f7762865ec30bd112ab767e2ebf","tarball":"http://registry-npm.ywwl.com/potpack/download/potpack-1.0.1.tgz","fileCount":5,"unpackedSize":10098,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbg5M1CRA9TVsSAnZWagAA0YcQAJCdGJU8fSfDNbintEKX\nWomv9BHpSdw/OfWwkq688reFQWZoziaYSptCs7+iErsA3xEShXsObvhvpc7A\nbBjys5HoKpEZ5QeXvrKwvpprSqqQs4jq5M8hUjDi0kLWd/oorr2y17Q+qMWa\n0/hsHyQ1Lch+zIy3NH3IXCMmt4CgXLoMqfiUbENrTX9kAZvBiynod+5k1v/Y\nj9zNcPzOp/yYhKZJZtWCH5BlNxJw6dFd6rbpqX5DiWR3fHIwJzgoGMIQCmr+\nc0HHCEg9vJ2cy5bDLm9qgbagvEqfT5BIj/XDAs6uBK1jCYN167yH3ChxWADr\nvWoDAAvbZz+3eZoQCy+AjpNLuJklQi/WyBSFHyFZ+9Jhd2SbdPr4EOdyPSwi\nQ55pK51Th284s6d+q61hiXqUgTC41QA00vUhNFF6yD5qkhyyk0lD5xcLg5pC\nrlNuG2wGUUg8ZvVx7Zd4SGlxqL/hxAPN/Z0btX/FCxQ/w7+MamVeJ595vGnA\n+aCvU38lsEAVoKom3+7EMjyEEysdsLyDaLRz2eLVw78HZZ+weE94kC0JUwEN\nVeH0PCOGKSC/DvuK+qpCPerMUVlWsB0qHDkQOcTriBH5zc8Y1GR2d9xiiTaE\n/jlkh8M18t7cpWJSLDkbRASS9J0USSh1GX4ievn59hehdjCOqUMAXEBBeQtU\nre/N\r\n=QdRF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAQxu+SPAHz/NcsHVEuv0tsCMCmpUEAm+d0BfM433jSeAiEA6kP8VGS4Son9zUKrN68ch7cwTaxtO0d8QgrQw9QkrQI="}],"size":3221,"noattachment":false,"key":"/potpack/-/potpack-1.0.1.tgz"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/potpack_1.0.1_1535349556455_0.9334555218129665"},"_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":1535349556528,"_cnpm_publish_time":1535349556528,"dist-tags":{"latest":"2.1.0"}}