{"_id":"@amarajs/plugin-css","_rev":"2-2b804d19453931bebb3c7477dcb6d121","name":"@amarajs/plugin-css","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@amarajs/plugin-css","amdName":"AmaraCSS","version":"0.1.0","description":"Provides custom CSS classes and styles for AmaraJS web applications.","jsnext:main":"src/index.js","main":"dist/amara-plugin-css.js","umd:main":"dist/amara-plugin-css.umd.js","scripts":{"bump":"standard-version","testonly":"mocha --compilers js:babel-register test/**/*.js","lint":"eslint src test","test":"flow && npm run lint && npm run testonly","build":"npm-run-all clean -p rollup:* -p minify:* -s size","clean":"rimraf dist && mkdirp dist","rollup:cjs":"rollup -c rollup.config.js -f cjs -n AmaraCSS src/index.js -o dist/amara-plugin-css.js","rollup:umd":"rollup -c rollup.config.js -f umd -n AmaraCSS src/index.js -o dist/amara-plugin-css.umd.js","minify:cjs":"uglifyjs dist/amara-plugin-css.js -cm toplevel -o dist/amara-plugin-css.min.js -p relative --source-map dist/amara-plugin-css.min.js.map","minify:umd":"uglifyjs dist/amara-plugin-css.umd.js -cm -o dist/amara-plugin-css.umd.min.js -p relative --source-map dist/amara-plugin-css.umd.min.js.map","size":"strip-json-comments --no-whitespace dist/amara-plugin-css.min.js | gzip-size | pretty-bytes","release":"npm run build -s && npm run bump && git push --follow-tags origin master && npm publish"},"keywords":["amara","amarajs","plugin","css","class","style"],"authors":["Dan Barnes <amarajs.framework@gmail.com>"],"repository":{"type":"git","url":"git+https://github.com/amarajs/plugin-css.git"},"license":"MIT","files":["src","dist"],"eslintConfig":{"parser":"babel-eslint","extends":"eslint:recommended","env":{"browser":true,"node":true,"mocha":true,"es6":true},"globals":{"expect":true},"rules":{"no-cond-assign":0}},"devDependencies":{"babel-core":"^6.9.1","babel-eslint":"^7.1.1","babel-plugin-transform-flow-strip-types":"^6.21.0","babel-preset-es2015":"^6.9.0","babel-preset-stage-0":"^6.5.0","babel-register":"^6.9.0","chai":"^3.5.0","eslint":"^3.13.1","flow-bin":"^0.38.0","gzip-size-cli":"^1.0.0","mkdirp":"^0.5.1","mocha":"^3.2.0","npm-run-all":"^2.1.1","pretty-bytes-cli":"^2.0.0","rimraf":"^2.5.2","rollup":"^0.41.4","rollup-plugin-buble":"^0.15.0","rollup-plugin-flow":"^1.1.1","sinon":"^1.17.4","sinon-chai":"^2.8.0","standard-version":"^4.0.0","strip-json-comments-cli":"^1.0.1","uglify-js":"^2.6.2"},"gitHead":"c1e7d8fcba0ec477bf93840fbad7a16300e86f06","bugs":{"url":"https://github.com/amarajs/plugin-css/issues"},"homepage":"https://github.com/amarajs/plugin-css#readme","_id":"@amarajs/plugin-css@0.1.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"amarajs-dan","email":"amarajs.framework@gmail.com"},"dist":{"integrity":"sha512-krFmf5l+EbmPhCH+Tjqp8ft3ruK41GANMcVo2b+k3IPS5zRSr5sN0vmbFi3kBs95soUsBsJF6mpS2ac7Zl7moA==","shasum":"1fda22e1b34d8aff375ae88210a5c1dcc1cc5eee","tarball":"https://registry.npmjs.org/@amarajs/plugin-css/-/plugin-css-0.1.0.tgz","fileCount":10,"unpackedSize":25254,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDTOosNFt6hi2gei5aMwiCPFiq2ncyEirmTpgIlR5seOAiEAuxOtbVx3L/XFhcz1zHV8LzeCvKg/hXvQKMLZ8WA3mEo="}]},"maintainers":[{"name":"amarajs-dan","email":"amarajs.framework@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/plugin-css_0.1.0_1522618228953_0.07914675554135764"},"_hasShrinkwrap":false}},"time":{"created":"2018-04-01T21:30:28.893Z","0.1.0":"2018-04-01T21:30:29.047Z","modified":"2022-04-04T13:43:42.600Z"},"maintainers":[{"name":"amarajs-dan","email":"amarajs.framework@gmail.com"}],"description":"Provides custom CSS classes and styles for AmaraJS web applications.","homepage":"https://github.com/amarajs/plugin-css#readme","keywords":["amara","amarajs","plugin","css","class","style"],"repository":{"type":"git","url":"git+https://github.com/amarajs/plugin-css.git"},"bugs":{"url":"https://github.com/amarajs/plugin-css/issues"},"license":"MIT","readme":"## @amarajs/plugin-css\n\nPlugin middleware for AmaraJS to add CSS styles and classes to DOM nodes dynamically.\n\n### Installation\n\n`npm install --save @amarajs/plugin-css`\n\n### Usage\n\n```javascript\nimport Amara from '@amarajs/core';\nimport AmaraCSS from '@amarajs/plugin-css';\nimport AmaraBrowser from '@amarajs/plugin-engine-browser';\nconst amara = new Amara([\n    AmaraCSS(),\n    AmaraBrowser()\n]);\n```\n\n### Feature Type\n\nThe `@amarajs/plugin-css` middleware allows you to create features of type `\"class\"` and `\"style\"`.\n\n#### Return Values\n\nFor `{type: \"class\"}` features, your apply function should return either an array of CSS class names to add to the target's `classList`, or else an object literal whose keys are CSS class names and whose values will be used to determine whether to add that class to the target. Truthy values will be added; non-truthy values will be removed.\n\n```javascript\n// add an array of class names\namara.add({\n    type: 'class',\n    targets: ['main'],\n    apply: () => ['a', 'b']\n});\n\n// add classes based on truthiness\namara.add({\n    type: 'class',\n    target: ['main'],\n    apply: () => ({\n        'a': true,\n        'b': false\n    })\n});\n```\n\nFor `{type: \"style\"}` features, your apply function should return an object literal whose keys are style properties (camelCased) and whose values are strings representing the property value.\n\n```javascript\n// set explicit styles\namara.add({\n    type: 'style',\n    targets: ['main'],\n    apply: () => ({\n        fontSize: '12pt',\n        fontWeight: 'bold'\n    })\n});\n```\n\n### Applying Multiple Results to the Same Target\n\nIf multiple `{type: \"class\"}` features target the same DOM, the CSS class names to apply to the target node will be combined and de-duplicated.\n\nIf multiple `{type: \"style\"}` features target the same DOM, the object literals will be merged together in the order the features were applied, with later features overwriting earlier features if multiple objects have the same property name.\n\n### Customization\n\nThis plugin has no customization options.\n\n### Contributing\n\nIf you have a feature request, please create a new issue so the community can discuss it.\n\nIf you find a defect, please submit a bug report that includes a working link to reproduce the problem (for example, using [jsBin](https://jsbin.com)). Of course, pull requests to fix open issues are always welcome!\n\n### License\n\nThe MIT License (MIT)\n\nCopyright (c) Dan Barnes\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","readmeFilename":"README.md"}