{"name":"css-in-js-utils","version":"3.0.2","description":"Useful utility functions for CSS in JS solutions","main":"lib/index.js","keywords":["css","cssinjs","utils"],"repository":{"type":"git","url":"git+https://github.com/rofrischmann/css-in-js-utils.git"},"author":{"name":"Robin Frischmann","email":"robin@rofrischmann.de"},"license":"MIT","scripts":{"babel":"babel -d lib modules","check":"npm run format && npm run lint && npm run test:coverage && npm run flow","format":"prettier --write \"modules/**/*.js\"","flow":"flow","lint":"eslint modules","release":"npm run check && npm run babel && npm publish","test":"jest","test:coverage":"jest --coverage"},"jest":{"rootDir":"modules"},"dependencies":{"hyphenate-style-name":"^1.0.2"},"devDependencies":{"babel-cli":"^6.22.1","babel-core":"^6.22.1","babel-eslint":"^7.1.1","babel-jest":"^18.0.0","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015":"^6.22.0","babel-preset-react":"^6.22.0","babel-preset-stage-0":"^6.22.0","codeclimate-test-reporter":"^0.4.0","eslint":"^3.14.1","eslint-config-airbnb":"^14.0.0","eslint-plugin-flowtype":"^2.30.0","eslint-plugin-import":"^2.2.0","eslint-plugin-jsx-a11y":"^3.0.2","eslint-plugin-react":"^6.9.0","flow-bin":"^0.81.0","jest":"^18.1.0","prettier":"^1.7.3"},"gitHead":"194b5dfa5402bb1f642ae45bbace3c3d8946d664","bugs":{"url":"https://github.com/rofrischmann/css-in-js-utils/issues"},"homepage":"https://github.com/rofrischmann/css-in-js-utils#readme","_id":"css-in-js-utils@3.0.2","_npmVersion":"6.4.1","_nodeVersion":"10.15.1","_npmUser":{"name":"rofrischmann","email":"robin@rofrischmann.de"},"dist":{"integrity":"sha512-D9VdAtwMADHMqQZPXYfsH2ARz+5JRf/Lv2R4euG+3bb9OxrM97QMJY68JwloLimbD8b/vsqOVZYHLPhyhaTcvw==","shasum":"829a7922630458653a3f83c9b8dbd870c9eb2e24","tarball":"http://registry-npm.ywwl.com/css-in-js-utils/download/css-in-js-utils-3.0.2.tgz","fileCount":28,"unpackedSize":33095,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc0pZFCRA9TVsSAnZWagAAtoAP/irMTCL3PNV1A5RMverv\nxO8/ODBaqmPU/yR3vPo1VBEVEYE1ZxzVBhkI27c/GDFl/MwyI4awdmk/NtEJ\npsDGQUZJGgDtOhK30nDPbN7ylHals1UseCPgivHtxtzqDqovSd7b/pZVdWSs\nPLzs3T2Lwn+vOJ4Z5pgGOfV7VdJxXD4wwoAR6FVz2L8/mm68FEAPul56vTcy\nynHRF0pEIgXnyHhKaYqk0+0X89v8HgtRfm7hZOsnRt4kt7uLCezO3sJwDVHE\nL9ROhsvE8ChJIePu2CrqJ2z5ZP0qjdZlLmqvSTKZs/RRG1ByZzbEE5X+wWy2\nbgqmTM3szp0TSob4n045jZcehcp1Ss66qwW8UOBujTXGSZ0KPfFDBpL7BbP9\nAHD4ekh9yja8L/xLqJEm2LrD7E+SqmwDQBvlUdIeVReOPemn0XhNrHQw8j0x\nXncdy16LHRRZETmzUxPiACTHGJSQk8iYxuAhYL8y6HP5uvH+FzZH1dDH05xT\nEBr585H6irsh27LR7Gq2yXXFMu+scfqRSlhNI1p11Y25TmlJ4Nz+2bKW78bU\nckDh37/js1y2beidiHpe40M5knBN8uQEsrDrd3gP6oqXEuvWavBP/mRsvliP\nHUL5hpC9Yg1n0x/AfguXRfDv+psOX5ta7xQ8k6d4Kr4uFoOAGfxEF+pGQc2m\n+Pj8\r\n=c4P4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDdnSoI+PVx5nvP6jchhysIjrGM23xkBn7OKTk2JerBrAiEA15DyzSzxPuERBUxMy06q1QLEkOr8HXtFApp3YlJkyIE="}],"size":7752,"noattachment":false,"key":"/css-in-js-utils/-/css-in-js-utils-3.0.2.tgz"},"maintainers":[{"name":"rofrischmann","email":"robin@rofrischmann.de"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/css-in-js-utils_3.0.2_1557304900902_0.07420969254495313"},"_hasShrinkwrap":false,"readme":"# CSS-in-JS Utilities\nA library that provides useful utilities functions for CSS-in-JS solutions.<br>\nThey are intended to be used by CSS-in-JS library authors rather used directly.\n<br>\n\n<img alt=\"TravisCI\" src=\"https://travis-ci.org/rofrischmann/css-in-js-utils.svg?branch=master\"> <img alt=\"Test Coverage\"  src=\"https://api.codeclimate.com/v1/badges/2964ee833f8d2104cac6/test_coverage\" /> <img alt=\"npm downloads\" src=\"https://img.shields.io/npm/dm/css-in-js-utils.svg\"> <img alt=\"npm version\" src=\"https://badge.fury.io/js/css-in-js-utils.svg\"> <img alt=\"gzipped size\" src=\"https://img.shields.io/bundlephobia/minzip/css-in-js-utils.svg?colorB=4c1&label=gzipped%20size\">\n\n## Installation\n```sh\nyarn add css-in-js-utils\n```\n\n## Why?\nBy now I have authored and collaborated on many different libraries and found I would rewrite the very same utility functions every time. That's why this repository is hosting small utilities especially built for CSS-in-JS solutions and tools. Even if there are tons of different libraries already, they all basically use the same mechanisms and utilities.\n\n## Utilities\n* [`assignStyle(base, ...extend)`](#assignstylebase-extend)\n* [`camelCaseProperty(property)`](#camelcasepropertyproperty)\n* [`cssifyDeclaration(property, value)`](#cssifydeclarationproperty-value)\n* [`cssifyObject(object)`](#cssifyobjectobject)\n* [`hyphenateProperty(property)`](#hyphenatepropertyproperty)\n* [`isPrefixedProperty(property)`](#isprefixedpropertyproperty)\n* [`isPrefixedValue(value)`](#isprefixedvaluevalue)\n* [`isUnitlessProperty(property)`](#isunitlesspropertyproperty)\n* [`normalizeProperty(property)`](#normalizepropertyproperty)\n* [`resolveArrayValue(property, value)`](#resolvearrayvalueproperty-value)\n* [`unprefixProperty(property)`](#unprefixpropertyproperty)\n* [`unprefixValue(value)`](#unprefixvaluevalue)\n\n------\n\n### `assignStyle(base, ...extend)`\nMerges deep style objects similar to `Object.assign`.<br>\nIt also merges array values into a single array whithout creating duplicates. The last occurence of every item wins.\n\n```javascript\nimport { assignStyle } from 'css-in-js-utils'\n\nassignStyle(\n  { color: 'red', backgroundColor: 'black' },\n  { color: 'blue' }\n)\n// => { color: 'blue', backgroundColor: 'black' }\n\nassignStyle(\n  {\n    color: 'red',\n    ':hover': {\n      backgroundColor: 'black'\n    }\n  },\n  { \n    ':hover': {\n      backgroundColor: 'blue'\n    }\n  }\n)\n// => { color: 'red', ':hover': { backgroundColor: 'blue' }}\n```\n\n------\n\n### `camelCaseProperty(property)`\nConverts the `property` to camelCase.\n\n```javascript\nimport { camelCaseProperty } from 'css-in-js-utils'\n\ncamelCaseProperty('padding-top')\n// => 'paddingTop'\n\ncamelCaseProperty('-webkit-transition')\n// => 'WebkitTransition'\n```\n\n------\n\n### `cssifyDeclaration(property, value)`\nGenerates a CSS declaration (`property`:`value`) string.\n\n```javascript\nimport { cssifyDeclaration } from 'css-in-js-utils'\n\ncssifyDeclaration('paddingTop', '400px')\n// => 'padding-top:400px'\n\ncssifyDeclaration('WebkitFlex', 3)\n// => '-webkit-flex:3'\n```\n\n------\n\n### `cssifyObject(object)`\nGenerates a CSS string using all key-property pairs in `object`.\nIt automatically removes declarations with value types other than `number` and `string`.\n\n```javascript\nimport { cssifyObject } from 'css-in-js-utils'\n\ncssifyObject({\n  paddingTop: '400px',\n  paddingBottom: undefined,\n  WebkitFlex: 3,\n  _anyKey: [1, 2, 4]\n})\n// => 'padding-top:400px;-webkit-flex:3'\n```\n\n------\n\n### `hyphenateProperty(property)`\nConverts the `property` to hyphen-case.\n> Directly mirrors [hyphenate-style-name](https://github.com/rexxars/hyphenate-style-name).\n\n```javascript\nimport { hyphenateProperty } from 'css-in-js-utils'\n\nhyphenateProperty('paddingTop')\n// => 'padding-top'\n\nhyphenateProperty('WebkitTransition')\n// => '-webkit-transition'\n```\n\n------\n\n### `isPrefixedProperty(property)`\nChecks if a `property` includes a vendor prefix.\n\n```javascript\nimport { isPrefixedProperty } from 'css-in-js-utils'\n\nisPrefixedProperty('paddingTop')\n// => false\n\nisPrefixedProperty('WebkitTransition')\n// => true\n```\n\n------\n### `isPrefixedValue(value)`\nChecks if a `value` includes vendor prefixes.\n\n```javascript\nimport { isPrefixedValue } from 'css-in-js-utils'\n\nisPrefixedValue('200px')\nisPrefixedValue(200)\n// => false\n\nisPrefixedValue('-webkit-calc(100% - 50px)')\n// => true\n```\n\n------\n\n### `isUnitlessProperty(property)`\nChecks if a `property` accepts unitless values.\n\n```javascript\nimport { isUnitlessProperty } from 'css-in-js-utils'\n\nisUnitlessProperty('width')\n// => false\n\nisUnitlessProperty('flexGrow')\nisUnitlessProperty('lineHeight')\nisUnitlessProperty('line-height')\n// => true\n```\n\n------\n\n### `normalizeProperty(property)`\nNormalizes the `property` by unprefixing **and** camelCasing it.\n> Uses the [`camelCaseProperty`](#camelcasepropertyproperty) and [`unprefixProperty`](#unprefixpropertyproperty)-methods.\n\n```javascript\nimport { normalizeProperty } from 'css-in-js-utils'\n\nnormalizeProperty('-webkit-transition-delay')\n// => 'transitionDelay'\n```\n\n------\n\n### `resolveArrayValue(property, value)`\nConcatenates array values to single CSS value.\n> Uses the [`hyphenateProperty`](#hyphenatepropertyproperty)-method.\n\n\n```javascript\nimport { resolveArrayValue } from 'css-in-js-utils'\n\nresolveArrayValue('display', [ '-webkit-flex', 'flex' ])\n// => '-webkit-flex;display:flex'\n\nresolveArrayValue('paddingTop', [ 'calc(100% - 50px)', '100px' ])\n// => 'calc(100% - 50px);padding-top:100px'\n```\n\n------\n\n### `unprefixProperty(property)`\nRemoves the vendor prefix (if set) from the `property`.\n\n```javascript\nimport { unprefixProperty } from 'css-in-js-utils'\n\nunprefixProperty('WebkitTransition')\n// => 'transition'\n\nunprefixProperty('transitionDelay')\n// => 'transitionDelay'\n```\n\n------\n\n### `unprefixValue(value)`\nRemoves all vendor prefixes (if any) from the `value`.\n\n```javascript\nimport { unprefixValue } from 'css-in-js-utils'\n\nunprefixValue('-webkit-calc(-moz-calc(100% - 50px)/2)')\n// => 'calc(calc(100% - 50px)/2)'\n\nunprefixValue('100px')\n// => '100px'\n```\n\n## Direct Import\nEvery utility function may be imported directly to save bundle size.\n\n```javascript\nimport camelCaseProperty from 'css-in-js-utils/lib/camelCaseProperty'\n```\n\n## License\ncss-in-js-utils is licensed under the [MIT License](http://opensource.org/licenses/MIT).<br>\nDocumentation is licensed under [Creative Common License](http://creativecommons.org/licenses/by/4.0/).<br>\nCreated with ♥ by [@rofrischmann](http://rofrischmann.de).\n","publish_time":1557304901092,"_cnpm_publish_time":1557304901092,"dist-tags":{"latest":"3.1.0"}}