first commit
This commit is contained in:
11
node_modules/@csstools/css-color-parser/CHANGELOG.md
generated
vendored
Normal file
11
node_modules/@csstools/css-color-parser/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# Changes to CSS Color Parser
|
||||
|
||||
### 3.0.10
|
||||
|
||||
_May 27, 2025_
|
||||
|
||||
- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`3.0.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#304) (patch)
|
||||
- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`3.0.5`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#305) (patch)
|
||||
- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.1.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#214) (patch)
|
||||
|
||||
[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md)
|
||||
20
node_modules/@csstools/css-color-parser/LICENSE.md
generated
vendored
Normal file
20
node_modules/@csstools/css-color-parser/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2022 Romain Menke, Antonio Laguna <antonio@laguna.es>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
37
node_modules/@csstools/css-color-parser/README.md
generated
vendored
Normal file
37
node_modules/@csstools/css-color-parser/README.md
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# CSS Color Parser <img src="https://cssdb.org/images/css.svg" alt="for CSS" width="90" height="90" align="right">
|
||||
|
||||
[<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/css-color-parser.svg" height="20">][npm-url]
|
||||
[<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/actions/workflows/test.yml/badge.svg?branch=main" height="20">][cli-url]
|
||||
[<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
|
||||
|
||||
## Usage
|
||||
|
||||
Add [CSS Color Parser] to your project:
|
||||
|
||||
```bash
|
||||
npm install @csstools/css-color-parser @csstools/css-parser-algorithms @csstools/css-tokenizer --save-dev
|
||||
```
|
||||
|
||||
```ts
|
||||
import { color } from '@csstools/css-color-parser';
|
||||
import { isFunctionNode, parseComponentValue } from '@csstools/css-parser-algorithms';
|
||||
import { serializeRGB } from '@csstools/css-color-parser';
|
||||
import { tokenize } from '@csstools/css-tokenizer';
|
||||
|
||||
// color() expects a parsed component value.
|
||||
const hwbComponentValue = parseComponentValue(tokenize({ css: 'hwb(10deg 10% 20%)' }));
|
||||
const colorData = color(hwbComponentValue);
|
||||
if (colorData) {
|
||||
console.log(colorData);
|
||||
|
||||
// serializeRGB() returns a component value.
|
||||
const rgbComponentValue = serializeRGB(colorData);
|
||||
console.log(rgbComponentValue.toString());
|
||||
}
|
||||
```
|
||||
|
||||
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
|
||||
[discord]: https://discord.gg/bUadyRwkJS
|
||||
[npm-url]: https://www.npmjs.com/package/@csstools/css-color-parser
|
||||
|
||||
[CSS Color Parser]: https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser
|
||||
1
node_modules/@csstools/css-color-parser/dist/index.cjs
generated
vendored
Normal file
1
node_modules/@csstools/css-color-parser/dist/index.cjs
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
164
node_modules/@csstools/css-color-parser/dist/index.d.ts
generated
vendored
Normal file
164
node_modules/@csstools/css-color-parser/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
import type { Color } from '@csstools/color-helpers';
|
||||
import type { ComponentValue } from '@csstools/css-parser-algorithms';
|
||||
import { FunctionNode } from '@csstools/css-parser-algorithms';
|
||||
|
||||
/**
|
||||
* Convert a color function to a `ColorData` object.
|
||||
*
|
||||
* @param {ComponentValue} colorNode - The color function to be converted.
|
||||
* @returns {ColorData|false} The color function as a `ColorData` object or `false` if it could not be converted.
|
||||
*/
|
||||
export declare function color(colorNode: ComponentValue): ColorData | false;
|
||||
|
||||
/**
|
||||
* A color data object.
|
||||
* It contains as much information as possible about the color and the original parsed syntax.
|
||||
*/
|
||||
export declare interface ColorData {
|
||||
/**
|
||||
* The color notation of the color data.
|
||||
*
|
||||
* We use "color notation" and not "color space" because these represent the original notation and not the actual color space.
|
||||
* The actual color space is however always implied by the color notation.
|
||||
*/
|
||||
colorNotation: ColorNotation;
|
||||
/**
|
||||
* The color channels.
|
||||
* This is always an array of three numbers
|
||||
* but the channels can only be interpreted by looking at the color notation.
|
||||
*/
|
||||
channels: Color;
|
||||
/**
|
||||
* The alpha channel.
|
||||
* This is either a number between `0` and `1` or a `ComponentValue` object.
|
||||
*
|
||||
* Since most computations are not dependent on the alpha channel,
|
||||
* we allow things like `var(--some-alpha)` as an alpha channel value for most inputs.
|
||||
*/
|
||||
alpha: number | ComponentValue;
|
||||
/**
|
||||
* Information about the original syntax.
|
||||
*/
|
||||
syntaxFlags: Set<SyntaxFlag>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a color data object fits the `display-p3` gamut.
|
||||
*
|
||||
* @param {ColorData} x - The color data to be checked.
|
||||
* @returns {boolean} Whether the color data fits the `display-p3` gamut.
|
||||
*/
|
||||
export declare function colorDataFitsDisplayP3_Gamut(x: ColorData): boolean;
|
||||
|
||||
/**
|
||||
* Check if a color data object fits the `sRGB` gamut.
|
||||
*
|
||||
* @param {ColorData} x - The color data to be checked.
|
||||
* @returns {boolean} Whether the color data fits the `sRGB` gamut.
|
||||
*/
|
||||
export declare function colorDataFitsRGB_Gamut(x: ColorData): boolean;
|
||||
|
||||
export declare enum ColorNotation {
|
||||
/** Adobe 1999, expressed through `color(a98-rgb 0 0 0)` */
|
||||
A98_RGB = "a98-rgb",
|
||||
/** Display P3, expressed through `color(display-p3 0 0 0)` */
|
||||
Display_P3 = "display-p3",
|
||||
/** Hex, expressed through `#000` */
|
||||
HEX = "hex",
|
||||
/** HSL, expressed through `hsl(0 0% 0%)` */
|
||||
HSL = "hsl",
|
||||
/** HWB, expressed through `hwb(0 0% 0%)` */
|
||||
HWB = "hwb",
|
||||
/** LCH, expressed through `lch(0 0% 0deg)` */
|
||||
LCH = "lch",
|
||||
/** Lab, expressed through `lab(0 0 0)` */
|
||||
Lab = "lab",
|
||||
/** Linear sRGB, expressed through `color(linear-srgb 0 0 0)` */
|
||||
Linear_sRGB = "srgb-linear",
|
||||
/** Oklch, expressed through `oklch(0 0% 0deg)` */
|
||||
OKLCH = "oklch",
|
||||
/** Oklab, expressed through `oklab(0 0 0)` */
|
||||
OKLab = "oklab",
|
||||
/** ProPhoto RGB, expressed through `color(prophoto-rgb 0 0 0)` */
|
||||
ProPhoto_RGB = "prophoto-rgb",
|
||||
/** RGB, expressed through `rgb(0 0 0)` */
|
||||
RGB = "rgb",
|
||||
/** sRGB, expressed through `color(srgb 0 0 0)` */
|
||||
sRGB = "srgb",
|
||||
/** Rec. 2020, expressed through `color(rec2020 0 0 0)` */
|
||||
Rec2020 = "rec2020",
|
||||
/** XYZ, expressed through `color(xyz-d50 0 0 0)` */
|
||||
XYZ_D50 = "xyz-d50",
|
||||
/** XYZ, expressed through `color(xyz-d65 0 0 0)` */
|
||||
XYZ_D65 = "xyz-d65"
|
||||
}
|
||||
|
||||
export declare function serializeHSL(color: ColorData, gamutMapping?: boolean): FunctionNode;
|
||||
|
||||
/**
|
||||
* Convert color data to component values in the OKLCH color space.
|
||||
* The return value can be converted to a string by calling `toString()` on it.
|
||||
*
|
||||
* @param {ColorData} color - The color data to be serialized.
|
||||
* @returns {FunctionNode} The serialized color data as a FunctionNode object.
|
||||
*/
|
||||
export declare function serializeOKLCH(color: ColorData): FunctionNode;
|
||||
|
||||
/**
|
||||
* Convert color data to component values in the display-p3 color space.
|
||||
* The return value can be converted to a string by calling `toString()` on it.
|
||||
*
|
||||
* @param {ColorData} color - The color data to be serialized.
|
||||
* @param {boolean} gamutMapping - Whether to perform gamut mapping, defaults to `true`.
|
||||
* @returns {FunctionNode} The serialized color data as a FunctionNode object.
|
||||
*/
|
||||
export declare function serializeP3(color: ColorData, gamutMapping?: boolean): FunctionNode;
|
||||
|
||||
/**
|
||||
* Convert color data to component values in the srgb color space.
|
||||
* The return value can be converted to a string by calling `toString()` on it.
|
||||
*
|
||||
* @param {ColorData} color - The color data to be serialized.
|
||||
* @param {boolean} gamutMapping - Whether to perform gamut mapping, defaults to `true`.
|
||||
* @returns {FunctionNode} The serialized color data as a FunctionNode object.
|
||||
*/
|
||||
export declare function serializeRGB(color: ColorData, gamutMapping?: boolean): FunctionNode;
|
||||
|
||||
export declare enum SyntaxFlag {
|
||||
/** Is a color keyword, e.g. `transparent`, `currentColor`, ... */
|
||||
ColorKeyword = "color-keyword",
|
||||
/** Has an explicit alpha channel */
|
||||
HasAlpha = "has-alpha",
|
||||
/** Has a channel with a dimension value, e.g. `50deg` */
|
||||
HasDimensionValues = "has-dimension-values",
|
||||
/** Has a channel with the `none` keyword */
|
||||
HasNoneKeywords = "has-none-keywords",
|
||||
/** Has a channel with a number value */
|
||||
HasNumberValues = "has-number-values",
|
||||
/** Has an alpha channel with a percentage value */
|
||||
HasPercentageAlpha = "has-percentage-alpha",
|
||||
/** Has a channel with a percentage value */
|
||||
HasPercentageValues = "has-percentage-values",
|
||||
/** Has an alpha channel with a `var()` function value */
|
||||
HasVariableAlpha = "has-variable-alpha",
|
||||
/** Is Hex notation */
|
||||
Hex = "hex",
|
||||
/** Is legacy HSL, e.g. `hsl(50deg, 0%, 0%)` */
|
||||
LegacyHSL = "legacy-hsl",
|
||||
/** Is legacy RGB, e.g. `rgb(0, 0, 0)` */
|
||||
LegacyRGB = "legacy-rgb",
|
||||
/** Is a named color, e.g. `red`, `blue` */
|
||||
NamedColor = "named-color",
|
||||
/** Is a relative color syntax, e.g. `rgb(from purple r g b)` */
|
||||
RelativeColorSyntax = "relative-color-syntax",
|
||||
/** Is a mixed color, e.g. `color-mix(in oklch, red, blue)` */
|
||||
ColorMix = "color-mix",
|
||||
/** Is a variadic mixed color, e.g. `color-mix(in oklch, red)` `color-mix(in oklch, red, blue, green)` */
|
||||
ColorMixVariadic = "color-mix-variadic",
|
||||
/** Is a contrasting color, e.g. `contrast-color()` */
|
||||
ContrastColor = "contrast-color",
|
||||
/** Is an experimental color syntax */
|
||||
Experimental = "experimental"
|
||||
}
|
||||
|
||||
export { }
|
||||
1
node_modules/@csstools/css-color-parser/dist/index.mjs
generated
vendored
Normal file
1
node_modules/@csstools/css-color-parser/dist/index.mjs
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
71
node_modules/@csstools/css-color-parser/package.json
generated
vendored
Normal file
71
node_modules/@csstools/css-color-parser/package.json
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"name": "@csstools/css-color-parser",
|
||||
"description": "Parse CSS color values",
|
||||
"version": "3.0.10",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Antonio Laguna",
|
||||
"email": "antonio@laguna.es",
|
||||
"url": "https://antonio.laguna.es"
|
||||
},
|
||||
{
|
||||
"name": "Romain Menke",
|
||||
"email": "romainmenke@gmail.com"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/csstools"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/csstools"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"type": "module",
|
||||
"main": "dist/index.cjs",
|
||||
"module": "dist/index.mjs",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"default": "./dist/index.cjs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"CHANGELOG.md",
|
||||
"LICENSE.md",
|
||||
"README.md",
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@csstools/color-helpers": "^5.0.2",
|
||||
"@csstools/css-calc": "^2.1.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@csstools/css-parser-algorithms": "^3.0.5",
|
||||
"@csstools/css-tokenizer": "^3.0.4"
|
||||
},
|
||||
"scripts": {},
|
||||
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/csstools/postcss-plugins.git",
|
||||
"directory": "packages/css-color-parser"
|
||||
},
|
||||
"bugs": "https://github.com/csstools/postcss-plugins/issues",
|
||||
"keywords": [
|
||||
"color",
|
||||
"css",
|
||||
"parser"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user