{"name":"css-in-js-utils","version":"3.1.0","description":"Useful utility functions for CSS in JS solutions","main":"lib/index.js","module":"es/index.js","types":"es/index.d.ts","jsnext:main":"es/index.js","sideEffects":false,"keywords":["css","cssinjs","utils","small"],"repository":{"type":"git","url":"git+https://github.com/robinweser/css-in-js-utils.git"},"author":{"name":"robinweser","email":"contact@weser.io"},"license":"MIT","scripts":{"build":"yarn run clean && yarn build:es && yarn build:lib","build:lib":"cross-env BABEL_ENV=commonjs babel modules --extensions '.ts' --ignore 'modules/__tests__','**/*.d.ts' --out-dir lib","build:es":"tsc && babel es --out-dir es","clean":"rimraf es lib coverage","check":"yarn lint && yarn test:coverage","format":"prettier --write \"modules/**/*.{js,ts}\"","lint":"eslint 'modules/**/*.{js,ts}'","release":"git pull --rebase && yarn run check && yarn build && npm publish","test":"cross-env BABEL_ENV=commonjs jest","test:coverage":"cross-env BABEL_ENV=commonjs jest --coverage","watch":"yarn test -- --watch"},"jest":{"moduleDirectories":["node_modules","modules"]},"dependencies":{"hyphenate-style-name":"^1.0.3"},"devDependencies":{"@babel/cli":"^7.8.4","@babel/core":"^7.9.0","@babel/preset-env":"^7.9.5","@babel/preset-typescript":"^7.9.0","@types/jest":"^25.2.1","@typescript-eslint/eslint-plugin":"^2.26.0","@typescript-eslint/parser":"^2.26.0","babel-jest":"^25.2.6","babel-plugin-transform-es2015-modules-commonjs":"^6.26.2","cross-env":"^7.0.2","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.1.0","eslint-plugin-import":"^2.20.2","jest":"^25.2.6","prettier":"^1.7.4","rimraf":"^2.6.1","typescript":"^3.8.3"},"gitHead":"401c5070c6dcab5f0daef591b0bdffbdd7c4c60b","bugs":{"url":"https://github.com/robinweser/css-in-js-utils/issues"},"homepage":"https://github.com/robinweser/css-in-js-utils#readme","_id":"css-in-js-utils@3.1.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-fJAcud6B3rRu+KHYk+Bwf+WFL2MDCJJ1XG9x137tJQ0xYxor7XziQtuGFbWNdqrvF4Tk26O3H73nfVqXt/fW1A==","shasum":"640ae6a33646d401fc720c54fc61c42cd76ae2bb","tarball":"http://registry-npm.ywwl.com/css-in-js-utils/download/css-in-js-utils-3.1.0.tgz","fileCount":47,"unpackedSize":61101,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfMpjaCRA9TVsSAnZWagAAP10P+gMfmB7nUZ9CffFg2+Zo\nTY9o+Vs8YxksCpzTRWT6w5xAnYZP7oxZVS6v2gGRgazHugEeV5OTFdyxrOGT\nN6LPR975T4743kUcAZWATh6uM830aK9PdS6Qm0Bt9Rpk3TODfHnCfHlHHBTY\nNeWzbtk78tGIbNMoEkaFE42suohKzCMcbL2AhSB48zIjZwHl1EjIBDdpgDfd\ncJ33P7cHJS5d0I50bIgfAKaCW9QMxF3KsxZT8nfddBLs81cnw0IJ1gAmLK4p\nw4nbmcQUv7GwutHsXkn56X6LFA5g3t6M0XftsfZp5w6BOVjTioU+gaM6B3MU\nyb7wgYX/HR4tesmfoSfcycnXtgeqaVTsQdphJyjEZuy5lDZ8Ugv/FLyUpHOY\nes57PV6nGE8AK87tf8fibrCxpAZrqQmfU8Yxl3o+bJYrP+vtZig+Ux7Y8ZJS\nItoLN+GZ/1Yz1WsbRxgFxzVNR1ztg1riGMMnPkpIzqiSuKneg52j+qxw2LPk\n2X/hiJu1kNrwPudruAhASl0iWX9ueXzf7DAttmDRdsYncmUv5xUvTtfMnezw\nkoc1yok0Z+AFvqPqmn/CaIQ8Z0mnedaQwtc37CGW7ARuUGoMzVV6MlhPO+ZN\nvZEW2aNR/X41DkHUyhBCGnxrao6NFMotZIr2Fj+nILZRx8QuikpIWzSbC7TR\n1B7h\r\n=0Smv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF/Sjp7phsVbHi8lpZ/qqq7GeIdNq+xrw4Pv1XcGeTNsAiEA+apnlRP6L0OnOXGd4awOEGS4k24cONoG9ycjODkz9hM="}],"size":17937,"noattachment":false,"key":"/css-in-js-utils/-/css-in-js-utils-3.1.0.tgz"},"maintainers":[{"name":"rofrischmann","email":"robin@rofrischmann.de"}],"_npmUser":{"name":"rofrischmann","email":"robin@weser.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/css-in-js-utils_3.1.0_1597151449834_0.365743358390725"},"_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":1597151449966,"_cnpm_publish_time":1597151449966,"dist-tags":{"latest":"3.1.0"}}