summaryrefslogtreecommitdiff
path: root/node_modules/@csstools/postcss-logical-viewport-units
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@csstools/postcss-logical-viewport-units')
-rw-r--r--node_modules/@csstools/postcss-logical-viewport-units/CHANGELOG.md49
-rw-r--r--node_modules/@csstools/postcss-logical-viewport-units/LICENSE.md18
-rw-r--r--node_modules/@csstools/postcss-logical-viewport-units/README.md118
-rw-r--r--node_modules/@csstools/postcss-logical-viewport-units/dist/has-feature.d.ts1
-rw-r--r--node_modules/@csstools/postcss-logical-viewport-units/dist/has-supports-at-rule-ancestor.d.ts2
-rw-r--r--node_modules/@csstools/postcss-logical-viewport-units/dist/index.cjs1
-rw-r--r--node_modules/@csstools/postcss-logical-viewport-units/dist/index.d.ts11
-rw-r--r--node_modules/@csstools/postcss-logical-viewport-units/dist/index.mjs1
-rw-r--r--node_modules/@csstools/postcss-logical-viewport-units/dist/lib/types.d.ts18
-rw-r--r--node_modules/@csstools/postcss-logical-viewport-units/dist/transform.d.ts4
-rw-r--r--node_modules/@csstools/postcss-logical-viewport-units/package.json90
11 files changed, 313 insertions, 0 deletions
diff --git a/node_modules/@csstools/postcss-logical-viewport-units/CHANGELOG.md b/node_modules/@csstools/postcss-logical-viewport-units/CHANGELOG.md
new file mode 100644
index 00000000..a93e5c0c
--- /dev/null
+++ b/node_modules/@csstools/postcss-logical-viewport-units/CHANGELOG.md
@@ -0,0 +1,49 @@
+# Changes to PostCSS Logical Viewport Units
+
+### 2.0.3
+
+_September 24, 2023_
+
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#221) (patch)
+
+### 2.0.2
+
+_September 18, 2023_
+
+- Improve performance
+
+### 2.0.1
+
+_July 24, 2023_
+
+- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#220) (minor)
+
+### 2.0.0
+
+_July 3, 2023_
+
+- Change license to `MIT-0` ([read more about this change in the blog post](https://preset-env.cssdb.org/blog/license-change/))
+
+### 1.0.3
+
+_April 10, 2023_
+
+- Updated `@csstools/css-tokenizer` to `2.1.1` (patch)
+
+### 1.0.2
+
+_January 28, 2023_
+
+- Improve `types` declaration in `package.json`
+
+### 1.0.1
+
+_January 24, 2023_
+
+- Correctly list dependencies in `package.json`
+
+### 1.0.0
+
+_January 19, 2023_
+
+- Initial version
diff --git a/node_modules/@csstools/postcss-logical-viewport-units/LICENSE.md b/node_modules/@csstools/postcss-logical-viewport-units/LICENSE.md
new file mode 100644
index 00000000..e8ae93b9
--- /dev/null
+++ b/node_modules/@csstools/postcss-logical-viewport-units/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/postcss-logical-viewport-units/README.md b/node_modules/@csstools/postcss-logical-viewport-units/README.md
new file mode 100644
index 00000000..622864c0
--- /dev/null
+++ b/node_modules/@csstools/postcss-logical-viewport-units/README.md
@@ -0,0 +1,118 @@
+# PostCSS Logical Viewport Units [<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/@csstools/postcss-logical-viewport-units.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/logical-viewport-units.svg" height="20">][css-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]
+
+```bash
+npm install @csstools/postcss-logical-viewport-units --save-dev
+```
+
+[PostCSS Logical Viewport Units] lets you easily use `vb` and `vi` length units following the [CSS-Values-4 Specification].
+
+```pcss
+.foo {
+ margin: 10vi 20vb;
+}
+
+/* becomes */
+
+.foo {
+ margin: 10vw 20vh;
+ margin: 10vi 20vb;
+}
+```
+
+## Usage
+
+Add [PostCSS Logical Viewport Units] to your project:
+
+```bash
+npm install postcss @csstools/postcss-logical-viewport-units --save-dev
+```
+
+Use it as a [PostCSS] plugin:
+
+```js
+const postcss = require('postcss');
+const postcssLogicalViewportUnits = require('@csstools/postcss-logical-viewport-units');
+
+postcss([
+ postcssLogicalViewportUnits(/* pluginOptions */)
+]).process(YOUR_CSS /*, processOptions */);
+```
+
+[PostCSS Logical Viewport Units] 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
+
+### inlineDirection
+
+The `inlineDirection` option allows you to specify the direction of the inline axe. The default value is `left-to-right`, which would match any latin language.
+
+**You should tweak this value so that it is specific to your language and writing mode.**
+
+```js
+postcssLogicalViewportUnits({
+ inlineDirection: 'top-to-bottom'
+})
+```
+
+```pcss
+.foo {
+ margin: 10vi 20vb;
+}
+
+/* becomes */
+
+.foo {
+ margin: 10vh 20vw;
+ margin: 10vi 20vb;
+}
+```
+
+Each direction must be one of the following:
+
+- `top-to-bottom`
+- `bottom-to-top`
+- `left-to-right`
+- `right-to-left`
+
+Please do note that transformations won't do anything particular for `right-to-left` or `bottom-to-top`.
+
+### preserve
+
+The `preserve` option determines whether the original notation
+is preserved. By default, it is preserved.
+
+```js
+postcssLogicalViewportUnits({ preserve: false })
+```
+
+```pcss
+.foo {
+ margin: 10vi 20vb;
+}
+
+/* becomes */
+
+.foo {
+ margin: 10vw 20vh;
+}
+```
+
+[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
+[css-url]: https://cssdb.org/#logical-viewport-units
+[discord]: https://discord.gg/bUadyRwkJS
+[npm-url]: https://www.npmjs.com/package/@csstools/postcss-logical-viewport-units
+
+[PostCSS]: https://github.com/postcss/postcss
+[PostCSS Logical Viewport Units]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-logical-viewport-units
+[CSS-Values-4 Specification]: https://www.w3.org/TR/css-values-4/#viewport-relative-units
diff --git a/node_modules/@csstools/postcss-logical-viewport-units/dist/has-feature.d.ts b/node_modules/@csstools/postcss-logical-viewport-units/dist/has-feature.d.ts
new file mode 100644
index 00000000..a902b0da
--- /dev/null
+++ b/node_modules/@csstools/postcss-logical-viewport-units/dist/has-feature.d.ts
@@ -0,0 +1 @@
+export declare function hasFeature(source: string): boolean;
diff --git a/node_modules/@csstools/postcss-logical-viewport-units/dist/has-supports-at-rule-ancestor.d.ts b/node_modules/@csstools/postcss-logical-viewport-units/dist/has-supports-at-rule-ancestor.d.ts
new file mode 100644
index 00000000..a46009ec
--- /dev/null
+++ b/node_modules/@csstools/postcss-logical-viewport-units/dist/has-supports-at-rule-ancestor.d.ts
@@ -0,0 +1,2 @@
+import type { Node } from 'postcss';
+export declare function hasSupportsAtRuleAncestor(node: Node): boolean;
diff --git a/node_modules/@csstools/postcss-logical-viewport-units/dist/index.cjs b/node_modules/@csstools/postcss-logical-viewport-units/dist/index.cjs
new file mode 100644
index 00000000..4371e8d6
--- /dev/null
+++ b/node_modules/@csstools/postcss-logical-viewport-units/dist/index.cjs
@@ -0,0 +1 @@
+"use strict";var t,e,o=require("@csstools/css-tokenizer");function hasFeature(t){{const e=t.toLowerCase();if(!e.includes("vb")&&!e.includes("vi"))return!1}const e=o.tokenizer({css:t});for(;;){const t=e.nextToken();if(!t)break;if(t[0]===o.TokenType.EOF)break;if(t[0]!==o.TokenType.Dimension)continue;const n=t[4].unit.toLowerCase();if("vb"===n||"vi"===n)return!0}return!1}function hasSupportsAtRuleAncestor(t){let e=t.parent;for(;e;)if("atrule"===e.type){if("supports"===e.name.toLowerCase()&&hasFeature(e.params))return!0;e=e.parent}else e=e.parent;return!1}function transform(t,e){const n=o.tokenizer({css:t}),r=[];let i=!1;for(;;){const t=n.nextToken();if(!t)break;if(r.push(t),t[0]===o.TokenType.EOF)break;if(t[0]!==o.TokenType.Dimension)continue;const s=t[4].unit.toLowerCase();let u;"vi"===s?u=e.vi:"vb"===s&&(u=e.vb),u&&(t[1]=t[4].value.toString()+u,t[4].unit=u,i=!0)}return i?o.stringify(...r):t}!function(t){t.TopToBottom="top-to-bottom",t.BottomToTop="bottom-to-top",t.RightToLeft="right-to-left",t.LeftToRight="left-to-right"}(t||(t={})),function(t){t.Top="top",t.Right="right",t.Bottom="bottom",t.Left="left"}(e||(e={}));const n=/(?:vi|vb)\b/i,creator=e=>{const o=Object.assign({inlineDirection:t.LeftToRight,preserve:!0},e),r=Object.values(t);if(!r.includes(o.inlineDirection))throw new Error(`[postcss-logical-viewport-units] "inlineDirection" must be one of ${r.join(", ")}`);const i=[t.LeftToRight,t.RightToLeft].includes(o.inlineDirection),s={vb:"vh",vi:"vw"};return i||(s.vb="vw",s.vi="vh"),{postcssPlugin:"postcss-logical-viewport-units",Declaration(t,{atRule:e}){{if(!n.test(t.value))return;const e=t.prev();if(e&&"decl"===e.type&&e.prop===t.prop)return;if(hasSupportsAtRuleAncestor(t))return}const r=transform(t.value,s);if(r===t.value)return;if(t.cloneBefore({value:r}),!o.preserve)return void t.remove();if(!t.variable)return;const i=e({name:"supports",params:"(top: 1vi)",source:t.source}),u=t.parent;if(!u)return;const c=u.cloneAfter({nodes:[]});c.append(t),i.append(c),u.after(i)}}};creator.postcss=!0,module.exports=creator;
diff --git a/node_modules/@csstools/postcss-logical-viewport-units/dist/index.d.ts b/node_modules/@csstools/postcss-logical-viewport-units/dist/index.d.ts
new file mode 100644
index 00000000..bf4c6641
--- /dev/null
+++ b/node_modules/@csstools/postcss-logical-viewport-units/dist/index.d.ts
@@ -0,0 +1,11 @@
+import type { PluginCreator } from 'postcss';
+import { DirectionFlow } from './lib/types';
+/** postcss-logical-viewport-units plugin options */
+export type pluginOptions = {
+ /** Preserve the original notation. default: false */
+ preserve?: boolean;
+ /** Sets the direction for inline. default: left-to-right */
+ inlineDirection?: DirectionFlow;
+};
+declare const creator: PluginCreator<pluginOptions>;
+export default creator;
diff --git a/node_modules/@csstools/postcss-logical-viewport-units/dist/index.mjs b/node_modules/@csstools/postcss-logical-viewport-units/dist/index.mjs
new file mode 100644
index 00000000..5cd02459
--- /dev/null
+++ b/node_modules/@csstools/postcss-logical-viewport-units/dist/index.mjs
@@ -0,0 +1 @@
+import{tokenizer as t,TokenType as e,stringify as o}from"@csstools/css-tokenizer";function hasFeature(o){{const t=o.toLowerCase();if(!t.includes("vb")&&!t.includes("vi"))return!1}const n=t({css:o});for(;;){const t=n.nextToken();if(!t)break;if(t[0]===e.EOF)break;if(t[0]!==e.Dimension)continue;const o=t[4].unit.toLowerCase();if("vb"===o||"vi"===o)return!0}return!1}function hasSupportsAtRuleAncestor(t){let e=t.parent;for(;e;)if("atrule"===e.type){if("supports"===e.name.toLowerCase()&&hasFeature(e.params))return!0;e=e.parent}else e=e.parent;return!1}var n,r;function transform(n,r){const i=t({css:n}),s=[];let u=!1;for(;;){const t=i.nextToken();if(!t)break;if(s.push(t),t[0]===e.EOF)break;if(t[0]!==e.Dimension)continue;const o=t[4].unit.toLowerCase();let n;"vi"===o?n=r.vi:"vb"===o&&(n=r.vb),n&&(t[1]=t[4].value.toString()+n,t[4].unit=n,u=!0)}return u?o(...s):n}!function(t){t.TopToBottom="top-to-bottom",t.BottomToTop="bottom-to-top",t.RightToLeft="right-to-left",t.LeftToRight="left-to-right"}(n||(n={})),function(t){t.Top="top",t.Right="right",t.Bottom="bottom",t.Left="left"}(r||(r={}));const i=/(?:vi|vb)\b/i,creator=t=>{const e=Object.assign({inlineDirection:n.LeftToRight,preserve:!0},t),o=Object.values(n);if(!o.includes(e.inlineDirection))throw new Error(`[postcss-logical-viewport-units] "inlineDirection" must be one of ${o.join(", ")}`);const r=[n.LeftToRight,n.RightToLeft].includes(e.inlineDirection),s={vb:"vh",vi:"vw"};return r||(s.vb="vw",s.vi="vh"),{postcssPlugin:"postcss-logical-viewport-units",Declaration(t,{atRule:o}){{if(!i.test(t.value))return;const e=t.prev();if(e&&"decl"===e.type&&e.prop===t.prop)return;if(hasSupportsAtRuleAncestor(t))return}const n=transform(t.value,s);if(n===t.value)return;if(t.cloneBefore({value:n}),!e.preserve)return void t.remove();if(!t.variable)return;const r=o({name:"supports",params:"(top: 1vi)",source:t.source}),u=t.parent;if(!u)return;const c=u.cloneAfter({nodes:[]});c.append(t),r.append(c),u.after(r)}}};creator.postcss=!0;export{creator as default};
diff --git a/node_modules/@csstools/postcss-logical-viewport-units/dist/lib/types.d.ts b/node_modules/@csstools/postcss-logical-viewport-units/dist/lib/types.d.ts
new file mode 100644
index 00000000..2b3c47f9
--- /dev/null
+++ b/node_modules/@csstools/postcss-logical-viewport-units/dist/lib/types.d.ts
@@ -0,0 +1,18 @@
+export declare const DirectionValues: {
+ BlockStart: string;
+ BlockEnd: string;
+ InlineStart: string;
+ InlineEnd: string;
+};
+export declare enum DirectionFlow {
+ TopToBottom = "top-to-bottom",
+ BottomToTop = "bottom-to-top",
+ RightToLeft = "right-to-left",
+ LeftToRight = "left-to-right"
+}
+export declare enum Axes {
+ Top = "top",
+ Right = "right",
+ Bottom = "bottom",
+ Left = "left"
+}
diff --git a/node_modules/@csstools/postcss-logical-viewport-units/dist/transform.d.ts b/node_modules/@csstools/postcss-logical-viewport-units/dist/transform.d.ts
new file mode 100644
index 00000000..0d007ffa
--- /dev/null
+++ b/node_modules/@csstools/postcss-logical-viewport-units/dist/transform.d.ts
@@ -0,0 +1,4 @@
+export declare function transform(source: string, replacements: {
+ vi: 'vw' | 'vh';
+ vb: 'vw' | 'vh';
+}): string;
diff --git a/node_modules/@csstools/postcss-logical-viewport-units/package.json b/node_modules/@csstools/postcss-logical-viewport-units/package.json
new file mode 100644
index 00000000..f20a819d
--- /dev/null
+++ b/node_modules/@csstools/postcss-logical-viewport-units/package.json
@@ -0,0 +1,90 @@
+{
+ "name": "@csstools/postcss-logical-viewport-units",
+ "description": "Use vb and vi length units in CSS",
+ "version": "2.0.3",
+ "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"
+ },
+ "main": "dist/index.cjs",
+ "module": "dist/index.mjs",
+ "types": "dist/index.d.ts",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.ts",
+ "import": "./dist/index.mjs",
+ "require": "./dist/index.cjs",
+ "default": "./dist/index.mjs"
+ }
+ },
+ "files": [
+ "CHANGELOG.md",
+ "LICENSE.md",
+ "README.md",
+ "dist"
+ ],
+ "dependencies": {
+ "@csstools/css-tokenizer": "^2.2.1"
+ },
+ "peerDependencies": {
+ "postcss": "^8.4"
+ },
+ "devDependencies": {
+ "@csstools/postcss-tape": "*"
+ },
+ "scripts": {
+ "build": "rollup -c ../../rollup/default.mjs",
+ "docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs",
+ "lint": "node ../../.github/bin/format-package-json.mjs",
+ "prepublishOnly": "npm run build && npm run test",
+ "test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
+ "test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
+ },
+ "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-logical-viewport-units#readme",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/csstools/postcss-plugins.git",
+ "directory": "plugins/postcss-logical-viewport-units"
+ },
+ "bugs": "https://github.com/csstools/postcss-plugins/issues",
+ "keywords": [
+ "block",
+ "css",
+ "inline",
+ "logical",
+ "padding",
+ "postcss",
+ "postcss-plugin",
+ "viewport units"
+ ],
+ "csstools": {
+ "cssdbId": "logical-viewport-units",
+ "exportName": "postcssLogicalViewportUnits",
+ "humanReadableName": "PostCSS Logical Viewport Units",
+ "specUrl": "https://www.w3.org/TR/css-values-4/#viewport-relative-units"
+ },
+ "volta": {
+ "extends": "../../package.json"
+ }
+}