{"bugs":{"url":"https://github.com/code-hike/codehike/issues"},"dist":{"shasum":"6a5b5507c7812be2dab9047d2072c867c9c43b35","tarball":"https://registry.npmjs.org/@code-hike/classer/-/classer-0.3.0-next.2.tgz","fileCount":7,"integrity":"sha512-Hn3hi7PpSFUyA7NjsXyjH4G195Q19hnmVTZCVJdNgEaKV2XC0Og+4RyLCmyYV5hFqfmxxVVXx3XYwLX3hwuL3A==","signatures":[{"sig":"MEUCIQCbKjEnmubPIpFzIGfaA+P2/DMDDKlwT4VgL16x91LJ7QIgNg9tonEBZWbqWkrkwI9e6ZMY++CRtO3ZBtYBjQ673/w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14149,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgTlP9CRA9TVsSAnZWagAALugP/1F13aGYs4MAzwWtPUJD\nP5vjcewvMwnzlkpSgHEgy3VkvYlBSsl8QXrKSDS4uelVwfcB+iiM7JyQb5XQ\nFgMALoLIuA4v8ThrgsTBXo9tY6SGvRieVX6hf1FDtpbqBt1vul5QK/jB3VJB\nGMMemcWpEPsvwrTpE5kVUdaApaQBOw6NhnU8mchFjJ8xDUmlNss1iOffYqhH\ndk7fCggE1pXhp5Zmj8yCrx1PS8Eq9VhjKLa6DiMCh+Rb3BxQsqqcgjT7YTq7\nRAaTLyPI+Jyz6kgqSGDxTqgS16Va/sOlq/hgOy5VOafTWJRi34UW5mZF0sfN\niNLlBHkFfvyI1Y6bqUnhOZ0rrXXiJs956R8iqoiJ+h1N1fmNIxfmsetElo0G\nVDAleXdTtEsdvOT5dHZoN104QxqFjP8Xfb0w0QtJpDLLm/EZiYougQ7RT59o\nS+g/5j/kt0a/CFzaSij0wxz7nUFH0RQ7Xu3n9+O2MSOk9JjY3mZ8X2ntB6HG\n2XMKprEw8w2J5oLRaVO004VpTm9YAH7lzD1GhTuF98TTlI6cGOyI8kLFBKEr\nVJTyht9tQecNbxssVGlhfJYq/m5vBJQ6QiZQzlRxyWUdX5jaUo4QAEDOIXjo\nb+Wc55P4I/rXn2Yv5jQ6SXn/vX17Te4tqt97Cn5tQ7zNaCEErFjFJ4Zv/7Yl\niot0\r\n=Ge6C\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","name":"@code-hike/classer","author":{"name":"Rodrigo Pombo"},"module":"dist/index.esm.js","readme":"> Classer is a tool from [Code Hike](https://codehike.org)\n\nA little package to make React component libraries interoperable with most styling solutions. ([See this twitter thread explaining why this is useful](https://twitter.com/pomber/status/1362125599607820290))\n\nYou write your library code like this:\n\n```jsx\n// foo-library code\nimport { useClasser } from \"@code-hike/classer\"\n\nexport function Foo({ classes }) {\n  const c = useClasser(\"foo\", classes)\n  return (\n    <div className={c(\"container\")}>\n      <h1 className={c(\"title\")}>Hello</h1>\n      <p className={c(\"description\")}>World</p>\n      <img\n        className={c(\"img\")}\n        src=\"https://placekitten.com/200/200\"\n      />\n    </div>\n  )\n}\n```\n\nAnd the library consumers use it like this in their apps:\n\n```jsx\nimport { Foo } from \"foo-library\"\n\nconst classes = {\n  \"foo-title\": \"my-app-blue\",\n  \"foo-img\": \"rounded-corners some-border\",\n}\n\nfunction MyApp() {\n  return <Foo classes={classes} />\n}\n```\n\n`MyApp` renders this HTML:\n\n```html\n<div class=\"foo-container\">\n  <h1 class=\"foo-title my-app-blue\">Hello</h1>\n  <p class=\"foo-description\">World</p>\n  <img\n    class=\"foo-img rounded-corners some-border\"\n    src=\"https://placekitten.com/200/200\"\n  />\n</div>\n```\n\nExamples:\n\n- [With Emotion](https://codesandbox.io/s/classer-emotion-b7go0)\n- [With Tailwind](https://codesandbox.io/s/classer-tailwind-wfs1d)\n\n## Context\n\nYou can also do this (to avoid passing `classes` to nested components):\n\n```jsx\n// foo-library code\nimport {\n  useClasser,\n  ClasserProvider,\n} from \"@code-hike/classer\"\n\nexport function Foo({ classes }) {\n  return (\n    <ClasserProvider classes={classes}>\n      <FirstChild />\n      <SecondChild />\n    </ClasserProvider>\n  )\n}\n\nfunction FirstChild() {\n  const c = useClasser(\"foo-first\")\n  return <h1 className={c(\"title\")}>Hi</h1>\n}\n\nfunction SecondChild() {\n  const c = useClasser(\"foo-second\")\n  return <h1 className={c(\"title\")}>Ho</h1>\n}\n```\n\n```jsx\nimport { Foo } from \"./foo-library\"\nimport styles from \"./app.module.css\"\n\nconst classes = {\n  \"foo-title\": styles.myTitle,\n  \"foo-img\": styles.myImage,\n}\n\nfunction MyApp() {\n  return <Foo classes={classes} />\n}\n```\n\n## License\n\nMIT\n","funding":{"url":"https://opencollective.com/codehike","type":"opencollective"},"gitHead":"6c9d78549b02682cd8502391b9f3b85d0ee5080f","license":"MIT","scripts":{"x":"x","publish-canary":"yarn publish --tag canary --access public"},"typings":"dist/index.d.ts","_npmUser":{"name":"pomber","email":"pombopombopombo@gmail.com"},"homepage":"https://codehike.org","repository":{"url":"git+https://github.com/code-hike/codehike.git","type":"git"},"_npmVersion":"lerna/4.0.0/node@v14.16.0+x64 (linux)","description":"> Classer is a tool from [Code Hike](https://codehike.org)","directories":{},"maintainers":[{"name":"pomber","email":"pombopombopombo@gmail.com"}],"_nodeVersion":"14.16.0","_hasShrinkwrap":false,"readmeFilename":"readme.md","devDependencies":{"react":"^16.13.1","@types/react":"^16.9.38","@code-hike/script":"0.3.0-next.2"},"peerDependencies":{"react":">=16.8"},"_npmOperationalInternal":{"tmp":"tmp/classer_0.3.0-next.2_1615746044698_0.23230484970531307","host":"s3://npm-registry-packages"},"_id":"@code-hike/classer@0.3.0-next.2","version":"0.3.0-next.2"}