First Commit

This commit is contained in:
2024-07-15 15:57:41 +03:00
commit 2f7b948cda
2137 changed files with 402438 additions and 0 deletions

14
node_modules/culori/src/util/hue.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
const hueToDeg = (val, unit) => {
switch (unit) {
case 'deg':
return +val;
case 'rad':
return (val / Math.PI) * 180;
case 'grad':
return (val / 10) * 9;
case 'turn':
return val * 360;
}
};
export default hueToDeg;

3
node_modules/culori/src/util/normalizeHue.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
const normalizeHue = hue => ((hue = hue % 360) < 0 ? hue + 360 : hue);
export default normalizeHue;

53
node_modules/culori/src/util/normalizePositions.js generated vendored Normal file
View File

@@ -0,0 +1,53 @@
/*
Normalize an array of color stop positions for a gradient
based on the rules defined in the CSS Images Module 4 spec:
1. make the first position 0 and the last position 1 if missing
2. sequences of unpositioned color stops should be spread out evenly
3. no position can be smaller than any of the ones preceding it
Reference: https://drafts.csswg.org/css-images-4/#color-stop-fixup
Note: this method does not make a defensive copy of the array
it receives as argument. Instead, it adjusts the values in-place.
*/
const normalizePositions = arr => {
// 1. fix up first/last position if missing
if (arr[0] === undefined) {
arr[0] = 0;
}
if (arr[arr.length - 1] === undefined) {
arr[arr.length - 1] = 1;
}
let i = 1;
let j;
let from_idx;
let from_pos;
let inc;
while (i < arr.length) {
// 2. fill up undefined positions
if (arr[i] === undefined) {
from_idx = i;
from_pos = arr[i - 1];
j = i;
// find end of `undefined` sequence...
while (arr[j] === undefined) j++;
// ...and add evenly-spread positions
inc = (arr[j] - from_pos) / (j - i + 1);
while (i < j) {
arr[i] = from_pos + (i + 1 - from_idx) * inc;
i++;
}
} else if (arr[i] < arr[i - 1]) {
// 3. make positions increase
arr[i] = arr[i - 1];
}
i++;
}
return arr;
};
export default normalizePositions;

37
node_modules/culori/src/util/regex.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
/*
Basic building blocks for color regexes
---------------------------------------
These regexes are expressed as strings
to be interpolated in the color regexes.
*/
// <number>
export const num = '([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)';
// <number> or 'none'
export const num_none = `(?:${num}|none)`;
// <percentage>
export const per = `${num}%`;
// <percent> or 'none'
export const per_none = `(?:${num}%|none)`;
// <number-percentage> (<alpha-value>)
export const num_per = `(?:${num}%|${num})`;
// <number-percentage> (<alpha-value>) or 'none'
export const num_per_none = `(?:${num}%|${num}|none)`;
// <hue>
export const hue = `(?:${num}(deg|grad|rad|turn)|${num})`;
// <hue> or 'none'
export const hue_none = `(?:${num}(deg|grad|rad|turn)|${num}|none)`;
export const c = `\\s*,\\s*`; // comma
export const so = '\\s*'; // space, optional
export const s = `\\s+`; // space
export const rx_num_per_none = new RegExp('^' + num_per_none + '$');