diff options
| author | ruki <waruqi@gmail.com> | 2018-11-08 00:38:48 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2018-11-07 21:53:09 +0800 |
| commit | 26105034da4fcce7ac883c899d781f016559310d (patch) | |
| tree | c459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/postcss-ordered-values | |
| parent | 2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff) | |
| download | xmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip | |
switch to vuepress
Diffstat (limited to 'node_modules/postcss-ordered-values')
13 files changed, 560 insertions, 0 deletions
diff --git a/node_modules/postcss-ordered-values/CHANGELOG.md b/node_modules/postcss-ordered-values/CHANGELOG.md new file mode 100644 index 00000000..07f2844b --- /dev/null +++ b/node_modules/postcss-ordered-values/CHANGELOG.md @@ -0,0 +1,58 @@ +# 2.2.3 + +* Resolves an integration issue with css-loader; now this module will ignore + any declarations that have import placeholders. +* Rewrote the processor structure for improved performance; now there is an + object of processors instead of an array, and a single value validation step + instead of one per processor. + +# 2.2.2 + +* Now will not re-order box-shadow values containing `calc()` definitions. + +# 2.2.1 + +* Now will not re-order values that contain any `var()` definitions. + +# 2.2.0 + +* Adds support for re-ordering `transition` declarations. + +# 2.1.1 + +* Fixes an issue where special comments were being discarded by this module. + Now, property values with any comments in them will be ignored. + +# 2.1.0 + +* Adds support for re-ordering `box-shadow` declarations. + +# 2.0.2 + +* Bump postcss-value-parser to `3.0.1` (thanks to @TrySound). +* Fixes an issue where the module was discarding color codes if a `calc` + function was found (thanks to @TrySound). + +# 2.0.1 + +* Bump postcss-value-parser to `2.0.2`. + +# 2.0.0 + +* Upgraded to PostCSS 5. + +# 1.1.1 + +* Fixes an issue where `flex` properties were being mangled by the module. + +# 1.1.0 + +* Adds support for `flex-flow` (thanks to @yisibl). + +# 1.0.1 + +* The module will now recognise `auto` as a valid value. + +# 1.0.0 + +* Initial release. diff --git a/node_modules/postcss-ordered-values/LICENSE-MIT b/node_modules/postcss-ordered-values/LICENSE-MIT new file mode 100644 index 00000000..fd0e863a --- /dev/null +++ b/node_modules/postcss-ordered-values/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info) + +Permission 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: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE 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. diff --git a/node_modules/postcss-ordered-values/README.md b/node_modules/postcss-ordered-values/README.md new file mode 100644 index 00000000..9ba63cbd --- /dev/null +++ b/node_modules/postcss-ordered-values/README.md @@ -0,0 +1,84 @@ +# [postcss][postcss]-ordered-values [][ci] [][npm] [][deps] + +> Ensure values are ordered consistently in your CSS. + + +## Install + +With [npm](https://npmjs.org/package/postcss-ordered-values) do: + +``` +npm install postcss-ordered-values --save +``` + + +## Example + +Some CSS properties accept their values in an arbitrary order; for this reason, +it is entirely possible that different developers will write their values in +different orders. This module normalizes the order, making it easier for other +modules to understand which declarations are duplicates. + +### Input + +```css +h1 { + border: solid 1px red; + border: red solid .5em; + border: rgba(0, 30, 105, 0.8) solid 1px; + border: 1px solid red; +} +``` + +### Output + +```css +h1 { + border: 1px solid red; + border: .5em solid red; + border: 1px solid rgba(0, 30, 105, 0.8); + border: 1px solid red; +} +``` + + +## Support List + +For more examples, see the [tests](src/__tests__/index.js). + +* `border(border-left|right|top|bottom)` +* `box-shadow` +* `outline` +* `flex-flow` +* `transition`, `-webkit-transition` + + +## Usage + +See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for +examples for your environment. + + +## Contributors + +Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)): + +<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> +| [<img src="https://avatars.githubusercontent.com/u/1282980?v=3" width="100px;"/><br /><sub>Ben Briggs</sub>](http://beneb.info)<br />[π»](https://github.com/ben-eb/postcss-ordered-values/commits?author=ben-eb) [π](https://github.com/ben-eb/postcss-ordered-values/commits?author=ben-eb) π [β οΈ](https://github.com/ben-eb/postcss-ordered-values/commits?author=ben-eb) | [<img src="https://avatars.githubusercontent.com/u/2784308?v=3" width="100px;"/><br /><sub>δΈδΈ</sub>](www.iyunlu.com/view)<br />[π»](https://github.com/ben-eb/postcss-ordered-values/commits?author=yisibl) [β οΈ](https://github.com/ben-eb/postcss-ordered-values/commits?author=yisibl) | [<img src="https://avatars.githubusercontent.com/u/5635476?v=3" width="100px;"/><br /><sub>Bogdan Chadkin</sub>](https://github.com/TrySound)<br />[π»](https://github.com/ben-eb/postcss-ordered-values/commits?author=TrySound) [β οΈ](https://github.com/ben-eb/postcss-ordered-values/commits?author=TrySound) | [<img src="https://avatars.githubusercontent.com/u/497260?v=3" width="100px;"/><br /><sub>Ambroos Vaes</sub>](https://github.com/Ambroos)<br />[π](https://github.com/ben-eb/postcss-ordered-values/issues?q=author%3AAmbroos) | +| :---: | :---: | :---: | :---: | +<!-- ALL-CONTRIBUTORS-LIST:END --> + +This project follows the [all-contributors] specification. Contributions of +any kind welcome! + + +## License + +MIT Β© [Ben Briggs](http://beneb.info) + + +[all-contributors]: https://github.com/kentcdodds/all-contributors +[ci]: https://travis-ci.org/ben-eb/postcss-ordered-values +[deps]: https://gemnasium.com/ben-eb/postcss-ordered-values +[npm]: http://badge.fury.io/js/postcss-ordered-values +[postcss]: https://github.com/postcss/postcss diff --git a/node_modules/postcss-ordered-values/dist/index.js b/node_modules/postcss-ordered-values/dist/index.js new file mode 100644 index 00000000..358e16d8 --- /dev/null +++ b/node_modules/postcss-ordered-values/dist/index.js @@ -0,0 +1,78 @@ +'use strict'; + +exports.__esModule = true; + +var _postcss = require('postcss'); + +var _postcss2 = _interopRequireDefault(_postcss); + +var _getParsed = require('./lib/getParsed'); + +var _getParsed2 = _interopRequireDefault(_getParsed); + +var _border = require('./rules/border'); + +var _border2 = _interopRequireDefault(_border); + +var _boxShadow = require('./rules/boxShadow'); + +var _boxShadow2 = _interopRequireDefault(_boxShadow); + +var _flexFlow = require('./rules/flexFlow'); + +var _flexFlow2 = _interopRequireDefault(_flexFlow); + +var _transition = require('./rules/transition'); + +var _transition2 = _interopRequireDefault(_transition); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* eslint-disable quote-props */ + +// rules +var rules = { + 'border': _border2.default, + 'border-top': _border2.default, + 'border-right': _border2.default, + 'border-bottom': _border2.default, + 'border-left': _border2.default, + 'outline': _border2.default, + 'box-shadow': _boxShadow2.default, + 'flex-flow': _flexFlow2.default, + 'transition': _transition2.default, + '-webkit-transition': _transition2.default +}; + +/* eslint-enable */ + +function shouldAbort(parsed) { + var abort = false; + parsed.walk(function (_ref) { + var type = _ref.type, + value = _ref.value; + + if (type === 'comment' || type === 'function' && value === 'var' || type === 'word' && ~value.indexOf('___CSS_LOADER_IMPORT___')) { + abort = true; + return false; + } + }); + return abort; +} + +exports.default = _postcss2.default.plugin('postcss-ordered-values', function () { + return function (css) { + css.walkDecls(function (decl) { + var processor = rules[decl.prop]; + if (!processor) { + return; + } + var parsed = (0, _getParsed2.default)(decl); + if (parsed.nodes.length < 2 || shouldAbort(parsed)) { + return; + } + processor(decl, parsed); + }); + }; +}); +module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/postcss-ordered-values/dist/lib/addSpace.js b/node_modules/postcss-ordered-values/dist/lib/addSpace.js new file mode 100644 index 00000000..1fadaa15 --- /dev/null +++ b/node_modules/postcss-ordered-values/dist/lib/addSpace.js @@ -0,0 +1,8 @@ +'use strict'; + +exports.__esModule = true; +exports.default = addSpace; +function addSpace() { + return { type: 'space', value: ' ' }; +} +module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/postcss-ordered-values/dist/lib/getArguments.js b/node_modules/postcss-ordered-values/dist/lib/getArguments.js new file mode 100644 index 00000000..67f9ce75 --- /dev/null +++ b/node_modules/postcss-ordered-values/dist/lib/getArguments.js @@ -0,0 +1,15 @@ +'use strict'; + +exports.__esModule = true; +exports.default = getArguments; +function getArguments(node) { + return node.nodes.reduce(function (list, child) { + if (child.type !== 'div' || child.value !== ',') { + list[list.length - 1].push(child); + } else { + list.push([]); + } + return list; + }, [[]]); +} +module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/postcss-ordered-values/dist/lib/getParsed.js b/node_modules/postcss-ordered-values/dist/lib/getParsed.js new file mode 100644 index 00000000..e53ae091 --- /dev/null +++ b/node_modules/postcss-ordered-values/dist/lib/getParsed.js @@ -0,0 +1,21 @@ +'use strict'; + +exports.__esModule = true; +exports.default = getParsed; + +var _postcssValueParser = require('postcss-value-parser'); + +var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function getParsed(decl) { + var value = decl.value, + raws = decl.raws; + + if (raws && raws.value && raws.value.raw) { + value = raws.value.raw; + } + return (0, _postcssValueParser2.default)(value); +} +module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/postcss-ordered-values/dist/lib/getValue.js b/node_modules/postcss-ordered-values/dist/lib/getValue.js new file mode 100644 index 00000000..b7330f3f --- /dev/null +++ b/node_modules/postcss-ordered-values/dist/lib/getValue.js @@ -0,0 +1,29 @@ +'use strict'; + +exports.__esModule = true; +exports.default = getValue; + +var _postcssValueParser = require('postcss-value-parser'); + +function getValue(values) { + return (0, _postcssValueParser.stringify)({ + nodes: values.reduce(function (nodes, arg, index) { + arg.forEach(function (val, idx) { + if (idx === arg.length - 1 && index === values.length - 1 && val.type === 'space') { + return; + } + nodes.push(val); + }); + if (index !== values.length - 1) { + if (nodes[nodes.length - 1] && nodes[nodes.length - 1].type === 'space') { + nodes[nodes.length - 1].type = 'div'; + nodes[nodes.length - 1].value = ','; + return nodes; + } + nodes.push({ type: 'div', value: ',' }); + } + return nodes; + }, []) + }); +} +module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/postcss-ordered-values/dist/rules/border.js b/node_modules/postcss-ordered-values/dist/rules/border.js new file mode 100644 index 00000000..fddd620b --- /dev/null +++ b/node_modules/postcss-ordered-values/dist/rules/border.js @@ -0,0 +1,42 @@ +'use strict'; + +exports.__esModule = true; +exports.default = normalizeBorder; + +var _postcssValueParser = require('postcss-value-parser'); + +// border: <line-width> || <line-style> || <color> +// outline: <outline-color> || <outline-style> || <outline-width> + +var borderWidths = ['thin', 'medium', 'thick']; + +var borderStyles = ['none', 'auto', // only in outline-style +'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset']; + +function normalizeBorder(decl, border) { + var order = { width: '', style: '', color: '' }; + border.walk(function (node) { + if (node.type === 'word') { + if (~borderStyles.indexOf(node.value)) { + order.style = node.value; + return false; + } + if (~borderWidths.indexOf(node.value) || (0, _postcssValueParser.unit)(node.value)) { + order.width = node.value; + return false; + } + order.color = node.value; + return false; + } + if (node.type === 'function') { + if (node.value === 'calc') { + order.width = (0, _postcssValueParser.stringify)(node); + } else { + order.color = (0, _postcssValueParser.stringify)(node); + } + return false; + } + }); + decl.value = (order.width + ' ' + order.style + ' ' + order.color).trim(); +}; +module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/postcss-ordered-values/dist/rules/boxShadow.js b/node_modules/postcss-ordered-values/dist/rules/boxShadow.js new file mode 100644 index 00000000..cf95b918 --- /dev/null +++ b/node_modules/postcss-ordered-values/dist/rules/boxShadow.js @@ -0,0 +1,59 @@ +'use strict'; + +exports.__esModule = true; +exports.default = normalizeBoxShadow; + +var _postcssValueParser = require('postcss-value-parser'); + +var _addSpace = require('../lib/addSpace'); + +var _addSpace2 = _interopRequireDefault(_addSpace); + +var _getArguments = require('../lib/getArguments'); + +var _getArguments2 = _interopRequireDefault(_getArguments); + +var _getValue = require('../lib/getValue'); + +var _getValue2 = _interopRequireDefault(_getValue); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// box-shadow: inset? && <length>{2,4} && <color>? + +function normalizeBoxShadow(decl, parsed) { + var args = (0, _getArguments2.default)(parsed); + var abort = false; + + var values = args.reduce(function (list, arg) { + var val = []; + var state = { + inset: [], + color: [] + }; + arg.forEach(function (node) { + if (node.type === 'function' && ~node.value.indexOf('calc')) { + abort = true; + return; + } + if (node.type === 'space') { + return; + } + if ((0, _postcssValueParser.unit)(node.value)) { + val = [].concat(val, [node, (0, _addSpace2.default)()]); + } else if (node.value === 'inset') { + state.inset = [].concat(state.inset, [node, (0, _addSpace2.default)()]); + } else { + state.color = [].concat(state.color, [node, (0, _addSpace2.default)()]); + } + }); + return [].concat(list, [[].concat(state.inset, val, state.color)]); + }, []); + + if (abort) { + return; + } + + decl.value = (0, _getValue2.default)(values); +} +module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/postcss-ordered-values/dist/rules/flexFlow.js b/node_modules/postcss-ordered-values/dist/rules/flexFlow.js new file mode 100644 index 00000000..06a48a10 --- /dev/null +++ b/node_modules/postcss-ordered-values/dist/rules/flexFlow.js @@ -0,0 +1,28 @@ +'use strict'; + +exports.__esModule = true; +exports.default = normalizeFlexFlow; +// flex-flow: <flex-direction> || <flex-wrap> + +var flexDirection = ['row', 'row-reverse', 'column', 'column-reverse']; + +var flexWrap = ['nowrap', 'wrap', 'wrap-reverse']; + +function normalizeFlexFlow(decl, flexFlow) { + var order = { + direction: '', + wrap: '' + }; + flexFlow.walk(function (node) { + if (~flexDirection.indexOf(node.value)) { + order.direction = node.value; + return; + } + if (~flexWrap.indexOf(node.value)) { + order.wrap = node.value; + return; + } + }); + decl.value = (order.direction + ' ' + order.wrap).trim(); +}; +module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/postcss-ordered-values/dist/rules/transition.js b/node_modules/postcss-ordered-values/dist/rules/transition.js new file mode 100644 index 00000000..3f755a1e --- /dev/null +++ b/node_modules/postcss-ordered-values/dist/rules/transition.js @@ -0,0 +1,59 @@ +'use strict'; + +exports.__esModule = true; +exports.default = normalizeTransition; + +var _postcssValueParser = require('postcss-value-parser'); + +var _addSpace = require('../lib/addSpace'); + +var _addSpace2 = _interopRequireDefault(_addSpace); + +var _getArguments = require('../lib/getArguments'); + +var _getArguments2 = _interopRequireDefault(_getArguments); + +var _getValue = require('../lib/getValue'); + +var _getValue2 = _interopRequireDefault(_getValue); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// transition: [ none | <single-transition-property> ] || <time> || <single-transition-timing-function> || <time> + +var timingFunctions = ['ease', 'linear', 'ease-in', 'ease-out', 'ease-in-out', 'step-start', 'step-end']; + +function normalizeTransition(decl, parsed) { + var args = (0, _getArguments2.default)(parsed); + + var values = args.reduce(function (list, arg) { + var state = { + timingFunction: [], + property: [], + time1: [], + time2: [] + }; + arg.forEach(function (node) { + if (node.type === 'space') { + return; + } + if (node.type === 'function' && ~['steps', 'cubic-bezier'].indexOf(node.value)) { + state.timingFunction = [].concat(state.timingFunction, [node, (0, _addSpace2.default)()]); + } else if ((0, _postcssValueParser.unit)(node.value)) { + if (!state.time1.length) { + state.time1 = [].concat(state.time1, [node, (0, _addSpace2.default)()]); + } else { + state.time2 = [].concat(state.time2, [node, (0, _addSpace2.default)()]); + } + } else if (~timingFunctions.indexOf(node.value)) { + state.timingFunction = [].concat(state.timingFunction, [node, (0, _addSpace2.default)()]); + } else { + state.property = [].concat(state.property, [node, (0, _addSpace2.default)()]); + } + }); + return [].concat(list, [[].concat(state.property, state.time1, state.timingFunction, state.time2)]); + }, []); + + decl.value = (0, _getValue2.default)(values); +} +module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/postcss-ordered-values/package.json b/node_modules/postcss-ordered-values/package.json new file mode 100644 index 00000000..5d5786a2 --- /dev/null +++ b/node_modules/postcss-ordered-values/package.json @@ -0,0 +1,57 @@ +{ + "name": "postcss-ordered-values", + "version": "2.2.3", + "description": "Ensure values are ordered consistently in your CSS.", + "main": "dist/index.js", + "files": [ + "dist", + "LICENSE-MIT" + ], + "scripts": { + "contributorAdd": "all-contributors add", + "contributorGenerate": "all-contributors generate", + "pretest": "eslint src", + "prepublish": "del-cli dist && BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/", + "test": "ava", + "test-012": "ava" + }, + "keywords": [ + "css", + "postcss", + "postcss-plugin" + ], + "license": "MIT", + "devDependencies": { + "all-contributors-cli": "^3.0.5", + "ava": "^0.17.0", + "babel-cli": "^6.3.17", + "babel-core": "^6.3.26", + "babel-plugin-add-module-exports": "^0.2.1", + "babel-preset-es2015": "^6.3.13", + "babel-preset-es2015-loose": "^7.0.0", + "babel-preset-stage-0": "^6.3.13", + "babel-register": "^6.9.0", + "del-cli": "^0.2.0", + "eslint": "^3.0.0", + "eslint-config-cssnano": "^3.0.0", + "eslint-plugin-babel": "^3.3.0", + "eslint-plugin-import": "^2.0.1" + }, + "homepage": "https://github.com/ben-eb/postcss-ordered-values", + "author": { + "name": "Ben Briggs", + "email": "beneb.info@gmail.com", + "url": "http://beneb.info" + }, + "repository": "ben-eb/postcss-ordered-values", + "dependencies": { + "postcss": "^5.0.4", + "postcss-value-parser": "^3.0.1" + }, + "ava": { + "require": "babel-register" + }, + "eslintConfig": { + "extends": "cssnano" + } +} |
