summaryrefslogtreecommitdiff
path: root/node_modules/postcss-reduce-initial/src
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:05:55 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:05:55 +0800
commitc06f7ee0a40255214c477e13d9b956a7e07c2900 (patch)
treef5982a568ef8fab865d0142e71c7494fea3e4c1b /node_modules/postcss-reduce-initial/src
parent3fd9400d4dccc25aa29b5702216732e0b7542073 (diff)
postcss,(plugins): nanocss, postcss-preset-env
Diffstat (limited to 'node_modules/postcss-reduce-initial/src')
-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
3 files changed, 423 insertions, 0 deletions
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;