summaryrefslogtreecommitdiff
path: root/node_modules/postcss-reduce-initial
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/postcss-reduce-initial')
-rw-r--r--node_modules/postcss-reduce-initial/LICENSE-MIT22
-rw-r--r--node_modules/postcss-reduce-initial/README.md92
-rw-r--r--node_modules/postcss-reduce-initial/package.json46
-rw-r--r--node_modules/postcss-reduce-initial/src/data/fromInitial.json317
-rw-r--r--node_modules/postcss-reduce-initial/src/data/toInitial.json36
-rw-r--r--node_modules/postcss-reduce-initial/src/index.js70
-rw-r--r--node_modules/postcss-reduce-initial/types/index.d.ts15
7 files changed, 598 insertions, 0 deletions
diff --git a/node_modules/postcss-reduce-initial/LICENSE-MIT b/node_modules/postcss-reduce-initial/LICENSE-MIT
new file mode 100644
index 00000000..fd0e863a
--- /dev/null
+++ b/node_modules/postcss-reduce-initial/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-reduce-initial/README.md b/node_modules/postcss-reduce-initial/README.md
new file mode 100644
index 00000000..d45d922b
--- /dev/null
+++ b/node_modules/postcss-reduce-initial/README.md
@@ -0,0 +1,92 @@
+# [postcss][postcss]-reduce-initial
+
+> Reduce `initial` definitions to the _actual_ initial value, where possible.
+
+## Install
+
+With [npm](https://npmjs.org/package/postcss-reduce-initial) do:
+
+```
+npm install postcss-reduce-initial --save
+```
+
+## Examples
+
+See the [data](data) for more conversions. This data is courtesy
+of Mozilla.
+
+### Convert `initial` values
+
+When the `initial` keyword is longer than the property value, it will
+be converted:
+
+#### Input
+
+```css
+h1 {
+ min-width: initial;
+}
+```
+
+#### Output
+
+```css
+h1 {
+ min-width: auto;
+}
+```
+
+### Convert values back to `initial`
+
+When the `initial` value is smaller than the property value, it will
+be converted:
+
+#### Input
+
+```css
+h1 {
+ transform-box: border-box;
+}
+```
+
+#### Output
+
+```css
+h1 {
+ transform-box: initial;
+}
+```
+
+This conversion is only applied when you supply a browsers list that all support
+the `initial` keyword; it's worth noting that Internet Explorer has no support.
+
+## API
+
+### reduceInitial([options])
+
+#### options
+
+##### ignore
+
+Type: `Array<String>`
+Default: `undefined`
+
+It contains the Array of properties that will be ignored while reducing its value to initial.
+Example : `{ ignore : ["min-height"] }`
+
+## Usage
+
+See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
+examples for your environment.
+
+## Contributors
+
+See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).
+
+## License
+
+This program uses a list of CSS properties derived from data maintained my the MDN team at Mozilla and licensed under the [CC0 1.0 Universal Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/).
+
+MIT © [Ben Briggs](http://beneb.info)
+
+[postcss]: https://github.com/postcss/postcss
diff --git a/node_modules/postcss-reduce-initial/package.json b/node_modules/postcss-reduce-initial/package.json
new file mode 100644
index 00000000..202bc496
--- /dev/null
+++ b/node_modules/postcss-reduce-initial/package.json
@@ -0,0 +1,46 @@
+{
+ "name": "postcss-reduce-initial",
+ "version": "6.0.0",
+ "description": "Reduce initial definitions to the actual initial value, where possible.",
+ "main": "src/index.js",
+ "types": "types/index.d.ts",
+ "files": [
+ "src",
+ "LICENSE-MIT",
+ "types"
+ ],
+ "keywords": [
+ "css",
+ "postcss",
+ "postcss-plugin"
+ ],
+ "license": "MIT",
+ "homepage": "https://github.com/cssnano/cssnano",
+ "author": {
+ "name": "Ben Briggs",
+ "email": "beneb.info@gmail.com",
+ "url": "http://beneb.info"
+ },
+ "repository": "cssnano/cssnano",
+ "dependencies": {
+ "browserslist": "^4.21.4",
+ "caniuse-api": "^3.0.0"
+ },
+ "bugs": {
+ "url": "https://github.com/cssnano/cssnano/issues"
+ },
+ "engines": {
+ "node": "^14 || ^16 || >=18.0"
+ },
+ "devDependencies": {
+ "@types/caniuse-api": "^3.0.2",
+ "html-to-text": "^8.2.0",
+ "postcss": "^8.2.15"
+ },
+ "peerDependencies": {
+ "postcss": "^8.2.15"
+ },
+ "scripts": {
+ "acquire": "node ./src/script/acquire.mjs"
+ }
+} \ No newline at end of file
diff --git a/node_modules/postcss-reduce-initial/src/data/fromInitial.json b/node_modules/postcss-reduce-initial/src/data/fromInitial.json
new file mode 100644
index 00000000..d16d7676
--- /dev/null
+++ b/node_modules/postcss-reduce-initial/src/data/fromInitial.json
@@ -0,0 +1,317 @@
+{
+ "-webkit-line-clamp": "none",
+ "accent-color": "auto",
+ "align-content": "normal",
+ "align-items": "normal",
+ "align-self": "auto",
+ "align-tracks": "normal",
+ "animation-delay": "0s",
+ "animation-direction": "normal",
+ "animation-duration": "0s",
+ "animation-fill-mode": "none",
+ "animation-iteration-count": "1",
+ "animation-name": "none",
+ "animation-timing-function": "ease",
+ "animation-timeline": "auto",
+ "appearance": "none",
+ "aspect-ratio": "auto",
+ "azimuth": "center",
+ "backdrop-filter": "none",
+ "background-attachment": "scroll",
+ "background-blend-mode": "normal",
+ "background-image": "none",
+ "background-position": "0% 0%",
+ "background-position-x": "0%",
+ "background-position-y": "0%",
+ "background-repeat": "repeat",
+ "block-overflow": "clip",
+ "block-size": "auto",
+ "border-block-style": "none",
+ "border-block-width": "medium",
+ "border-block-end-style": "none",
+ "border-block-end-width": "medium",
+ "border-block-start-style": "none",
+ "border-block-start-width": "medium",
+ "border-bottom-left-radius": "0",
+ "border-bottom-right-radius": "0",
+ "border-bottom-style": "none",
+ "border-bottom-width": "medium",
+ "border-end-end-radius": "0",
+ "border-end-start-radius": "0",
+ "border-image-outset": "0",
+ "border-image-slice": "100%",
+ "border-image-source": "none",
+ "border-image-width": "1",
+ "border-inline-style": "none",
+ "border-inline-width": "medium",
+ "border-inline-end-style": "none",
+ "border-inline-end-width": "medium",
+ "border-inline-start-style": "none",
+ "border-inline-start-width": "medium",
+ "border-left-style": "none",
+ "border-left-width": "medium",
+ "border-right-style": "none",
+ "border-right-width": "medium",
+ "border-spacing": "0",
+ "border-start-end-radius": "0",
+ "border-start-start-radius": "0",
+ "border-top-left-radius": "0",
+ "border-top-right-radius": "0",
+ "border-top-style": "none",
+ "border-top-width": "medium",
+ "bottom": "auto",
+ "box-decoration-break": "slice",
+ "box-shadow": "none",
+ "break-after": "auto",
+ "break-before": "auto",
+ "break-inside": "auto",
+ "caption-side": "top",
+ "caret-color": "auto",
+ "caret-shape": "auto",
+ "clear": "none",
+ "clip": "auto",
+ "clip-path": "none",
+ "color-scheme": "normal",
+ "column-count": "auto",
+ "column-gap": "normal",
+ "column-rule-style": "none",
+ "column-rule-width": "medium",
+ "column-span": "none",
+ "column-width": "auto",
+ "contain": "none",
+ "contain-intrinsic-block-size": "none",
+ "contain-intrinsic-height": "none",
+ "contain-intrinsic-inline-size": "none",
+ "contain-intrinsic-width": "none",
+ "content": "normal",
+ "counter-increment": "none",
+ "counter-reset": "none",
+ "counter-set": "none",
+ "cursor": "auto",
+ "direction": "ltr",
+ "empty-cells": "show",
+ "filter": "none",
+ "flex-basis": "auto",
+ "flex-direction": "row",
+ "flex-grow": "0",
+ "flex-shrink": "1",
+ "flex-wrap": "nowrap",
+ "float": "none",
+ "font-feature-settings": "normal",
+ "font-kerning": "auto",
+ "font-language-override": "normal",
+ "font-optical-sizing": "auto",
+ "font-variation-settings": "normal",
+ "font-size": "medium",
+ "font-size-adjust": "none",
+ "font-stretch": "normal",
+ "font-style": "normal",
+ "font-variant": "normal",
+ "font-variant-alternates": "normal",
+ "font-variant-caps": "normal",
+ "font-variant-east-asian": "normal",
+ "font-variant-ligatures": "normal",
+ "font-variant-numeric": "normal",
+ "font-variant-position": "normal",
+ "font-weight": "normal",
+ "forced-color-adjust": "auto",
+ "grid-auto-columns": "auto",
+ "grid-auto-flow": "row",
+ "grid-auto-rows": "auto",
+ "grid-column-end": "auto",
+ "grid-column-gap": "0",
+ "grid-column-start": "auto",
+ "grid-row-end": "auto",
+ "grid-row-gap": "0",
+ "grid-row-start": "auto",
+ "grid-template-areas": "none",
+ "grid-template-columns": "none",
+ "grid-template-rows": "none",
+ "hanging-punctuation": "none",
+ "height": "auto",
+ "hyphenate-character": "auto",
+ "hyphens": "manual",
+ "image-rendering": "auto",
+ "image-resolution": "1dppx",
+ "ime-mode": "auto",
+ "initial-letter": "normal",
+ "initial-letter-align": "auto",
+ "inline-size": "auto",
+ "input-security": "auto",
+ "inset": "auto",
+ "inset-block": "auto",
+ "inset-block-end": "auto",
+ "inset-block-start": "auto",
+ "inset-inline": "auto",
+ "inset-inline-end": "auto",
+ "inset-inline-start": "auto",
+ "isolation": "auto",
+ "justify-content": "normal",
+ "justify-items": "legacy",
+ "justify-self": "auto",
+ "justify-tracks": "normal",
+ "left": "auto",
+ "letter-spacing": "normal",
+ "line-break": "auto",
+ "line-clamp": "none",
+ "line-height": "normal",
+ "line-height-step": "0",
+ "list-style-image": "none",
+ "list-style-type": "disc",
+ "margin-block": "0",
+ "margin-block-end": "0",
+ "margin-block-start": "0",
+ "margin-bottom": "0",
+ "margin-inline": "0",
+ "margin-inline-end": "0",
+ "margin-inline-start": "0",
+ "margin-left": "0",
+ "margin-right": "0",
+ "margin-top": "0",
+ "margin-trim": "none",
+ "mask-border-mode": "alpha",
+ "mask-border-outset": "0",
+ "mask-border-slice": "0",
+ "mask-border-source": "none",
+ "mask-border-width": "auto",
+ "mask-composite": "add",
+ "mask-image": "none",
+ "mask-position": "center",
+ "mask-repeat": "repeat",
+ "mask-size": "auto",
+ "masonry-auto-flow": "pack",
+ "math-depth": "0",
+ "math-shift": "normal",
+ "math-style": "normal",
+ "max-block-size": "none",
+ "max-height": "none",
+ "max-inline-size": "none",
+ "max-lines": "none",
+ "max-width": "none",
+ "min-block-size": "0",
+ "min-height": "auto",
+ "min-inline-size": "0",
+ "min-width": "auto",
+ "mix-blend-mode": "normal",
+ "object-fit": "fill",
+ "offset-anchor": "auto",
+ "offset-distance": "0",
+ "offset-path": "none",
+ "offset-position": "auto",
+ "offset-rotate": "auto",
+ "opacity": "1",
+ "order": "0",
+ "orphans": "2",
+ "outline-offset": "0",
+ "outline-style": "none",
+ "outline-width": "medium",
+ "overflow-anchor": "auto",
+ "overflow-block": "auto",
+ "overflow-clip-margin": "0px",
+ "overflow-inline": "auto",
+ "overflow-wrap": "normal",
+ "overscroll-behavior": "auto",
+ "overscroll-behavior-block": "auto",
+ "overscroll-behavior-inline": "auto",
+ "overscroll-behavior-x": "auto",
+ "overscroll-behavior-y": "auto",
+ "padding-block": "0",
+ "padding-block-end": "0",
+ "padding-block-start": "0",
+ "padding-bottom": "0",
+ "padding-inline": "0",
+ "padding-inline-end": "0",
+ "padding-inline-start": "0",
+ "padding-left": "0",
+ "padding-right": "0",
+ "padding-top": "0",
+ "page-break-after": "auto",
+ "page-break-before": "auto",
+ "page-break-inside": "auto",
+ "paint-order": "normal",
+ "perspective": "none",
+ "place-content": "normal",
+ "pointer-events": "auto",
+ "position": "static",
+ "resize": "none",
+ "right": "auto",
+ "rotate": "none",
+ "row-gap": "normal",
+ "scale": "none",
+ "scrollbar-color": "auto",
+ "scrollbar-gutter": "auto",
+ "scrollbar-width": "auto",
+ "scroll-behavior": "auto",
+ "scroll-margin": "0",
+ "scroll-margin-block": "0",
+ "scroll-margin-block-start": "0",
+ "scroll-margin-block-end": "0",
+ "scroll-margin-bottom": "0",
+ "scroll-margin-inline": "0",
+ "scroll-margin-inline-start": "0",
+ "scroll-margin-inline-end": "0",
+ "scroll-margin-left": "0",
+ "scroll-margin-right": "0",
+ "scroll-margin-top": "0",
+ "scroll-padding": "auto",
+ "scroll-padding-block": "auto",
+ "scroll-padding-block-start": "auto",
+ "scroll-padding-block-end": "auto",
+ "scroll-padding-bottom": "auto",
+ "scroll-padding-inline": "auto",
+ "scroll-padding-inline-start": "auto",
+ "scroll-padding-inline-end": "auto",
+ "scroll-padding-left": "auto",
+ "scroll-padding-right": "auto",
+ "scroll-padding-top": "auto",
+ "scroll-snap-align": "none",
+ "scroll-snap-coordinate": "none",
+ "scroll-snap-points-x": "none",
+ "scroll-snap-points-y": "none",
+ "scroll-snap-stop": "normal",
+ "scroll-snap-type": "none",
+ "scroll-snap-type-x": "none",
+ "scroll-snap-type-y": "none",
+ "scroll-timeline-axis": "block",
+ "scroll-timeline-name": "none",
+ "shape-image-threshold": "0.0",
+ "shape-margin": "0",
+ "shape-outside": "none",
+ "tab-size": "8",
+ "table-layout": "auto",
+ "text-align-last": "auto",
+ "text-combine-upright": "none",
+ "text-decoration-line": "none",
+ "text-decoration-skip-ink": "auto",
+ "text-decoration-style": "solid",
+ "text-decoration-thickness": "auto",
+ "text-emphasis-style": "none",
+ "text-indent": "0",
+ "text-justify": "auto",
+ "text-orientation": "mixed",
+ "text-overflow": "clip",
+ "text-rendering": "auto",
+ "text-shadow": "none",
+ "text-transform": "none",
+ "text-underline-offset": "auto",
+ "text-underline-position": "auto",
+ "top": "auto",
+ "touch-action": "auto",
+ "transform": "none",
+ "transform-style": "flat",
+ "transition-delay": "0s",
+ "transition-duration": "0s",
+ "transition-property": "all",
+ "transition-timing-function": "ease",
+ "translate": "none",
+ "unicode-bidi": "normal",
+ "user-select": "auto",
+ "white-space": "normal",
+ "widows": "2",
+ "width": "auto",
+ "will-change": "auto",
+ "word-break": "normal",
+ "word-spacing": "normal",
+ "word-wrap": "normal",
+ "z-index": "auto"
+}
diff --git a/node_modules/postcss-reduce-initial/src/data/toInitial.json b/node_modules/postcss-reduce-initial/src/data/toInitial.json
new file mode 100644
index 00000000..f001cb6e
--- /dev/null
+++ b/node_modules/postcss-reduce-initial/src/data/toInitial.json
@@ -0,0 +1,36 @@
+{
+ "background-clip": "border-box",
+ "background-color": "transparent",
+ "background-origin": "padding-box",
+ "background-size": "auto auto",
+ "border-block-color": "currentcolor",
+ "border-block-end-color": "currentcolor",
+ "border-block-start-color": "currentcolor",
+ "border-bottom-color": "currentcolor",
+ "border-collapse": "separate",
+ "border-inline-color": "currentcolor",
+ "border-inline-end-color": "currentcolor",
+ "border-inline-start-color": "currentcolor",
+ "border-left-color": "currentcolor",
+ "border-right-color": "currentcolor",
+ "border-top-color": "currentcolor",
+ "box-sizing": "content-box",
+ "color": "canvastext",
+ "column-rule-color": "currentcolor",
+ "font-synthesis": "weight style",
+ "image-orientation": "from-image",
+ "mask-clip": "border-box",
+ "mask-mode": "match-source",
+ "mask-origin": "border-box",
+ "mask-type": "luminance",
+ "ruby-align": "space-around",
+ "ruby-merge": "separate",
+ "ruby-position": "alternate",
+ "text-decoration-color": "currentcolor",
+ "text-emphasis-color": "currentcolor",
+ "text-emphasis-position": "over right",
+ "transform-box": "view-box",
+ "transform-origin": "50% 50% 0",
+ "vertical-align": "baseline",
+ "writing-mode": "horizontal-tb"
+}
diff --git a/node_modules/postcss-reduce-initial/src/index.js b/node_modules/postcss-reduce-initial/src/index.js
new file mode 100644
index 00000000..5432f7fe
--- /dev/null
+++ b/node_modules/postcss-reduce-initial/src/index.js
@@ -0,0 +1,70 @@
+'use strict';
+const browserslist = require('browserslist');
+const { isSupported } = require('caniuse-api');
+const fromInitial = require('./data/fromInitial.json');
+const toInitial = require('./data/toInitial.json');
+
+const initial = 'initial';
+
+// In most of the browser including chrome the initial for `writing-mode` is not `horizontal-tb`. Ref https://github.com/cssnano/cssnano/pull/905
+const defaultIgnoreProps = ['writing-mode', 'transform-box'];
+/** @typedef {{ignore?: string[]}} Options */
+
+/**
+ * @type {import('postcss').PluginCreator<Options>}
+ * @param {Options} options
+ * @return {import('postcss').Plugin}
+ */
+function pluginCreator(options = {}) {
+ return {
+ postcssPlugin: 'postcss-reduce-initial',
+ /** @param {import('postcss').Result & {opts: browserslist.Options & {ignore?: string[]}}} result */
+ prepare(result) {
+ const resultOpts = result.opts || {};
+ const browsers = browserslist(null, {
+ stats: resultOpts.stats,
+ path: __dirname,
+ env: resultOpts.env,
+ });
+
+ const initialSupport = isSupported('css-initial-value', browsers);
+ return {
+ OnceExit(css) {
+ css.walkDecls((decl) => {
+ const lowerCasedProp = decl.prop.toLowerCase();
+ const ignoreProp = new Set(
+ defaultIgnoreProps.concat(options.ignore || [])
+ );
+
+ if (ignoreProp.has(lowerCasedProp)) {
+ return;
+ }
+
+ if (
+ initialSupport &&
+ Object.prototype.hasOwnProperty.call(toInitial, lowerCasedProp) &&
+ decl.value.toLowerCase() ===
+ toInitial[/** @type {keyof toInitial} */ (lowerCasedProp)]
+ ) {
+ decl.value = initial;
+ return;
+ }
+
+ if (
+ decl.value.toLowerCase() !== initial ||
+ !fromInitial[/** @type {keyof fromInitial} */ (lowerCasedProp)]
+ ) {
+ return;
+ }
+
+ decl.value =
+ fromInitial[/** @type {keyof fromInitial} */ (lowerCasedProp)];
+ });
+ },
+ };
+ },
+ };
+}
+
+pluginCreator.postcss = true;
+module.exports = pluginCreator;
diff --git a/node_modules/postcss-reduce-initial/types/index.d.ts b/node_modules/postcss-reduce-initial/types/index.d.ts
new file mode 100644
index 00000000..1f9371f3
--- /dev/null
+++ b/node_modules/postcss-reduce-initial/types/index.d.ts
@@ -0,0 +1,15 @@
+export = pluginCreator;
+/** @typedef {{ignore?: string[]}} Options */
+/**
+ * @type {import('postcss').PluginCreator<Options>}
+ * @param {Options} options
+ * @return {import('postcss').Plugin}
+ */
+declare function pluginCreator(options?: Options): import('postcss').Plugin;
+declare namespace pluginCreator {
+ export { postcss, Options };
+}
+type Options = {
+ ignore?: string[];
+};
+declare var postcss: true;