This commit is contained in:
Iliyan Angelov
2025-09-14 23:24:25 +03:00
commit c67067a2a4
71311 changed files with 6800714 additions and 0 deletions

View File

@@ -0,0 +1,108 @@
# CC0 1.0 Universal
## Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an “owner”) of an original work of
authorship and/or a database (each, a “Work”).
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific works
(“Commons”) that the public can reliably and without fear of later claims of
infringement build upon, modify, incorporate in other works, reuse and
redistribute as freely as possible in any form whatsoever and for any purposes,
including without limitation commercial purposes. These owners may contribute
to the Commons to promote the ideal of a free culture and the further
production of creative, cultural and scientific works, or to gain reputation or
greater distribution for their Work in part through the use and efforts of
others.
For these and/or other purposes and motivations, and without any expectation of
additional consideration or compensation, the person associating CC0 with a
Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights (“Copyright and
Related Rights”). Copyright and Related Rights include, but are not limited
to, the following:
1. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a persons image or likeness
depicted in a Work;
4. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(i), below;
5. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
6. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
7. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations
thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmers Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
makes the Waiver for the benefit of each member of the public at large and
to the detriment of Affirmers heirs and successors, fully intending that
such Waiver shall not be subject to revocation, rescission, cancellation,
termination, or any other legal or equitable action to disrupt the quiet
enjoyment of the Work by the public as contemplated by Affirmers express
Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmers express Statement of Purpose. In addition, to the extent the
Waiver is so judged Affirmer hereby grants to each affected person a
royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmers Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “License”). The License
shall be deemed effective as of the date CC0 was applied by Affirmer to the
Work. Should any part of the License for any reason be judged legally
invalid or ineffective under applicable law, such partial invalidity or
ineffectiveness shall not invalidate the remainder of the License, and in
such case Affirmer hereby affirms that he or she will not (i) exercise any
of his or her remaining Copyright and Related Rights in the Work or (ii)
assert any associated claims and causes of action with respect to the Work,
in either case contrary to Affirmers express Statement of Purpose.
4. Limitations and Disclaimers.
1. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
2. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or
otherwise, including without limitation warranties of title,
merchantability, fitness for a particular purpose, non infringement, or
the absence of latent or other defects, accuracy, or the present or
absence of errors, whether or not discoverable, all to the greatest
extent permissible under applicable law.
3. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any persons Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the Work.
4. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
http://creativecommons.org/publicdomain/zero/1.0/.

107
frontend/node_modules/@csstools/normalize.css/README.md generated vendored Normal file
View File

