diff options
Diffstat (limited to 'node_modules/postcss-custom-properties')
7 files changed, 0 insertions, 323 deletions
diff --git a/node_modules/postcss-custom-properties/CHANGELOG.md b/node_modules/postcss-custom-properties/CHANGELOG.md deleted file mode 100644 index ab201ac8..00000000 --- a/node_modules/postcss-custom-properties/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -# Changes to PostCSS Custom Properties - -### 13.3.12 - -_July 6, 2024_ - -- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.4.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#241) (patch) -- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.7.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#271) (patch) -- Updated [`@csstools/cascade-layer-name-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/cascade-layer-name-parser) to [`1.0.13`](https://github.com/csstools/postcss-plugins/tree/main/packages/cascade-layer-name-parser/CHANGELOG.md#1013) (patch) - -### 13.3.11 - -_June 29, 2024_ - -- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#232) (patch) -- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.7.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#270) (minor) -- Updated [`@csstools/cascade-layer-name-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/cascade-layer-name-parser) to [`1.0.12`](https://github.com/csstools/postcss-plugins/tree/main/packages/cascade-layer-name-parser/CHANGELOG.md#1012) (patch) - -### 13.3.10 - -_May 4, 2024_ - -- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#231) (patch) -- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#263) (patch) -- Updated [`@csstools/cascade-layer-name-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/cascade-layer-name-parser) to [`1.0.11`](https://github.com/csstools/postcss-plugins/tree/main/packages/cascade-layer-name-parser/CHANGELOG.md#1011) (patch) - -[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-properties/CHANGELOG.md) diff --git a/node_modules/postcss-custom-properties/LICENSE.md b/node_modules/postcss-custom-properties/LICENSE.md deleted file mode 100644 index 6d704708..00000000 --- a/node_modules/postcss-custom-properties/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -# The MIT License (MIT) - -Copyright © PostCSS - -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-custom-properties/README.md b/node_modules/postcss-custom-properties/README.md deleted file mode 100644 index bdf1a410..00000000 --- a/node_modules/postcss-custom-properties/README.md +++ /dev/null @@ -1,186 +0,0 @@ -# PostCSS Custom Properties [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][PostCSS] - -[<img alt="npm version" src="https://img.shields.io/npm/v/postcss-custom-properties.svg" height="20">][npm-url] [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url] [<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]<br><br>[<img alt="Baseline Status" src="https://cssdb.org/images/badges-baseline/custom-properties.svg" height="20">][css-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/custom-properties.svg" height="20">][css-url] - -```bash -npm install postcss-custom-properties --save-dev -``` - -[PostCSS Custom Properties] lets you use Custom Properties in CSS, following -the [CSS Custom Properties] specification. - -[](https://caniuse.com/#feat=css-variables) - -```pcss -:root { - --color-blue-dark: rgb(0, 61, 184); - --color-blue-light: rgb(0, 217, 255); - --color-pink: rgb(255, 192, 211); - --text-color: var(--color-pink); -} - -.element { - /* custom props */ - --border-color: var(--color-blue-light); - - /* props */ - border: 1px solid var(--border-color); - color: var(--text-color); -} - -.element--dark { - --border-color: var(--color-blue-dark); -} - -/* becomes */ - -:root { - --color-blue-dark: rgb(0, 61, 184); - --color-blue-light: rgb(0, 217, 255); - --color-pink: rgb(255, 192, 211); - --text-color: var(--color-pink); -} - -.element { - /* custom props */ - --border-color: var(--color-blue-light); - - /* props */ - border: 1px solid rgb(0, 217, 255); - border: 1px solid var(--border-color); - color: rgb(255, 192, 211); - color: var(--text-color); -} - -.element--dark { - --border-color: var(--color-blue-dark); -} -``` - -**Note:** -- Only processes variables that were defined in the `:root` or `html` selector. -- Locally defined variables will be used as fallbacks only within the same rule, but not elsewhere. -- Fallback values in `var()` will be used if the variable was not defined in the `:root` or `html` selector. - -## Usage - -Add [PostCSS Custom Properties] to your project: - -```bash -npm install postcss postcss-custom-properties --save-dev -``` - -Use it as a [PostCSS] plugin: - -```js -const postcss = require('postcss'); -const postcssCustomProperties = require('postcss-custom-properties'); - -postcss([ - postcssCustomProperties(/* pluginOptions */) -]).process(YOUR_CSS /*, processOptions */); -``` - -[PostCSS Custom Properties] runs in all Node environments, with special -instructions for: - -- [Node](INSTALL.md#node) -- [PostCSS CLI](INSTALL.md#postcss-cli) -- [PostCSS Load Config](INSTALL.md#postcss-load-config) -- [Webpack](INSTALL.md#webpack) -- [Next.js](INSTALL.md#nextjs) -- [Gulp](INSTALL.md#gulp) -- [Grunt](INSTALL.md#grunt) - -## Options - -### preserve - -The `preserve` option determines whether properties using -custom properties should be preserved in their original form. By default these are preserved. - -Custom property declarations are always preserved only `var()` functions can be omitted. - -```js -postcssCustomProperties({ preserve: false }) -``` - -```pcss -:root { - --color-blue-dark: rgb(0, 61, 184); - --color-blue-light: rgb(0, 217, 255); - --color-pink: rgb(255, 192, 211); - --text-color: var(--color-pink); -} - -.element { - /* custom props */ - --border-color: var(--color-blue-light); - - /* props */ - border: 1px solid var(--border-color); - color: var(--text-color); -} - -.element--dark { - --border-color: var(--color-blue-dark); -} - -/* becomes */ - -:root { - --color-blue-dark: rgb(0, 61, 184); - --color-blue-light: rgb(0, 217, 255); - --color-pink: rgb(255, 192, 211); - --text-color: var(--color-pink); -} - -.element { - /* custom props */ - --border-color: var(--color-blue-light); - - /* props */ - border: 1px solid var(--border-color); - color: rgb(255, 192, 211); -} - -.element--dark { - --border-color: var(--color-blue-dark); -} -``` - -## Modular CSS Processing - -If you're using Modular CSS such as, CSS Modules, `postcss-loader` or `vanilla-extract` to name a few, you'll probably -notice that custom properties are not being resolved. This happens because each file is processed separately so -unless you import the custom properties definitions in each file, they won't be resolved. - -To overcome this, we recommend using the [PostCSS Global Data](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-global-data#readme) -plugin which allows you to pass a list of files that will be globally available. The plugin won't inject any extra code -in the output but will provide the context needed to resolve custom properties. - -For it to run it needs to be placed before the [PostCSS Custom Properties] plugin. - -```js -const postcss = require('postcss'); -const postcssCustomProperties = require('postcss-custom-properties'); -const postcssGlobalData = require('@csstools/postcss-global-data'); - -postcss([ - postcssGlobalData({ - files: [ - 'path/to/your/custom-selectors.css' - ] - }), - postcssCustomProperties(/* pluginOptions */) -]).process(YOUR_CSS /*, processOptions */); -``` - -[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test -[css-url]: https://cssdb.org/#custom-properties -[discord]: https://discord.gg/bUadyRwkJS -[npm-url]: https://www.npmjs.com/package/postcss-custom-properties - -[PostCSS]: https://github.com/postcss/postcss -[PostCSS Custom Properties]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-properties -[CSS Custom Properties]: https://www.w3.org/TR/css-variables-1/ diff --git a/node_modules/postcss-custom-properties/dist/index.cjs b/node_modules/postcss-custom-properties/dist/index.cjs deleted file mode 100644 index 55a9f554..00000000 --- a/node_modules/postcss-custom-properties/dist/index.cjs +++ /dev/null @@ -1 +0,0 @@ -"use strict";var e=require("@csstools/cascade-layer-name-parser"),t=require("postcss-value-parser"),r=require("@csstools/utilities");const n=e.parse("csstools-implicit-layer")[0];function collectCascadeLayerOrder(t){const r=new Map,o=new Map,s=[];t.walkAtRules((t=>{if("layer"!==t.name.toLowerCase())return;{let e=t.parent;for(;e;){if("atrule"!==e.type||"layer"!==e.name.toLowerCase()){if(e===t.root())break;return}e=e.parent}}let a;if(t.nodes)a=normalizeLayerName(t.params,1);else{if(!t.params.trim())return;a=t.params}let i=e.parse(a);if(i?.length){{let e=t.parent;for(;e&&"atrule"===e.type&&"layer"===e.name.toLowerCase();){const t=o.get(e);t?(i=i.map((e=>t.concat(e))),e=e.parent):e=e.parent}}if(e.addLayerToModel(s,i),t.nodes){const e=i[0].concat(n);r.set(t,e),o.set(t,i[0])}}}));for(const t of r.values())e.addLayerToModel(s,[t]);const a=new WeakMap;for(const[e,t]of r)a.set(e,s.findIndex((e=>t.equal(e))));return a}function normalizeLayerName(e,t){return e.trim()?e:"csstools-anon-layer--"+t++}const o=/(?:!\s*)?postcss-custom-properties:\s*off\b/i,s=new WeakMap;function isBlockIgnored(e){if(!e||!e.nodes)return!1;if(s.has(e))return s.get(e);const t=e.some((e=>isIgnoreComment(e,o)));return s.set(e,t),t}const a=/(?:!\s*)?postcss-custom-properties:\s*ignore\s+next\b/i;function isDeclarationIgnored(e){return!!e&&(!!isBlockIgnored(e.parent)||isIgnoreComment(e.prev(),a))}function isIgnoreComment(e,t){return!!e&&"comment"===e.type&&t.test(e.text)}const i=new Set(["layer"]);function isProcessableRule(e){let t=e.parent;for(;t;){if("atrule"===t.type&&!i.has(t.name.toLowerCase()))return!1;t=t.parent}return!0}const l=/^html$/i,c=/^:where\(html\)$/i,u=/^:root$/i,p=/^:where\(:root\)$/i,f=/(html|:root)/i,d=/^var$/i;function isVarFunction(e){return"function"===e.type&&d.test(e.value)&&e.nodes?.length>0}const m=/\bvar\(/i;function parseOrCached(e,r){let n=r.get(e);return n||(n=t(e),r.set(e,n),n)}function toposort(e,t){let r=e.length;const n=new Array(r),o={};let s=r;const a=makeOutgoingEdges(t),i=makeNodesHash(e);for(;s--;)o[s]||visit(e[s],s,new Set);return n;function visit(e,t,s){if(s.has(e)){let t;try{t=", node was:"+JSON.stringify(e)}catch{t=""}throw new Error("Cyclic dependency"+t)}if(!i.has(e))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(e));if(o[t])return;o[t]=!0;const l=Array.from(a.get(e)||new Set);if(t=l.length){s.add(e);do{const e=l[--t];visit(e,i.get(e),s)}while(t);s.delete(e)}n[--r]=e}}function removeCyclicReferences(e,t){const r=new Set;for(;e.size>0;){const n=findCyclicNode(Array.from(e.keys()),t);if(!n)return r;e.delete(n),r.add(n),t=t.filter((e=>-1===e.indexOf(n)))}return r}function findCyclicNode(e,t){let r=e.length;const n=new Array(r),o={};let s=r;const a=makeOutgoingEdges(t),i=makeNodesHash(e);for(;s--;)if(!o[s]){const t=visit(e[s],s,new Set);if(!t)continue;return t}function visit(e,t,s){if(s.has(e))return e;if(!i.has(e))return;if(o[t])return;o[t]=!0;const l=Array.from(a.get(e)||new Set);if(t=l.length){s.add(e);do{const e=l[--t],r=visit(e,i.get(e),s);if(r)return r}while(t);s.delete(e)}n[--r]=e}}function makeOutgoingEdges(e){const t=new Map;for(let r=0,n=e.length;r<n;r++){const n=e[r];t.has(n[0])||t.set(n[0],new Set),t.has(n[1])||t.set(n[1],new Set),t.get(n[0]).add(n[1])}return t}function makeNodesHash(e){const t=new Map;for(let r=0,n=e.length;r<n;r++)t.set(e[r],r);return t}function parseVarFunction(e){let t,r,n=!1;for(const o of e.nodes)if(t||"word"!==o.type)if(!t||n||"div"!==o.type||","!==o.value){if(n&&Array.isArray(r))r.push(o);else if("space"!==o.type&&("div"!==o.type||""!==o.value.trim()))return}else n=!0,r=[];else t=o;if(t)return{name:t,fallback:r}}function transformValueAST(e,r){return e.nodes?.length?(walk(e.nodes,((e,n,o)=>{if(!isVarFunction(e))return;const s=parseVarFunction(e);if(!s)return;let a=!1;s.fallback&&t.walk(s.fallback,(e=>{if(!isVarFunction(e))return;const t=parseVarFunction(e);return t?t.fallback||r.has(t.name.value)?void 0:(a=!0,!1):void 0}));let i=r.get(s.name.value)?.nodes;i||!s.fallback||a||(i=s.fallback),void 0!==i&&(i.length?o.splice(n,1,...i):o.splice(n,1,{type:"div",value:" ",before:"",after:"",sourceIndex:e.sourceIndex,sourceEndIndex:e.sourceEndIndex}))})),t.stringify(e.nodes)):""}function walk(e,t){let r,n,o;for(r=0,n=e.length;r<n;r+=1)o=e[r],"function"===o.type&&Array.isArray(o.nodes)&&walk(o.nodes,t),t(o,r,e),n=e.length}const v=/^initial$/i;function isInitial(e){const t=e.nodes.filter((e=>"comment"!==e.type&&"space"!==e.type));return 1===t.length&&("word"===t[0].type&&v.test(t[0].value))}function buildCustomPropertiesMap(e,r,n){if(!e.size)return r;const o=new Map(r);{const s=[];for(const[a,i]of e.entries()){const l=parseOrCached(i,n);let c=!1;t.walk(l.nodes,(t=>{if(!isVarFunction(t))return;const n=parseVarFunction(t);n&&(n.fallback||e.has(n.name.value)||r.has(n.name.value)?s.push([n.name.value,a]):c=!0)})),c||o.set(a,l)}removeCyclicReferences(o,s)}{const e=[];for(const[r,n]of o.entries())t.walk(n.nodes,(t=>{if(!isVarFunction(t))return;const n=parseVarFunction(t);n&&(n.fallback||o.has(n.name.value)?e.push([n.name.value,r]):o.delete(r))}));for(let t=0;t<e.length;t++){const[r,n]=e[t];o.has(r)&&o.has(n)||e.splice(t--,1)}const r=toposort(Array.from(o.keys()),e);for(const e of r){const t=o.get(e);if(!t)continue;const r=parseOrCached(transformValueAST(t,o),n);o.set(e,r)}}for(const[e,t]of o.entries())isInitial(t)&&o.delete(e);return o}function getCustomPropertiesFromRoot(e,t){const r=new Map,n=new Map,o=collectCascadeLayerOrder(e);return e.walkRules((e=>{f.test(e.selector)&&e.nodes?.length&&isProcessableRule(e)&&(isBlockIgnored(e)||e.selectors.forEach((t=>{let s=-1;if(c.test(t)||p.test(t))s=0;else if(l.test(t))s=1;else{if(!u.test(t))return;s=2}const a=(f=o,((i=e).parent&&"atrule"===i.parent.type&&"layer"===i.parent.name.toLowerCase()?f.has(i.parent)?f.get(i.parent)+1:0:1e7)+10+s);var i,f;e.each((e=>{if("decl"!==e.type)return;if(!e.variable||isDeclarationIgnored(e))return;if("initial"===e.value.toLowerCase().trim())return;const t=n.get(e.prop)??-1;a>=t&&(n.set(e.prop,a),r.set(e.prop,e.value))}))})))})),buildCustomPropertiesMap(r,new Map,t)}function getCustomPropertiesFromSiblings(e,t,r){if(!e.parent)return t;const n=new Map;return e.parent.each((t=>{"decl"===t.type&&t.variable&&e!==t&&(isDeclarationIgnored(t)||n.set(t.prop,t.value))})),n.size?buildCustomPropertiesMap(n,t,r):t}function transformProperties(e,r,n){if(isTransformableDecl(e)&&!isDeclarationIgnored(e)){const o=e.value,s=transformValueAST(t(o),r);if(s===o)return;if(parentHasExactFallback(e,s))return void(n.preserve||e.remove());if(n.preserve){const t=e.cloneBefore({value:s});hasTrailingComment(t)&&t.raws?.value&&(t.raws.value.value=t.value.replace(w,"$1"),t.raws.value.raw=t.raws.value.value+t.raws.value.raw.replace(w,"$2"))}else e.value=s,hasTrailingComment(e)&&e.raws?.value&&(e.raws.value.value=e.value.replace(w,"$1"),e.raws.value.raw=e.raws.value.value+e.raws.value.raw.replace(w,"$2"))}}const isTransformableDecl=e=>!e.variable&&e.value.includes("--")&&e.value.toLowerCase().includes("var("),hasTrailingComment=e=>"value"in Object(Object(e.raws).value)&&"raw"in(e.raws?.value??{})&&w.test(e.raws.value?.raw??""),w=/^([\W\w]+)(\s*\/\*[\W\w]+?\*\/)$/;function parentHasExactFallback(e,t){if(!e||!e.parent)return!1;let r=!1;const n=e.parent.index(e);return e.parent.each(((o,s)=>o!==e&&(!(s>=n)&&void("decl"===o.type&&o.prop.toLowerCase()===e.prop.toLowerCase()&&o.value===t&&(r=!0))))),r}const g=/\bvar\(|\(top: var\(--f\)/i,creator=e=>{const t=!("preserve"in Object(e))||Boolean(e?.preserve);if("importFrom"in Object(e))throw new Error('[postcss-custom-properties] "importFrom" is no longer supported');if("exportTo"in Object(e))throw new Error('[postcss-custom-properties] "exportTo" is no longer supported');return{postcssPlugin:"postcss-custom-properties",prepare(){let e=new Map;const n=new WeakMap,o=new Map;return{postcssPlugin:"postcss-custom-properties",Once(t){e=getCustomPropertiesFromRoot(t,o)},Declaration(s){if(!m.test(s.value))return;if(r.hasSupportsAtRuleAncestor(s,g))return;let a=e;t&&s.parent&&(a=n.get(s.parent)??getCustomPropertiesFromSiblings(s,e,o),n.set(s.parent,a)),transformProperties(s,a,{preserve:t})}}}}};creator.postcss=!0,module.exports=creator; diff --git a/node_modules/postcss-custom-properties/dist/index.d.ts b/node_modules/postcss-custom-properties/dist/index.d.ts deleted file mode 100644 index 7e2b993e..00000000 --- a/node_modules/postcss-custom-properties/dist/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { PluginCreator } from 'postcss'; - -declare const creator: PluginCreator<pluginOptions>; -export default creator; - -/** postcss-custom-properties plugin options */ -export declare type pluginOptions = { - /** Preserve the original notation. default: true */ - preserve?: boolean; -}; - -export { } diff --git a/node_modules/postcss-custom-properties/dist/index.mjs b/node_modules/postcss-custom-properties/dist/index.mjs deleted file mode 100644 index 83c0c47e..00000000 --- a/node_modules/postcss-custom-properties/dist/index.mjs +++ /dev/null @@ -1 +0,0 @@ -import{parse as e,addLayerToModel as t}from"@csstools/cascade-layer-name-parser";import r from"postcss-value-parser";import{hasSupportsAtRuleAncestor as n}from"@csstools/utilities";const o=e("csstools-implicit-layer")[0];function collectCascadeLayerOrder(r){const n=new Map,s=new Map,a=[];r.walkAtRules((r=>{if("layer"!==r.name.toLowerCase())return;{let e=r.parent;for(;e;){if("atrule"!==e.type||"layer"!==e.name.toLowerCase()){if(e===r.root())break;return}e=e.parent}}let i;if(r.nodes)i=normalizeLayerName(r.params,1);else{if(!r.params.trim())return;i=r.params}let l=e(i);if(l?.length){{let e=r.parent;for(;e&&"atrule"===e.type&&"layer"===e.name.toLowerCase();){const t=s.get(e);t?(l=l.map((e=>t.concat(e))),e=e.parent):e=e.parent}}if(t(a,l),r.nodes){const e=l[0].concat(o);n.set(r,e),s.set(r,l[0])}}}));for(const e of n.values())t(a,[e]);const i=new WeakMap;for(const[e,t]of n)i.set(e,a.findIndex((e=>t.equal(e))));return i}function normalizeLayerName(e,t){return e.trim()?e:"csstools-anon-layer--"+t++}const s=/(?:!\s*)?postcss-custom-properties:\s*off\b/i,a=new WeakMap;function isBlockIgnored(e){if(!e||!e.nodes)return!1;if(a.has(e))return a.get(e);const t=e.some((e=>isIgnoreComment(e,s)));return a.set(e,t),t}const i=/(?:!\s*)?postcss-custom-properties:\s*ignore\s+next\b/i;function isDeclarationIgnored(e){return!!e&&(!!isBlockIgnored(e.parent)||isIgnoreComment(e.prev(),i))}function isIgnoreComment(e,t){return!!e&&"comment"===e.type&&t.test(e.text)}const l=new Set(["layer"]);function isProcessableRule(e){let t=e.parent;for(;t;){if("atrule"===t.type&&!l.has(t.name.toLowerCase()))return!1;t=t.parent}return!0}const c=/^html$/i,u=/^:where\(html\)$/i,p=/^:root$/i,f=/^:where\(:root\)$/i,d=/(html|:root)/i,m=/^var$/i;function isVarFunction(e){return"function"===e.type&&m.test(e.value)&&e.nodes?.length>0}const v=/\bvar\(/i;function parseOrCached(e,t){let n=t.get(e);return n||(n=r(e),t.set(e,n),n)}function toposort(e,t){let r=e.length;const n=new Array(r),o={};let s=r;const a=makeOutgoingEdges(t),i=makeNodesHash(e);for(;s--;)o[s]||visit(e[s],s,new Set);return n;function visit(e,t,s){if(s.has(e)){let t;try{t=", node was:"+JSON.stringify(e)}catch{t=""}throw new Error("Cyclic dependency"+t)}if(!i.has(e))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(e));if(o[t])return;o[t]=!0;const l=Array.from(a.get(e)||new Set);if(t=l.length){s.add(e);do{const e=l[--t];visit(e,i.get(e),s)}while(t);s.delete(e)}n[--r]=e}}function removeCyclicReferences(e,t){const r=new Set;for(;e.size>0;){const n=findCyclicNode(Array.from(e.keys()),t);if(!n)return r;e.delete(n),r.add(n),t=t.filter((e=>-1===e.indexOf(n)))}return r}function findCyclicNode(e,t){let r=e.length;const n=new Array(r),o={};let s=r;const a=makeOutgoingEdges(t),i=makeNodesHash(e);for(;s--;)if(!o[s]){const t=visit(e[s],s,new Set);if(!t)continue;return t}function visit(e,t,s){if(s.has(e))return e;if(!i.has(e))return;if(o[t])return;o[t]=!0;const l=Array.from(a.get(e)||new Set);if(t=l.length){s.add(e);do{const e=l[--t],r=visit(e,i.get(e),s);if(r)return r}while(t);s.delete(e)}n[--r]=e}}function makeOutgoingEdges(e){const t=new Map;for(let r=0,n=e.length;r<n;r++){const n=e[r];t.has(n[0])||t.set(n[0],new Set),t.has(n[1])||t.set(n[1],new Set),t.get(n[0]).add(n[1])}return t}function makeNodesHash(e){const t=new Map;for(let r=0,n=e.length;r<n;r++)t.set(e[r],r);return t}function parseVarFunction(e){let t,r,n=!1;for(const o of e.nodes)if(t||"word"!==o.type)if(!t||n||"div"!==o.type||","!==o.value){if(n&&Array.isArray(r))r.push(o);else if("space"!==o.type&&("div"!==o.type||""!==o.value.trim()))return}else n=!0,r=[];else t=o;if(t)return{name:t,fallback:r}}function transformValueAST(e,t){return e.nodes?.length?(walk(e.nodes,((e,n,o)=>{if(!isVarFunction(e))return;const s=parseVarFunction(e);if(!s)return;let a=!1;s.fallback&&r.walk(s.fallback,(e=>{if(!isVarFunction(e))return;const r=parseVarFunction(e);return r?r.fallback||t.has(r.name.value)?void 0:(a=!0,!1):void 0}));let i=t.get(s.name.value)?.nodes;i||!s.fallback||a||(i=s.fallback),void 0!==i&&(i.length?o.splice(n,1,...i):o.splice(n,1,{type:"div",value:" ",before:"",after:"",sourceIndex:e.sourceIndex,sourceEndIndex:e.sourceEndIndex}))})),r.stringify(e.nodes)):""}function walk(e,t){let r,n,o;for(r=0,n=e.length;r<n;r+=1)o=e[r],"function"===o.type&&Array.isArray(o.nodes)&&walk(o.nodes,t),t(o,r,e),n=e.length}const w=/^initial$/i;function isInitial(e){const t=e.nodes.filter((e=>"comment"!==e.type&&"space"!==e.type));return 1===t.length&&("word"===t[0].type&&w.test(t[0].value))}function buildCustomPropertiesMap(e,t,n){if(!e.size)return t;const o=new Map(t);{const s=[];for(const[a,i]of e.entries()){const l=parseOrCached(i,n);let c=!1;r.walk(l.nodes,(r=>{if(!isVarFunction(r))return;const n=parseVarFunction(r);n&&(n.fallback||e.has(n.name.value)||t.has(n.name.value)?s.push([n.name.value,a]):c=!0)})),c||o.set(a,l)}removeCyclicReferences(o,s)}{const e=[];for(const[t,n]of o.entries())r.walk(n.nodes,(r=>{if(!isVarFunction(r))return;const n=parseVarFunction(r);n&&(n.fallback||o.has(n.name.value)?e.push([n.name.value,t]):o.delete(t))}));for(let t=0;t<e.length;t++){const[r,n]=e[t];o.has(r)&&o.has(n)||e.splice(t--,1)}const t=toposort(Array.from(o.keys()),e);for(const e of t){const t=o.get(e);if(!t)continue;const r=parseOrCached(transformValueAST(t,o),n);o.set(e,r)}}for(const[e,t]of o.entries())isInitial(t)&&o.delete(e);return o}function getCustomPropertiesFromRoot(e,t){const r=new Map,n=new Map,o=collectCascadeLayerOrder(e);return e.walkRules((e=>{d.test(e.selector)&&e.nodes?.length&&isProcessableRule(e)&&(isBlockIgnored(e)||e.selectors.forEach((t=>{let s=-1;if(u.test(t)||f.test(t))s=0;else if(c.test(t))s=1;else{if(!p.test(t))return;s=2}const a=(l=o,((i=e).parent&&"atrule"===i.parent.type&&"layer"===i.parent.name.toLowerCase()?l.has(i.parent)?l.get(i.parent)+1:0:1e7)+10+s);var i,l;e.each((e=>{if("decl"!==e.type)return;if(!e.variable||isDeclarationIgnored(e))return;if("initial"===e.value.toLowerCase().trim())return;const t=n.get(e.prop)??-1;a>=t&&(n.set(e.prop,a),r.set(e.prop,e.value))}))})))})),buildCustomPropertiesMap(r,new Map,t)}function getCustomPropertiesFromSiblings(e,t,r){if(!e.parent)return t;const n=new Map;return e.parent.each((t=>{"decl"===t.type&&t.variable&&e!==t&&(isDeclarationIgnored(t)||n.set(t.prop,t.value))})),n.size?buildCustomPropertiesMap(n,t,r):t}function transformProperties(e,t,n){if(isTransformableDecl(e)&&!isDeclarationIgnored(e)){const o=e.value,s=transformValueAST(r(o),t);if(s===o)return;if(parentHasExactFallback(e,s))return void(n.preserve||e.remove());if(n.preserve){const t=e.cloneBefore({value:s});hasTrailingComment(t)&&t.raws?.value&&(t.raws.value.value=t.value.replace(g,"$1"),t.raws.value.raw=t.raws.value.value+t.raws.value.raw.replace(g,"$2"))}else e.value=s,hasTrailingComment(e)&&e.raws?.value&&(e.raws.value.value=e.value.replace(g,"$1"),e.raws.value.raw=e.raws.value.value+e.raws.value.raw.replace(g,"$2"))}}const isTransformableDecl=e=>!e.variable&&e.value.includes("--")&&e.value.toLowerCase().includes("var("),hasTrailingComment=e=>"value"in Object(Object(e.raws).value)&&"raw"in(e.raws?.value??{})&&g.test(e.raws.value?.raw??""),g=/^([\W\w]+)(\s*\/\*[\W\w]+?\*\/)$/;function parentHasExactFallback(e,t){if(!e||!e.parent)return!1;let r=!1;const n=e.parent.index(e);return e.parent.each(((o,s)=>o!==e&&(!(s>=n)&&void("decl"===o.type&&o.prop.toLowerCase()===e.prop.toLowerCase()&&o.value===t&&(r=!0))))),r}const h=/\bvar\(|\(top: var\(--f\)/i,creator=e=>{const t=!("preserve"in Object(e))||Boolean(e?.preserve);if("importFrom"in Object(e))throw new Error('[postcss-custom-properties] "importFrom" is no longer supported');if("exportTo"in Object(e))throw new Error('[postcss-custom-properties] "exportTo" is no longer supported');return{postcssPlugin:"postcss-custom-properties",prepare(){let e=new Map;const r=new WeakMap,o=new Map;return{postcssPlugin:"postcss-custom-properties",Once(t){e=getCustomPropertiesFromRoot(t,o)},Declaration(s){if(!v.test(s.value))return;if(n(s,h))return;let a=e;t&&s.parent&&(a=r.get(s.parent)??getCustomPropertiesFromSiblings(s,e,o),r.set(s.parent,a)),transformProperties(s,a,{preserve:t})}}}}};creator.postcss=!0;export{creator as default}; diff --git a/node_modules/postcss-custom-properties/package.json b/node_modules/postcss-custom-properties/package.json deleted file mode 100644 index 782dc6a5..00000000 --- a/node_modules/postcss-custom-properties/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "postcss-custom-properties", - "description": "Use Custom Properties Queries in CSS", - "version": "13.3.12", - "author": "Jonathan Neal <jonathantneal@hotmail.com>", - "contributors": [ - "Maxime Thirouin" - ], - "license": "MIT", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/csstools" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/csstools" - } - ], - "engines": { - "node": "^14 || ^16 || >=18" - }, - "type": "module", - "main": "dist/index.cjs", - "module": "dist/index.mjs", - "exports": { - ".": { - "import": { - "types": "./dist/index.d.ts", - "default": "./dist/index.mjs" - }, - "require": { - "default": "./dist/index.cjs" - } - } - }, - "files": [ - "CHANGELOG.md", - "LICENSE.md", - "README.md", - "dist", - "index.d.ts" - ], - "dependencies": { - "@csstools/cascade-layer-name-parser": "^1.0.13", - "@csstools/css-parser-algorithms": "^2.7.1", - "@csstools/css-tokenizer": "^2.4.1", - "@csstools/utilities": "^1.0.0", - "postcss-value-parser": "^4.2.0" - }, - "peerDependencies": { - "postcss": "^8.4" - }, - "scripts": {}, - "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-properties#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/csstools/postcss-plugins.git", - "directory": "plugins/postcss-custom-properties" - }, - "bugs": "https://github.com/csstools/postcss-plugins/issues", - "keywords": [ - "css", - "csswg", - "custom", - "declarations", - "postcss", - "postcss-plugin", - "properties", - "specification", - "variables", - "vars", - "w3c" - ] -} |
