postcss-lab-function
Advanced tools
Comparing version 3.1.2 to 4.0.0
'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var postcss = _interopDefault(require('postcss')); | ||
var postcssValuesParser = require('postcss-values-parser'); | ||
@@ -83,18 +80,18 @@ var convertColors = require('@csstools/convert-colors'); | ||
const createRegExpTest = Function.bind.bind(RegExp.prototype.test); | ||
const createRegExpTest$1 = Function.bind.bind(RegExp.prototype.test); | ||
/** Return whether the function name is `lab` or `lch`. */ | ||
const isColorFunctionName = createRegExpTest(/^(lab|lch)$/i); | ||
const isColorFunctionName = createRegExpTest$1(/^(lab|lch)$/i); | ||
/** Return whether the function name is `calc`. */ | ||
const isCalcFunctionName = createRegExpTest(/^calc$/i); | ||
const isCalcFunctionName = createRegExpTest$1(/^calc$/i); | ||
/** Return whether the function name is `lab`. */ | ||
const isLabColorFunctionName = createRegExpTest(/^lab$/i); | ||
const isLabColorFunctionName = createRegExpTest$1(/^lab$/i); | ||
/** Return whether the unit is alpha-like. */ | ||
const isAlphaLikeUnit = createRegExpTest(/^%?$/i); | ||
const isAlphaLikeUnit = createRegExpTest$1(/^%?$/i); | ||
/** Return whether the unit is hue-like. */ | ||
const isHueLikeUnit = createRegExpTest(/^(deg|grad|rad|turn)?$/i); | ||
const isHueLikeUnit = createRegExpTest$1(/^(deg|grad|rad|turn)?$/i); | ||
/** @type {(node: CSSFunction) => boolean} Return whether the node is an Alpha-like unit. */ | ||
@@ -174,6 +171,6 @@ | ||
const createRegExpTest$1 = Function.bind.bind(RegExp.prototype.test); | ||
const createRegExpTest = Function.bind.bind(RegExp.prototype.test); | ||
/** Return whether the value has a lab() or lch() function. */ | ||
const hasAnyColorFunction = createRegExpTest$1(/(^|[^\w-])(lab|lch)\(/i); | ||
const hasAnyColorFunction = createRegExpTest(/(^|[^\w-])(lab|lch)\(/i); | ||
/** @typedef {import('postcss').Declaration} CSSDeclaration */ | ||
@@ -183,16 +180,18 @@ | ||
const postcssPlugin = postcss.plugin('postcss-lab-function', | ||
const postcssPlugin = | ||
/** @type {PostCSSPluginInitializer} */ | ||
opts => { | ||
options.preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : false; | ||
return root => { | ||
root.walkDecls(onCSSDeclaration); | ||
return { | ||
postcssPlugin: 'postcss-lab-function', | ||
Declaration: onCSSDeclaration | ||
}; | ||
}); | ||
/** @typedef {import('postcss').Root} CSSRoot */ | ||
}; | ||
/** @typedef {(root: CSSRoot) => void} PostCSSTransformCallback */ | ||
postcssPlugin.postcss = true; | ||
/** @typedef {import('postcss').Plugin} PostCSSPlugin */ | ||
/** @typedef {(opts: options) => PostCSSTransformCallback} PostCSSPluginInitializer */ | ||
/** @typedef {(opts: options) => PostCSSPlugin} PostCSSPluginInitializer */ | ||
module.exports = postcssPlugin; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -1,2 +0,1 @@ | ||
import postcss from 'postcss'; | ||
import { parse } from 'postcss-values-parser'; | ||
@@ -79,18 +78,18 @@ import { lab2rgb, lch2rgb } from '@csstools/convert-colors'; | ||
const createRegExpTest = Function.bind.bind(RegExp.prototype.test); | ||
const createRegExpTest$1 = Function.bind.bind(RegExp.prototype.test); | ||
/** Return whether the function name is `lab` or `lch`. */ | ||
const isColorFunctionName = createRegExpTest(/^(lab|lch)$/i); | ||
const isColorFunctionName = createRegExpTest$1(/^(lab|lch)$/i); | ||
/** Return whether the function name is `calc`. */ | ||
const isCalcFunctionName = createRegExpTest(/^calc$/i); | ||
const isCalcFunctionName = createRegExpTest$1(/^calc$/i); | ||
/** Return whether the function name is `lab`. */ | ||
const isLabColorFunctionName = createRegExpTest(/^lab$/i); | ||
const isLabColorFunctionName = createRegExpTest$1(/^lab$/i); | ||
/** Return whether the unit is alpha-like. */ | ||
const isAlphaLikeUnit = createRegExpTest(/^%?$/i); | ||
const isAlphaLikeUnit = createRegExpTest$1(/^%?$/i); | ||
/** Return whether the unit is hue-like. */ | ||
const isHueLikeUnit = createRegExpTest(/^(deg|grad|rad|turn)?$/i); | ||
const isHueLikeUnit = createRegExpTest$1(/^(deg|grad|rad|turn)?$/i); | ||
/** @type {(node: CSSFunction) => boolean} Return whether the node is an Alpha-like unit. */ | ||
@@ -170,6 +169,6 @@ | ||
const createRegExpTest$1 = Function.bind.bind(RegExp.prototype.test); | ||
const createRegExpTest = Function.bind.bind(RegExp.prototype.test); | ||
/** Return whether the value has a lab() or lch() function. */ | ||
const hasAnyColorFunction = createRegExpTest$1(/(^|[^\w-])(lab|lch)\(/i); | ||
const hasAnyColorFunction = createRegExpTest(/(^|[^\w-])(lab|lch)\(/i); | ||
/** @typedef {import('postcss').Declaration} CSSDeclaration */ | ||
@@ -179,16 +178,18 @@ | ||
const postcssPlugin = postcss.plugin('postcss-lab-function', | ||
const postcssPlugin = | ||
/** @type {PostCSSPluginInitializer} */ | ||
opts => { | ||
options.preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : false; | ||
return root => { | ||
root.walkDecls(onCSSDeclaration); | ||
return { | ||
postcssPlugin: 'postcss-lab-function', | ||
Declaration: onCSSDeclaration | ||
}; | ||
}); | ||
/** @typedef {import('postcss').Root} CSSRoot */ | ||
}; | ||
/** @typedef {(root: CSSRoot) => void} PostCSSTransformCallback */ | ||
postcssPlugin.postcss = true; | ||
/** @typedef {import('postcss').Plugin} PostCSSPlugin */ | ||
/** @typedef {(opts: options) => PostCSSTransformCallback} PostCSSPluginInitializer */ | ||
/** @typedef {(opts: options) => PostCSSPlugin} PostCSSPluginInitializer */ | ||
export default postcssPlugin; | ||
export { postcssPlugin as default }; | ||
//# sourceMappingURL=index.esm.js.map |
{ | ||
"name": "postcss-lab-function", | ||
"version": "3.1.2", | ||
"version": "4.0.0", | ||
"description": "Use lab() and lch() color functions in CSS", | ||
@@ -26,17 +26,19 @@ "author": "Jonathan Neal <jonathantneal@hotmail.com>", | ||
"engines": { | ||
"node": ">=10.0.0" | ||
"node": ">=12" | ||
}, | ||
"dependencies": { | ||
"@csstools/convert-colors": "^2.0.0", | ||
"postcss": "^7.0.27", | ||
"postcss-values-parser": "^3.2.0" | ||
"@csstools/convert-colors": "2.0.0", | ||
"postcss-values-parser": "6.0.0" | ||
}, | ||
"peerDependencies": { | ||
"postcss": "^8.3" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.9.0", | ||
"@babel/preset-env": "^7.9.5", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^6.8.0", | ||
"postcss-tape": "^5.0.2", | ||
"rollup": "^2.7.2", | ||
"rollup-plugin-babel": "^4.4.0" | ||
"@babel/core": "7.15.5", | ||
"@babel/preset-env": "7.15.6", | ||
"@rollup/plugin-babel": "5.3.0", | ||
"eslint": "7.32.0", | ||
"postcss": "8.3.6", | ||
"postcss-tape": "6.0.1", | ||
"rollup": "2.56.3" | ||
}, | ||
@@ -59,20 +61,6 @@ "babel": { | ||
"extends": "eslint:recommended", | ||
"parser": "babel-eslint" | ||
"parserOptions": { | ||
"sourceType": "module" | ||
} | ||
}, | ||
"rollup": { | ||
"input": "src/index.js", | ||
"plugins": [ | ||
"rollup-plugin-babel" | ||
], | ||
"output": [ | ||
{ | ||
"file": "dist/index.cjs.js", | ||
"format": "cjs" | ||
}, | ||
{ | ||
"file": "dist/index.esm.js", | ||
"format": "esm" | ||
} | ||
] | ||
}, | ||
"keywords": [ | ||
@@ -79,0 +67,0 @@ "postcss", |
@@ -5,3 +5,3 @@ # PostCSS Lab Function [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss] | ||
[<img alt="CSS Standard Status" src="https://cssdb.org/badge/lab-function.svg" height="20">][css-url] | ||
[<img alt="build status" src="https://img.shields.io/travis/csstools/postcss-lab-function/master.svg" height="20">][cli-url] | ||
[<img alt="Build Status" src="https://github.com/csstools/postcss-lab-function/workflows/test/badge.svg" height="20">][cli-url] | ||
[<img alt="support chat" src="https://img.shields.io/badge/support-chat-blue.svg" height="20">][git-url] | ||
@@ -32,16 +32,8 @@ | ||
```bash | ||
npm install postcss-lab-function --save-dev | ||
npm install postcss postcss-lab-function --save-dev | ||
``` | ||
Use [PostCSS Lab Function] to process your CSS: | ||
Use it as a [PostCSS] plugin: | ||
```js | ||
const postcssLabFunction = require('postcss-lab-function'); | ||
postcssLabFunction.process(YOUR_CSS /*, processOptions, pluginOptions */); | ||
``` | ||
Or use it as a [PostCSS] plugin: | ||
```js | ||
const postcss = require('postcss'); | ||
@@ -88,3 +80,3 @@ const postcssLabFunction = require('postcss-lab-function'); | ||
[cli-url]: https://travis-ci.org/csstools/postcss-lab-function | ||
[cli-url]: https://github.com/csstools/postcss-lab-function/actions/workflows/test.yml?query=workflow/test | ||
[css-url]: https://cssdb.org/#lab-function | ||
@@ -91,0 +83,0 @@ [git-url]: https://gitter.im/postcss/postcss |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51618
7
277
89
+ Addedis-url-superb@4.0.0(transitive)
+ Addednanoid@3.3.7(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpostcss@8.4.47(transitive)
+ Addedpostcss-values-parser@6.0.0(transitive)
+ Addedquote-unquote@1.0.0(transitive)
+ Addedsource-map-js@1.2.1(transitive)
- Removedpostcss@^7.0.27
- Removedip-regex@4.3.0(transitive)
- Removedis-url-superb@3.0.0(transitive)
- Removedpicocolors@0.2.1(transitive)
- Removedpostcss@7.0.39(transitive)
- Removedpostcss-values-parser@3.2.1(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedtlds@1.255.0(transitive)
- Removedurl-regex@5.0.0(transitive)
Updatedpostcss-values-parser@6.0.0