@@ -0,0 +1,107 @@
# @csstools/normalize.css [<img src="https://csstools.github.io/normalize.css/logo.svg" alt="normalize" width="90" height="90" align="right">][@csstools/normalize.css]
[@csstools/normalize.css] is a CSS library that provides consistent,
cross-browser default styling of HTML elements.
## Usage
```html
<link href="https://unpkg.com/@csstools/normalize.css" rel="stylesheet" />
```
## Install
```sh
npm install @csstools/normalize.css --save
```
#### Webpack Usage
Import [@csstools/normalize.css] in CSS:
```css
@import '~@csstools/normalize.css';
```
Alternatively, import [@csstools/normalize.css] in JS:
```js
import '@csstools/normalize.css';
```
In `webpack.config.js`, use the appropriate loaders:
```js
module.exports = {
module: {
rules: [
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
}
]
}
}
```
**Download**
See https://csstools.github.io/normalize.css/latest/normalize.css
## What does it do?
* Normalizes styles for a wide range of elements.
* Corrects bugs and common browser inconsistencies.
* Explains what code does using detailed comments.
## Browser support
* Chrome (last 3)
* Edge (last 3)
* Firefox (last 3)
* Firefox ESR
* Opera (last 3)
* Safari (last 2)
* iOS Safari (last 2)
## Contributing
Please read the [contribution guidelines](CONTRIBUTING.md) in order to make the
contribution process easy and effective for everyone involved.
## Similar Projects
- [modern-normalize.css](https://github.com/sindresorhus/modern-normalize) - An
alternative to normalize.css, adhering to a minimal set of normalizations and
common developer expectations and preferences.
- [opinionate.css](https://github.com/adamgruber/opinionate.css) - A supplement
to normalize.css with opinionated rules.
- [remedy.css](https://github.com/mozdevs/cssremedy) - An alternative to
normalize.css, adhering to different common developer expectations and
preferences.
- [sanitize.css](https://github.com/csstools/sanitize.css) - An alternative to
normalize.css, adhering to common developer expectations and preferences.
## Differences from `necolas/normalize.css`
Nicolas Gallagher and I started writing normalize.css together. I named and
created the normalize.css repository with the help of Paul Irish and Ben Alman.
I transferred the repository to Nicolas, who turned it into a “household” CSS
library.
Later, I resumed authorship of normalize.css with Luciano Battagliero. Together,
we tagged, deprecated, and removed “opinionated” styles — styles developers
often prefer but which do not fix bugs or “normalize” browser differences.
Later, Nicolas resumed authorship and the issue of whether to include or omit
the opinionated styles forced us to split.
I continue working on the normalize.css project, currently under the “csstools”
tag. I hope one day our differences are resolved and the projects are one again.
## Acknowledgements
normalize.css is a project by [Jonathan Neal](https://github.com/jonathantneal),
co-created with [Nicolas Gallagher](https://github.com/necolas).
[@csstools/normalize.css]: https://github.com/csstools/normalize.css

View File

@@ -0,0 +1,257 @@
/* Document
* ========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
:where(html) {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
text-size-adjust: 100%; /* 2 */
}
/* Sections
* ========================================================================== */
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Edge, Firefox, and Safari.
*/
:where(h1) {
font-size: 2em;
margin-block-end: 0.67em;
margin-block-start: 0.67em;
}
/* Grouping content
* ========================================================================== */
/**
* Remove the margin on nested lists in Chrome, Edge, and Safari.
*/
:where(dl, ol, ul) :where(dl, ol, ul) {
margin-block-end: 0;
margin-block-start: 0;
}
/**
* 1. Add the correct box sizing in Firefox.
* 2. Correct the inheritance of border color in Firefox.
*/
:where(hr) {
box-sizing: content-box; /* 1 */
color: inherit; /* 2 */
height: 0; /* 1 */
}
/* Text-level semantics
* ========================================================================== */
/**
* Add the correct text decoration in Safari.
*/
:where(abbr[title]) {
text-decoration: underline;
text-decoration: underline dotted;
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
:where(b, strong) {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
:where(code, kbd, pre, samp) {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font size in all browsers.
*/
:where(small) {
font-size: 80%;
}
/* Tabular data
* ========================================================================== */
/**
* 1. Correct table border color in Chrome, Edge, and Safari.
* 2. Remove text indentation from table contents in Chrome, Edge, and Safari.
*/
:where(table) {
border-color: currentColor; /* 1 */
text-indent: 0; /* 2 */
}
/* Forms
* ========================================================================== */
/**
* Remove the margin on controls in Safari.
*/
:where(button, input, select) {
margin: 0;
}
/**
* Remove the inheritance of text transform in Firefox.
*/
:where(button) {
text-transform: none;
}
/**
* Correct the inability to style buttons in iOS and Safari.
*/
:where(button, input:is([type="button" i], [type="reset" i], [type="submit" i])) {
-webkit-appearance: button;
}
/**
* Add the correct vertical alignment in Chrome, Edge, and Firefox.
*/
:where(progress) {
vertical-align: baseline;
}
/**
* Remove the inheritance of text transform in Firefox.
*/
:where(select) {
text-transform: none;
}
/**
* Remove the margin in Firefox and Safari.
*/
:where(textarea) {
margin: 0;
}
/**
* 1. Correct the odd appearance in Chrome, Edge, and Safari.
* 2. Correct the outline style in Safari.
*/
:where(input[type="search" i]) {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Safari.
*/
::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
height: auto;
}
/**
* Correct the text style of placeholders in Chrome, Edge, and Safari.
*/
::-webkit-input-placeholder {
color: inherit;
opacity: 0.54;
}
/**
* Remove the inner padding in Chrome, Edge, and Safari on macOS.
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style upload buttons in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/**
* Remove the inner border and padding of focus outlines in Firefox.
*/
:where(button, input:is([type="button" i], [type="color" i], [type="reset" i], [type="submit" i]))::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus outline styles unset by the previous rule in Firefox.
*/
:where(button, input:is([type="button" i], [type="color" i], [type="reset" i], [type="submit" i]))::-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Remove the additional :invalid styles in Firefox.
*/
:where(:-moz-ui-invalid) {
box-shadow: none;
}
/* Interactive
* ========================================================================== */
/*
* Add the correct styles in Safari.
*/
:where(dialog) {
background-color: white;
border: solid;
color: black;
height: -moz-fit-content;
height: fit-content;
left: 0;
margin: auto;
padding: 1em;
position: absolute;
right: 0;
width: -moz-fit-content;
width: fit-content;
}
:where(dialog:not([open])) {
display: none;
}
/*
* Add the correct display in all browsers.
*/
:where(summary) {
display: list-item;
}

View File

@@ -0,0 +1,265 @@
/* Document
* ========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
:where(html) {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
text-size-adjust: 100%; /* 2 */
}
/* Sections
* ========================================================================== */
/**
* Remove the margin in all browsers. (opinionated)
*/
:where(body) {
margin: 0;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Edge, Firefox, and Safari.
*/
:where(h1) {
font-size: 2em;
margin-block-end: 0.67em;
margin-block-start: 0.67em;
}
/* Grouping content
* ========================================================================== */
/**
* Remove the margin on nested lists in Chrome, Edge, and Safari.
*/
:where(dl, ol, ul) :where(dl, ol, ul) {
margin-block-end: 0;
margin-block-start: 0;
}
/**
* 1. Add the correct box sizing in Firefox.
* 2. Correct the inheritance of border color in Firefox.
*/
:where(hr) {
box-sizing: content-box; /* 1 */
color: inherit; /* 2 */
height: 0; /* 1 */
}
/* Text-level semantics
* ========================================================================== */
/**
* Add the correct text decoration in Safari.
*/
:where(abbr[title]) {
text-decoration: underline;
text-decoration: underline dotted;
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
:where(b, strong) {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
:where(code, kbd, pre, samp) {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font size in all browsers.
*/
:where(small) {
font-size: 80%;
}
/* Tabular data
* ========================================================================== */
/**
* 1. Correct table border color in Chrome, Edge, and Safari.
* 2. Remove text indentation from table contents in Chrome, Edge, and Safari.
*/
:where(table) {
border-color: currentColor; /* 1 */
text-indent: 0; /* 2 */
}
/* Forms
* ========================================================================== */
/**
* Remove the margin on controls in Safari.
*/
:where(button, input, select) {
margin: 0;
}
/**
* Remove the inheritance of text transform in Firefox.
*/
:where(button) {
text-transform: none;
}
/**
* Correct the inability to style buttons in iOS and Safari.
*/
:where(button, input:is([type="button" i], [type="reset" i], [type="submit" i])) {
-webkit-appearance: button;
}
/**
* Add the correct vertical alignment in Chrome, Edge, and Firefox.
*/
:where(progress) {
vertical-align: baseline;
}
/**
* Remove the inheritance of text transform in Firefox.
*/
:where(select) {
text-transform: none;
}
/**
* Remove the margin in Firefox and Safari.
*/
:where(textarea) {
margin: 0;
}
/**
* 1. Correct the odd appearance in Chrome, Edge, and Safari.
* 2. Correct the outline style in Safari.
*/
:where(input[type="search" i]) {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Safari.
*/
::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
height: auto;
}
/**
* Correct the text style of placeholders in Chrome, Edge, and Safari.
*/
::-webkit-input-placeholder {
color: inherit;
opacity: 0.54;
}
/**
* Remove the inner padding in Chrome, Edge, and Safari on macOS.
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style upload buttons in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/**
* Remove the inner border and padding of focus outlines in Firefox.
*/
:where(button, input:is([type="button" i], [type="color" i], [type="reset" i], [type="submit" i]))::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus outline styles unset by the previous rule in Firefox.
*/
:where(button, input:is([type="button" i], [type="color" i], [type="reset" i], [type="submit" i]))::-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Remove the additional :invalid styles in Firefox.
*/
:where(:-moz-ui-invalid) {
box-shadow: none;
}
/* Interactive
* ========================================================================== */
/*
* Add the correct styles in Safari.
*/
:where(dialog) {
background-color: white;
border: solid;
color: black;
height: -moz-fit-content;
height: fit-content;
left: 0;
margin: auto;
padding: 1em;
position: absolute;
right: 0;
width: -moz-fit-content;
width: fit-content;
}
:where(dialog:not([open])) {
display: none;
}
/*
* Add the correct display in all browsers.
*/
:where(summary) {
display: list-item;
}

View File

@@ -0,0 +1,30 @@
{
"name": "@csstools/normalize.css",
"version": "12.1.1",
"description": "A cross-browser CSS foundation",
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
"contributors": [
"Jonathan Neal <jonathantneal@hotmail.com> (http://jonathantneal.com/)",
"Nicolas Gallagher <nicolas@nicolasgallagher.com> (http://nicolasgallagher.com/)",
"Luciano Battagliero <lucianobattagliero+git@gmail.com> (https://lucianobattagliero.com/)"
],
"license": "CC0-1.0",
"repository": "csstools/normalize.css",
"homepage": "https://github.com/csstools/normalize.css#readme",
"bugs": "https://github.com/csstools/normalize.css/issues",
"main": "normalize.css",
"style": "normalize.css",
"files": [
"normalize.css",
"opinionated.css"
],
"scripts": {
"test": "echo \"no test\""
},
"keywords": [
"css",
"normalizes",
"browsers",
"fixes"
]
}

View File

@@ -0,0 +1,39 @@
# Changes to PostCSS Cascade Layers
### 1.1.1 (September 17, 2022)
- Fix pre-defined layer order in nested `@layer` rules.
### 1.1.0 (September 14, 2022)
- Add support for `@scope` and `@container` as parent rules for `@layer`
### 1.0.6 (September 7, 2022)
- Fix broken `@keyframes` in `@layer`.
### 1.0.5 (July 8, 2022)
- Fix case insensitive `@layer` matching (`@LaYeR`).
- Updated `@csstools/selector-specificity` to `2.0.2` (patch)
### 1.0.4 (June 23, 2022)
- Fix selector order with any pseudo element. This plugin will no longer re-order selectors.
### 1.0.3 (June 4, 2022)
- Update `@csstools/selector-specificity` (major)
### 1.0.2 (May 20, 2022)
- Use only simple `:not(#\#)` selectors to adjust specificity.
### 1.0.1 (May 17, 2022)
- Process CSS after most other plugins to ensure correct analysis and transformation of sugary CSS.
- Fix selector order with `:before` and other pseudo elements.
### 1.0.0 (May 12, 2022)
- Initial version

View File

@@ -0,0 +1,108 @@
# CC0 1.0 Universal
## Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an “owner”) of an original work of
authorship and/or a database (each, a “Work”).
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific works
(“Commons”) that the public can reliably and without fear of later claims of
infringement build upon, modify, incorporate in other works, reuse and
redistribute as freely as possible in any form whatsoever and for any purposes,
including without limitation commercial purposes. These owners may contribute
to the Commons to promote the ideal of a free culture and the further
production of creative, cultural and scientific works, or to gain reputation or
greater distribution for their Work in part through the use and efforts of
others.
For these and/or other purposes and motivations, and without any expectation of
additional consideration or compensation, the person associating CC0 with a
Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights (“Copyright and
Related Rights”). Copyright and Related Rights include, but are not limited
to, the following:
1. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a persons image or likeness
depicted in a Work;
4. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(i), below;
5. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
6. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
7. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations
thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmers Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
makes the Waiver for the benefit of each member of the public at large and
to the detriment of Affirmers heirs and successors, fully intending that
such Waiver shall not be subject to revocation, rescission, cancellation,
termination, or any other legal or equitable action to disrupt the quiet
enjoyment of the Work by the public as contemplated by Affirmers express
Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmers express Statement of Purpose. In addition, to the extent the
Waiver is so judged Affirmer hereby grants to each affected person a
royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmers Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “License”). The License
shall be deemed effective as of the date CC0 was applied by Affirmer to the
Work. Should any part of the License for any reason be judged legally
invalid or ineffective under applicable law, such partial invalidity or
ineffectiveness shall not invalidate the remainder of the License, and in
such case Affirmer hereby affirms that he or she will not (i) exercise any
of his or her remaining Copyright and Related Rights in the Work or (ii)
assert any associated claims and causes of action with respect to the Work,
in either case contrary to Affirmers express Statement of Purpose.
4. Limitations and Disclaimers.
1. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
2. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or
otherwise, including without limitation warranties of title,
merchantability, fitness for a particular purpose, non infringement, or
the absence of latent or other defects, accuracy, or the present or
absence of errors, whether or not discoverable, all to the greatest
extent permissible under applicable law.
3. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any persons Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the Work.
4. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
http://creativecommons.org/publicdomain/zero/1.0/.

View File

@@ -0,0 +1,200 @@
# PostCSS Cascade Layers [<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-cascade-layers.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/cascade-layers.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]
[PostCSS Cascade Layers] lets you use `@layer` following the [Cascade Layers Specification]. For more information on layers, checkout [A Complete Guide to CSS Cascade Layers] by Miriam Suzanne.
```pcss
target {
color: purple;
}
@layer {
target {
color: green;
}
}
/* becomes */
target:not(#\#) {
color: purple;
}
target {
color: green;
}
```
## How it works
[PostCSS Cascade Layers] creates "layers" of specificity.
It applies extra specificity on all your styles based on :
- the most specific selector found
- the order in which layers are defined
```css
@layer A, B;
@layer B {
.a-less-specific-selector {
/* styles */
}
}
@layer A {
#something #very-specific {
/* styles */
}
}
@layer C {
.a-less-specific-selector {
/* styles */
}
}
```
most specific selector :
- `#something #very-specific`
- `[2, 0, 0]`
- `2 + 1` -> `3` to ensure there is no overlap
the order in which layers are defined :
- `A`
- `B`
- `C`
| layer | previous adjustment | specificity adjustment | selector |
| ------ | ------ | ----------- | --- |
| `A` | `0` | `0 + 0 = 0` | N/A |
| `B` | `0` | `0 + 3 = 3` | `:not(#/#):not(#/#):not(#/#)` |
| `C` | `3` | `3 + 3 = 6` | `:not(#/#):not(#/#):not(#/#):not(#/#):not(#/#):not(#/#)` |
This approach lets more important (later) layers always override less important (earlier) layers.<br>
And layers have enough room internally so that each selector works and overrides as expected.
More layers with more specificity will cause longer `:not(...)` selectors to be generated.
⚠️ For this to work the plugin needs to analyze your entire stylesheet at once.<br>
If you have different assets that are unaware of each other it will not work correctly as the analysis will be incorrect.
## Usage
Add [PostCSS Cascade Layers] to your project:
```bash
npm install postcss @csstools/postcss-cascade-layers --save-dev
```
Use it as a [PostCSS] plugin:
```js
const postcss = require('postcss');
const postcssCascadeLayers = require('@csstools/postcss-cascade-layers');
postcss([
postcssCascadeLayers(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```
[PostCSS Cascade Layers] runs in all Node environments, with special
instructions for:
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- | --- |
## Options
### onRevertLayerKeyword
The `onRevertLayerKeyword` option enables warnings if `revert-layer` is used.
Transforming `revert-layer` for older browsers is not possible in this plugin.
Defaults to `warn`
```js
postcssCascadeLayers({ onRevertLayerKeyword: 'warn' }) // 'warn' | false
```
```pcss
/* [postcss-cascade-layers]: handling "revert-layer" is unsupported by this plugin and will cause style differences between browser versions. */
@layer {
.foo {
color: revert-layer;
}
}
```
### onConditionalRulesChangingLayerOrder
The `onConditionalRulesChangingLayerOrder` option enables warnings if layers are declared in multiple different orders in conditional rules.
Transforming these layers correctly for older browsers is not possible in this plugin.
Defaults to `warn`
```js
postcssCascadeLayers({ onConditionalRulesChangingLayerOrder: 'warn' }) // 'warn' | false
```
```pcss
/* [postcss-cascade-layers]: handling different layer orders in conditional rules is unsupported by this plugin and will cause style differences between browser versions. */
@media (min-width: 10px) {
@layer B {
.foo {
color: red;
}
}
}
@layer A {
.foo {
color: pink;
}
}
@layer B {
.foo {
color: red;
}
}
```
### onImportLayerRule
The `@import` at-rule can also be used with cascade layers, specifically to create a new layer like so:
```css
@import 'theme.css' layer(utilities);
```
If your CSS uses `@import` with layers, you will also need the [postcss-import] plugin. This plugin alone will not handle the `@import` at-rule.
This plugin will warn you when it detects that [postcss-import] did not transform`@import` at-rules.
```js
postcssCascadeLayers({ onImportLayerRule: 'warn' }) // 'warn' | false
```
### Contributors
The contributors to this plugin were [Olu Niyi-Awosusi] and [Sana Javed] from [Oddbird] and Romain Menke.
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
[css-url]: https://cssdb.org/#cascade-layers
[discord]: https://discord.gg/bUadyRwkJS
[npm-url]: https://www.npmjs.com/package/@csstools/postcss-cascade-layers
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
[PostCSS]: https://github.com/postcss/postcss
[PostCSS Loader]: https://github.com/postcss/postcss-loader
[PostCSS Cascade Layers]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-cascade-layers
[Cascade Layers Specification]: https://www.w3.org/TR/css-cascade-5/#layering
[A Complete Guide to CSS Cascade Layers]: https://css-tricks.com/css-cascade-layers/
[Olu Niyi-Awosusi]: https://github.com/oluoluoxenfree
[Sana Javed]: https://github.com/sanajaved7
[Oddbird]: https://github.com/oddbird
[postcss-import]: https://github.com/postcss/postcss-import

View File

@@ -0,0 +1 @@
export declare function adjustSelectorSpecificity(selector: string, amount: number): string;

View File

@@ -0,0 +1,3 @@
import type { Container } from 'postcss';
export declare function removeEmptyDescendantBlocks(block: Container): void;
export declare function removeEmptyAncestorBlocks(block: Container): void;

View File

@@ -0,0 +1,8 @@
/** @constant {string} INVALID_LAYER_NAME Used to replace "layer" temporarily when an invalid layer is detected. This allows us to ignore this rule in further processing. */
export declare const INVALID_LAYER_NAME = "csstools-invalid-layer";
/** @constant {string} WITH_SELECTORS_LAYER_NAME Used to replace "layer" temporarily for any layer at rules that contain selectors. This allows us to sort these differently from other layer at rules. */
export declare const WITH_SELECTORS_LAYER_NAME = "csstools-layer-with-selector-rules";
export declare const ANONYMOUS_LAYER_SUFFIX = "6efdb677-bb05-44e5-840f-29d2175862fd";
export declare const IMPLICIT_LAYER_SUFFIX = "b147acf6-11a6-4338-a4d0-80aef4cd1a2f";
export declare const CONDITIONAL_ATRULES: string[];
export declare const ATRULES_WITH_NON_SELECTOR_BLOCK_LISTS: string[];

View File

@@ -0,0 +1,3 @@
import type { Container } from 'postcss';
import type { Model } from './model';
export declare function desugarAndParseLayerNames(root: Container, model: Model): void;

View File

@@ -0,0 +1,3 @@
import type { Container, ChildNode } from 'postcss';
import type { Model } from './model';
export declare function desugarNestedLayers(root: Container<ChildNode>, model: Model): void;

View File

@@ -0,0 +1,2 @@
import type { AtRule } from 'postcss';
export declare function getConditionalAtRuleAncestor(layerRule: AtRule): AtRule | null;

View File

@@ -0,0 +1,2 @@
import type { AtRule, Node } from 'postcss';
export declare function getLayerAtRuleAncestor(node: Node): AtRule | null;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import type { PluginCreator } from 'postcss';
import { pluginOptions } from './options';
declare const creator: PluginCreator<pluginOptions>;
export default creator;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
import type { AtRule } from 'postcss';
export declare function isProcessableLayerRule(atRule: AtRule): boolean;

View File

@@ -0,0 +1,18 @@
import type { AtRule } from 'postcss';
export declare class Model {
anonymousLayerCount: number;
layerCount: number;
layerOrder: Map<string, number>;
layerParamsParsed: Map<string, Array<string>>;
layerNameParts: Map<string, Array<string>>;
constructor();
createAnonymousLayerName(): string;
createImplicitLayerName(layerName: string): string;
addLayerParams(key: string, parts?: string): void;
addLayerParams(key: string, parts: Array<string>): void;
addLayerNameParts(parts: string): void;
addLayerNameParts(parts: Array<string>): void;
getLayerParams(layer: AtRule): Array<string>;
getLayerNameList(layerName: string): Array<string>;
sortLayerNames(): void;
}

View File

@@ -0,0 +1,5 @@
export declare type pluginOptions = {
onRevertLayerKeyword: 'warn' | false;
onConditionalRulesChangingLayerOrder: 'warn' | false;
onImportLayerRule: 'warn' | false;
};

View File

@@ -0,0 +1,7 @@
import type { Container, Result } from 'postcss';
import type { Model } from './model';
import { pluginOptions } from './options';
export declare function recordLayerOrder(root: Container, model: Model, { result, options }: {
result: Result;
options: pluginOptions;
}): void;

View File

@@ -0,0 +1,3 @@
import type { Container, ChildNode, AtRule } from 'postcss';
export declare function someInTree(container: Container, predicate: (node: ChildNode) => boolean): boolean;
export declare function someAtRuleInTree(container: Container, predicate: (node: AtRule) => boolean): boolean;

View File

@@ -0,0 +1,3 @@
import type { Container } from 'postcss';
import type { Model } from './model';
export declare function sortRootNodes(root: Container, model: Model): void;

View File

@@ -0,0 +1,2 @@
import type { Container } from 'postcss';
export declare function splitImportantStyles(root: Container): void;

View File

@@ -0,0 +1,97 @@
{
"name": "@csstools/postcss-cascade-layers",
"description": "Use cascade layers in CSS",
"version": "1.1.1",
"contributors": [
{
"name": "Olu Niyi-Awosusi",
"email": "o.niyiawosusi@gmail.com"
},
{
"name": "Sana Javed",
"email": "sanajaved7@gmail.com"
},
{
"name": "Antonio Laguna",
"email": "antonio@laguna.es",
"url": "https://antonio.laguna.es"
},
{
"name": "Romain Menke",
"email": "romainmenke@gmail.com"
}
],
"license": "CC0-1.0",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/csstools"
},
"engines": {
"node": "^12 || ^14 || >=16"
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
}
},
"files": [
"CHANGELOG.md",
"LICENSE.md",
"README.md",
"dist"
],
"dependencies": {
"@csstools/selector-specificity": "^2.0.2",
"postcss-selector-parser": "^6.0.10"
},
"peerDependencies": {
"postcss": "^8.2"
},
"devDependencies": {
"postcss-import": "^15.0.0",
"puppeteer": "^17.1.3"
},
"scripts": {
"build": "rollup -c ../../rollup/default.js",
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"",
"docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs",
"lint": "npm run lint:eslint && npm run lint:package-json",
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:package-json": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run clean && npm run build && npm run test",
"test": "node .tape.mjs && npm run test:exports",
"test:browser": "node ./test/_browser.mjs",
"test:exports": "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-cascade-layers#readme",
"repository": {
"type": "git",
"url": "https://github.com/csstools/postcss-plugins.git",
"directory": "plugins/postcss-cascade-layers"
},
"bugs": "https://github.com/csstools/postcss-plugins/issues",
"keywords": [
"cascade",
"css",
"layers",
"postcss",
"postcss-plugin",
"selectors",
"specificity"
],
"csstools": {
"cssdbId": "cascade-layers",
"exportName": "postcssCascadeLayers",
"humanReadableName": "PostCSS Cascade Layers",
"specUrl": "https://www.w3.org/TR/css-cascade-5/#layering"
},
"volta": {
"extends": "../../package.json"
}
}

View File

@@ -0,0 +1,41 @@
# Changes to PostCSS Color Function
### 1.1.1 (July 8, 2022)
- Fix case insensitive matching.
### 1.1.0 (April 4, 2022)
- Allow percentage units in XYZ color spaces.
```css
.percentages {
color-1: color(xyz-d50 64.331% 19.245% 16.771%);
color-2: color(xyz-d65 64.331% 19.245% 16.771%);
color-3: color(xyz 64.331% 19.245% 16.771%);
/* becomes */
color-1: rgb(245,0,135);
color-2: rgb(253,0,127);
color-3: rgb(253,0,127);
}
```
### 1.0.3 (March 8, 2022)
- Fix gamut mapping giving overly unsaturated colors.
- Implement powerless color components in gamut mapping.
### 1.0.2 (February 12, 2022)
- Updated `@csstools/postcss-progressive-custom-properties` to `1.1.0`.
### 1.0.1 (February 11, 2022)
- Add tests for percentage values in non-xyz color spaces.
- Ignore percentage values in xyz color space as these are not supported.
### 1.0.0 (February 7, 2022)
- Initial version

View File

@@ -0,0 +1,108 @@
# CC0 1.0 Universal
## Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an “owner”) of an original work of
authorship and/or a database (each, a “Work”).
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific works
(“Commons”) that the public can reliably and without fear of later claims of
infringement build upon, modify, incorporate in other works, reuse and
redistribute as freely as possible in any form whatsoever and for any purposes,
including without limitation commercial purposes. These owners may contribute
to the Commons to promote the ideal of a free culture and the further
production of creative, cultural and scientific works, or to gain reputation or
greater distribution for their Work in part through the use and efforts of
others.
For these and/or other purposes and motivations, and without any expectation of
additional consideration or compensation, the person associating CC0 with a
Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights (“Copyright and
Related Rights”). Copyright and Related Rights include, but are not limited
to, the following:
1. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a persons image or likeness
depicted in a Work;
4. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(i), below;
5. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
6. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
7. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations
thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmers Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
makes the Waiver for the benefit of each member of the public at large and
to the detriment of Affirmers heirs and successors, fully intending that
such Waiver shall not be subject to revocation, rescission, cancellation,
termination, or any other legal or equitable action to disrupt the quiet
enjoyment of the Work by the public as contemplated by Affirmers express
Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmers express Statement of Purpose. In addition, to the extent the
Waiver is so judged Affirmer hereby grants to each affected person a
royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmers Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “License”). The License
shall be deemed effective as of the date CC0 was applied by Affirmer to the
Work. Should any part of the License for any reason be judged legally
invalid or ineffective under applicable law, such partial invalidity or
ineffectiveness shall not invalidate the remainder of the License, and in
such case Affirmer hereby affirms that he or she will not (i) exercise any
of his or her remaining Copyright and Related Rights in the Work or (ii)
assert any associated claims and causes of action with respect to the Work,
in either case contrary to Affirmers express Statement of Purpose.
4. Limitations and Disclaimers.
1. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
2. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or
otherwise, including without limitation warranties of title,
merchantability, fitness for a particular purpose, non infringement, or
the absence of latent or other defects, accuracy, or the present or
absence of errors, whether or not discoverable, all to the greatest
extent permissible under applicable law.
3. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any persons Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the Work.
4. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
http://creativecommons.org/publicdomain/zero/1.0/.

View File

@@ -0,0 +1,170 @@
# PostCSS Color Function [<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-color-function.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/color-function.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]
[PostCSS Color Function] lets you use the `color` function in
CSS, following the [CSS Color] specification.
```pcss
.color {
color: color(display-p3 0.64331 0.19245 0.16771);
}
:root {
--a-color: color(srgb 0.64331 0.19245 0.16771);
}
/* becomes */
.color {
color: rgb(179,35,35);
}
:root {
--a-color: rgb(164,49,43);
}
```
## Usage
Add [PostCSS Color Function] to your project:
```bash
npm install postcss @csstools/postcss-color-function --save-dev
```
Use it as a [PostCSS] plugin:
```js
const postcss = require('postcss');
const postcssColorFunction = require('@csstools/postcss-color-function');
postcss([
postcssColorFunction(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```
[PostCSS Color Function] runs in all Node environments, with special
instructions for:
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- | --- |
## Options
### preserve
The `preserve` option determines whether the original notation
is preserved. By default, it is not preserved.
```js
postcssColorFunction({ preserve: true })
```
```pcss
.color {
color: color(display-p3 0.64331 0.19245 0.16771);
}
:root {
--a-color: color(srgb 0.64331 0.19245 0.16771);
}
/* becomes */
.color {
color: rgb(179,35,35);
color: color(display-p3 0.64331 0.19245 0.16771);
}
:root {
--a-color: rgb(164,49,43);
}
@supports (color: color(srgb 0 0 0)) {
:root {
--a-color: color(srgb 0.64331 0.19245 0.16771);
}
}
```
### enableProgressiveCustomProperties
The `enableProgressiveCustomProperties` option determines whether the original notation
is wrapped with `@supports` when used in Custom Properties. By default, it is enabled.
⚠️ We only recommend disabling this when you set `preserve` to `false` or if you bring your own fix for Custom Properties. See what the plugin does in its [README](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties#readme).
```js
postcssColorFunction({ enableProgressiveCustomProperties: false })
```
```pcss
.color {
color: color(display-p3 0.64331 0.19245 0.16771);
}
:root {
--a-color: color(srgb 0.64331 0.19245 0.16771);
}
/* becomes */
.color {
color: rgb(179,35,35);
color: color(display-p3 0.64331 0.19245 0.16771);
}
:root {
--a-color: rgb(164,49,43);
--a-color: color(srgb 0.64331 0.19245 0.16771);
}
```
_Custom properties do not fallback to the previous declaration_
## Supported Color Spaces
```css
.color-spaces {
color: color(a98-rgb 0.803 0.484 0.944);
color: color(display-p3 0.8434 0.509 0.934);
color: color(prophoto-rgb 0.759 0.493 0.898);
color: color(rec2020 0.772 0.491 0.920);
color: color(srgb 0.897 0.488 0.959);
color: color(srgb-linear 0.783 0.203 0.910);
color: color(xyz 0.560 0.377 0.904);
color: color(xyz-d50 0.550 0.375 0.680);
color: color(xyz-d65 0.560 0.377 0.904);
}
```
## Out of gamut colors
Depending on the browser implementation out of gamut colors may be clipped, resulting in a different color.<br>
Fallback values generated by [PostCSS Color Function] are always mapped to a close alternative in sRGB.
When setting `preserve` to `true` the original values will be used by some browsers and these may be clipped.<br>
Certain browsers will have an incorrect color if this occurs.
If the plugin detects out of gamut colors it will emit a warning :
> "color(srgb-linear -0.01656 0.23079 0.25298)" is out of gamut for "srgb-linear". When "preserve: true" is set this will lead to unexpected results in some browsers.
To resolve this warning pick a larger color space when declaring the original value.
## Copyright : color conversions
This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/tree/main/css-color-4. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
[css-url]: https://cssdb.org/#color-function
[discord]: https://discord.gg/bUadyRwkJS
[npm-url]: https://www.npmjs.com/package/@csstools/postcss-color-function
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
[PostCSS]: https://github.com/postcss/postcss
[PostCSS Loader]: https://github.com/postcss/postcss-loader
[PostCSS Color Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-color-function
[CSS Color]: https://www.w3.org/TR/css-color-4/#funcdef-color

View File

@@ -0,0 +1,3 @@
declare type color = [number, number, number];
export declare function a98RgbToSRgb(a98: color): color;
export {};

View File

@@ -0,0 +1,3 @@
declare type color = [number, number, number];
export declare function cieXyz50ToSRgb(xyz: color): color;
export {};

View File

@@ -0,0 +1,3 @@
declare type color = [number, number, number];
export declare function cieXyz65ToSRgb(xyz: color): color;
export {};

View File

@@ -0,0 +1,3 @@
declare type color = [number, number, number];
export declare function displayP3ToSRgb(displayP3: color): color;
export {};

View File

@@ -0,0 +1,3 @@
declare type color = [number, number, number];
export declare function prophotoRgbToSRgb(prophoto: color): color;
export {};

View File

@@ -0,0 +1,3 @@
declare type color = [number, number, number];
export declare function rec2020ToSRgb(rec: color): color;
export {};

View File

@@ -0,0 +1,3 @@
declare type color = [number, number, number];
export declare function sRgbLinearToSRgb(linearSRgb: color): color;
export {};

View File

@@ -0,0 +1,3 @@
declare type color = [number, number, number];
export declare function sRgbToSRgb(sRgb: color): color;
export {};

View File

@@ -0,0 +1,47 @@
/**
* @license W3C
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
*
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
*/
declare type color = [number, number, number];
export declare const D50: number[];
export declare const D65: number[];
export declare function lin_sRGB(RGB: color): color;
export declare function gam_sRGB(RGB: color): color;
export declare function lin_sRGB_to_XYZ(rgb: color): color;
export declare function XYZ_to_lin_sRGB(XYZ: color): color;
export declare function lin_P3(RGB: color): color;
export declare function gam_P3(RGB: color): color;
export declare function lin_P3_to_XYZ(rgb: color): color;
export declare function XYZ_to_lin_P3(XYZ: color): color;
export declare function lin_ProPhoto(RGB: color): color;
export declare function gam_ProPhoto(RGB: color): color;
export declare function lin_ProPhoto_to_XYZ(rgb: color): color;
export declare function XYZ_to_lin_ProPhoto(XYZ: color): color;
export declare function lin_a98rgb(RGB: color): color;
export declare function gam_a98rgb(RGB: color): color;
export declare function lin_a98rgb_to_XYZ(rgb: color): color;
export declare function XYZ_to_lin_a98rgb(XYZ: color): color;
export declare function lin_2020(RGB: color): color;
export declare function gam_2020(RGB: color): color;
export declare function lin_2020_to_XYZ(rgb: color): color;
export declare function XYZ_to_lin_2020(XYZ: color): color;
export declare function D65_to_D50(XYZ: color): color;
export declare function D50_to_D65(XYZ: color): color;
export declare function XYZ_to_Lab(XYZ: color): color;
export declare function Lab_to_XYZ(Lab: color): color;
export declare function Lab_to_LCH(Lab: color): color;
export declare function LCH_to_Lab(LCH: color): color;
export declare function XYZ_to_OKLab(XYZ: color): color;
export declare function OKLab_to_XYZ(OKLab: color): color;
export declare function OKLab_to_OKLCH(OKLab: color): color;
export declare function OKLCH_to_OKLab(OKLCH: color): color;
export declare function rectangular_premultiply(color: color, alpha: number): color;
export declare function rectangular_un_premultiply(color: color, alpha: number): color;
export declare function polar_premultiply(color: color, alpha: number, hueIndex: number): color;
export declare function polar_un_premultiply(color: color, alpha: number, hueIndex: number): color;
export declare function hsl_premultiply(color: color, alpha: number): color;
export {};

View File

@@ -0,0 +1,11 @@
/**
* @license W3C
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
*
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js
*/
declare type color = [number, number, number];
export declare function deltaEOK(reference: color, sample: color): number;
export {};

View File

@@ -0,0 +1,5 @@
declare type color = [number, number, number];
export declare function mapGamut(startOKLCH: color, toDestination: (x: color) => color, fromDestination: (x: color) => color): color;
export declare function clip(color: color): color;
export declare function inGamut(x: color): boolean;
export {};

View File

@@ -0,0 +1,13 @@
/**
* Simple matrix (and vector) multiplication
* Warning: No error handling for incompatible dimensions!
* @author Lea Verou 2020 MIT License
*
* @license W3C
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/multiply-matrices.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
*
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/multiply-matrices.js
*/
export declare function multiplyMatrices(a: Array<Array<number>> | Array<number>, b: Array<Array<number>> | Array<number>): Array<Array<number>> | Array<number>;

View File

@@ -0,0 +1,25 @@
/**
* @license W3C
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/utilities.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
*
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/utilities.js
*/
declare type color = [number, number, number];
export declare function sRGB_to_luminance(RGB: color): number;
export declare function contrast(RGB1: color, RGB2: color): number;
export declare function sRGB_to_LCH(RGB: color): color;
export declare function P3_to_LCH(RGB: color): color;
export declare function r2020_to_LCH(RGB: color): color;
export declare function LCH_to_sRGB(LCH: color): color;
export declare function LCH_to_P3(LCH: color): color;
export declare function LCH_to_r2020(LCH: color): color;
export declare function hslToRgb(hsl: color): color;
export declare function hueToRgb(t1: number, t2: number, hue: number): number;
export declare function naive_CMYK_to_sRGB(CMYK: [number, number, number, number]): color;
export declare function naive_sRGB_to_CMYK(RGB: color): [number, number, number, number];
export declare function XYZ_to_xy(XYZ: color): [number, number];
export declare function xy_to_uv(xy: [number, number]): [number, number];
export declare function XYZ_to_uv(XYZ: color): [number, number];
export {};

View File

@@ -0,0 +1,2 @@
import type { Declaration } from 'postcss';
export declare function hasFallback(node: Declaration): boolean;

View File

@@ -0,0 +1,2 @@
import type { Node } from 'postcss';
export declare function hasSupportsAtRuleAncestor(node: Node): boolean;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
import type { PluginCreator } from 'postcss';
declare type pluginOptions = {
preserve?: boolean;
enableProgressiveCustomProperties?: boolean;
};
declare const postcssPlugin: PluginCreator<pluginOptions>;
export default postcssPlugin;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
import type { Declaration, Result } from 'postcss';
export declare function modifiedValues(originalValue: string, decl: Declaration, result: Result, preserve: boolean): string | undefined;

View File

@@ -0,0 +1,3 @@
import type { Declaration, Result } from 'postcss';
import type { FunctionNode } from 'postcss-value-parser';
export declare function onCSSFunctionSRgb(node: FunctionNode, decl: Declaration, result: Result, preserve: boolean): void;

View File

@@ -0,0 +1,85 @@
{
"name": "@csstools/postcss-color-function",
"description": "Use the color() function in CSS",
"version": "1.1.1",
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
"license": "CC0-1.0",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/csstools"
},
"engines": {
"node": "^12 || ^14 || >=16"
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
}
},
"files": [
"CHANGELOG.md",
"LICENSE.md",
"README.md",
"dist"
],
"dependencies": {
"@csstools/postcss-progressive-custom-properties": "^1.1.0",
"postcss-value-parser": "^4.2.0"
},
"peerDependencies": {
"postcss": "^8.2"
},
"devDependencies": {
"postcss-lab-function": "^4.0.3"
},
"scripts": {
"build": "rollup -c ../../rollup/default.js",
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"",
"docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs",
"lint": "npm run lint:eslint && npm run lint:package-json",
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:package-json": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run clean && npm run build && npm run test",
"test": "node .tape.mjs && npm run test:exports",
"test:exports": "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-color-function#readme",
"repository": {
"type": "git",
"url": "https://github.com/csstools/postcss-plugins.git",
"directory": "plugins/postcss-color-function"
},
"bugs": "https://github.com/csstools/postcss-plugins/issues",
"keywords": [
"color",
"color",
"colors",
"css",
"design",
"display-p3",
"postcss",
"postcss-plugin",
"prophoto-rgb",
"rec2020",
"rgb",
"rgba",
"srgb-linear",
"syntax",
"xyz"
],
"csstools": {
"cssdbId": "color-function",
"exportName": "postcssColorFunction",
"humanReadableName": "PostCSS Color Function",
"specUrl": "https://www.w3.org/TR/css-color-4/#funcdef-color"
},
"volta": {
"extends": "../../package.json"
}
}

View File

@@ -0,0 +1,9 @@
# Changes to PostCSS Font Format
### 1.0.1 (July 8, 2022)
- Fix case insensitive matching.
### 1.0.0 (January 25, 2022)
- Initial version

View File

@@ -0,0 +1,108 @@
# CC0 1.0 Universal
## Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an “owner”) of an original work of
authorship and/or a database (each, a “Work”).
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific works
(“Commons”) that the public can reliably and without fear of later claims of
infringement build upon, modify, incorporate in other works, reuse and
redistribute as freely as possible in any form whatsoever and for any purposes,
including without limitation commercial purposes. These owners may contribute
to the Commons to promote the ideal of a free culture and the further
production of creative, cultural and scientific works, or to gain reputation or
greater distribution for their Work in part through the use and efforts of
others.
For these and/or other purposes and motivations, and without any expectation of
additional consideration or compensation, the person associating CC0 with a
Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights (“Copyright and
Related Rights”). Copyright and Related Rights include, but are not limited
to, the following:
1. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a persons image or likeness
depicted in a Work;
4. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(i), below;
5. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
6. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
7. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations
thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmers Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
makes the Waiver for the benefit of each member of the public at large and
to the detriment of Affirmers heirs and successors, fully intending that
such Waiver shall not be subject to revocation, rescission, cancellation,
termination, or any other legal or equitable action to disrupt the quiet
enjoyment of the Work by the public as contemplated by Affirmers express
Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmers express Statement of Purpose. In addition, to the extent the
Waiver is so judged Affirmer hereby grants to each affected person a
royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmers Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “License”). The License
shall be deemed effective as of the date CC0 was applied by Affirmer to the
Work. Should any part of the License for any reason be judged legally
invalid or ineffective under applicable law, such partial invalidity or
ineffectiveness shall not invalidate the remainder of the License, and in
such case Affirmer hereby affirms that he or she will not (i) exercise any
of his or her remaining Copyright and Related Rights in the Work or (ii)
assert any associated claims and causes of action with respect to the Work,
in either case contrary to Affirmers express Statement of Purpose.
4. Limitations and Disclaimers.
1. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
2. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or
otherwise, including without limitation warranties of title,
merchantability, fitness for a particular purpose, non infringement, or
the absence of latent or other defects, accuracy, or the present or
absence of errors, whether or not discoverable, all to the greatest
extent permissible under applicable law.
3. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any persons Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the Work.
4. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
http://creativecommons.org/publicdomain/zero/1.0/.

View File

@@ -0,0 +1,86 @@
# PostCSS Font Format [<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-font-format-keywords.svg" height="20">][npm-url]
[<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/font-format-keywords.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]
[PostCSS Font Format Keywords] lets you specify font formats as keywords, following the [CSS Fonts] specification.
```pcss
@font-face {
src: url(file.woff2) format(woff2);
}
/* becomes */
@font-face {
src: url(file.woff2) format("woff2");
}
```
_See prior work by [valtlai](https://github.com/valtlai) here [postcss-font-format-keywords](https://github.com/valtlai/postcss-font-format-keywords)
To ensure long term maintenance and to provide the needed features this plugin was recreated based on valtlai's work._
## Usage
Add [PostCSS Font Format Keywords] to your project:
```bash
npm install postcss @csstools/postcss-font-format-keywords --save-dev
```
Use it as a [PostCSS] plugin:
```js
const postcss = require('postcss');
const postcssFontFormatKeywords = require('@csstools/postcss-font-format-keywords');
postcss([
postcssFontFormatKeywords(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```
[PostCSS Font Format Keywords] runs in all Node environments, with special
instructions for:
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- | --- |
## Options
### preserve
The `preserve` option determines whether the original source
is preserved. By default, it is not preserved.
```js
postcssFontFormatKeywords({ preserve: true })
```
```pcss
@font-face {
src: url(file.woff2) format(woff2);
}
/* becomes */
@font-face {
src: url(file.woff2) format("woff2");
src: url(file.woff2) format(woff2);
}
```
[postcss]: https://github.com/postcss/postcss
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
[css-url]: https://cssdb.org/#font-format-keywords
[discord]: https://discord.gg/bUadyRwkJS
[npm-url]: https://www.npmjs.com/package/@csstools/postcss-font-format-keywords
[CSS Fonts]: https://www.w3.org/TR/css-fonts-4/#font-format-values
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
[PostCSS]: https://github.com/postcss/postcss
[PostCSS Loader]: https://github.com/postcss/postcss-loader
[PostCSS Font Format Keywords]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-font-format-keywords

View File

@@ -0,0 +1 @@
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=e(require("postcss-value-parser"));const o=["woff","truetype","opentype","woff2","embedded-opentype","collection","svg"],r=e=>{const r="preserve"in Object(e)&&Boolean(e.preserve);return{postcssPlugin:"postcss-font-format-keywords",AtRule(e){"font-face"===e.name.toLowerCase()&&e.walkDecls((e=>{if("src"!==e.prop.toLowerCase())return;if(!e.value.toLowerCase().includes("format("))return;const s=t.default(e.value);s.walk((e=>{"function"===e.type&&"format"===e.value.toLowerCase()&&e.nodes.forEach((e=>{"word"===e.type&&o.includes(e.value.toLowerCase())&&(e.value=t.default.stringify({type:"string",value:e.value,quote:'"'}))}))})),s.toString()!==e.value&&(e.cloneBefore({value:s.toString()}),r||e.remove())}))}}};r.postcss=!0,module.exports=r;

View File

@@ -0,0 +1,5 @@
import type { PluginCreator } from 'postcss';
declare const creator: PluginCreator<{
preserve: boolean;
}>;
export default creator;

View File

@@ -0,0 +1 @@
import e from"postcss-value-parser";const o=["woff","truetype","opentype","woff2","embedded-opentype","collection","svg"],t=t=>{const r="preserve"in Object(t)&&Boolean(t.preserve);return{postcssPlugin:"postcss-font-format-keywords",AtRule(t){"font-face"===t.name.toLowerCase()&&t.walkDecls((t=>{if("src"!==t.prop.toLowerCase())return;if(!t.value.toLowerCase().includes("format("))return;const s=e(t.value);s.walk((t=>{"function"===t.type&&"format"===t.value.toLowerCase()&&t.nodes.forEach((t=>{"word"===t.type&&o.includes(t.value.toLowerCase())&&(t.value=e.stringify({type:"string",value:t.value,quote:'"'}))}))})),s.toString()!==t.value&&(t.cloneBefore({value:s.toString()}),r||t.remove())}))}}};t.postcss=!0;export{t as default};

View File

@@ -0,0 +1,73 @@
{
"name": "@csstools/postcss-font-format-keywords",
"description": "Use unquoted format on @font-face CSS definitions.",
"version": "1.0.1",
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
"license": "CC0-1.0",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/csstools"
},
"engines": {
"node": "^12 || ^14 || >=16"
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
}
},
"files": [
"CHANGELOG.md",
"LICENSE.md",
"README.md",
"dist"
],
"dependencies": {
"postcss-value-parser": "^4.2.0"
},
"peerDependencies": {
"postcss": "^8.2"
},
"scripts": {
"build": "rollup -c ../../rollup/default.js",
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"",
"docs": "node ../../.github/bin/generate-docs/install.mjs",
"lint": "npm run lint:eslint && npm run lint:package-json",
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:package-json": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run clean && npm run build && npm run test",
"test": "node .tape.mjs && npm run test:exports",
"test:exports": "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-font-format-keywords#readme",
"repository": {
"type": "git",
"url": "https://github.com/csstools/postcss-plugins.git",
"directory": "plugins/postcss-font-format-keywords"
},
"keywords": [
"css",
"embedded-opentype",
"font",
"font-format-keywords",
"format",
"opentype",
"postcss-plugin",
"truetype",
"woff",
"woff2"
],
"csstools": {
"exportName": "postcssFontFormatKeywords",
"humanReadableName": "PostCSS Font Format Keywords"
},
"volta": {
"extends": "../../package.json"
}
}

View File

@@ -0,0 +1,13 @@
# Changes to PostCSS HWB Function
### 1.0.2 (July 8, 2022)
- Fix case insensitive matching.
### 1.0.1 (May 18, 2022)
- Fix grayscale conversions.
### 1.0.0 (January 22, 2022)
- Initial version

View File

@@ -0,0 +1,176 @@
# Installing PostCSS HWB Function
[PostCSS HWB Function] runs in all Node environments, with special instructions for:
| [Node](#node) | [PostCSS CLI](#postcss-cli) | [Webpack](#webpack) | [Create React App](#create-react-app) | [Gulp](#gulp) | [Grunt](#grunt) |
| --- | --- | --- | --- | --- | --- |
## Node
Add [PostCSS HWB Function] to your project:
```bash
npm install postcss @csstools/postcss-hwb-function --save-dev
```
Use it as a [PostCSS] plugin:
```js
const postcss = require('postcss');
const postcssHWBFunction = require('@csstools/postcss-hwb-function');
postcss([
postcssHWBFunction(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```
## PostCSS CLI
Add [PostCSS CLI] to your project:
```bash
npm install postcss-cli @csstools/postcss-hwb-function --save-dev
```
Use [PostCSS HWB Function] in your `postcss.config.js` configuration file:
```js
const postcssHWBFunction = require('@csstools/postcss-hwb-function');
module.exports = {
plugins: [
postcssHWBFunction(/* pluginOptions */)
]
}
```
## Webpack
_Webpack version 5_
Add [PostCSS Loader] to your project:
```bash
npm install postcss-loader @csstools/postcss-hwb-function --save-dev
```
Use [PostCSS HWB Function] in your Webpack configuration:
```js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: [
"style-loader",
{
loader: "css-loader",
options: { importLoaders: 1 },
},
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [
[
"@csstools/postcss-hwb-function",
{
// Options
},
],
],
},
},
},
],
},
],
},
};
```
## Create React App
Add [React App Rewired] and [React App Rewire PostCSS] to your project:
```bash
npm install react-app-rewired react-app-rewire-postcss @csstools/postcss-hwb-function --save-dev
```
Use [React App Rewire PostCSS] and [PostCSS HWB Function] in your
`config-overrides.js` file:
```js
const reactAppRewirePostcss = require('react-app-rewire-postcss');
const postcssHWBFunction = require('@csstools/postcss-hwb-function');
module.exports = config => reactAppRewirePostcss(config, {
plugins: () => [
postcssHWBFunction(/* pluginOptions */)
]
});
```
## Gulp
Add [Gulp PostCSS] to your project:
```bash
npm install gulp-postcss @csstools/postcss-hwb-function --save-dev
```
Use [PostCSS HWB Function] in your Gulpfile:
```js
const postcss = require('gulp-postcss');
const postcssHWBFunction = require('@csstools/postcss-hwb-function');
gulp.task('css', function () {
var plugins = [
postcssHWBFunction(/* pluginOptions */)
];
return gulp.src('./src/*.css')
.pipe(postcss(plugins))
.pipe(gulp.dest('.'));
});
```
## Grunt
Add [Grunt PostCSS] to your project:
```bash
npm install grunt-postcss @csstools/postcss-hwb-function --save-dev
```
Use [PostCSS HWB Function] in your Gruntfile:
```js
const postcssHWBFunction = require('@csstools/postcss-hwb-function');
grunt.loadNpmTasks('grunt-postcss');
grunt.initConfig({
postcss: {
options: {
processors: [
postcssHWBFunction(/* pluginOptions */)
]
},
dist: {
src: '*.css'
}
}
});
```
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
[PostCSS]: https://github.com/postcss/postcss
[PostCSS CLI]: https://github.com/postcss/postcss-cli
[PostCSS Loader]: https://github.com/postcss/postcss-loader
[PostCSS HWB Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-hwb-function
[React App Rewire PostCSS]: https://github.com/csstools/react-app-rewire-postcss
[React App Rewired]: https://github.com/timarney/react-app-rewired

View File

@@ -0,0 +1,108 @@
# CC0 1.0 Universal
## Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an “owner”) of an original work of
authorship and/or a database (each, a “Work”).
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific works
(“Commons”) that the public can reliably and without fear of later claims of
infringement build upon, modify, incorporate in other works, reuse and
redistribute as freely as possible in any form whatsoever and for any purposes,
including without limitation commercial purposes. These owners may contribute
to the Commons to promote the ideal of a free culture and the further
production of creative, cultural and scientific works, or to gain reputation or
greater distribution for their Work in part through the use and efforts of
others.
For these and/or other purposes and motivations, and without any expectation of
additional consideration or compensation, the person associating CC0 with a
Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights (“Copyright and
Related Rights”). Copyright and Related Rights include, but are not limited
to, the following:
1. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a persons image or likeness
depicted in a Work;
4. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(i), below;
5. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
6. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
7. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations
thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmers Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
makes the Waiver for the benefit of each member of the public at large and
to the detriment of Affirmers heirs and successors, fully intending that
such Waiver shall not be subject to revocation, rescission, cancellation,
termination, or any other legal or equitable action to disrupt the quiet
enjoyment of the Work by the public as contemplated by Affirmers express
Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmers express Statement of Purpose. In addition, to the extent the
Waiver is so judged Affirmer hereby grants to each affected person a
royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmers Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “License”). The License
shall be deemed effective as of the date CC0 was applied by Affirmer to the
Work. Should any part of the License for any reason be judged legally
invalid or ineffective under applicable law, such partial invalidity or
ineffectiveness shall not invalidate the remainder of the License, and in
such case Affirmer hereby affirms that he or she will not (i) exercise any
of his or her remaining Copyright and Related Rights in the Work or (ii)
assert any associated claims and causes of action with respect to the Work,
in either case contrary to Affirmers express Statement of Purpose.
4. Limitations and Disclaimers.
1. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
2. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or
otherwise, including without limitation warranties of title,
merchantability, fitness for a particular purpose, non infringement, or
the absence of latent or other defects, accuracy, or the present or
absence of errors, whether or not discoverable, all to the greatest
extent permissible under applicable law.
3. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any persons Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the Work.
4. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
http://creativecommons.org/publicdomain/zero/1.0/.

View File

@@ -0,0 +1,88 @@
# PostCSS HWB Function [<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-hwb-function.svg" height="20">][npm-url]
[<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/hwb-function.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]
[PostCSS HWB Function] lets you use `hwb` color functions in
CSS, following the [CSS Color] specification.
```pcss
a {
color: hwb(194 0% 0%);
color: hwb(194 0% 0% / .5);
}
/* becomes */
a {
color: rgb(0, 195, 255);
color: rgba(0, 195, 255, .5);
}
```
## Usage
Add [PostCSS HWB Function] to your project:
```bash
npm install postcss @csstools/postcss-hwb-function --save-dev
```
Use it as a [PostCSS] plugin:
```js
const postcss = require('postcss');
const postcssHWBFunction = require('@csstools/postcss-hwb-function');
postcss([
postcssHWBFunction(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```
[PostCSS HWB Function] runs in all Node environments, with special
instructions for:
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- | --- |
## Options
### preserve
The `preserve` option determines whether the original functional color notation
is preserved. By default, it is not preserved.
```js
postcssHWBFunction({ preserve: true })
```
```pcss
a {
color: hwb(194 0% 0%);
color: hwb(194 0% 0% / .5);
}
/* becomes */
a {
color: rgb(0, 195, 255);
color: hwb(194 0% 0%);
color: rgba(0, 195, 255, .5);
color: hwb(194 0% 0% / .5);
}
```
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
[css-url]: https://cssdb.org/#hwb-function
[discord]: https://discord.gg/bUadyRwkJS
[npm-url]: https://www.npmjs.com/package/@csstools/postcss-hwb-function
[CSS Color]: https://drafts.csswg.org/css-color/#the-hwb-notation
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
[PostCSS]: https://github.com/postcss/postcss
[PostCSS Loader]: https://github.com/postcss/postcss-loader
[PostCSS HWB Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-hwb-function

View File

@@ -0,0 +1,2 @@
import type { Node } from 'postcss';
export declare function hasSupportsAtRuleAncestor(node: Node): boolean;

View File

@@ -0,0 +1,3 @@
declare type color = [number, number, number];
export declare function hwbToRgb(hwb: color): color;
export {};

View File

@@ -0,0 +1 @@
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=e(require("postcss-value-parser"));function n(e){const t=e[0];let n=e[1],r=e[2];if(n/=100,r/=100,n+r>=1){const e=n/(n+r);return[e,e,e].map((e=>Math.round(255*e)))}const u=function(e){let t=e[0],n=e[1],r=e[2];t%=360,t<0&&(t+=360);function u(e){const u=(e+t/30)%12,o=n*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(u-3,9-u,1))}return n/=100,r/=100,[u(0),u(8),u(4)]}([t,100,50]);for(let e=0;e<3;e++)u[e]*=1-n-r,u[e]+=n;return u.map((e=>Math.round(255*e)))}function r(e){const r=e.nodes.slice().filter((e=>"comment"!==e.type&&"space"!==e.type)),s=function(e){if(!function(e){if(!e||"word"!==e.type)return!1;if(!i(e))return!1;const n=t.default.unit(e.value);if(!n)return!1;const r=n.unit.toLowerCase();return!!n.number&&("deg"===r||"grad"===r||"rad"===r||"turn"===r||""===r)}(e[0]))return null;if(!u(e[1]))return null;if(!u(e[2]))return null;const n={h:t.default.unit(e[0].value),hNode:e[0],w:t.default.unit(e[1].value),wNode:e[1],b:t.default.unit(e[2].value),bNode:e[2]};if(function(e){switch(e.unit.toLowerCase()){case"deg":return void(e.unit="");case"rad":return e.unit="",void(e.number=(180*parseFloat(e.number)/Math.PI).toString());case"grad":return e.unit="",void(e.number=(.9*parseFloat(e.number)).toString());case"turn":e.unit="",e.number=(360*parseFloat(e.number)).toString()}}(n.h),""!==n.h.unit)return null;a(n.w),a(n.b),function(e){return e&&"div"===e.type&&"/"===e.value}(e[3])&&(n.slash=e[3]);(u(e[4])||function(e){return e&&"function"===e.type&&"calc"===e.value.toLowerCase()}(e[4])||function(e){return e&&"function"===e.type&&"var"===e.value.toLowerCase()}(e[4]))&&(n.alpha=e[4]);return n}(r);if(!s)return;if(r.length>3&&(!s.slash||!s.alpha))return;e.value="rgb",function(e,n,r){if(!n||!r)return;if(e.value="rgba",n.value=",",n.before="",!function(e){if(!e||"word"!==e.type)return!1;if(!i(e))return!1;const n=t.default.unit(e.value);if(!n)return!1;return!!n.number}(r))return;const u=t.default.unit(r.value);if(!u)return;"%"===u.unit&&(u.number=String(parseFloat(u.number)/100),r.value=String(u.number))}(e,s.slash,s.alpha);const[l,c,f]=[(d=s).hNode,d.wNode,d.bNode];var d;const[p,v,b]=function(e){return[e.h,e.w,e.b]}(s),h=n([p.number,v.number,b.number].map((e=>parseFloat(e))));e.nodes.splice(e.nodes.indexOf(l)+1,0,{sourceIndex:0,sourceEndIndex:1,value:",",type:"div",before:"",after:""}),e.nodes.splice(e.nodes.indexOf(c)+1,0,{sourceIndex:0,sourceEndIndex:1,value:",",type:"div",before:"",after:""}),o(e.nodes,l,{...l,value:String(h[0])}),o(e.nodes,c,{...c,value:String(h[1])}),o(e.nodes,f,{...f,value:String(h[2])})}function u(e){if(!e||"word"!==e.type)return!1;if(!i(e))return!1;const n=t.default.unit(e.value);return!!n&&("%"===n.unit||""===n.unit)}function o(e,t,n){const r=e.indexOf(t);e[r]=n}function a(e){if("%"!==e.unit)return e.unit="%",void(e.number=(100*parseFloat(e.number)).toString())}function i(e){if(!e||!e.value)return!1;try{return!1!==t.default.unit(e.value)}catch(e){return!1}}const s=e=>{const n="preserve"in Object(e)&&Boolean(e.preserve);return{postcssPlugin:"postcss-hwb-function",Declaration:(e,{result:u,postcss:o})=>{if(n&&function(e){let t=e.parent;for(;t;)if("atrule"===t.type){if("supports"===t.name.toLowerCase()&&-1!==t.params.toLowerCase().indexOf("(color: hwb(0% 0 0))"))return!0;t=t.parent}else t=t.parent;return!1}(e))return;const a=e.value;if(!a.toLowerCase().includes("hwb"))return;const i=function(e,n,u){let o;try{o=t.default(e)}catch(t){n.warn(u,`Failed to parse value '${e}' as a hwb function. Leaving the original value intact.`)}if(void 0===o)return;o.walk((e=>{e.type&&"function"===e.type&&"hwb"===e.value.toLowerCase()&&r(e)}));const a=String(o);if(a===e)return;return a}(a,e,u);if(void 0!==i)if(e.variable&&n){const t=e.parent,n=o.atRule({name:"supports",params:"(color: hwb(0% 0 0))",source:e.source}),r=t.clone();r.removeAll(),r.append(e.clone()),n.append(r),function(e,t,n){let r=t,u=t.next();for(;r&&u&&"atrule"===u.type&&"supports"===u.name.toLowerCase()&&u.params===n;)r=u,u=u.next();r.after(e)}(n,t,"(color: hwb(0% 0 0))"),e.replaceWith(e.clone({value:i}))}else n?e.cloneBefore({value:i}):e.replaceWith(e.clone({value:i}))}}};s.postcss=!0,module.exports=s;

View File

@@ -0,0 +1,6 @@
import type { PluginCreator } from 'postcss';
/** Transform hwb() functions in CSS. */
declare const postcssPlugin: PluginCreator<{
preserve: boolean;
}>;
export default postcssPlugin;

View File

@@ -0,0 +1 @@
import e from"postcss-value-parser";function n(e){const n=e[0];let t=e[1],r=e[2];if(t/=100,r/=100,t+r>=1){const e=t/(t+r);return[e,e,e].map((e=>Math.round(255*e)))}const u=function(e){let n=e[0],t=e[1],r=e[2];n%=360,n<0&&(n+=360);function u(e){const u=(e+n/30)%12,o=t*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(u-3,9-u,1))}return t/=100,r/=100,[u(0),u(8),u(4)]}([n,100,50]);for(let e=0;e<3;e++)u[e]*=1-t-r,u[e]+=t;return u.map((e=>Math.round(255*e)))}function t(t){const i=t.nodes.slice().filter((e=>"comment"!==e.type&&"space"!==e.type)),s=function(n){if(!function(n){if(!n||"word"!==n.type)return!1;if(!a(n))return!1;const t=e.unit(n.value);if(!t)return!1;const r=t.unit.toLowerCase();return!!t.number&&("deg"===r||"grad"===r||"rad"===r||"turn"===r||""===r)}(n[0]))return null;if(!r(n[1]))return null;if(!r(n[2]))return null;const t={h:e.unit(n[0].value),hNode:n[0],w:e.unit(n[1].value),wNode:n[1],b:e.unit(n[2].value),bNode:n[2]};if(function(e){switch(e.unit.toLowerCase()){case"deg":return void(e.unit="");case"rad":return e.unit="",void(e.number=(180*parseFloat(e.number)/Math.PI).toString());case"grad":return e.unit="",void(e.number=(.9*parseFloat(e.number)).toString());case"turn":e.unit="",e.number=(360*parseFloat(e.number)).toString()}}(t.h),""!==t.h.unit)return null;o(t.w),o(t.b),function(e){return e&&"div"===e.type&&"/"===e.value}(n[3])&&(t.slash=n[3]);(r(n[4])||function(e){return e&&"function"===e.type&&"calc"===e.value.toLowerCase()}(n[4])||function(e){return e&&"function"===e.type&&"var"===e.value.toLowerCase()}(n[4]))&&(t.alpha=n[4]);return t}(i);if(!s)return;if(i.length>3&&(!s.slash||!s.alpha))return;t.value="rgb",function(n,t,r){if(!t||!r)return;if(n.value="rgba",t.value=",",t.before="",!function(n){if(!n||"word"!==n.type)return!1;if(!a(n))return!1;const t=e.unit(n.value);if(!t)return!1;return!!t.number}(r))return;const u=e.unit(r.value);if(!u)return;"%"===u.unit&&(u.number=String(parseFloat(u.number)/100),r.value=String(u.number))}(t,s.slash,s.alpha);const[l,c,f]=[(p=s).hNode,p.wNode,p.bNode];var p;const[d,v,b]=function(e){return[e.h,e.w,e.b]}(s),m=n([d.number,v.number,b.number].map((e=>parseFloat(e))));t.nodes.splice(t.nodes.indexOf(l)+1,0,{sourceIndex:0,sourceEndIndex:1,value:",",type:"div",before:"",after:""}),t.nodes.splice(t.nodes.indexOf(c)+1,0,{sourceIndex:0,sourceEndIndex:1,value:",",type:"div",before:"",after:""}),u(t.nodes,l,{...l,value:String(m[0])}),u(t.nodes,c,{...c,value:String(m[1])}),u(t.nodes,f,{...f,value:String(m[2])})}function r(n){if(!n||"word"!==n.type)return!1;if(!a(n))return!1;const t=e.unit(n.value);return!!t&&("%"===t.unit||""===t.unit)}function u(e,n,t){const r=e.indexOf(n);e[r]=t}function o(e){if("%"!==e.unit)return e.unit="%",void(e.number=(100*parseFloat(e.number)).toString())}function a(n){if(!n||!n.value)return!1;try{return!1!==e.unit(n.value)}catch(e){return!1}}const i=n=>{const r="preserve"in Object(n)&&Boolean(n.preserve);return{postcssPlugin:"postcss-hwb-function",Declaration:(n,{result:u,postcss:o})=>{if(r&&function(e){let n=e.parent;for(;n;)if("atrule"===n.type){if("supports"===n.name.toLowerCase()&&-1!==n.params.toLowerCase().indexOf("(color: hwb(0% 0 0))"))return!0;n=n.parent}else n=n.parent;return!1}(n))return;const a=n.value;if(!a.toLowerCase().includes("hwb"))return;const i=function(n,r,u){let o;try{o=e(n)}catch(e){r.warn(u,`Failed to parse value '${n}' as a hwb function. Leaving the original value intact.`)}if(void 0===o)return;o.walk((e=>{e.type&&"function"===e.type&&"hwb"===e.value.toLowerCase()&&t(e)}));const a=String(o);if(a===n)return;return a}(a,n,u);if(void 0!==i)if(n.variable&&r){const e=n.parent,t=o.atRule({name:"supports",params:"(color: hwb(0% 0 0))",source:n.source}),r=e.clone();r.removeAll(),r.append(n.clone()),t.append(r),function(e,n,t){let r=n,u=n.next();for(;r&&u&&"atrule"===u.type&&"supports"===u.name.toLowerCase()&&u.params===t;)r=u,u=u.next();r.after(e)}(t,e,"(color: hwb(0% 0 0))"),n.replaceWith(n.clone({value:i}))}else r?n.cloneBefore({value:i}):n.replaceWith(n.clone({value:i}))}}};i.postcss=!0;export{i as default};

View File

@@ -0,0 +1,2 @@
import type { FunctionNode } from 'postcss-value-parser';
export declare function onCSSFunctionSRgb(node: FunctionNode): void;

View File

@@ -0,0 +1,81 @@
{
"name": "@csstools/postcss-hwb-function",
"description": "Use hwb() color functions in CSS",
"version": "1.0.2",
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
"license": "CC0-1.0",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/csstools"
},
"engines": {
"node": "^12 || ^14 || >=16"
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
}
},
"files": [
"CHANGELOG.md",
"INSTALL.md",
"LICENSE.md",
"README.md",
"dist"
],
"dependencies": {
"postcss-value-parser": "^4.2.0"
},
"peerDependencies": {
"postcss": "^8.2"
},
"scripts": {
"build": "rollup -c ../../rollup/default.js",
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"",
"docs": "node ../../.github/bin/generate-docs/install.mjs",
"lint": "npm run lint:eslint && npm run lint:package-json",
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:package-json": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run clean && npm run build && npm run test",
"test": "node .tape.mjs && npm run test:exports",
"test:exports": "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-hwb-function#readme",
"repository": {
"type": "git",
"url": "https://github.com/csstools/postcss-plugins.git",
"directory": "plugins/postcss-hwb-function"
},
"bugs": "https://github.com/csstools/postcss-plugins/issues",
"keywords": [
"color",
"colors",
"comma",
"css",
"design",
"functional",
"hsl",
"hsla",
"hwb",
"notation",
"postcss",
"postcss-plugin",
"rgb",
"rgba",
"space",
"syntax"
],
"csstools": {
"exportName": "postcssHWBFunction",
"humanReadableName": "PostCSS HWB Function"
},
"volta": {
"extends": "../../package.json"
}
}

View File

@@ -0,0 +1,9 @@
# Changes to PostCSS IC Unit
### 1.0.1 (July 8, 2022)
- Fix case insensitive matching.
### 1.0.0 (February 15, 2022)
- Initial version

View File

@@ -0,0 +1,108 @@
# CC0 1.0 Universal
## Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an “owner”) of an original work of
authorship and/or a database (each, a “Work”).
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific works
(“Commons”) that the public can reliably and without fear of later claims of
infringement build upon, modify, incorporate in other works, reuse and
redistribute as freely as possible in any form whatsoever and for any purposes,
including without limitation commercial purposes. These owners may contribute
to the Commons to promote the ideal of a free culture and the further
production of creative, cultural and scientific works, or to gain reputation or
greater distribution for their Work in part through the use and efforts of
others.
For these and/or other purposes and motivations, and without any expectation of
additional consideration or compensation, the person associating CC0 with a
Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights (“Copyright and
Related Rights”). Copyright and Related Rights include, but are not limited
to, the following:
1. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a persons image or likeness
depicted in a Work;
4. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(i), below;
5. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
6. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
7. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations
thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmers Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
makes the Waiver for the benefit of each member of the public at large and
to the detriment of Affirmers heirs and successors, fully intending that
such Waiver shall not be subject to revocation, rescission, cancellation,
termination, or any other legal or equitable action to disrupt the quiet
enjoyment of the Work by the public as contemplated by Affirmers express
Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmers express Statement of Purpose. In addition, to the extent the
Waiver is so judged Affirmer hereby grants to each affected person a
royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmers Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “License”). The License
shall be deemed effective as of the date CC0 was applied by Affirmer to the
Work. Should any part of the License for any reason be judged legally
invalid or ineffective under applicable law, such partial invalidity or
ineffectiveness shall not invalidate the remainder of the License, and in
such case Affirmer hereby affirms that he or she will not (i) exercise any
of his or her remaining Copyright and Related Rights in the Work or (ii)
assert any associated claims and causes of action with respect to the Work,
in either case contrary to Affirmers express Statement of Purpose.
4. Limitations and Disclaimers.
1. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
2. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or
otherwise, including without limitation warranties of title,
merchantability, fitness for a particular purpose, non infringement, or
the absence of latent or other defects, accuracy, or the present or
absence of errors, whether or not discoverable, all to the greatest
extent permissible under applicable law.
3. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any persons Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the Work.
4. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
http://creativecommons.org/publicdomain/zero/1.0/.

View File

@@ -0,0 +1,94 @@
# PostCSS IC Unit [<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-ic-unit.svg" height="20">][npm-url]
[<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/ic-unit.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]
[PostCSS IC Unit] lets you use the ic length unit, following the [CSS Values and Units Module] specification.
```pcss
p {
text-indent: 2ic;
}
.bubble {
width: calc(8ic + 20px);
}
/* becomes */
p {
text-indent: 2em;
}
.bubble {
width: calc(8em + 20px);
}
```
_See prior work by [JLHwung](https://github.com/JLHwung) here [postcss-ic-unit](https://github.com/JLHwung/postcss-ic-unit)
To ensure long term maintenance and to provide the needed features this plugin was recreated based on JLHwung's work._
## Usage
Add [PostCSS IC Unit] to your project:
```bash
npm install postcss @csstools/postcss-ic-unit --save-dev
```
Use it as a [PostCSS] plugin:
```js
const postcss = require('postcss');
const postcssIcUnit = require('@csstools/postcss-ic-unit');
postcss([
postcssIcUnit(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```
[PostCSS IC Unit] runs in all Node environments, with special
instructions for:
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- | --- |
## Options
### preserve
The `preserve` option determines whether the original source
is preserved. By default, it is not preserved.
```js
postcssIcUnit({ preserve: true })
```
```pcss
p {
text-indent: 2ic;
}
/* becomes */
p {
text-indent: 2em;
text-indent: 2ic;
}
```
[postcss]: https://github.com/postcss/postcss
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
[css-url]: https://cssdb.org/#ic-unit
[discord]: https://discord.gg/bUadyRwkJS
[npm-url]: https://www.npmjs.com/package/@csstools/postcss-ic-unit
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
[PostCSS]: https://github.com/postcss/postcss
[PostCSS Loader]: https://github.com/postcss/postcss-loader
[CSS Values and Units Module]: https://www.w3.org/TR/css-values-4/#ic
[PostCSS IC Unit]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-ic-unit

View File

@@ -0,0 +1,2 @@
import type { Node } from 'postcss';
export declare function hasSupportsAtRuleAncestor(node: Node): boolean;

View File

@@ -0,0 +1 @@
"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),s=require("postcss-value-parser");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e),o=t(s);const u=e=>({postcssPlugin:"postcss-ic-unit",Declaration(s){if(!s.value.toLowerCase().includes("ic"))return;if(function(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()&&/\(font-size: \d+ic\)/.test(s.params.toLowerCase()))return!0;s=s.parent}else s=s.parent;return!1}(s))return;const t=o.default(s.value);t.walk((e=>{if(!e.type||"word"!==e.type)return;const s=o.default.unit(e.value);s&&"ic"===s.unit.toLowerCase()&&(e.value=`${s.number}em`)}));const r=String(t);r!==s.value&&(s.cloneBefore({value:r}),e.preserve||s.remove())}});u.postcss=!0;const n=e=>{const s=Object.assign({preserve:!1,enableProgressiveCustomProperties:!0},e);return s.enableProgressiveCustomProperties&&s.preserve?{postcssPlugin:"postcss-ic-unit",plugins:[r.default(),u(s)]}:u(s)};n.postcss=!0,module.exports=n;

View File

@@ -0,0 +1,7 @@
import type { PluginCreator } from 'postcss';
declare type pluginOptions = {
preserve?: boolean;
enableProgressiveCustomProperties?: boolean;
};
declare const postcssPlugin: PluginCreator<pluginOptions>;
export default postcssPlugin;

View File

@@ -0,0 +1 @@
import e from"@csstools/postcss-progressive-custom-properties";import s from"postcss-value-parser";const t=e=>({postcssPlugin:"postcss-ic-unit",Declaration(t){if(!t.value.toLowerCase().includes("ic"))return;if(function(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()&&/\(font-size: \d+ic\)/.test(s.params.toLowerCase()))return!0;s=s.parent}else s=s.parent;return!1}(t))return;const r=s(t.value);r.walk((e=>{if(!e.type||"word"!==e.type)return;const t=s.unit(e.value);t&&"ic"===t.unit.toLowerCase()&&(e.value=`${t.number}em`)}));const o=String(r);o!==t.value&&(t.cloneBefore({value:o}),e.preserve||t.remove())}});t.postcss=!0;const r=s=>{const r=Object.assign({preserve:!1,enableProgressiveCustomProperties:!0},s);return r.enableProgressiveCustomProperties&&r.preserve?{postcssPlugin:"postcss-ic-unit",plugins:[e(),t(r)]}:t(r)};r.postcss=!0;export{r as default};

View File

@@ -0,0 +1,72 @@
{
"name": "@csstools/postcss-ic-unit",
"description": "Use the ic length unit",
"version": "1.0.1",
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
"license": "CC0-1.0",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/csstools"
},
"engines": {
"node": "^12 || ^14 || >=16"
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
}
},
"files": [
"CHANGELOG.md",
"LICENSE.md",
"README.md",
"dist"
],
"dependencies": {
"@csstools/postcss-progressive-custom-properties": "^1.1.0",
"postcss-value-parser": "^4.2.0"
},
"peerDependencies": {
"postcss": "^8.2"
},
"scripts": {
"build": "rollup -c ../../rollup/default.js",
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"",
"docs": "node ../../.github/bin/generate-docs/install.mjs",
"lint": "npm run lint:eslint && npm run lint:package-json",
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:package-json": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run clean && npm run build && npm run test",
"test": "node .tape.mjs && npm run test:exports",
"test:exports": "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-ic-unit#readme",
"repository": {
"type": "git",
"url": "https://github.com/csstools/postcss-plugins.git",
"directory": "plugins/postcss-ic-unit"
},
"bugs": "https://github.com/csstools/postcss-plugins/issues",
"keywords": [
"CJK water ideograph",
"css",
"glyph",
"ic",
"length",
"postcss-plugin",
"values"
],
"csstools": {
"exportName": "postcssIcUnit",
"humanReadableName": "PostCSS IC Unit"
},
"volta": {
"extends": "../../package.json"
}
}

View File

@@ -0,0 +1,48 @@
# Changes to PostCSS Is Pseudo Class
### 2.0.7 (July 8, 2022)
- Fix case insensitive matching.
### 2.0.6 (June 23, 2022)
- Fix selector order with any pseudo element.
- Fix transforming pseudo elements in `:is()`. Following the specification pseudo elements are invalid and we now transform to a known invalid pseudo element.
- Add `onPseudoElement` plugin option. Set `{ onPseudoElement: 'warning' }` to receive warnings when this plugin encounters an unprocessable pseudo element.
### 2.0.5 (June 4, 2022)
- Update `@csstools/selector-specificity` (major)
### 2.0.4 (May 17, 2022)
- Fix selector order with `:before` and other pseudo elements.
### 2.0.3 (May 11, 2022)
- Use `@csstools/selector-specificity` for specificity calculations.
### 2.0.2 (April 4, 2022)
- Improved : compound selector order with pseudo elements
- Improved : selector specificity calculation.
### 2.0.1 (March 4, 2022)
- Preserve selector order as much as possible. Fixes issues where pseudo elements `::before` were moved.
### 2.0.0 (January 31, 2022)
- Remove `skip` flag in `onComplexSelectors` option.
If a complex selector is encountered that has no known equivalent, it will always be skipped and preserved now.
The previous behavior was to remove `:is()` even if that broke the selector.
### 1.0.1 (January 17, 2022)
- Fix selector order
### 1.0.0 (January 13, 2022)
- initial release

View File

@@ -0,0 +1,108 @@
# CC0 1.0 Universal
## Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an “owner”) of an original work of
authorship and/or a database (each, a “Work”).
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific works
(“Commons”) that the public can reliably and without fear of later claims of
infringement build upon, modify, incorporate in other works, reuse and
redistribute as freely as possible in any form whatsoever and for any purposes,
including without limitation commercial purposes. These owners may contribute
to the Commons to promote the ideal of a free culture and the further
production of creative, cultural and scientific works, or to gain reputation or
greater distribution for their Work in part through the use and efforts of
others.
For these and/or other purposes and motivations, and without any expectation of
additional consideration or compensation, the person associating CC0 with a
Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights (“Copyright and
Related Rights”). Copyright and Related Rights include, but are not limited
to, the following:
1. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a persons image or likeness
depicted in a Work;
4. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(i), below;
5. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
6. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
7. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations
thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmers Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
makes the Waiver for the benefit of each member of the public at large and
to the detriment of Affirmers heirs and successors, fully intending that
such Waiver shall not be subject to revocation, rescission, cancellation,
termination, or any other legal or equitable action to disrupt the quiet
enjoyment of the Work by the public as contemplated by Affirmers express
Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmers express Statement of Purpose. In addition, to the extent the
Waiver is so judged Affirmer hereby grants to each affected person a
royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmers Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “License”). The License
shall be deemed effective as of the date CC0 was applied by Affirmer to the
Work. Should any part of the License for any reason be judged legally
invalid or ineffective under applicable law, such partial invalidity or
ineffectiveness shall not invalidate the remainder of the License, and in
such case Affirmer hereby affirms that he or she will not (i) exercise any
of his or her remaining Copyright and Related Rights in the Work or (ii)
assert any associated claims and causes of action with respect to the Work,
in either case contrary to Affirmers express Statement of Purpose.
4. Limitations and Disclaimers.
1. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
2. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or
otherwise, including without limitation warranties of title,
merchantability, fitness for a particular purpose, non infringement, or
the absence of latent or other defects, accuracy, or the present or
absence of errors, whether or not discoverable, all to the greatest
extent permissible under applicable law.
3. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any persons Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the Work.
4. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
http://creativecommons.org/publicdomain/zero/1.0/.

View File

@@ -0,0 +1,251 @@
# PostCSS Is Pseudo [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS" width="90" height="90" align="right">][postcss]
[![NPM Version][npm-img]][npm-url]
[![CSS Standard Status][css-img]][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]
[PostCSS Is Pseudo Class] lets you use the `:is` pseudo class function, following the
[CSS Selector] specification.
```pcss
:is(input, button):is(:hover, :focus) {
order: 1;
}
```
Becomes :
```pcss
input:hover {
order: 1;
}
input:focus {
order: 1;
}
button:hover {
order: 1;
}
button:focus {
order: 1;
}
```
## Usage
Add [PostCSS Is Pseudo Class] to your project:
```bash
npm install @csstools/postcss-is-pseudo-class --save-dev
```
Use [PostCSS Is Pseudo Class] as a [PostCSS] plugin:
```js
import postcss from 'postcss';
import postcssIsPseudoClass from '@csstools/postcss-is-pseudo-class';
postcss([
postcssIsPseudoClass(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```
[PostCSS Is Pseudo Class] runs in all Node environments, with special instructions for:
| [Node](INSTALL.md#node) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- |
## Options
### preserve
The `preserve` option determines whether the original notation
is preserved. By default, it is not preserved.
```js
postcss([
postcssIsPseudoClass({ preserve: true })
]).process(YOUR_CSS /*, processOptions */);
```
```pcss
:is(input, button):is(:hover, :focus) {
order: 1;
}
```
Becomes :
```pcss
input:hover {
order: 1;
}
input:focus {
order: 1;
}
button:hover {
order: 1;
}
button:focus {
order: 1;
}
:is(input, button):is(:hover, :focus) {
order: 1;
}
```
### specificityMatchingName
The `specificityMatchingName` option allows you to change to selector used to adjust specificity.
The default value is `does-not-exist`.
If this is an actual class, id or tag name in your code, you will need to set a different option here.
See how `:not` is used to modify [specificity](#specificity).
```js
postcss([
postcssIsPseudoClass({ specificityMatchingName: 'something-random' })
]).process(YOUR_CSS /*, processOptions */);
```
```pcss
:is(.button, button):hover {
order: 7;
}
```
Becomes :
```pcss
.button:hover {
order: 7;
}
button:not(.something-random):hover {
order: 7;
}
```
### onComplexSelector
Warn on complex selectors in `:is` pseudo class functions.
```js
postcss([
postcssIsPseudoClass({ onComplexSelector: 'warning' })
]).process(YOUR_CSS /*, processOptions */);
```
### onPseudoElement
Warn when pseudo elements are used in `:is` pseudo class functions.
⚠️ Pseudo elements are always invalid and will be transformed to `::-csstools-invalid-<pseudo-name>`.
```js
postcss([
postcssIsPseudoClass({ onPseudoElement: 'warning' })
]).process(YOUR_CSS /*, processOptions */);
```
```css
:is(::after):hover {
order: 1.0;
}
/* becomes */
::-csstools-invalid-after:hover {
order: 1.0;
}
```
## ⚠️ Known shortcomings
### Specificity
`:is` takes the specificity of the most specific list item.
We can increase specificity with `:not` selectors, but we can't decrease it.
Converted selectors are ensured to have the same specificity as `:is` for the most important bit.
Less important bits can have higher specificity that `:is`.
Before :
[specificity: 0, 2, 0](https://polypane.app/css-specificity-calculator/#selector=%3Ais(%3Ahover%2C%20%3Afocus)%3Ais(.button%2C%20button))
```pcss
:is(:hover, :focus):is(.button, button) {
order: 7;
}
```
After :
```pcss
/* specificity: [0, 2, 0] */
.button:hover {
order: 7;
}
/* specificity: [0, 2, 1] */
/* last bit is higher than it should be, but middle bit matches */
button:not(.does-not-exist):hover {
order: 7;
}
/* specificity: [0, 2, 0] */
.button:focus {
order: 7;
}
/* specificity: [0, 2, 1] */
/* last bit is higher than it should be, but middle bit matches */
button:not(.does-not-exist):focus {
order: 7;
}
```
### Complex selectors
Before :
```pcss
:is(.alpha > .beta) ~ :is(:focus > .beta) {
order: 2;
}
```
After :
```pcss
.alpha > .beta ~ :focus > .beta {
order: 2;
}
```
_this is a different selector than expected as `.beta ~ :focus` matches `.beta` followed by `:focus`._<br>
_avoid these cases._<br>
_writing the selector without `:is()` is advised here_
```pcss
/* without is */
.alpha:focus > .beta ~ .beta {
order: 2;
}
```
If you have a specific pattern you can open an issue to discuss it.
We can detect and transform some cases but can't generalize them into a single solution that tackles all of them.
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
[css-img]: https://cssdb.org/images/badges/is-pseudo-class.svg
[css-url]: https://cssdb.org/#is-pseudo-class
[discord]: https://discord.gg/bUadyRwkJS
[npm-img]: https://img.shields.io/npm/v/@csstools/postcss-is-pseudo-class.svg
[npm-url]: https://www.npmjs.com/package/@csstools/postcss-is-pseudo-class
[CSS Selector]: https://www.w3.org/TR/selectors-4/#matches
[PostCSS]: https://github.com/postcss/postcss
[PostCSS Is Pseudo Class]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-is-pseudo-class

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
import type { PluginCreator } from 'postcss';
declare type pluginOptions = {
preserve?: boolean;
onComplexSelector?: 'warning';
onPseudoElement?: 'warning';
specificityMatchingName?: string;
};
declare const creator: PluginCreator<pluginOptions>;
export default creator;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
export default function complexSelectors(selectors: string[], pluginOptions: {
onComplexSelector?: 'warning';
}, warnOnComplexSelector: () => void, warnOnPseudoElements: () => void): string[];

View File

@@ -0,0 +1 @@
export declare function childAdjacentChild(selector: any): boolean;

View File

@@ -0,0 +1 @@
export declare function isInCompoundWithOneOtherElement(selector: any): boolean;

View File

@@ -0,0 +1 @@
export declare function sortCompoundSelectorsInsideComplexSelector(node: any): void;

View File

@@ -0,0 +1,3 @@
export default function splitSelectors(selectors: string[], pluginOptions: {
specificityMatchingName: string;
}, recursionDepth?: number): any[];

View File

@@ -0,0 +1,78 @@
{
"name": "@csstools/postcss-is-pseudo-class",
"description": "A pseudo-class for matching elements in a selector list",
"version": "2.0.7",
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
"license": "CC0-1.0",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/csstools"
},
"engines": {
"node": "^12 || ^14 || >=16"
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
}
},
"files": [
"CHANGELOG.md",
"LICENSE.md",
"README.md",
"dist"
],
"dependencies": {
"@csstools/selector-specificity": "^2.0.0",
"postcss-selector-parser": "^6.0.10"
},
"peerDependencies": {
"postcss": "^8.2"
},
"devDependencies": {
"puppeteer": "^15.1.1"
},
"scripts": {
"build": "rollup -c ../../rollup/default.js",
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"",
"docs": "node ../../.github/bin/generate-docs/install.mjs",
"lint": "npm run lint:eslint && npm run lint:package-json",
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:package-json": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run clean && npm run build && npm run test",
"stryker": "stryker run --logLevel error",
"test": "node .tape.mjs && npm run test:exports",
"test:browser": "node ./test/_browser.mjs",
"test:exports": "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-is-pseudo-class#readme",
"repository": {
"type": "git",
"url": "https://github.com/csstools/postcss-plugins.git",
"directory": "plugins/postcss-is-pseudo-class"
},
"bugs": "https://github.com/csstools/postcss-plugins/issues",
"keywords": [
"css",
"is",
"matches",
"polyfill",
"postcss",
"postcss-plugin",
"pseudo",
"selector"
],
"csstools": {
"exportName": "postcssIsPseudoClass",
"humanReadableName": "PostCSS Is Pseudo"
},
"volta": {
"extends": "../../package.json"
}
}

View File

@@ -0,0 +1,5 @@
# Changes to PostCSS Nested Calc
### 1.0.0 (August 15, 2022)
- Initial version

View File

@@ -0,0 +1,108 @@
# CC0 1.0 Universal
## Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an “owner”) of an original work of
authorship and/or a database (each, a “Work”).
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific works
(“Commons”) that the public can reliably and without fear of later claims of
infringement build upon, modify, incorporate in other works, reuse and
redistribute as freely as possible in any form whatsoever and for any purposes,
including without limitation commercial purposes. These owners may contribute
to the Commons to promote the ideal of a free culture and the further
production of creative, cultural and scientific works, or to gain reputation or
greater distribution for their Work in part through the use and efforts of
others.
For these and/or other purposes and motivations, and without any expectation of
additional consideration or compensation, the person associating CC0 with a
Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights (“Copyright and
Related Rights”). Copyright and Related Rights include, but are not limited
to, the following:
1. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a persons image or likeness
depicted in a Work;
4. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(i), below;
5. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
6. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
7. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations
thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmers Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
makes the Waiver for the benefit of each member of the public at large and
to the detriment of Affirmers heirs and successors, fully intending that
such Waiver shall not be subject to revocation, rescission, cancellation,
termination, or any other legal or equitable action to disrupt the quiet
enjoyment of the Work by the public as contemplated by Affirmers express
Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmers express Statement of Purpose. In addition, to the extent the
Waiver is so judged Affirmer hereby grants to each affected person a
royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmers Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “License”). The License
shall be deemed effective as of the date CC0 was applied by Affirmer to the
Work. Should any part of the License for any reason be judged legally
invalid or ineffective under applicable law, such partial invalidity or
ineffectiveness shall not invalidate the remainder of the License, and in
such case Affirmer hereby affirms that he or she will not (i) exercise any
of his or her remaining Copyright and Related Rights in the Work or (ii)
assert any associated claims and causes of action with respect to the Work,
in either case contrary to Affirmers express Statement of Purpose.
4. Limitations and Disclaimers.
1. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
2. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or
otherwise, including without limitation warranties of title,
merchantability, fitness for a particular purpose, non infringement, or
the absence of latent or other defects, accuracy, or the present or
absence of errors, whether or not discoverable, all to the greatest
extent permissible under applicable law.
3. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any persons Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the Work.
4. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
http://creativecommons.org/publicdomain/zero/1.0/.

View File

@@ -0,0 +1,78 @@
# PostCSS Nested Calc [<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-nested-calc.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/nested-calc.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]
[PostCSS Nested Calc] lets you use nested `calc()` expressions following the [CSS Values and Units 4 specification].
```pcss
.example {
order: calc(1 + calc(2 * 2));
}
/* becomes */
.example {
order: calc(1 + (2 * 2));
order: calc(1 + calc(2 * 2));
}
```
## Usage
Add [PostCSS Nested Calc] to your project:
```bash
npm install postcss @csstools/postcss-nested-calc --save-dev
```
Use it as a [PostCSS] plugin:
```js
const postcss = require('postcss');
const postcssNestedCalc = require('@csstools/postcss-nested-calc');
postcss([
postcssNestedCalc(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```
[PostCSS Nested Calc] runs in all Node environments, with special
instructions for:
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- | --- |
## Options
### preserve
The `preserve` option determines whether the original notation
is preserved. By default the original values are preserved.
```js
postcssNestedCalc({ preserve: false })
```
```pcss
.example {
order: calc(1 + calc(2 * 2));
}
/* becomes */
.example {
order: calc(1 + (2 * 2));
}
```
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
[css-url]: https://cssdb.org/#nested-calc
[discord]: https://discord.gg/bUadyRwkJS
[npm-url]: https://www.npmjs.com/package/@csstools/postcss-nested-calc
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
[PostCSS]: https://github.com/postcss/postcss
[PostCSS Loader]: https://github.com/postcss/postcss-loader
[PostCSS Nested Calc]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nested-calc
[CSS Values and Units 4 specification]: https://www.w3.org/TR/css-values/#calc-func

View File

@@ -0,0 +1 @@
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=e(require("postcss-value-parser"));const a=/calc\(/gim;const r=e=>{const r=Object.assign({preserve:!0},e);return{postcssPlugin:"postcss-nested-calc",Declaration(e,{result:l}){if((e.value.match(a)||[]).length<2)return;if(e.variable)return;const n=e.value;let s;try{s=t.default(n)}catch(t){return void e.warn(l,`Failed to parse value '${n}'. Leaving the original value intact.`)}if(void 0===s)return;t.default.walk(s.nodes,(e=>{e.type&&"function"===e.type&&"calc"===e.value.toLowerCase()&&t.default.walk(e.nodes,(e=>{if(e.type&&"function"===e.type)return"calc"===e.value.toLowerCase()&&void(e.value="")}))}),!0);const c=String(s);c!==n&&(r.preserve?e.cloneBefore({value:c}):e.replaceWith(e.clone({value:c})))}}};r.postcss=!0,module.exports=r;

View File

@@ -0,0 +1,6 @@
import type { PluginCreator } from 'postcss';
declare type pluginOptions = {
preserve?: boolean;
};
declare const creator: PluginCreator<pluginOptions>;
export default creator;

View File

@@ -0,0 +1 @@
import e from"postcss-value-parser";const t=/calc\(/gim;const a=a=>{const r=Object.assign({preserve:!0},a);return{postcssPlugin:"postcss-nested-calc",Declaration(a,{result:s}){if((a.value.match(t)||[]).length<2)return;if(a.variable)return;const n=a.value;let o;try{o=e(n)}catch(e){return void a.warn(s,`Failed to parse value '${n}'. Leaving the original value intact.`)}if(void 0===o)return;e.walk(o.nodes,(t=>{t.type&&"function"===t.type&&"calc"===t.value.toLowerCase()&&e.walk(t.nodes,(e=>{if(e.type&&"function"===e.type)return"calc"===e.value.toLowerCase()&&void(e.value="")}))}),!0);const c=String(o);c!==n&&(r.preserve?a.cloneBefore({value:c}):a.replaceWith(a.clone({value:c})))}}};a.postcss=!0;export{a as default};

View File

@@ -0,0 +1 @@
export declare function numberOfCalcOccurrences(value: string): number;

View File

@@ -0,0 +1,81 @@
{
"name": "@csstools/postcss-nested-calc",
"description": "Use nested calc() expressions in CSS",
"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": "CC0-1.0",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/csstools"
},
"engines": {
"node": "^12 || ^14 || >=16"
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
}
},
"files": [
"CHANGELOG.md",
"LICENSE.md",
"README.md",
"dist"
],
"dependencies": {
"postcss-value-parser": "^4.2.0"
},
"peerDependencies": {
"postcss": "^8.2"
},
"scripts": {
"build": "rollup -c ../../rollup/default.js",
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"",
"docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs",
"lint": "npm run lint:eslint && npm run lint:package-json",
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
"lint:package-json": "node ../../.github/bin/format-package-json.mjs",
"prepublishOnly": "npm run clean && npm run build && npm run test",
"test": "node .tape.mjs && npm run test:exports",
"test:exports": "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-nested-calc#readme",
"repository": {
"type": "git",
"url": "https://github.com/csstools/postcss-plugins.git",
"directory": "plugins/postcss-nested-calc"
},
"bugs": "https://github.com/csstools/postcss-plugins/issues",
"keywords": [
"calc",
"css",
"math",
"nested",
"postcss-plugin"
],
"csstools": {
"cssdbId": "nested-calc",
"exportName": "postcssNestedCalc",
"humanReadableName": "PostCSS Nested Calc",
"specUrl": "https://www.w3.org/TR/css-values/#calc-func"
},
"volta": {
"extends": "../../package.json"
}
}

View File

@@ -0,0 +1,9 @@
# Changes to PostCSS Normalize Display Values
### 1.0.1 (July 8, 2022)
- Fix case insensitive matching.
### 1.0.0 (January 25, 2022)
- Initial version

View File

@@ -0,0 +1,108 @@
# CC0 1.0 Universal
## Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an “owner”) of an original work of
authorship and/or a database (each, a “Work”).
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific works
(“Commons”) that the public can reliably and without fear of later claims of
infringement build upon, modify, incorporate in other works, reuse and
redistribute as freely as possible in any form whatsoever and for any purposes,
including without limitation commercial purposes. These owners may contribute
to the Commons to promote the ideal of a free culture and the further
production of creative, cultural and scientific works, or to gain reputation or
greater distribution for their Work in part through the use and efforts of
others.
For these and/or other purposes and motivations, and without any expectation of
additional consideration or compensation, the person associating CC0 with a
Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights (“Copyright and
Related Rights”). Copyright and Related Rights include, but are not limited
to, the following:
1. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a persons image or likeness
depicted in a Work;
4. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(i), below;
5. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
6. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
7. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations
thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmers Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
makes the Waiver for the benefit of each member of the public at large and
to the detriment of Affirmers heirs and successors, fully intending that
such Waiver shall not be subject to revocation, rescission, cancellation,
termination, or any other legal or equitable action to disrupt the quiet
enjoyment of the Work by the public as contemplated by Affirmers express
Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmers express Statement of Purpose. In addition, to the extent the
Waiver is so judged Affirmer hereby grants to each affected person a
royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmers Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “License”). The License
shall be deemed effective as of the date CC0 was applied by Affirmer to the
Work. Should any part of the License for any reason be judged legally
invalid or ineffective under applicable law, such partial invalidity or
ineffectiveness shall not invalidate the remainder of the License, and in
such case Affirmer hereby affirms that he or she will not (i) exercise any
of his or her remaining Copyright and Related Rights in the Work or (ii)
assert any associated claims and causes of action with respect to the Work,
in either case contrary to Affirmers express Statement of Purpose.
4. Limitations and Disclaimers.
1. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
2. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or
otherwise, including without limitation warranties of title,
merchantability, fitness for a particular purpose, non infringement, or
the absence of latent or other defects, accuracy, or the present or
absence of errors, whether or not discoverable, all to the greatest
extent permissible under applicable law.
3. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any persons Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the Work.
4. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
http://creativecommons.org/publicdomain/zero/1.0/.

View File

@@ -0,0 +1,86 @@
# PostCSS Normalize Display Values [<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-normalize-display-values.svg" height="20">][npm-url]
[<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/display-two-values.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]
[PostCSS Normalize Display Values] lets you specify definition of outer and inner displays types for an element.
```pcss
.element {
display: inline flow-root;
}
/* becomes */
.element {
display: inline-block;
display: inline flow-root;
}
```
_See prior work by [cssnano](https://github.com/cssnano) here [postcss-normalize-display-values](https://github.com/cssnano/cssnano/tree/master/packages/postcss-normalize-display-values)
To ensure long term maintenance and to provide the needed features this plugin was recreated based on cssnano's work._
## Usage
Add [PostCSS Normalize Display Values] to your project:
```bash
npm install postcss @csstools/postcss-normalize-display-values --save-dev
```
Use it as a [PostCSS] plugin:
```js
const postcss = require('postcss');
const postcssNormalizeDisplayValues = require('@csstools/postcss-normalize-display-values');
postcss([
postcssNormalizeDisplayValues(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```
[PostCSS Normalize Display Values] runs in all Node environments, with special
instructions for:
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- | --- |
## Options
### preserve
The `preserve` option determines whether the original source
is preserved. By default, it is preserved.
```js
postcssNormalizeDisplayValues({ preserve: false })
```
```pcss
.element {
display: inline flow-root;
}
/* becomes */
.element {
display: inline-block;
}
```
[postcss]: https://github.com/postcss/postcss
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
[css-url]: https://cssdb.org/#display-two-values
[discord]: https://discord.gg/bUadyRwkJS
[npm-url]: https://www.npmjs.com/package/@csstools/postcss-normalize-display-values
[CSS Fonts]: https://www.w3.org/TR/css-display-3/#the-display-properties
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
[PostCSS]: https://github.com/postcss/postcss
[PostCSS Loader]: https://github.com/postcss/postcss-loader
[PostCSS Normalize Display Values]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-normalize-display-values

View File

@@ -0,0 +1 @@
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=e(require("postcss-value-parser")),t=new Map([["block,flow","block"],["block,flow-root","flow-root"],["inline,flow","inline"],["inline,flow-root","inline-block"],["run-in,flow","run-in"],["list-item,block,flow","list-item"],["inline,flow,list-item","inline list-item"],["block,flex","flex"],["inline,flex","inline-flex"],["block,grid","grid"],["inline,grid","inline-grid"],["inline,ruby","ruby"],["block,table","table"],["inline,table","inline-table"],["table-cell,flow","table-cell"],["table-caption,flow","table-caption"],["ruby-base,flow","ruby-base"],["ruby-text,flow","ruby-text"]]);const n=e=>{const n=!("preserve"in Object(e))||Boolean(e.preserve);return{postcssPlugin:"postcss-normalize-display-values",prepare(){const e=new Map;return{Declaration(o){if("display"!==o.prop.toLowerCase())return;const i=o.value;if(!i)return;if(e.has(i))return void(o.value!==e.get(i)&&(o.cloneBefore({value:e.get(i)}),n||o.remove()));const r=function(e){const{nodes:n}=l.default(e);if(1===n.length)return e;const o=n.filter((e=>"word"===e.type)).map((e=>e.value.toLowerCase()));if(o.length<=1)return e;return t.get(o.join(","))||e}(i);e.set(i,r),o.value!==r&&(o.cloneBefore({value:r}),n||o.remove())}}}}};n.postcss=!0,module.exports=n;

Some files were not shown because too many files have changed in this diff Show More