0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

122
web/node_modules/postcss-calc/CHANGELOG.md generated vendored Executable file
View file

@ -0,0 +1,122 @@
# 7.0.5
- Fixed: reduction
# 7.0.4
- Fixed: strips away important factors from multiplications in calc() ([#107](https://github.com/postcss/postcss-calc/issues/107))
# 7.0.3
- Fixed: substracted css-variable from zero ([#111](https://github.com/postcss/postcss-calc/issues/111))
# 7.0.2
- Fixed: incorrect reduction of subtraction from zero ([#88](https://github.com/postcss/postcss-calc/issues/88))
- Fixed: doesn't remove calc for single function
- Fixed: relax parser on unknown units ([#76](https://github.com/postcss/postcss-calc/issues/76))
- Fixed: handle numbers with exponen composed ([#83](https://github.com/postcss/postcss-calc/pull/83))
- Fixed: handle plus sign before value ([#79](https://github.com/postcss/postcss-calc/pull/79))
- Fixed: better handle precision for nested calc ([#75](https://github.com/postcss/postcss-calc/pull/75))
- Fixed: properly handle nested add and sub expression inside sub expression ([#64](https://github.com/postcss/postcss-calc/issues/64))
- Fixed: handle uppercase units and functions ([#71](https://github.com/postcss/postcss-calc/pull/71))
- Fixed: do not break `calc` with single var ([cssnano/cssnano#725](https://github.com/cssnano/cssnano/issues/725))
- Updated: `postcss` to 7.0.27 (patch)
- Updated: `postcss-selector-parser` to 6.0.2
- Updated: `postcss-value-parser` to 4.0.2
# 7.0.1
- Updated: `postcss` to 7.0.2 (patch)
- Updated: `postcss-selector-parser` to 5.0.0-rc.4 (patch)
- Updated: `postcss-value-parser` to 3.3.1 (patch)
# 7.0.0
- Changed: Updated postcss-selector-parser to version 5.0.0-rc.3
- Changed: Dropped reduce-css-calc as a dependency
- Fixed: Support constant() and env() ([#42](https://github.com/postcss/postcss-calc/issues/42), [#48](https://github.com/postcss/postcss-calc/issues/48))
- Fixed: Support custom properties with "calc" in its name ([#50](https://github.com/postcss/postcss-calc/issues/50))
- Fixed: Remove unnecessary whitespace around `*` and `/` ([cssnano#625](https://github.com/cssnano/cssnano/issues/625))
- Fixed: Arithmetic bugs around subtraction ([#49](https://github.com/postcss/postcss-calc/issues/49))
- Fixed: Handling of nested calc statements ([reduce-css-calc#49](https://github.com/MoOx/reduce-css-calc/issues/49))
- Fixed: Bugs regarding complex calculations ([reduce-cs-calc#45](https://github.com/MoOx/reduce-css-calc/issues/45))
- Fixed: `100%` incorrectly being transformed to `1` ([reduce-css-calc#44](https://github.com/MoOx/reduce-css-calc/issues/44))
- Added: support for case-insensitive calc statements
# 6.0.2 - 2018-09-25
- Fixed: use PostCSS 7 (thanks to @douglasduteil)
# 6.0.1 - 2017-10-10
- Fixed: throwing error for attribute selectors without a value
# 6.0.0 - 2017-05-08
- Breaking: Updated PostCSS from v5.x to v6.x, and reduce-css-calc from v1.x
to v2.x (thanks to @andyjansson).
# 5.3.1 - 2016-08-22
- Fixed: avoid security issue related to ``reduce-css-calc@< 1.2.4``.
# 5.3.0 - 2016-07-11
- Added: support for selector transformation via `selectors` option.
([#29](https://github.com/postcss/postcss-calc/pull/29) - @uniquegestaltung)
# 5.2.1 - 2016-04-10
- Fixed: support for multiline value
([#27](https://github.com/postcss/postcss-calc/pull/27))
# 5.2.0 - 2016-01-08
- Added: "mediaQueries" option for `@media` support
([#22](https://github.com/postcss/postcss-calc/pull/22))
# 5.1.0 - 2016-01-07
- Added: "warnWhenCannotResolve" option to warn when calc() are not reduced to a single value
([#20](https://github.com/postcss/postcss-calc/pull/20))
# 5.0.0 - 2015-08-25
- Removed: compatibility with postcss v4.x
- Added: compatibility with postcss v5.x
# 4.1.0 - 2015-04-09
- Added: compatibility with postcss v4.1.x ([#12](https://github.com/postcss/postcss-calc/pull/12))
# 4.0.1 - 2015-04-09
- Fixed: `preserve` option does not create duplicated values ([#7](https://github.com/postcss/postcss-calc/issues/7))
# 4.0.0 - 2015-01-26
- Added: compatibility with postcss v4.x
- Changed: partial compatiblity with postcss v3.x (stack traces have lost filename)
# 3.0.0 - 2014-11-24
- Added: GNU like exceptions ([#4](https://github.com/postcss/postcss-calc/issues/4))
- Added: `precision` option ([#5](https://github.com/postcss/postcss-calc/issues/5))
- Added: `preserve` option ([#6](https://github.com/postcss/postcss-calc/issues/6))
# 2.1.0 - 2014-10-15
- Added: source of the error (gnu like message) (fix [#3](https://github.com/postcss/postcss-calc/issues/3))
# 2.0.1 - 2014-08-10
- Fixed: correctly ignore unrecognized values (fix [#2](https://github.com/postcss/postcss-calc/issues/2))
# 2.0.0 - 2014-08-06
- Changed: Plugin now return a function to have a consistent api. ([ref 1](https://github.com/ianstormtaylor/rework-color-function/issues/6), [ref 2](https://twitter.com/jongleberry/status/496552790416576513))
# 1.0.0 - 2014-08-04
✨ First release based on [rework-calc](https://github.com/reworkcss/rework-calc) v1.1.0 (code mainly exported to [`reduce-css-calc`](https://github.com/MoOx/reduce-css-calc))

20
web/node_modules/postcss-calc/LICENSE generated vendored Executable file
View file

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2014 Maxime Thirouin
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.

189
web/node_modules/postcss-calc/README.md generated vendored Executable file
View file

@ -0,0 +1,189 @@
# PostCSS Calc [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS" width="90" height="90" align="right">][PostCSS]
[![NPM Version][npm-img]][npm-url]
[![Build Status][cli-img]][cli-url]
[![Support Chat][git-img]][git-url]
[PostCSS Calc] lets you reduce `calc()` references whenever it's possible. This
can be particularly useful with the [PostCSS Custom Properties] plugin.
When multiple units are mixed together in the same expression, the `calc()`
statement is left as is, to fallback to the [W3C calc() implementation].
## Installation
```bash
npm install postcss-calc
```
## Usage
```js
// dependencies
var fs = require("fs")
var postcss = require("postcss")
var calc = require("postcss-calc")
// css to be processed
var css = fs.readFileSync("input.css", "utf8")
// process css
var output = postcss()
.use(calc())
.process(css)
.css
```
**Example** (with [PostCSS Custom Properties] enabled as well):
```js
// dependencies
var fs = require("fs")
var postcss = require("postcss")
var customProperties = require("postcss-custom-properties")
var calc = require("postcss-calc")
// css to be processed
var css = fs.readFileSync("input.css", "utf8")
// process css
var output = postcss()
.use(customProperties())
.use(calc())
.process(css)
.css
```
Using this `input.css`:
```css
:root {
--main-font-size: 16px;
}
body {
font-size: var(--main-font-size);
}
h1 {
font-size: calc(var(--main-font-size) * 2);
height: calc(100px - 2em);
margin-bottom: calc(
var(--main-font-size)
* 1.5
)
}
```
you will get:
```css
body {
font-size: 16px
}
h1 {
font-size: 32px;
height: calc(100px - 2em);
margin-bottom: 24px
}
```
Checkout [tests] for more examples.
### Options
#### `precision` (default: `5`)
Allow you to define the precision for decimal numbers.
```js
var out = postcss()
.use(calc({precision: 10}))
.process(css)
.css
```
#### `preserve` (default: `false`)
Allow you to preserve calc() usage in output so browsers will handle decimal
precision themselves.
```js
var out = postcss()
.use(calc({preserve: true}))
.process(css)
.css
```
#### `warnWhenCannotResolve` (default: `false`)
Adds warnings when calc() are not reduced to a single value.
```js
var out = postcss()
.use(calc({warnWhenCannotResolve: true}))
.process(css)
.css
```
#### `mediaQueries` (default: `false`)
Allows calc() usage as part of media query declarations.
```js
var out = postcss()
.use(calc({mediaQueries: true}))
.process(css)
.css
```
#### `selectors` (default: `false`)
Allows calc() usage as part of selectors.
```js
var out = postcss()
.use(calc({selectors: true}))
.process(css)
.css
```
Example:
```css
div[data-size="calc(3*3)"] {
width: 100px;
}
```
---
## Contributing
Work on a branch, install dev-dependencies, respect coding style & run tests
before submitting a bug fix or a feature.
```bash
git clone git@github.com:postcss/postcss-calc.git
git checkout -b patch-1
npm install
npm test
```
## [Changelog](CHANGELOG.md)
## [License](LICENSE)
[cli-img]: https://img.shields.io/travis/postcss/postcss-calc/master.svg
[cli-url]: https://travis-ci.org/postcss/postcss-calc
[git-img]: https://img.shields.io/badge/support-chat-blue.svg
[git-url]: https://gitter.im/postcss/postcss
[npm-img]: https://img.shields.io/npm/v/postcss-calc.svg
[npm-url]: https://www.npmjs.com/package/postcss-calc
[PostCSS]: https://github.com/postcss
[PostCSS Calc]: https://github.com/postcss/postcss-calc
[PostCSS Custom Properties]: https://github.com/postcss/postcss-custom-properties
[tests]: src/__tests__/index.js
[W3C calc() implementation]: https://www.w3.org/TR/css3-values/#calc-notation

42
web/node_modules/postcss-calc/dist/index.js generated vendored Normal file
View file

@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _postcss = require("postcss");
var _transform = _interopRequireDefault(require("./lib/transform"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (0, _postcss.plugin)('postcss-calc', function (opts) {
var options = Object.assign({
precision: 5,
preserve: false,
warnWhenCannotResolve: false,
mediaQueries: false,
selectors: false
}, opts);
return function (css, result) {
css.walk(function (node) {
var type = node.type;
if (type === 'decl') {
(0, _transform.default)(node, "value", options, result);
}
if (type === 'atrule' && options.mediaQueries) {
(0, _transform.default)(node, "params", options, result);
}
if (type === 'rule' && options.selectors) {
(0, _transform.default)(node, "selector", options, result);
}
});
};
});
exports.default = _default;
module.exports = exports.default;

157
web/node_modules/postcss-calc/dist/lib/convertUnit.js generated vendored Normal file
View file

@ -0,0 +1,157 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var conversions = {
// Absolute length units
'px': {
'px': 1,
'cm': 96 / 2.54,
'mm': 96 / 25.4,
'q': 96 / 101.6,
'in': 96,
'pt': 96 / 72,
'pc': 16
},
'cm': {
'px': 2.54 / 96,
'cm': 1,
'mm': 0.1,
'q': 0.025,
'in': 2.54,
'pt': 2.54 / 72,
'pc': 2.54 / 6
},
'mm': {
'px': 25.4 / 96,
'cm': 10,
'mm': 1,
'q': 0.25,
'in': 25.4,
'pt': 25.4 / 72,
'pc': 25.4 / 6
},
'q': {
'px': 101.6 / 96,
'cm': 40,
'mm': 4,
'q': 1,
'in': 101.6,
'pt': 101.6 / 72,
'pc': 101.6 / 6
},
'in': {
'px': 1 / 96,
'cm': 1 / 2.54,
'mm': 1 / 25.4,
'q': 1 / 101.6,
'in': 1,
'pt': 1 / 72,
'pc': 1 / 6
},
'pt': {
'px': 0.75,
'cm': 72 / 2.54,
'mm': 72 / 25.4,
'q': 72 / 101.6,
'in': 72,
'pt': 1,
'pc': 12
},
'pc': {
'px': 0.0625,
'cm': 6 / 2.54,
'mm': 6 / 25.4,
'q': 6 / 101.6,
'in': 6,
'pt': 6 / 72,
'pc': 1
},
// Angle units
'deg': {
'deg': 1,
'grad': 0.9,
'rad': 180 / Math.PI,
'turn': 360
},
'grad': {
'deg': 400 / 360,
'grad': 1,
'rad': 200 / Math.PI,
'turn': 400
},
'rad': {
'deg': Math.PI / 180,
'grad': Math.PI / 200,
'rad': 1,
'turn': Math.PI * 2
},
'turn': {
'deg': 1 / 360,
'grad': 0.0025,
'rad': 0.5 / Math.PI,
'turn': 1
},
// Duration units
's': {
's': 1,
'ms': 0.001
},
'ms': {
's': 1000,
'ms': 1
},
// Frequency units
'hz': {
'hz': 1,
'khz': 1000
},
'khz': {
'hz': 0.001,
'khz': 1
},
// Resolution units
'dpi': {
'dpi': 1,
'dpcm': 1 / 2.54,
'dppx': 1 / 96
},
'dpcm': {
'dpi': 2.54,
'dpcm': 1,
'dppx': 2.54 / 96
},
'dppx': {
'dpi': 96,
'dpcm': 96 / 2.54,
'dppx': 1
}
};
function convertUnit(value, sourceUnit, targetUnit, precision) {
var sourceUnitNormalized = sourceUnit.toLowerCase();
var targetUnitNormalized = targetUnit.toLowerCase();
if (!conversions[targetUnitNormalized]) {
throw new Error("Cannot convert to " + targetUnit);
}
if (!conversions[targetUnitNormalized][sourceUnitNormalized]) {
throw new Error("Cannot convert from " + sourceUnit + " to " + targetUnit);
}
var converted = conversions[targetUnitNormalized][sourceUnitNormalized] * value;
if (precision !== false) {
precision = Math.pow(10, parseInt(precision) || 5);
return Math.round(converted * precision) / precision;
}
return converted;
}
var _default = convertUnit;
exports.default = _default;
module.exports = exports.default;

320
web/node_modules/postcss-calc/dist/lib/reducer.js generated vendored Normal file
View file

@ -0,0 +1,320 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _convertUnit = _interopRequireDefault(require("./convertUnit"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isValueType(type) {
switch (type) {
case 'LengthValue':
case 'AngleValue':
case 'TimeValue':
case 'FrequencyValue':
case 'ResolutionValue':
case 'EmValue':
case 'ExValue':
case 'ChValue':
case 'RemValue':
case 'VhValue':
case 'VwValue':
case 'VminValue':
case 'VmaxValue':
case 'PercentageValue':
case 'Number':
return true;
}
return false;
}
function flip(operator) {
return operator === '+' ? '-' : '+';
}
function isAddSubOperator(operator) {
return operator === '+' || operator === '-';
}
function collectAddSubItems(preOperator, node, collected, precision) {
if (!isAddSubOperator(preOperator)) {
throw new Error(`invalid operator ${preOperator}`);
}
var type = node.type;
if (isValueType(type)) {
var itemIndex = collected.findIndex(function (x) {
return x.node.type === type;
});
if (itemIndex >= 0) {
if (node.value === 0) {
return;
}
var _covertNodesUnits = covertNodesUnits(collected[itemIndex].node, node, precision),
reducedNode = _covertNodesUnits.left,
current = _covertNodesUnits.right;
if (collected[itemIndex].preOperator === '-') {
collected[itemIndex].preOperator = '+';
reducedNode.value *= -1;
}
if (preOperator === "+") {
reducedNode.value += current.value;
} else {
reducedNode.value -= current.value;
} // make sure reducedNode.value >= 0
if (reducedNode.value >= 0) {
collected[itemIndex] = {
node: reducedNode,
preOperator: '+'
};
} else {
reducedNode.value *= -1;
collected[itemIndex] = {
node: reducedNode,
preOperator: '-'
};
}
} else {
// make sure node.value >= 0
if (node.value >= 0) {
collected.push({
node,
preOperator
});
} else {
node.value *= -1;
collected.push({
node,
preOperator: flip(preOperator)
});
}
}
} else if (type === "MathExpression") {
if (isAddSubOperator(node.operator)) {
collectAddSubItems(preOperator, node.left, collected, precision);
var collectRightOperator = preOperator === '-' ? flip(node.operator) : node.operator;
collectAddSubItems(collectRightOperator, node.right, collected, precision);
} else {
// * or /
var _reducedNode = reduce(node, precision); // prevent infinite recursive call
if (_reducedNode.type !== "MathExpression" || isAddSubOperator(_reducedNode.operator)) {
collectAddSubItems(preOperator, _reducedNode, collected, precision);
} else {
collected.push({
node: _reducedNode,
preOperator
});
}
}
} else {
collected.push({
node,
preOperator
});
}
}
function reduceAddSubExpression(node, precision) {
var collected = [];
collectAddSubItems('+', node, collected, precision);
var withoutZeroItem = collected.filter(function (item) {
return !(isValueType(item.node.type) && item.node.value === 0);
});
var firstNonZeroItem = withoutZeroItem[0]; // could be undefined
// prevent producing "calc(-var(--a))" or "calc()"
// which is invalid css
if (!firstNonZeroItem || firstNonZeroItem.preOperator === '-' && !isValueType(firstNonZeroItem.node.type)) {
var firstZeroItem = collected.find(function (item) {
return isValueType(item.node.type) && item.node.value === 0;
});
withoutZeroItem.unshift(firstZeroItem);
} // make sure the preOperator of the first item is +
if (withoutZeroItem[0].preOperator === '-' && isValueType(withoutZeroItem[0].node.type)) {
withoutZeroItem[0].node.value *= -1;
withoutZeroItem[0].preOperator = '+';
}
var root = withoutZeroItem[0].node;
for (var i = 1; i < withoutZeroItem.length; i++) {
root = {
type: 'MathExpression',
operator: withoutZeroItem[i].preOperator,
left: root,
right: withoutZeroItem[i].node
};
}
return root;
}
function reduceDivisionExpression(node) {
if (!isValueType(node.right.type)) {
return node;
}
if (node.right.type !== 'Number') {
throw new Error(`Cannot divide by "${node.right.unit}", number expected`);
}
return applyNumberDivision(node.left, node.right.value);
} // apply (expr) / number
function applyNumberDivision(node, divisor) {
if (divisor === 0) {
throw new Error('Cannot divide by zero');
}
if (isValueType(node.type)) {
node.value /= divisor;
return node;
}
if (node.type === "MathExpression" && isAddSubOperator(node.operator)) {
// turn (a + b) / num into a/num + b/num
// is good for further reduction
// checkout the test case
// "should reduce division before reducing additions"
return {
type: "MathExpression",
operator: node.operator,
left: applyNumberDivision(node.left, divisor),
right: applyNumberDivision(node.right, divisor)
};
} // it is impossible to reduce it into a single value
// .e.g the node contains css variable
// so we just preserve the division and let browser do it
return {
type: "MathExpression",
operator: '/',
left: node,
right: {
type: "Number",
value: divisor
}
};
}
function reduceMultiplicationExpression(node) {
// (expr) * number
if (node.right.type === 'Number') {
return applyNumberMultiplication(node.left, node.right.value);
} // number * (expr)
if (node.left.type === 'Number') {
return applyNumberMultiplication(node.right, node.left.value);
}
return node;
} // apply (expr) / number
function applyNumberMultiplication(node, multiplier) {
if (isValueType(node.type)) {
node.value *= multiplier;
return node;
}
if (node.type === "MathExpression" && isAddSubOperator(node.operator)) {
// turn (a + b) * num into a*num + b*num
// is good for further reduction
// checkout the test case
// "should reduce multiplication before reducing additions"
return {
type: "MathExpression",
operator: node.operator,
left: applyNumberMultiplication(node.left, multiplier),
right: applyNumberMultiplication(node.right, multiplier)
};
} // it is impossible to reduce it into a single value
// .e.g the node contains css variable
// so we just preserve the division and let browser do it
return {
type: "MathExpression",
operator: '*',
left: node,
right: {
type: "Number",
value: multiplier
}
};
}
function covertNodesUnits(left, right, precision) {
switch (left.type) {
case 'LengthValue':
case 'AngleValue':
case 'TimeValue':
case 'FrequencyValue':
case 'ResolutionValue':
if (right.type === left.type && right.unit && left.unit) {
var converted = (0, _convertUnit.default)(right.value, right.unit, left.unit, precision);
right = {
type: left.type,
value: converted,
unit: left.unit
};
}
return {
left,
right
};
default:
return {
left,
right
};
}
}
function reduce(node, precision) {
if (node.type === "MathExpression") {
if (isAddSubOperator(node.operator)) {
// reduceAddSubExpression will call reduce recursively
return reduceAddSubExpression(node, precision);
}
node.left = reduce(node.left, precision);
node.right = reduce(node.right, precision);
switch (node.operator) {
case "/":
return reduceDivisionExpression(node, precision);
case "*":
return reduceMultiplicationExpression(node, precision);
}
return node;
}
return node;
}
var _default = reduce;
exports.default = _default;
module.exports = exports.default;

81
web/node_modules/postcss-calc/dist/lib/stringifier.js generated vendored Normal file
View file

@ -0,0 +1,81 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var order = {
"*": 0,
"/": 0,
"+": 1,
"-": 1
};
function round(value, prec) {
if (prec !== false) {
var precision = Math.pow(10, prec);
return Math.round(value * precision) / precision;
}
return value;
}
function stringify(node, prec) {
switch (node.type) {
case "MathExpression":
{
var left = node.left,
right = node.right,
op = node.operator;
var str = "";
if (left.type === 'MathExpression' && order[op] < order[left.operator]) {
str += `(${stringify(left, prec)})`;
} else {
str += stringify(left, prec);
}
str += order[op] ? ` ${node.operator} ` : node.operator;
if (right.type === 'MathExpression' && order[op] < order[right.operator]) {
str += `(${stringify(right, prec)})`;
} else {
str += stringify(right, prec);
}
return str;
}
case 'Number':
return round(node.value, prec);
case 'Function':
return node.value;
default:
return round(node.value, prec) + node.unit;
}
}
function _default(calc, node, originalValue, options, result, item) {
var str = stringify(node, options.precision);
var shouldPrintCalc = node.type === "MathExpression" || node.type === "Function";
if (shouldPrintCalc) {
// if calc expression couldn't be resolved to a single value, re-wrap it as
// a calc()
str = `${calc}(${str})`; // if the warnWhenCannotResolve option is on, inform the user that the calc
// expression could not be resolved to a single value
if (options.warnWhenCannotResolve) {
result.warn("Could not reduce expression: " + originalValue, {
plugin: 'postcss-calc',
node: item
});
}
}
return str;
}
module.exports = exports.default;

81
web/node_modules/postcss-calc/dist/lib/transform.js generated vendored Normal file
View file

@ -0,0 +1,81 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
var _parser = require("../parser");
var _reducer = _interopRequireDefault(require("./reducer"));
var _stringifier = _interopRequireDefault(require("./stringifier"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// eslint-disable-next-line import/no-unresolved
var MATCH_CALC = /((?:-(moz|webkit)-)?calc)/i;
function transformValue(value, options, result, item) {
return (0, _postcssValueParser.default)(value).walk(function (node) {
// skip anything which isn't a calc() function
if (node.type !== 'function' || !MATCH_CALC.test(node.value)) {
return node;
} // stringify calc expression and produce an AST
var contents = _postcssValueParser.default.stringify(node.nodes);
var ast = _parser.parser.parse(contents); // reduce AST to its simplest form, that is, either to a single value
// or a simplified calc expression
var reducedAst = (0, _reducer.default)(ast, options.precision); // stringify AST and write it back
node.type = 'word';
node.value = (0, _stringifier.default)(node.value, reducedAst, value, options, result, item);
return false;
}).toString();
}
function transformSelector(value, options, result, item) {
return (0, _postcssSelectorParser.default)(function (selectors) {
selectors.walk(function (node) {
// attribute value
// e.g. the "calc(3*3)" part of "div[data-size="calc(3*3)"]"
if (node.type === 'attribute' && node.value) {
node.setValue(transformValue(node.value, options, result, item));
} // tag value
// e.g. the "calc(3*3)" part of "div:nth-child(2n + calc(3*3))"
if (node.type === 'tag') {
node.value = transformValue(node.value, options, result, item);
}
return;
});
}).processSync(value);
}
var _default = function _default(node, property, options, result) {
var value = property === "selector" ? transformSelector(node[property], options, result, node) : transformValue(node[property], options, result, node); // if the preserve option is enabled and the value has changed, write the
// transformed value into a cloned node which is inserted before the current
// node, preserving the original value. Otherwise, overwrite the original
// value.
if (options.preserve && node[property] !== value) {
var clone = node.clone();
clone[property] = value;
node.parent.insertBefore(node, clone);
} else {
node[property] = value;
}
};
exports.default = _default;
module.exports = exports.default;

3804
web/node_modules/postcss-calc/dist/parser.js generated vendored Normal file

File diff suppressed because it is too large Load diff

61
web/node_modules/postcss-calc/package.json generated vendored Normal file
View file

@ -0,0 +1,61 @@
{
"name": "postcss-calc",
"version": "7.0.5",
"description": "PostCSS plugin to reduce calc()",
"keywords": [
"css",
"postcss",
"postcss-plugin",
"calculation",
"calc"
],
"main": "dist/index.js",
"files": [
"dist",
"LICENSE"
],
"scripts": {
"prepublish": "npm run build",
"build": "del-cli dist && cross-env BABEL_ENV=publish babel src --out-dir dist --ignore src/__tests__/**/*.js && jison src/parser.jison -o dist/parser.js",
"pretest": "npm run build && eslint src",
"test": "ava"
},
"author": "Andy Jansson",
"license": "MIT",
"repository": "https://github.com/postcss/postcss-calc.git",
"eslintConfig": {
"parser": "babel-eslint",
"extends": "eslint-config-i-am-meticulous",
"rules": {
"curly": "error"
}
},
"devDependencies": {
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/register": "^7.0.0",
"ava": "^1.4.1",
"babel-eslint": "^10.0.1",
"babel-plugin-add-module-exports": "^1.0.0",
"cross-env": "^5.2.0",
"del-cli": "^1.1.0",
"eslint": "^5.7.0",
"eslint-config-i-am-meticulous": "^11.0.0",
"eslint-plugin-babel": "^5.2.1",
"eslint-plugin-import": "^2.14.0",
"jison-gho": "^0.6.1-215"
},
"dependencies": {
"postcss": "^7.0.27",
"postcss-selector-parser": "^6.0.2",
"postcss-value-parser": "^4.0.2"
},
"ava": {
"require": [
"@babel/register",
"@babel/polyfill"
]
}
}