{"_id":"react-docgen-renderer-template","_rev":"4-a34565a9ed6d8656ea61174b4069a665","name":"react-docgen-renderer-template","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.0":{"name":"react-docgen-renderer-template","version":"0.0.0","description":"Allows you to create your own react-docgen based renderers","main":"lib/index.js","scripts":{"test":"lab","test:debug":"lab --coverage-exclude lib --inspect-brk","test:coverage:html":"lab -r console -o stdout -r html -o coverage.html"},"keywords":["react","react-docgen","template","render"],"repository":{"type":"git","url":"git+https://github.com/OriR/react-docgen-renderer-template.git"},"author":{"name":"Ori Riner"},"license":"MIT","devDependencies":{"code":"^5.2.0","lab":"^15.5.0"},"gitHead":"8277220f1ecc35f0c2c015c6b80e7e6be7d22405","bugs":{"url":"https://github.com/OriR/react-docgen-renderer-template/issues"},"homepage":"https://github.com/OriR/react-docgen-renderer-template#readme","_id":"react-docgen-renderer-template@0.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.0","_npmUser":{"name":"orir","email":"oririner@gmail.com"},"dist":{"integrity":"sha512-/wQ1fLvEqhM8OBY6glzm2H4/LN3mpH7NGQWfHuEvppxzmHhg1Aj0uKwndMbsgb5O7lkFhcNLbEokLvFPuWpyCQ==","shasum":"36c7b871aff52c7dacc00da45149e5e84153273f","tarball":"https://registry.npmjs.org/react-docgen-renderer-template/-/react-docgen-renderer-template-0.0.0.tgz","fileCount":7,"unpackedSize":8765,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVeFvCRA9TVsSAnZWagAA2T0P/0J3l2VjqkEb3xLkiXTv\n/a50ZNhPTy3WLMZ0doX4hcV8S0fBPnpC1FYJ6Tqjnoj3vRHT7jFYSZopOj8I\njE6Ytqc32FB0oAt4wwf6mE5bSKKT4gGFxi3E53o7XOWP0ArAjAXxutZXlAY4\nmUqecj1y1or7+Dname1UNqecflhw/MglHd3lUfnz4IxRAzXoqLFFvNJBOFDV\nQjh25wGENFY2J5vou5ICsbv2XggPe+wvuMFe1zW6M29DVl0y/Py5dhUfiwfD\nTVJV4ocO3iFiDxknjLytczHwpgpHf0hONGBt7XRD+v4rNiv05t/ZeVTe52lp\nnVwZZijHft1gz0h3GHZJ6eX4C7ujRu1CcI17hwSOgE6DT4QXNLoUxqyuCHXH\ngSiXXJPk9aGVCRG6yJiGrg50l7R3uvlZPcTn3IM0x4Ak0NwMwZszkAJbfqRr\nVZS9TuaxR/pHknyynWVktsofCEGN+NBhjZladbptcTXbGHfLn53LEDh/FJuH\nQyVMITev1DIvQzjm7V1RWo7OX6uDdHoGgd8si1hyx/zrNEGX6td6F8qbdSFs\nUUrhFgoRv3rc5SLbHJHUAODY4XTP/JsirVlzYDaaoxlR00ga2OxspWxgCaCT\nzazRTgbnRGLW/p9Q9FqmxtkKc8D2fSJiR+HgDBUa11fsx3u3peTful9KfCPy\nj1cG\r\n=xCpb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDODzluH+oz6SH7MaX1dKbNCTexjsVGe278lFBGyRrTPwIgCOIwdR5GTKERqO4EGnDQMNLVjHoSCCeYQlvRfkElc4k="}]},"maintainers":[{"name":"orir","email":"oririner@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-docgen-renderer-template_0.0.0_1549132143329_0.9957299776273751"},"_hasShrinkwrap":false},"0.0.1":{"name":"react-docgen-renderer-template","version":"0.0.1","description":"Allows you to create your own react-docgen based renderers","main":"lib/index.js","scripts":{"test":"lab","test:debug":"lab --coverage-exclude lib --inspect-brk","test:coverage:html":"lab -r console -o stdout -r html -o coverage.html"},"keywords":["react","react-docgen","template","render"],"repository":{"type":"git","url":"git+https://github.com/OriR/react-docgen-renderer-template.git"},"author":{"name":"Ori Riner"},"license":"MIT","devDependencies":{"code":"^5.2.0","lab":"^15.5.0"},"gitHead":"c1e6b93743ff3faffdd47c379e1f945bfa3ec39f","bugs":{"url":"https://github.com/OriR/react-docgen-renderer-template/issues"},"homepage":"https://github.com/OriR/react-docgen-renderer-template#readme","_id":"react-docgen-renderer-template@0.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.15.0","_npmUser":{"name":"orir","email":"oririner@gmail.com"},"dist":{"integrity":"sha512-OIdDsSXVZY7fU4CvqNN9w//oAgFxcO7iJ76q/BJPY8BW6j4PAfqQKNvXEl/Y13Fzz43FLjgwTMcKCChGgGnECw==","shasum":"a287006a85cf7a58cb263315a95cdd8b6f97a602","tarball":"https://registry.npmjs.org/react-docgen-renderer-template/-/react-docgen-renderer-template-0.0.1.tgz","fileCount":7,"unpackedSize":9714,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWFF5CRA9TVsSAnZWagAAs9gP/3DZDMjIvDOSIwpF1D3R\nWNXOMoE+tH2SVJpiKgDAzZH2s5u5NVXcYs9Nif6F9pl+kFVgqQ7vgUUB9S3E\ngr6cQxrCaeTK6BHTgDZNX0sCS78fRmX0L7pWJTzzGpX69ibuQ73jCymnB2qG\n7EdwPBP1IrVRGevG3g/b5BfrTTmkCgzMqlqt+9UMzdL+uHM7nH6NTL/BWVhh\nvQIz3QHYMnTzDlKZKoCMQsyTjzoJsKxiJXj1qVbVgOpFju6zsCv2bFR9gq1V\nYeGwuKYF0/1eON7YIoH2j/HRwPj3cSTB3j+nXhtauuXYIiiZh4R8SCc5jZj5\nTBTj6mDsA+jBKytIR0EogSM4PxGih6dKqOLuHtkUxbr5qWtgHUnAztbmghVv\n6kYZXzjvfeyI6OUuFnac27ul3sbPaQkwFPKiyo62Jc6YPmuaNnDFlFWea4W9\nBqU15ihuRdCiDgdQ6keKoU8duRantmfNnLOlprh8i3Bx+IZDWRyQh4ly74iC\njjG4XAE+PTMJtzj0n9qaVCoHsQKHqFZs3l5RyMH0ovtJjIVIAhqgdfeFq1el\nozBn5NekERu+MTzdfAlBDdPuxC8CzRc9LRkrrs8OKfIUS6O5dizlujyrZRfC\n0SrPRDIcu5E+Gdjatm32WXOBdRjkaTBvU1zS+Ekqo83ptJaJlZWfYtbAhUFY\ntlzd\r\n=nw6W\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDmRCkKn/XbnXLzV3cGcmfbzZzlSEIiqMFiyFmi5RBvYQIgKTXn8Ur6xEGieEexCHPmV1Fy5tzT0gFeI7alK8KMvnI="}]},"maintainers":[{"name":"orir","email":"oririner@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-docgen-renderer-template_0.0.1_1549291897389_0.5544958087773646"},"_hasShrinkwrap":false},"0.0.2":{"name":"react-docgen-renderer-template","version":"0.0.2","description":"Allows you to create your own react-docgen based renderers","main":"lib/index.js","scripts":{"test":"lab","test:debug":"lab --coverage-exclude lib --inspect-brk","test:coverage:html":"lab -r console -o stdout -r html -o coverage.html"},"keywords":["react","react-docgen","template","render"],"repository":{"type":"git","url":"git+https://github.com/OriR/react-docgen-renderer-template.git"},"author":{"name":"Ori Riner"},"license":"MIT","devDependencies":{"code":"^5.2.0","lab":"^15.5.0"},"gitHead":"6c1f0daddb0038b1272c69455dd878d682d49c3d","bugs":{"url":"https://github.com/OriR/react-docgen-renderer-template/issues"},"homepage":"https://github.com/OriR/react-docgen-renderer-template#readme","_id":"react-docgen-renderer-template@0.0.2","_npmVersion":"6.4.1","_nodeVersion":"10.15.0","_npmUser":{"name":"orir","email":"oririner@gmail.com"},"dist":{"integrity":"sha512-0UrdDaYzZBg3G84VnWIPmpEk9M4OkXpdz/TTHzmFSObR1OuVwqC9Pe51xJFeRehWfvQchNCAKmHHKP7c5h9Eig==","shasum":"e37f5afd180e3cbbe5b28352c5cc7fdbe9041397","tarball":"https://registry.npmjs.org/react-docgen-renderer-template/-/react-docgen-renderer-template-0.0.2.tgz","fileCount":7,"unpackedSize":10047,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWFbeCRA9TVsSAnZWagAA6c8P/1sc+PPxuXnth0XjWTKr\nSmD75qfY2/NJKc1JPVRe1+fP8rtu7SwIFW6tjtBDMLOLB1pnDVwmjkPBZFTB\n30tTqNbzBuoopjoYEdTmu3HrutQ9GM6dEk/ORiXQ3MtGgy9WlysRK5Z1/KAe\nrD1lGQDeKWal1IfFr5ccXUsj2cwavAt9BRM9VV2lziqgwN4DiREy5sUwYgXo\n4tzXLcsjIk8NScjmMDW0gapgQ70bXOuSVAbjiKsx7dhFYGN4BRtrhdgQybgC\ntbjaOcdrLWmi2oObiHbDXY+k3230iID47xMypxNU9934xl2VkJDqHHD4/oy1\nGkpnDqRBBfUnWD9TdIieqnw95df+Y8ZdrmMvEDLiVo9A1XYCciAAnxjSAfJ8\npOn1Ub6qCwgN5+ZhPnlx2ONyXt00w9m+B4ZdCek+iZP3pT2THQomZw0sQlN7\nf+rm26ZxRch18yfzoZlAJjQXlPSBsqgmw2iUgaXsrIvB10uaOoB6VQj+0kwI\nhanK2384RNBiTGITZ5mzB8GQ7mxjORIkQNEuutRjQSImYiMhkWh91jPdzEOe\nF7g9aSnDq5kT3rNtcDEcmQY6hWdgNwp85lk12cV1ARGERCw4ELMkxtooIerl\nTwRDb5duptVAvmLWX5Bobj16USbWW/meUjcrhvLF/d9qeMRFy3VufkzgMWFa\ne7e6\r\n=WUSG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGKGGRQhRYkKfRXM7NoCPvBjE2ML4zF/BAPQ1duxGgSLAiEAglWOqMTlYyplBM37M0sU8dPEntmo29rBRS6PX/qIJBQ="}]},"maintainers":[{"name":"orir","email":"oririner@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-docgen-renderer-template_0.0.2_1549293277564_0.6945346970128834"},"_hasShrinkwrap":false},"0.1.0":{"name":"react-docgen-renderer-template","version":"0.1.0","description":"Allows you to create your own react-docgen based renderers","main":"lib/index.js","scripts":{"test":"lab","test:debug":"node --inspect-brk=0.0.0.0 ./node_modules/.bin/lab --coverage-exclude lib","test:coverage:html":"lab -r console -o stdout -r html -o coverage.html"},"keywords":["react","react-docgen","template","render"],"repository":{"type":"git","url":"git+https://github.com/OriR/react-docgen-renderer-template.git"},"author":{"name":"Ori Riner"},"license":"MIT","devDependencies":{"code":"^5.2.0","husky":"^1.3.1","lab":"^15.5.0","lint-staged":"^8.1.4","prettier":"^1.16.4"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"ae9864bb15187c0535b03dfdefd0d5c6d6088e60","bugs":{"url":"https://github.com/OriR/react-docgen-renderer-template/issues"},"homepage":"https://github.com/OriR/react-docgen-renderer-template#readme","_id":"react-docgen-renderer-template@0.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.0","_npmUser":{"name":"orir","email":"oririner@gmail.com"},"dist":{"integrity":"sha512-3GyuFI9pBf3E2lW6oX6j3DvTQv55Wc9pWNKwDVcUFf8kDfpDyWmTeAYWPxoSEhSZxhEP+LV/1Tr4DLwE4CULQQ==","shasum":"29340c947ab42b0060aa8e1c64e379a822e2733e","tarball":"https://registry.npmjs.org/react-docgen-renderer-template/-/react-docgen-renderer-template-0.1.0.tgz","fileCount":6,"unpackedSize":9685,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZy7eCRA9TVsSAnZWagAAXO0P/j54LhHQ0T0aJizImIiD\nA++E2b+h8E+vrVzlziuZa5ZADIK95UO7w6UgaIq/xAtlamqaQYO5Ug0K170l\nG/B3eWKIsRQ+OK12B78Ayt5KwGmhCmVT8ak66szO2u5hziu8yh1m+daNNENZ\nfv2hHjYVgkg+CV4AVFmyddmx3gCs3tqWx54yrPwQE2IEZ8IULfgfH3wZ23i6\nYsbFXMh4+DMIdtCKvUoC0psgnKILGYsclIhbBc8WuK8ezEDsZ2cgbMqDyxk4\nijSEoTpPN8ma/McnMjwb/aeodF2GdT6eWaUVH3FVX2xyzX+igRmRfC3H8faw\nvsA8Nfo1k/PxDCMkl8ktarNmECPgg1P2289txwfEQJSrNlcKrvdpdnpmNB6C\nmeVd9e40HXLEVNSPI2MjBKgennrlRv4Kby5CjRLgJ+tpcqC1JY7X9d5YB44j\nc4ypiWVxILc/wF0aRUWqBdvshRpxcnG4Cmt9HFCp+Cbst3B0HSe934uK+S8g\nRdQl/UYXQTEKPDdNMLKExVdWIe8pdKxEhkix1g/OHWsjMP/0wURn794lbykZ\nMrZLySDUqis5A8sihQpLsY/SpKM9MUYlqTDTKdWFdP1bZ5iDGtDLyIOoCWw8\n9f/xkrpmnp8Tf+6VGnqRTDoffcW1nQSkqdAu+jlcUhePFxj0oPOfGmp1+Jhc\ndihJ\r\n=b6iN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDFWMr45w9lr5PABjSHeA+U47sc2mIBoUbj8CMEg6Al1wIhAMMXmn2Sy83MwUD7CC5iaCuJ2vQZB4JqKCjCfkMszRPZ"}]},"maintainers":[{"name":"orir","email":"oririner@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-docgen-renderer-template_0.1.0_1550266077535_0.21341317390198244"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-02T18:29:03.329Z","0.0.0":"2019-02-02T18:29:03.423Z","modified":"2022-05-14T09:44:26.968Z","0.0.1":"2019-02-04T14:51:37.514Z","0.0.2":"2019-02-04T15:14:37.656Z","0.1.0":"2019-02-15T21:27:57.653Z"},"maintainers":[{"name":"orir","email":"oririner@gmail.com"}],"description":"Allows you to create your own react-docgen based renderers","homepage":"https://github.com/OriR/react-docgen-renderer-template#readme","keywords":["react","react-docgen","template","render"],"repository":{"type":"git","url":"git+https://github.com/OriR/react-docgen-renderer-template.git"},"author":{"name":"Ori Riner"},"bugs":{"url":"https://github.com/OriR/react-docgen-renderer-template/issues"},"license":"MIT","readme":"## react-docgen-renderer-template\nA helper library for creating templates based on `react-docgen` objects.\n\n### Install\n```\nnpm install --save-dev react-docgen-renderer-template\n```\n\n### Usage\n**Template Creators**\n```javascript\nconst { template, type } = require('react-docgen-renderer-template');\n\n// The template function gets an object of key/value pairs that represent type mappings for the template.\n// The key is the type name and the value is a string to be displayed for that type.\n// The string can also be a template string with functions inside that get the context (current prop definition) and a getType function that returns the type of a specific prop.  \nconst templateCreator = template({\n  unknown: 'Unknown',\n  func: 'Function',\n  array: 'Array',\n  object: 'Object',\n  string: 'String',\n  number: 'Number',\n  bool: 'Boolean',\n  node: 'ReactNode',\n  element: 'ReactElement',\n  symbol: 'Symbol',\n  any: '*',\n  custom: '(custom validator)',\n  shape: 'Shape',\n  arrayOf: type`Array[]<${({ context, getType }) => getType(context.type.value) }>`,\n  objectOf: type`Object[#]<${({ context, getType }) => getType(context.type.value) }>`,\n  instanceOf: type`${({ context }) => context.type.value}`,\n  enum: type`Enum(${({ context, getType }) => context.type.value.map(value => getType(value)).join(', ')})`,\n  union: type`Union<${({ context, getType }) => context.type.value.map(value => getType(value)).join('|')}>`\n});\n\nconst template = templateCreator`This is my custom template to render a component docs.\nI can use custom functions that will interpolate according to the metadata about the component, like so:\n${({ context, getType}) => {\n  //context contains all the metadata about the component docs.\n  // context.componentName - the name of the component\n  // context.srcLinkUrl - the URL to link the source of the of the file to\n  // context.srcLink - the name to show for the link of the source of the file\n  // context.description - the description of the component\n  // context.props - the props the component has\n  // context.composes - an array of component objects that this component composes in its prop types (each object in the array is of the same type as this context object)\n  // context.isMissingComposes - whether or not there are some compositions that couldn't be resolved\n  // \n  // getType - a function that takes a type of a prop and returns its value according to the type mappings\n}}`\n\n```\n\nThe result of the template should be passed as-is to a renderer instance, for example [`react-docgen-markdown-renderer`](https://github.com/OriR/react-docgen-markdown-render).\n\n**Renderer Creators**\nThe `TemplateObject` contains two methods.\n\n**template.setPlugins**\nThis function gets an array of plugins to apply on the template.\nA plugin is an object with a function `getTypeMapping` that gets an options object with an `extension` - the extension of the template. That function returns an object with a key/value pairs, where each key is a type returned by `react-docgen` and the value is either a string to display for that type or a template string with functions as the templates (these will be called to populate the actual type) and should return a string.\n\n**template.instantiate**\nThis function instatiates the template.</br>\nIt gets the context to apply on the template, and the extension this template will be saved as (typically the format).</br>\nThis function returns the full blown template as a sring to be saved to the disk.\n\n\n\n### License\nMIT\n","readmeFilename":"README.md"}