Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-color-functional-notation

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-color-functional-notation - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

4

CHANGELOG.md
# Changes to PostCSS Color Functional Notation
### 2.0.1 (September 18, 2018)
- Updated: PostCSS Values Parser 2 (patch for this project)
### 2.0.0 (September 17, 2018)

@@ -4,0 +8,0 @@

50

index.cjs.js

@@ -6,3 +6,3 @@ 'use strict';

var postcss = _interopDefault(require('postcss'));
var parser = _interopDefault(require('postcss-values-parser'));
var valuesParser = _interopDefault(require('postcss-values-parser'));

@@ -13,7 +13,7 @@ var index = postcss.plugin('postcss-color-functional-notation', opts => {

root.walkDecls(decl => {
const value = decl.value;
const originalValue = decl.value;
if (colorAnyRegExp.test(value)) {
const ast = parser(value).parse();
ast.walkType('func', node => {
if (colorAnyRegExp.test(originalValue)) {
const valueAST = valuesParser(originalValue).parse();
valueAST.walkType('func', node => {
if (colorRegExp.test(node.value)) {

@@ -42,3 +42,3 @@ const children = node.nodes.slice(1, -1);

if (isSlash(slashNode)) {
if (slashNode && isSlash(slashNode)) {
slashNode.replaceWith(newComma());

@@ -59,10 +59,12 @@ }

});
const newValue = String(ast);
const modifiedValue = String(valueAST);
if (preserve) {
decl.cloneBefore({
value: newValue
});
} else {
decl.value = newValue;
if (modifiedValue !== originalValue) {
if (preserve) {
decl.cloneBefore({
value: modifiedValue
});
} else {
decl.value = modifiedValue;
}
}

@@ -83,21 +85,21 @@ }

const isAlphaValue = node => isCalc(node) || Object(node).type === 'number' && alphaUnitMatch.test(node.unit);
const isAlphaValue = node => isCalc(node) || node.type === 'number' && alphaUnitMatch.test(node.unit);
const isCalc = node => Object(node).type === 'func' && calcFuncMatch.test(node.value);
const isCalc = node => node.type === 'func' && calcFuncMatch.test(node.value);
const isHue = node => isCalc(node) || Object(node).type === 'number' && hueUnitMatch.test(node.unit);
const isHue = node => isCalc(node) || node.type === 'number' && hueUnitMatch.test(node.unit);
const isNumber = node => isCalc(node) || Object(node).type === 'number' && node.unit === '';
const isNumber = node => isCalc(node) || node.type === 'number' && node.unit === '';
const isPercentage = node => isCalc(node) || Object(node).type === 'number' && (node.unit === '%' || node.unit === '' && node.value === '0');
const isPercentage = node => isCalc(node) || node.type === 'number' && (node.unit === '%' || node.unit === '' && node.value === '0');
const isHslish = node => Object(node).type === 'func' && hslishRegExp.test(node.value);
const isHslish = node => node.type === 'func' && hslishRegExp.test(node.value);
const isHslRgb = node => Object(node).type === 'func' && hslRgbFuncMatch.test(node.value);
const isHslRgb = node => node.type === 'func' && hslRgbFuncMatch.test(node.value);
const isHslaRgba = node => Object(node).type === 'func' && hslaRgbaFuncMatch.test(node.value);
const isHslaRgba = node => node.type === 'func' && hslaRgbaFuncMatch.test(node.value);
const isRgbish = node => Object(node).type === 'func' && rgbishRegExp.test(node.value);
const isRgbish = node => node.type === 'func' && rgbishRegExp.test(node.value);
const isSlash = node => Object(node).type === 'operator' && node.value === '/';
const isSlash = node => node.type === 'operator' && node.value === '/';

@@ -114,3 +116,3 @@ const functionalHSLMatch = [isHue, isPercentage, isPercentage, isSlash, isAlphaValue];

const newComma = () => parser.comma({
const newComma = () => valuesParser.comma({
value: ','

@@ -117,0 +119,0 @@ });

{
"name": "postcss-color-functional-notation",
"version": "2.0.0",
"version": "2.0.1",
"description": "Use space and slash separated color notation in CSS",

@@ -31,7 +31,7 @@ "author": "Jonathan Neal <jonathantneal@hotmail.com>",

"postcss": "^7.0.2",
"postcss-values-parser": "^1.5.0"
"postcss-values-parser": "^2.0.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/core": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"babel-eslint": "^9.0.0",

@@ -43,3 +43,3 @@ "eslint": "^5.6.0",

"rollup": "^0.66.0",
"rollup-plugin-babel": "^4.0.1"
"rollup-plugin-babel": "^4.0.3"
},

@@ -46,0 +46,0 @@ "eslintConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc