{"_id":"potpack","_rev":"3332292","name":"potpack","description":"A tiny library for packing 2D rectangles (for sprite layouts)","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"time":{"modified":"2024-07-10T07:27:48.000Z","created":"2018-08-23T11:32:12.709Z","2.0.0":"2022-10-17T10:01:17.622Z","1.0.2":"2021-10-22T08:26:55.083Z","1.0.1":"2018-08-27T05:59:16.528Z","1.0.0":"2018-08-23T11:32:12.709Z"},"users":{},"author":{"name":"Vladimir Agafonkin"},"repository":{"type":"git","url":"git+https://github.com/mapbox/potpack.git"},"versions":{"2.0.0":{"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":{"shasum":"61f4dd2dc4b3d5e996e3698c0ec9426d0e169104","size":2932,"noattachment":false,"key":"/potpack/-/potpack-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/potpack/download/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,"_cnpmcore_publish_time":"2022-10-19T19:36:47.348Z","publish_time":1666000877622,"_cnpm_publish_time":1666000877622},"1.0.2":{"name":"potpack","version":"1.0.2","description":"A tiny library for packing 2D rectangles (for sprite layouts)","main":"index","module":"index.mjs","unpkg":"index.js","jsdelivr":"index.js","types":"index.d.ts","scripts":{"pretest":"eslint index.mjs test.mjs bench.mjs","test":"node -r esm test.mjs","bench":"node -r esm bench.mjs","build":"rollup -c","start":"rollup -w","prepublishOnly":"npm run build"},"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","@rollup/plugin-buble":"^0.21.3","bin-pack":"^1.0.2","eslint":"^8.0.1","eslint-config-mourner":"^3.0.0","esm":"^3.2.25","rollup":"^2.58.0","tape":"^5.3.1"},"gitHead":"b2df24995f43740e362a1ceb2ad25da77e44dd88","_id":"potpack@1.0.2","_nodeVersion":"14.18.0","_npmVersion":"7.24.1","dist":{"shasum":"23b99e64eb74f5741ffe7656b5b5c4ddce8dfc14","size":3440,"noattachment":false,"key":"/potpack/-/potpack-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/potpack/download/potpack-1.0.2.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_1.0.2_1634891214911_0.16557632626017038"},"_hasShrinkwrap":false,"publish_time":1634891215083,"_cnpm_publish_time":1634891215083},"1.0.1":{"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":{"shasum":"d1b1afd89e4c8f7762865ec30bd112ab767e2ebf","size":3221,"noattachment":false,"key":"/potpack/-/potpack-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/potpack/download/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,"publish_time":1535349556528,"_cnpm_publish_time":1535349556528},"1.0.0":{"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":{"shasum":"c7e9eec8b9898f95bf1412e95e213e606bea7a60","size":3063,"noattachment":false,"key":"/potpack/-/potpack-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/potpack/download/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,"publish_time":1535023932709,"_cnpm_publish_time":1535023932709}},"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","_attachments":{},"homepage":"https://mapbox.github.io/potpack/","bugs":{"url":"https://github.com/mapbox/potpack/issues"},"license":"ISC"}