@tsparticles/plugin-oklch-color 3.9.1 → 4.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/599.min.js +2 -0
- package/599.min.js.LICENSE.txt +1 -0
- package/browser/OklchColorManager.js +19 -15
- package/browser/index.js +6 -6
- package/browser/utils.js +25 -21
- package/cjs/OklchColorManager.js +24 -24
- package/cjs/index.js +6 -9
- package/cjs/utils.js +27 -30
- package/dist_browser_OklchColorManager_js.js +40 -0
- package/esm/OklchColorManager.js +19 -15
- package/esm/index.js +6 -6
- package/esm/utils.js +25 -21
- package/package.json +4 -3
- package/report.html +5 -4
- package/tsparticles.plugin.oklchColor.js +209 -50
- package/tsparticles.plugin.oklchColor.min.js +1 -1
- package/tsparticles.plugin.oklchColor.min.js.LICENSE.txt +1 -1
- package/types/OklchColorManager.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/types/utils.d.ts +1 -3
- package/umd/OklchColorManager.js +19 -15
- package/umd/index.js +41 -7
- package/umd/utils.js +24 -22
- package/browser/LchColorManager.js +0 -44
- package/cjs/LchColorManager.js +0 -48
- package/esm/LchColorManager.js +0 -44
- package/types/LchColorManager.d.ts +0 -9
- package/umd/LchColorManager.js +0 -58
package/cjs/LchColorManager.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LchColorManager = void 0;
|
|
4
|
-
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
const utils_js_1 = require("./utils.js");
|
|
6
|
-
class LchColorManager {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.key = "lch";
|
|
9
|
-
this.stringPrefix = "lch";
|
|
10
|
-
}
|
|
11
|
-
handleColor(color) {
|
|
12
|
-
const colorValue = color.value, lchColor = colorValue.lch ?? color.value;
|
|
13
|
-
if (lchColor.l !== undefined && lchColor.c !== undefined && lchColor.h !== undefined) {
|
|
14
|
-
return (0, utils_js_1.lchToRgb)(lchColor);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
handleRangeColor(color) {
|
|
18
|
-
const colorValue = color.value, lchColor = colorValue.lch ?? color.value;
|
|
19
|
-
if (lchColor.l !== undefined && lchColor.c !== undefined && lchColor.h !== undefined) {
|
|
20
|
-
return (0, utils_js_1.lchToRgb)({
|
|
21
|
-
l: (0, engine_1.getRangeValue)(lchColor.l),
|
|
22
|
-
c: (0, engine_1.getRangeValue)(lchColor.c),
|
|
23
|
-
h: (0, engine_1.getRangeValue)(lchColor.h),
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
parseString(input) {
|
|
28
|
-
const isLch = input.startsWith("lch");
|
|
29
|
-
if (!isLch) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const regex = /lch\(\s*(\d+(\.\d+)?)%\s+(\d+(\.\d+)?)\s+(\d+(\.\d+)?)(?:\s*\/\s*(0|1|0?\.\d+|\d{1,3}%))?\s*\)/i, result = regex.exec(input), indexes = {
|
|
33
|
-
l: 1,
|
|
34
|
-
c: 3,
|
|
35
|
-
h: 5,
|
|
36
|
-
a: 7,
|
|
37
|
-
}, defaultAlpha = 1;
|
|
38
|
-
return result
|
|
39
|
-
? (0, utils_js_1.lchaToRgba)({
|
|
40
|
-
a: result[indexes.a] ? (0, engine_1.parseAlpha)(result[indexes.a]) : defaultAlpha,
|
|
41
|
-
c: parseFloat(result[indexes.c]),
|
|
42
|
-
h: parseFloat(result[indexes.h]),
|
|
43
|
-
l: parseFloat(result[indexes.l]),
|
|
44
|
-
})
|
|
45
|
-
: undefined;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.LchColorManager = LchColorManager;
|
package/esm/LchColorManager.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { getRangeValue, parseAlpha, } from "@tsparticles/engine";
|
|
2
|
-
import { lchToRgb, lchaToRgba } from "./utils.js";
|
|
3
|
-
export class LchColorManager {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.key = "lch";
|
|
6
|
-
this.stringPrefix = "lch";
|
|
7
|
-
}
|
|
8
|
-
handleColor(color) {
|
|
9
|
-
const colorValue = color.value, lchColor = colorValue.lch ?? color.value;
|
|
10
|
-
if (lchColor.l !== undefined && lchColor.c !== undefined && lchColor.h !== undefined) {
|
|
11
|
-
return lchToRgb(lchColor);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
handleRangeColor(color) {
|
|
15
|
-
const colorValue = color.value, lchColor = colorValue.lch ?? color.value;
|
|
16
|
-
if (lchColor.l !== undefined && lchColor.c !== undefined && lchColor.h !== undefined) {
|
|
17
|
-
return lchToRgb({
|
|
18
|
-
l: getRangeValue(lchColor.l),
|
|
19
|
-
c: getRangeValue(lchColor.c),
|
|
20
|
-
h: getRangeValue(lchColor.h),
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
parseString(input) {
|
|
25
|
-
const isLch = input.startsWith("lch");
|
|
26
|
-
if (!isLch) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const regex = /lch\(\s*(\d+(\.\d+)?)%\s+(\d+(\.\d+)?)\s+(\d+(\.\d+)?)(?:\s*\/\s*(0|1|0?\.\d+|\d{1,3}%))?\s*\)/i, result = regex.exec(input), indexes = {
|
|
30
|
-
l: 1,
|
|
31
|
-
c: 3,
|
|
32
|
-
h: 5,
|
|
33
|
-
a: 7,
|
|
34
|
-
}, defaultAlpha = 1;
|
|
35
|
-
return result
|
|
36
|
-
? lchaToRgba({
|
|
37
|
-
a: result[indexes.a] ? parseAlpha(result[indexes.a]) : defaultAlpha,
|
|
38
|
-
c: parseFloat(result[indexes.c]),
|
|
39
|
-
h: parseFloat(result[indexes.h]),
|
|
40
|
-
l: parseFloat(result[indexes.l]),
|
|
41
|
-
})
|
|
42
|
-
: undefined;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type IColor, type IColorManager, type IRangeColor, type IRgb, type IRgba } from "@tsparticles/engine";
|
|
2
|
-
export declare class LchColorManager implements IColorManager {
|
|
3
|
-
readonly key: string;
|
|
4
|
-
readonly stringPrefix: string;
|
|
5
|
-
constructor();
|
|
6
|
-
handleColor(color: IColor): IRgb | undefined;
|
|
7
|
-
handleRangeColor(color: IRangeColor): IRgb | undefined;
|
|
8
|
-
parseString(input: string): IRgba | undefined;
|
|
9
|
-
}
|
package/umd/LchColorManager.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine", "./utils.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.LchColorManager = void 0;
|
|
13
|
-
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const utils_js_1 = require("./utils.js");
|
|
15
|
-
class LchColorManager {
|
|
16
|
-
constructor() {
|
|
17
|
-
this.key = "lch";
|
|
18
|
-
this.stringPrefix = "lch";
|
|
19
|
-
}
|
|
20
|
-
handleColor(color) {
|
|
21
|
-
const colorValue = color.value, lchColor = colorValue.lch ?? color.value;
|
|
22
|
-
if (lchColor.l !== undefined && lchColor.c !== undefined && lchColor.h !== undefined) {
|
|
23
|
-
return (0, utils_js_1.lchToRgb)(lchColor);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
handleRangeColor(color) {
|
|
27
|
-
const colorValue = color.value, lchColor = colorValue.lch ?? color.value;
|
|
28
|
-
if (lchColor.l !== undefined && lchColor.c !== undefined && lchColor.h !== undefined) {
|
|
29
|
-
return (0, utils_js_1.lchToRgb)({
|
|
30
|
-
l: (0, engine_1.getRangeValue)(lchColor.l),
|
|
31
|
-
c: (0, engine_1.getRangeValue)(lchColor.c),
|
|
32
|
-
h: (0, engine_1.getRangeValue)(lchColor.h),
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
parseString(input) {
|
|
37
|
-
const isLch = input.startsWith("lch");
|
|
38
|
-
if (!isLch) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const regex = /lch\(\s*(\d+(\.\d+)?)%\s+(\d+(\.\d+)?)\s+(\d+(\.\d+)?)(?:\s*\/\s*(0|1|0?\.\d+|\d{1,3}%))?\s*\)/i, result = regex.exec(input), indexes = {
|
|
42
|
-
l: 1,
|
|
43
|
-
c: 3,
|
|
44
|
-
h: 5,
|
|
45
|
-
a: 7,
|
|
46
|
-
}, defaultAlpha = 1;
|
|
47
|
-
return result
|
|
48
|
-
? (0, utils_js_1.lchaToRgba)({
|
|
49
|
-
a: result[indexes.a] ? (0, engine_1.parseAlpha)(result[indexes.a]) : defaultAlpha,
|
|
50
|
-
c: parseFloat(result[indexes.c]),
|
|
51
|
-
h: parseFloat(result[indexes.h]),
|
|
52
|
-
l: parseFloat(result[indexes.l]),
|
|
53
|
-
})
|
|
54
|
-
: undefined;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.LchColorManager = LchColorManager;
|
|
58
|
-
});
|