{"_id":"5stars","_rev":"1-660fc49338c606a703343b0cdf204595","name":"5stars","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"5stars","version":"1.0.0","dependencies":{"ajv":"^6.10.2","bluebird":"^3.7.2","chalk":"^3.0.0","commander":"^4.0.1","debug":"^4.1.1","fs-extra":"^8.1.0","jsdom":"^15.2.1","request":"^2.88.0","request-promise":"^4.2.5","svgo":"^1.3.2"},"lint-staged":{"*.js":["eslint --fix","git add"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"bin":{"5stars":"./lib/index.js"},"scripts":{"test":"node test/test.js"},"devDependencies":{"eslint":"^6.7.2","husky":"^3.1.0","lint-staged":"^9.5.0"},"gitHead":"40796ebe7c5a038eef1371f4f657752ddb5f8eaf","description":":star::star::star::star::star:","_id":"5stars@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"8.16.0","_npmUser":{"name":"zhansingsong","email":"zhansingsong@gmail.com"},"dist":{"integrity":"sha512-RldoTDHGIdTkvj2BJtpobmGiwjBj9q0UUH25wUmyPl5QCRqaj8eASkkSQ4vSX+Vd7dXKtQKz46u4e3U/k1mD/A==","shasum":"56ac0f26e25456056189a95523c21fa61addd8b4","tarball":"https://registry.npmjs.org/5stars/-/5stars-1.0.0.tgz","fileCount":6,"unpackedSize":21779,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd5l0RCRA9TVsSAnZWagAA+GsQAJL7FDXwW6q0QLRbTvjc\nOpc4xDV9lt7MXe/STrdnqrZsOpk4+foHlSZcoJCBfyItRV9qojCp6h4jVMio\nK+t4rEC4ckTWLLdRkiUW4P3FiXvq7J6E3+6NdAR0MBPifz28lBIDhypaUXu1\nl8YsaqnPuTOgTQgKcSfGwNedUQ1MCU751oiwBaWbvHR06h2tMnt8mGuPGgiM\nx2nHTdp92vVcpkQlltjHZNwYLUgIUBgjM1DWOxyh8X2IpBXK9HU4vFAwzVq0\nFmc86ZpZCEQ6kcLbCOItA//E9Llb1XFBFFnT7tURoizr6HzYP0GfIx/ZT96A\nMKhtGiIbrwEs8PB3pVWRlRDdNStH2tlbo6paT5qvXbXlRlEMe9dMcrY1Ndfn\ncJaOy0t4GI0DLQWGf0xZkVP8kSX62N+dBfhIknsoMF61ufJDbmnbHRhJkeID\nLAS1GTXw38Z1i8jl4ME1hbWfYS5H+D8ad2L/a0LjqdWp2IM5bBIwox3G81IX\nFzU1nOr5FBj0YizAgXPsgMeNTTjQA7+QSIFLJTkrOEw0Sr3NBAmWBwAqrkn9\nQ2xazKi4vRi2lXuqfcDtf/SffsoxnuDvXachfUsHT5TgAsT1DLBUmopJAz/T\n/lv6OJKpSDCH6IBlMqvx+VX0SsNfQlO3s9g6kSjOKtNpJHcJyT1Jeti6pqR4\nweP0\r\n=dep7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0QKpyFdfwdwiRTjhFmc32Gjkum29yveOfAnB9HRzqSwIgWdahVKLBq94cdvCYxn6ooNwX6eoWTxoRhNJss8EIPMY="}]},"maintainers":[{"name":"zhansingsong","email":"zhansingsong@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/5stars_1.0.0_1575378193013_0.3503850152407677"},"_hasShrinkwrap":false}},"time":{"created":"2019-12-03T13:03:13.013Z","1.0.0":"2019-12-03T13:03:13.190Z","modified":"2022-04-04T10:23:23.711Z"},"maintainers":[{"name":"zhansingsong","email":"zhansingsong@gmail.com"}],"description":":star::star::star::star::star:","readme":"# 5star\n\n:star::star::star::star::star:\n\nA quickly generating 5 stars for rating based on SVG technique utility tool.\n\n[CHINESE DOC](./README_CN.md)\n\n## Features\n\n- supports `display` and `click` modes.\n- optimizes SVG files by [sogo](https://github.com/svg/svgo).\n- supports remote url file and local file.\n- generates fast.\n- supports `configuration` and `cli` usages.\n\n## Warn :warning:\n\n- **normal svg file and active svg file must be the same size, the both files are required as well.**\n- **normal svg file and active svg file need to be filled，in order to ensure 'click' mode work.**\n\n## Try it out\n\n- **`display` mode**\n\n```bash\nnpx 5stars -a https://raw.githubusercontent.com/zhansingsong/5stars/master/svgs/emoji-a.svg -b https://raw.githubusercontent.com/zhansingsong/5stars/master/svgs/emoji-b.svg -o output-emoji.svg -s 20\n```\n[output-emoji.svg](./medias/output-emoji.svg)\n\n![](./medias/output-emoji.svg)\n\n- **`click` mode**\n\n```bash\nnpx 5stars -a https://raw.githubusercontent.com/zhansingsong/5stars/master/svgs/emoji-a.svg -b https://raw.githubusercontent.com/zhansingsong/5stars/master/svgs/emoji-b.svg -o output-emoji-click.svg -m click -s 20\n```\n[output-emoji-click.svg](./medias/output-emoji-click.svg)\n\n![](./medias/click-mode-emoji.gif)\n\n\n## Getting started\n\n- If there is the following directory structure: **examples**\n\n  ```bash\n  examples\n  ├── config.json\n  ├── star-active.svg\n  └── star-normal.svg\n  ```\n\n- config.json\n\n  ```json\n  {\n    \"normal\": \"star-normal.svg\",\n    \"active\": \"star-active.svg\",\n    \"space\": 0,\n    \"width\": \"auto\",\n    \"height\": \"auto\",\n    \"computeSpace\": true,\n    \"mode\": \"display\",\n    \"output\": \"output.svg\"\n  }\n  ```\n- run the following command in current directory **examples**\n\n  ```bash\n  ➜  examples git:(master) ✗ npx 5stars\n  5stars  start generating ...\n          complete reading star-active.svg\n          complete reading star-normal.svg\n          complete creating new symbol element star-a\n          complete creating new symbol element star-b\n          start to output output.svg\n          done!\n  ```\n\n- `output.svg`\n\n  ![output](examples/output.svg)\n\n## Usage\n\n```\nnpx 5stars # use default config.json\nnpx 5stars -c yourConfigFile\nnpx 5stars --a star-normal.svg --b star-active.svg\n```\n\n- `display` mode\n\n  ```html\n  <!-- output.svg -->\n  <svg class=\"5stars-svg\" data-width=\"0.5\" id=\"5stars-svg\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"100%\" height=\"100%\"\n  viewBox=\"0 0 309.335 53.867\">\n    <!-- Generator: 5stars. https://github.com/zhansingsong/5stars -->\n    <!-- content -->\n  </svg>\n  ```\n  manipulate `output.svg` how to display by `data-width=\"0.5\"` attribute of the output svg.\n\n  The following output is `data-width=\"0.7\"`:\n\n  ![](./medias/output.svg)\n\n- `click` mode\n\n  ```html\n  <svg class=\"5stars-svg\" id=\"5stars-svg\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"100%\" height=\"100%\"\n  viewBox=\"0 0 309.335 53.867\">\n    <!-- Generator: 5stars. https://github.com/zhansingsong/5stars -->\n    <!-- content -->\n  </svg>\n  ```\n\n  If you want to control when the click operation ends, You can override `window._5stars_click_cb_(n)`:\n\n  ```js\n  window._5stars_click_cb_ = function (n) {\n    // end click operation when returning true\n    return n == 5;\n  }\n  ```\n  **[Example](./examples/click-preview.html)**\n\n  ```html\n  <!DOCTYPE html>\n  <html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n    <title>5stars click mode</title>\n  </head>\n  <body>\n    <script>\n    window._5stars_click_cb_ = function (n) {\n      // end click operation when returning true\n      return n == 5;\n    }\n    </script>\n\n    <svg class=\"5stars-svg\" id=\"5stars-svg\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"  width=\"100%\" height=\"100%\"\n    viewBox=\"0 0 269.335 53.867\">\n      <!-- Generator: 5stars. https://github.com/zhansingsong/5stars -->\n      <!-- content -->\n    </svg>\n  </body>\n  </html>\n  ```\n\n  ![](./medias/click-mode.gif)\n\n\n## config options\n\n```js\n// defaults\nconst config = {\n  // normal svg file\n  normal: undefined,\n  // active svg file\n  active: undefined,\n  // space between stars\n  space: 0,\n  // width of normal and active svg files\n  width: 'auto',\n  // height of normal and active svg files\n  height: 'auto',\n  // output path\n  output: './output.svg',\n  // if space isn't included on computing svg width.\n  computeSpace: false,\n  // generation mode: display | click\n  mode: 'display'\n};\n```\n- **normal**: normal svg file, required.\n- **active**: active svg file, required.\n- **space**: space between stars.\n- **width**: width of normal and active svg files.\n- **height**: height of normal and active svg files.\n- **output**: output path relative to current directory.\n- **computeSpace**: if space isn't included on computing svg width.\n- **mode**: generation mode\n  - **display**\n  - **click**\n\n## CLI\n\n```\nUsage: 5stars [options]\n\nOptions:\n  -v, --version           output the version number\n  -c, --config [config]   config file\n  -a, --normal [normal]   normal svg file\n  -b, --active [active]   active svg file\n  -s, --space [space]     space between stars\n  --width [width]         width of normal and active svg files\n  --height [height]       height of normal and active svg files\n  -o, --output [output]   output path\n  -m, --mode [mode]       generation mode\n  -M, --no-compute-space  if space is not included on computing svg width.\n  -h, --help              output usage information\n\nExamples:\n\n  $ 5stars # use default config.json\n  $ 5stars -c yourConfig.json\n  $ 5stars -a star-normal.svg -b star-active.svg\n```\n\n## License\n\n[MIT](LICENSE).\n","readmeFilename":"README.md"}