@csstools/postcss-media-minmax 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE.md +21 -0
- package/README.md +63 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +1 -0
- package/dist/to-lower-case-a-z.d.ts +1 -0
- package/dist/transform-single-pair.d.ts +2 -0
- package/dist/transform.d.ts +2 -0
- package/package.json +86 -0
package/CHANGELOG.md
ADDED
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Romain Menke, Antonio Laguna <antonio@laguna.es>, PostCSS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# PostCSS Media MinMax [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][PostCSS]
|
|
2
|
+
|
|
3
|
+
[<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/postcss-media-minmax.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/media-query-ranges.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]
|
|
4
|
+
|
|
5
|
+
[PostCSS Media MinMax] lets you use the range notation in media queries following the [Media Queries 4 Specification].
|
|
6
|
+
|
|
7
|
+
```pcss
|
|
8
|
+
@media screen and (width >=500px) and (width <=1200px) {
|
|
9
|
+
.bar {
|
|
10
|
+
display: block;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* becomes */
|
|
15
|
+
|
|
16
|
+
@media screen and (min-width:500px) and (max-width:1200px) {
|
|
17
|
+
.bar {
|
|
18
|
+
display: block;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
Add [PostCSS Media MinMax] to your project:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install postcss @csstools/postcss-media-minmax --save-dev
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Use it as a [PostCSS] plugin:
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
const postcss = require('postcss');
|
|
35
|
+
const postcssMediaMinMax = require('@csstools/postcss-media-minmax');
|
|
36
|
+
|
|
37
|
+
postcss([
|
|
38
|
+
postcssMediaMinMax(/* pluginOptions */)
|
|
39
|
+
]).process(YOUR_CSS /*, processOptions */);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
[PostCSS Media MinMax] runs in all Node environments, with special
|
|
43
|
+
instructions for:
|
|
44
|
+
|
|
45
|
+
- [Node](INSTALL.md#node)
|
|
46
|
+
- [PostCSS CLI](INSTALL.md#postcss-cli)
|
|
47
|
+
- [PostCSS Load Config](INSTALL.md#postcss-load-config)
|
|
48
|
+
- [Webpack](INSTALL.md#webpack)
|
|
49
|
+
- [Next.js](INSTALL.md#nextjs)
|
|
50
|
+
- [Gulp](INSTALL.md#gulp)
|
|
51
|
+
- [Grunt](INSTALL.md#grunt)
|
|
52
|
+
|
|
53
|
+
_See prior work by [yisibl](https://github.com/yisibl) here [postcss-media-minmax](https://github.com/postcss/postcss-media-minmax)
|
|
54
|
+
To ensure long term maintenance and to provide the needed features this plugin was recreated based on yisibl's work._
|
|
55
|
+
|
|
56
|
+
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
|
|
57
|
+
[css-url]: https://cssdb.org/#media-query-ranges
|
|
58
|
+
[discord]: https://discord.gg/bUadyRwkJS
|
|
59
|
+
[npm-url]: https://www.npmjs.com/package/@csstools/postcss-media-minmax
|
|
60
|
+
|
|
61
|
+
[PostCSS]: https://github.com/postcss/postcss
|
|
62
|
+
[PostCSS Media MinMax]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-media-minmax
|
|
63
|
+
[Media Queries 4 Specification]: https://www.w3.org/TR/mediaqueries-4/#mq-features
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("@csstools/css-parser-algorithms"),i=require("@csstools/css-tokenizer"),n=require("@csstools/media-query-list-parser"),t=require("@csstools/css-calc");const a=/[A-Z]/g;const r={width:"px",height:"px","device-width":"px","device-height":"px","aspect-ratio":"","device-aspect-ratio":"",color:"","color-index":"",monochrome:"",resolution:"dpi"},o={width:!1,height:!1,"device-width":!1,"device-height":!1,"aspect-ratio":!1,"device-aspect-ratio":!1,color:!0,"color-index":!0,monochrome:!0,resolution:"dpi"};function featureNamePrefix(e){return e===n.MediaFeatureLT.LT||e===n.MediaFeatureLT.LT_OR_EQ?"max-":e===n.MediaFeatureGT.GT||e===n.MediaFeatureGT.GT_OR_EQ?"min-":""}const s={">":1,"<":-1},u=.001,d=.02;function transformSingleNameValuePair(a,l,c,p){let T=c.before,m=c.after;if(p||(T=c.after,m=c.before),!p){const e=n.invertComparison(l);if(!1===e)return;l=e}if(l===n.MediaFeatureEQ.EQ||l===n.MediaFeatureLT.LT_OR_EQ||l===n.MediaFeatureGT.GT_OR_EQ)return Array.isArray(c.value)?n.newMediaFeaturePlain(featureNamePrefix(l)+a,...T,...c.value.flatMap((e=>e.tokens())),...m):n.newMediaFeaturePlain(featureNamePrefix(l)+a,...T,...c.value.tokens(),...m);let v,f,y=!1;if(Array.isArray(c.value)){if(!n.matchesRatioExactly(c.value))return;if("aspect-ratio"!==a&&"device-aspect-ratio"!==a)return;const e=n.matchesRatio(c.value);if(-1===e)return;y=!0,v=c.value[e[0]],f=[...c.value.slice(e[0]+1).flatMap((e=>e.tokens()))]}else v=c.value,f=[];const h=r[a.toLowerCase()];if(e.isFunctionNode(v)&&"calc"===v.getName().toLowerCase()){const[[r]]=t.calcFromComponentValues([[v]],{precision:5,toCanonicalUnits:!0});if(!r||!e.isTokenNode(r)||r.value[0]!==i.TokenType.Number&&r.value[0]!==i.TokenType.Percentage&&r.value[0]!==i.TokenType.Dimension||!Number.isInteger(r.value[4].value)){let e;if(void 0!==h){const n=s[l]*("px"===h?d:u);e=[i.TokenType.Dimension,`${n.toString()}${h}`,-1,-1,{value:n,unit:h,type:i.NumberType.Integer}]}else if(!0===o[a]){const n=s[l];e=[i.TokenType.Number,n.toString(),-1,-1,{value:n,type:i.NumberType.Integer}]}else if(y){const n=s[l]*u;e=[i.TokenType.Number,n.toString(),-1,-1,{value:n,type:i.NumberType.Integer}]}else{const n=s[l];e=[i.TokenType.Number,n.toString(),-1,-1,{value:n,type:i.NumberType.Integer}]}return n.newMediaFeaturePlain(featureNamePrefix(l)+a,...T,[i.TokenType.Function,"calc(",-1,-1,{value:"calc("}],[i.TokenType.OpenParen,"(",-1,-1,void 0],...v.tokens().slice(1),[i.TokenType.Whitespace," ",-1,-1,void 0],[i.TokenType.Delim,"+",-1,-1,{value:"+"}],[i.TokenType.Whitespace," ",-1,-1,void 0],e,[i.TokenType.CloseParen,")",-1,-1,void 0],...f,...m)}v=r}if(!e.isTokenNode(v))return;let k,g=v.value,M="";if(void 0!==h&&g[0]===i.TokenType.Number&&0===g[4].value)k=s[l],M=h;else if(g[0]===i.TokenType.Number&&0===g[4].value)k=s[l],M="";else if(g[0]===i.TokenType.Dimension&&0===g[4].value)k=s[l],M=g[4].unit;else if(g[0]===i.TokenType.Number&&!0===o[a])k=g[4].value+s[l];else if(g[0]===i.TokenType.Dimension&&"px"===g[4].unit&&g[4].type===i.NumberType.Integer)k=Number(Math.round(Number(g[4].value+d*s[l]+"e6"))+"e-6");else{if(g[0]!==i.TokenType.Dimension&&g[0]!==i.TokenType.Number)return;k=Number(Math.round(Number(g[4].value+u*s[l]+"e6"))+"e-6")}return M&&(g=[i.TokenType.Dimension,g[1],g[2],g[3],{value:g[4].value,unit:M,type:g[4].type}]),g[4].value=k,g[0]===i.TokenType.Dimension?g[1]=g[4].value.toString()+g[4].unit:g[1]=g[4].value.toString(),n.newMediaFeaturePlain(featureNamePrefix(l)+a,...T,g,...f,...m)}const l=new Set(["aspect-ratio","color","color-index","device-aspect-ratio","device-height","device-width","height","horizontal-viewport-segments","monochrome","resolution","vertical-viewport-segments","width"]);function transform(t){return t.map(((t,r)=>{const o=e.gatherNodeAncestry(t);t.walk((e=>{const r=e.node;if(!n.isMediaFeatureRange(r))return;const s=e.parent;if(!n.isMediaFeature(s))return;const u=r.name.getName().replace(a,(e=>String.fromCharCode(e.charCodeAt(0)+32)));if(!l.has(u))return;if(n.isMediaFeatureRangeNameValue(r)||n.isMediaFeatureRangeValueName(r)){const e=r.operatorKind();if(!1===e)return;const i=transformSingleNameValuePair(u,e,r.value,n.isMediaFeatureRangeNameValue(r));return void(i&&(s.feature=i.feature))}const d=o.get(s);if(!n.isMediaInParens(d))return;let c=null,p=null;{const e=r.valueOneOperatorKind();if(!1===e)return;const i=transformSingleNameValuePair(u,e,r.valueOne,!1);if(!i)return;e===n.MediaFeatureLT.LT||e===n.MediaFeatureLT.LT_OR_EQ?(c=i,c.before=s.before):(p=i,p.after=s.after)}{const e=r.valueTwoOperatorKind();if(!1===e)return;const i=transformSingleNameValuePair(u,e,r.valueTwo,!0);if(!i)return;e===n.MediaFeatureLT.LT||e===n.MediaFeatureLT.LT_OR_EQ?(p=i,p.before=s.before):(c=i,c.after=s.after)}if(!c||!p)return;const T=new n.MediaInParens(c),m=new n.MediaInParens(p),v=getMediaConditionListWithAndFromAncestry(d,o);if(v)return v.leading===d?(v.leading=T,void(v.list=[new n.MediaAnd([[i.TokenType.Whitespace," ",-1,-1,void 0],[i.TokenType.Ident,"and",-1,-1,{value:"and"}],[i.TokenType.Whitespace," ",-1,-1,void 0]],m),...v.list])):void v.list.splice(v.indexOf(o.get(d)),1,new n.MediaAnd([[i.TokenType.Whitespace," ",-1,-1,void 0],[i.TokenType.Ident,"and",-1,-1,{value:"and"}],[i.TokenType.Whitespace," ",-1,-1,void 0]],T),new n.MediaAnd([[i.TokenType.Whitespace," ",-1,-1,void 0],[i.TokenType.Ident,"and",-1,-1,{value:"and"}],[i.TokenType.Whitespace," ",-1,-1,void 0]],m));const f=new n.MediaConditionListWithAnd(T,[new n.MediaAnd([[i.TokenType.Whitespace," ",-1,-1,void 0],[i.TokenType.Ident,"and",-1,-1,{value:"and"}],[i.TokenType.Whitespace," ",-1,-1,void 0]],m)],[[i.TokenType.Whitespace," ",-1,-1,void 0]]),y=getMediaConditionInShallowMediaQueryFromAncestry(d,t,o);y?y.media=f:d.media=new n.MediaCondition(new n.MediaInParens(new n.MediaCondition(f),[[i.TokenType.Whitespace," ",-1,-1,void 0],[i.TokenType.OpenParen,"(",-1,-1,void 0]],[[i.TokenType.CloseParen,")",-1,-1,void 0]]))}));const s=t.tokens();return i.stringify(...s.filter(((e,n)=>(0!==n||0!==r||e[0]!==i.TokenType.Whitespace)&&(e[0]!==i.TokenType.Whitespace||!s[n+1]||s[n+1][0]!==i.TokenType.Whitespace))))})).join(",")}function getMediaConditionListWithAndFromAncestry(e,i){let t=e;if(t){if(t=i.get(t),n.isMediaConditionListWithAnd(t))return t;if(n.isMediaAnd(t))return t=i.get(t),n.isMediaConditionListWithAnd(t)?t:void 0}}function getMediaConditionInShallowMediaQueryFromAncestry(e,i,t){let a=e;if(!a)return;if(a=t.get(a),!n.isMediaCondition(a))return;const r=a;return a=t.get(a),n.isMediaQuery(a)&&a===i?r:void 0}const creator=()=>({postcssPlugin:"postcss-media-minmax",AtRule:{media:e=>{if(!(e.params.includes("<")||e.params.includes(">")||e.params.includes("=")))return;const i=transform(n.parse(e.params,{preserveInvalidMediaQueries:!0,onParseError:()=>{throw e.error(`Unable to parse media query "${e.params}"`)}}));e.params!==i&&(e.params=i)}}});creator.postcss=!0,module.exports=creator;
|
package/dist/index.d.ts
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isFunctionNode as e,isTokenNode as t,gatherNodeAncestry as r}from"@csstools/css-parser-algorithms";import{TokenType as i,NumberType as n,stringify as a}from"@csstools/css-tokenizer";import{invertComparison as o,MediaFeatureEQ as s,MediaFeatureLT as u,MediaFeatureGT as l,newMediaFeaturePlain as c,matchesRatioExactly as d,matchesRatio as f,isMediaFeatureRange as m,isMediaFeature as v,isMediaFeatureRangeNameValue as p,isMediaFeatureRangeValueName as h,isMediaInParens as g,MediaInParens as w,MediaAnd as N,MediaConditionListWithAnd as b,MediaCondition as y,isMediaConditionListWithAnd as x,isMediaAnd as W,isMediaCondition as P,isMediaQuery as S,parse as A}from"@csstools/media-query-list-parser";import{calcFromComponentValues as I}from"@csstools/css-calc";const O=/[A-Z]/g;const C={width:"px",height:"px","device-width":"px","device-height":"px","aspect-ratio":"","device-aspect-ratio":"",color:"","color-index":"",monochrome:"",resolution:"dpi"},T={width:!1,height:!1,"device-width":!1,"device-height":!1,"aspect-ratio":!1,"device-aspect-ratio":!1,color:!0,"color-index":!0,monochrome:!0,resolution:"dpi"};function featureNamePrefix(e){return e===u.LT||e===u.LT_OR_EQ?"max-":e===l.GT||e===l.GT_OR_EQ?"min-":""}const _={">":1,"<":-1},L=.001,M=.02;function transformSingleNameValuePair(r,a,m,v){let p=m.before,h=m.after;if(v||(p=m.after,h=m.before),!v){const e=o(a);if(!1===e)return;a=e}if(a===s.EQ||a===u.LT_OR_EQ||a===l.GT_OR_EQ)return Array.isArray(m.value)?c(featureNamePrefix(a)+r,...p,...m.value.flatMap((e=>e.tokens())),...h):c(featureNamePrefix(a)+r,...p,...m.value.tokens(),...h);let g,w,N=!1;if(Array.isArray(m.value)){if(!d(m.value))return;if("aspect-ratio"!==r&&"device-aspect-ratio"!==r)return;const e=f(m.value);if(-1===e)return;N=!0,g=m.value[e[0]],w=[...m.value.slice(e[0]+1).flatMap((e=>e.tokens()))]}else g=m.value,w=[];const b=C[r.toLowerCase()];if(e(g)&&"calc"===g.getName().toLowerCase()){const[[e]]=I([[g]],{precision:5,toCanonicalUnits:!0});if(!e||!t(e)||e.value[0]!==i.Number&&e.value[0]!==i.Percentage&&e.value[0]!==i.Dimension||!Number.isInteger(e.value[4].value)){let e;if(void 0!==b){const t=_[a]*("px"===b?M:L);e=[i.Dimension,`${t.toString()}${b}`,-1,-1,{value:t,unit:b,type:n.Integer}]}else if(!0===T[r]){const t=_[a];e=[i.Number,t.toString(),-1,-1,{value:t,type:n.Integer}]}else if(N){const t=_[a]*L;e=[i.Number,t.toString(),-1,-1,{value:t,type:n.Integer}]}else{const t=_[a];e=[i.Number,t.toString(),-1,-1,{value:t,type:n.Integer}]}return c(featureNamePrefix(a)+r,...p,[i.Function,"calc(",-1,-1,{value:"calc("}],[i.OpenParen,"(",-1,-1,void 0],...g.tokens().slice(1),[i.Whitespace," ",-1,-1,void 0],[i.Delim,"+",-1,-1,{value:"+"}],[i.Whitespace," ",-1,-1,void 0],e,[i.CloseParen,")",-1,-1,void 0],...w,...h)}g=e}if(!t(g))return;let y,x=g.value,W="";if(void 0!==b&&x[0]===i.Number&&0===x[4].value)y=_[a],W=b;else if(x[0]===i.Number&&0===x[4].value)y=_[a],W="";else if(x[0]===i.Dimension&&0===x[4].value)y=_[a],W=x[4].unit;else if(x[0]===i.Number&&!0===T[r])y=x[4].value+_[a];else if(x[0]===i.Dimension&&"px"===x[4].unit&&x[4].type===n.Integer)y=Number(Math.round(Number(x[4].value+M*_[a]+"e6"))+"e-6");else{if(x[0]!==i.Dimension&&x[0]!==i.Number)return;y=Number(Math.round(Number(x[4].value+L*_[a]+"e6"))+"e-6")}return W&&(x=[i.Dimension,x[1],x[2],x[3],{value:x[4].value,unit:W,type:x[4].type}]),x[4].value=y,x[0]===i.Dimension?x[1]=x[4].value.toString()+x[4].unit:x[1]=x[4].value.toString(),c(featureNamePrefix(a)+r,...p,x,...w,...h)}const Q=new Set(["aspect-ratio","color","color-index","device-aspect-ratio","device-height","device-width","height","horizontal-viewport-segments","monochrome","resolution","vertical-viewport-segments","width"]);function transform(e){return e.map(((e,t)=>{const n=r(e);e.walk((t=>{const r=t.node;if(!m(r))return;const a=t.parent;if(!v(a))return;const o=r.name.getName().replace(O,(e=>String.fromCharCode(e.charCodeAt(0)+32)));if(!Q.has(o))return;if(p(r)||h(r)){const e=r.operatorKind();if(!1===e)return;const t=transformSingleNameValuePair(o,e,r.value,p(r));return void(t&&(a.feature=t.feature))}const s=n.get(a);if(!g(s))return;let l=null,c=null;{const e=r.valueOneOperatorKind();if(!1===e)return;const t=transformSingleNameValuePair(o,e,r.valueOne,!1);if(!t)return;e===u.LT||e===u.LT_OR_EQ?(l=t,l.before=a.before):(c=t,c.after=a.after)}{const e=r.valueTwoOperatorKind();if(!1===e)return;const t=transformSingleNameValuePair(o,e,r.valueTwo,!0);if(!t)return;e===u.LT||e===u.LT_OR_EQ?(c=t,c.before=a.before):(l=t,l.after=a.after)}if(!l||!c)return;const d=new w(l),f=new w(c),x=getMediaConditionListWithAndFromAncestry(s,n);if(x)return x.leading===s?(x.leading=d,void(x.list=[new N([[i.Whitespace," ",-1,-1,void 0],[i.Ident,"and",-1,-1,{value:"and"}],[i.Whitespace," ",-1,-1,void 0]],f),...x.list])):void x.list.splice(x.indexOf(n.get(s)),1,new N([[i.Whitespace," ",-1,-1,void 0],[i.Ident,"and",-1,-1,{value:"and"}],[i.Whitespace," ",-1,-1,void 0]],d),new N([[i.Whitespace," ",-1,-1,void 0],[i.Ident,"and",-1,-1,{value:"and"}],[i.Whitespace," ",-1,-1,void 0]],f));const W=new b(d,[new N([[i.Whitespace," ",-1,-1,void 0],[i.Ident,"and",-1,-1,{value:"and"}],[i.Whitespace," ",-1,-1,void 0]],f)],[[i.Whitespace," ",-1,-1,void 0]]),P=getMediaConditionInShallowMediaQueryFromAncestry(s,e,n);P?P.media=W:s.media=new y(new w(new y(W),[[i.Whitespace," ",-1,-1,void 0],[i.OpenParen,"(",-1,-1,void 0]],[[i.CloseParen,")",-1,-1,void 0]]))}));const o=e.tokens();return a(...o.filter(((e,r)=>(0!==r||0!==t||e[0]!==i.Whitespace)&&(e[0]!==i.Whitespace||!o[r+1]||o[r+1][0]!==i.Whitespace))))})).join(",")}function getMediaConditionListWithAndFromAncestry(e,t){let r=e;if(r){if(r=t.get(r),x(r))return r;if(W(r))return r=t.get(r),x(r)?r:void 0}}function getMediaConditionInShallowMediaQueryFromAncestry(e,t,r){let i=e;if(!i)return;if(i=r.get(i),!P(i))return;const n=i;return i=r.get(i),S(i)&&i===t?n:void 0}const creator=()=>({postcssPlugin:"postcss-media-minmax",AtRule:{media:e=>{if(!(e.params.includes("<")||e.params.includes(">")||e.params.includes("=")))return;const t=transform(A(e.params,{preserveInvalidMediaQueries:!0,onParseError:()=>{throw e.error(`Unable to parse media query "${e.params}"`)}}));e.params!==t&&(e.params=t)}}});creator.postcss=!0;export{creator as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toLowerCaseAZ(x: string): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { MediaFeature, MediaFeatureComparison, MediaFeatureValue } from '@csstools/media-query-list-parser';
|
|
2
|
+
export declare function transformSingleNameValuePair(name: string, operator: MediaFeatureComparison, value: MediaFeatureValue, nameBeforeValue: boolean): MediaFeature | undefined;
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@csstools/postcss-media-minmax",
|
|
3
|
+
"description": "Use the range notation in CSS media queries",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"contributors": [
|
|
6
|
+
{
|
|
7
|
+
"name": "Antonio Laguna",
|
|
8
|
+
"email": "antonio@laguna.es",
|
|
9
|
+
"url": "https://antonio.laguna.es"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "Romain Menke",
|
|
13
|
+
"email": "romainmenke@gmail.com"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "yisi"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"funding": {
|
|
21
|
+
"type": "opencollective",
|
|
22
|
+
"url": "https://opencollective.com/csstools"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": "^14 || ^16 || >=18"
|
|
26
|
+
},
|
|
27
|
+
"main": "dist/index.cjs",
|
|
28
|
+
"module": "dist/index.mjs",
|
|
29
|
+
"types": "dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.mjs",
|
|
34
|
+
"require": "./dist/index.cjs",
|
|
35
|
+
"default": "./dist/index.mjs"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"CHANGELOG.md",
|
|
40
|
+
"LICENSE.md",
|
|
41
|
+
"README.md",
|
|
42
|
+
"dist"
|
|
43
|
+
],
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@csstools/css-calc": "^1.0.1",
|
|
46
|
+
"@csstools/css-parser-algorithms": "^2.1.0",
|
|
47
|
+
"@csstools/css-tokenizer": "^2.1.0",
|
|
48
|
+
"@csstools/media-query-list-parser": "^2.0.2"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"postcss": "^8.4"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@csstools/postcss-tape": "*"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "rollup -c ../../rollup/default.mjs",
|
|
58
|
+
"docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs",
|
|
59
|
+
"lint": "node ../../.github/bin/format-package-json.mjs",
|
|
60
|
+
"prepublishOnly": "npm run build && npm run test",
|
|
61
|
+
"test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
|
|
62
|
+
"test:browser": "node ./test/_browser.mjs",
|
|
63
|
+
"test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
|
|
64
|
+
},
|
|
65
|
+
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-media-minmax#readme",
|
|
66
|
+
"repository": {
|
|
67
|
+
"type": "git",
|
|
68
|
+
"url": "https://github.com/csstools/postcss-plugins.git",
|
|
69
|
+
"directory": "plugins/postcss-media-minmax"
|
|
70
|
+
},
|
|
71
|
+
"bugs": "https://github.com/csstools/postcss-plugins/issues",
|
|
72
|
+
"keywords": [
|
|
73
|
+
"media queries",
|
|
74
|
+
"postcss-plugin",
|
|
75
|
+
"range"
|
|
76
|
+
],
|
|
77
|
+
"csstools": {
|
|
78
|
+
"cssdbId": "media-query-ranges",
|
|
79
|
+
"exportName": "postcssMediaMinMax",
|
|
80
|
+
"humanReadableName": "PostCSS Media MinMax",
|
|
81
|
+
"specUrl": "https://www.w3.org/TR/mediaqueries-4/#mq-features"
|
|
82
|
+
},
|
|
83
|
+
"volta": {
|
|
84
|
+
"extends": "../../package.json"
|
|
85
|
+
}
|
|
86
|
+
}
|