summaryrefslogtreecommitdiff
path: root/node_modules/@csstools/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@csstools/utilities')
-rw-r--r--node_modules/@csstools/utilities/CHANGELOG.md7
-rw-r--r--node_modules/@csstools/utilities/LICENSE.md18
-rw-r--r--node_modules/@csstools/utilities/README.md25
-rw-r--r--node_modules/@csstools/utilities/dist/index.cjs1
-rw-r--r--node_modules/@csstools/utilities/dist/index.d.ts24
-rw-r--r--node_modules/@csstools/utilities/dist/index.mjs1
-rw-r--r--node_modules/@csstools/utilities/package.json65
7 files changed, 141 insertions, 0 deletions
diff --git a/node_modules/@csstools/utilities/CHANGELOG.md b/node_modules/@csstools/utilities/CHANGELOG.md
new file mode 100644
index 00000000..ebf1f2a9
--- /dev/null
+++ b/node_modules/@csstools/utilities/CHANGELOG.md
@@ -0,0 +1,7 @@
+# Changes to Utilities
+
+### 1.0.0
+
+_February 19, 2024_
+
+- Initial version
diff --git a/node_modules/@csstools/utilities/LICENSE.md b/node_modules/@csstools/utilities/LICENSE.md
new file mode 100644
index 00000000..e8ae93b9
--- /dev/null
+++ b/node_modules/@csstools/utilities/LICENSE.md
@@ -0,0 +1,18 @@
+MIT No Attribution (MIT-0)
+
+Copyright © CSSTools Contributors
+
+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.
+
+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/@csstools/utilities/README.md b/node_modules/@csstools/utilities/README.md
new file mode 100644
index 00000000..67a1b35b
--- /dev/null
+++ b/node_modules/@csstools/utilities/README.md
@@ -0,0 +1,25 @@
+# Utilities
+
+[<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/utilities.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]
+
+Helpers that we use in many PostCSS plugins.
+
+## API
+
+[Read the API docs](./docs/utilities.md)
+
+## Usage
+
+Add [Utilities] to your project:
+
+```bash
+npm install @csstools/utilities --save-dev
+```
+
+[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
+[discord]: https://discord.gg/bUadyRwkJS
+[npm-url]: https://www.npmjs.com/package/@csstools/utilities
+
+[Utilities]: https://github.com/csstools/postcss-plugins/tree/main/packages/utilities
diff --git a/node_modules/@csstools/utilities/dist/index.cjs b/node_modules/@csstools/utilities/dist/index.cjs
new file mode 100644
index 00000000..5b60709f
--- /dev/null
+++ b/node_modules/@csstools/utilities/dist/index.cjs
@@ -0,0 +1 @@
+"use strict";exports.hasFallback=function hasFallback(t){const e=t.parent;if(!e)return!1;const r=t.prop.toLowerCase(),s=e.index(t);for(let t=0;t<s;t++){const s=e.nodes[t];if("decl"===s.type&&s.prop.toLowerCase()===r)return!0}return!1},exports.hasSupportsAtRuleAncestor=function hasSupportsAtRuleAncestor(t,e){let r=t.parent;for(;r;)if("atrule"===r.type&&"supports"===r.name.toLowerCase()){if(e.test(r.params))return!0;r=r.parent}else r=r.parent;return!1};
diff --git a/node_modules/@csstools/utilities/dist/index.d.ts b/node_modules/@csstools/utilities/dist/index.d.ts
new file mode 100644
index 00000000..f1610688
--- /dev/null
+++ b/node_modules/@csstools/utilities/dist/index.d.ts
@@ -0,0 +1,24 @@
+import type { Declaration } from 'postcss';
+import type { Node } from 'postcss';
+
+/**
+ * Check if a declaration has a fallback.
+ * Returns true if a declaration with the same property name appears before the current declaration.
+ *
+ * @param {Declaration} node The declaration node to check
+ * @returns {boolean} Whether the declaration has a fallback
+ */
+export declare function hasFallback(node: Declaration): boolean;
+
+/**
+ * Check if a node has a `@supports` at-rule ancestor with a given regex in its params.
+ *
+ * @param {Node} node The node to check
+ * @param {{ test(str: string): boolean }} predicate The test to match against the `@supports` at-rule's params
+ * @returns {boolean}
+ */
+export declare function hasSupportsAtRuleAncestor(node: Node, predicate: {
+ test(str: string): boolean;
+}): boolean;
+
+export { }
diff --git a/node_modules/@csstools/utilities/dist/index.mjs b/node_modules/@csstools/utilities/dist/index.mjs
new file mode 100644
index 00000000..282f9708
--- /dev/null
+++ b/node_modules/@csstools/utilities/dist/index.mjs
@@ -0,0 +1 @@
+function hasFallback(e){const t=e.parent;if(!t)return!1;const r=e.prop.toLowerCase(),o=t.index(e);for(let e=0;e<o;e++){const o=t.nodes[e];if("decl"===o.type&&o.prop.toLowerCase()===r)return!0}return!1}function hasSupportsAtRuleAncestor(e,t){let r=e.parent;for(;r;)if("atrule"===r.type&&"supports"===r.name.toLowerCase()){if(t.test(r.params))return!0;r=r.parent}else r=r.parent;return!1}export{hasFallback,hasSupportsAtRuleAncestor};
diff --git a/node_modules/@csstools/utilities/package.json b/node_modules/@csstools/utilities/package.json
new file mode 100644
index 00000000..cc5a9de3
--- /dev/null
+++ b/node_modules/@csstools/utilities/package.json
@@ -0,0 +1,65 @@
+{
+ "name": "@csstools/utilities",
+ "description": "Utilities for PostCSS plugins",
+ "version": "1.0.0",
+ "contributors": [
+ {
+ "name": "Antonio Laguna",
+ "email": "antonio@laguna.es",
+ "url": "https://antonio.laguna.es"
+ },
+ {
+ "name": "Romain Menke",
+ "email": "romainmenke@gmail.com"
+ }
+ ],
+ "license": "MIT-0",
+ "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"
+ ],
+ "peerDependencies": {
+ "postcss": "^8.4"
+ },
+ "homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/utilities#readme",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/csstools/postcss-plugins.git",
+ "directory": "packages/utilities"
+ },
+ "bugs": "https://github.com/csstools/postcss-plugins/issues",
+ "keywords": [
+ "helpers",
+ "postcss",
+ "utilities"
+ ]
+}