@tsparticles/plugin-hex-color 4.0.0-alpha.2 → 4.0.0-alpha.20
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/97.min.js +1 -0
- package/browser/HexColorManager.js +5 -8
- package/browser/index.js +4 -4
- package/cjs/HexColorManager.js +5 -8
- package/cjs/index.js +4 -4
- package/dist_browser_HexColorManager_js.js +2 -2
- package/esm/HexColorManager.js +5 -8
- package/esm/index.js +4 -4
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.plugin.hexColor.js +2 -2
- package/tsparticles.plugin.hexColor.min.js +2 -2
- package/types/HexColorManager.d.ts +0 -2
- package/types/index.d.ts +1 -1
- package/umd/HexColorManager.js +5 -8
- package/umd/index.js +4 -4
- package/69.min.js +0 -2
- package/69.min.js.LICENSE.txt +0 -1
- package/tsparticles.plugin.hexColor.min.js.LICENSE.txt +0 -1
package/97.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_plugin_hex_color=this.webpackChunk_tsparticles_plugin_hex_color||[]).push([[97],{97(r,e,a){var t,s;a.d(e,{HexColorManager:()=>p}),(s=t||(t={}))[s.r=1]="r",s[s.g=2]="g",s[s.b=3]="b",s[s.a=4]="a";let n=/^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i,i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i;class p{accepts(r){return r.startsWith("#")}handleColor(r){return this._parseString(r.value)}handleRangeColor(r){return this._parseString(r.value)}parseString(r){return this._parseString(r)}_parseString(r){if("string"!=typeof r||!this.accepts(r))return;let e=r.replace(n,(r,e,a,t,s)=>e+e+a+a+t+t+(void 0===s?"":s+s)),a=i.exec(e);return a?{a:a[t.a]?Number.parseInt(a[t.a],16)/255:1,b:Number.parseInt(a[t.b]??"0",16),g:Number.parseInt(a[t.g]??"0",16),r:Number.parseInt(a[t.r]??"0",16)}:void 0}}}}]);
|
|
@@ -7,9 +7,6 @@ var RgbIndexes;
|
|
|
7
7
|
})(RgbIndexes || (RgbIndexes = {}));
|
|
8
8
|
const shorthandHexRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i, hexRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i, hexRadix = 16, defaultAlpha = 1, alphaFactor = 0xff;
|
|
9
9
|
export class HexColorManager {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.key = "hex";
|
|
12
|
-
}
|
|
13
10
|
accepts(input) {
|
|
14
11
|
return input.startsWith("#");
|
|
15
12
|
}
|
|
@@ -27,14 +24,14 @@ export class HexColorManager {
|
|
|
27
24
|
return;
|
|
28
25
|
}
|
|
29
26
|
const hexFixed = hexColor.replace(shorthandHexRegex, (_, r, g, b, a) => {
|
|
30
|
-
return r + r + g + g + b + b + (a
|
|
27
|
+
return r + r + g + g + b + b + (a === undefined ? "" : a + a);
|
|
31
28
|
}), result = hexRegex.exec(hexFixed);
|
|
32
29
|
return result
|
|
33
30
|
? {
|
|
34
|
-
a: result[RgbIndexes.a] ? parseInt(result[RgbIndexes.a], hexRadix) / alphaFactor : defaultAlpha,
|
|
35
|
-
b: parseInt(result[RgbIndexes.b] ?? "0", hexRadix),
|
|
36
|
-
g: parseInt(result[RgbIndexes.g] ?? "0", hexRadix),
|
|
37
|
-
r: parseInt(result[RgbIndexes.r] ?? "0", hexRadix),
|
|
31
|
+
a: result[RgbIndexes.a] ? Number.parseInt(result[RgbIndexes.a], hexRadix) / alphaFactor : defaultAlpha,
|
|
32
|
+
b: Number.parseInt(result[RgbIndexes.b] ?? "0", hexRadix),
|
|
33
|
+
g: Number.parseInt(result[RgbIndexes.g] ?? "0", hexRadix),
|
|
34
|
+
r: Number.parseInt(result[RgbIndexes.r] ?? "0", hexRadix),
|
|
38
35
|
}
|
|
39
36
|
: undefined;
|
|
40
37
|
}
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export function loadHexColorPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(async (e) => {
|
|
1
|
+
export async function loadHexColorPlugin(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.20");
|
|
3
|
+
await engine.register(async (e) => {
|
|
4
4
|
const { HexColorManager } = await import("./HexColorManager.js");
|
|
5
|
-
e.addColorManager(new HexColorManager());
|
|
5
|
+
e.addColorManager("hex", new HexColorManager());
|
|
6
6
|
});
|
|
7
7
|
}
|
package/cjs/HexColorManager.js
CHANGED
|
@@ -7,9 +7,6 @@ var RgbIndexes;
|
|
|
7
7
|
})(RgbIndexes || (RgbIndexes = {}));
|
|
8
8
|
const shorthandHexRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i, hexRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i, hexRadix = 16, defaultAlpha = 1, alphaFactor = 0xff;
|
|
9
9
|
export class HexColorManager {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.key = "hex";
|
|
12
|
-
}
|
|
13
10
|
accepts(input) {
|
|
14
11
|
return input.startsWith("#");
|
|
15
12
|
}
|
|
@@ -27,14 +24,14 @@ export class HexColorManager {
|
|
|
27
24
|
return;
|
|
28
25
|
}
|
|
29
26
|
const hexFixed = hexColor.replace(shorthandHexRegex, (_, r, g, b, a) => {
|
|
30
|
-
return r + r + g + g + b + b + (a
|
|
27
|
+
return r + r + g + g + b + b + (a === undefined ? "" : a + a);
|
|
31
28
|
}), result = hexRegex.exec(hexFixed);
|
|
32
29
|
return result
|
|
33
30
|
? {
|
|
34
|
-
a: result[RgbIndexes.a] ? parseInt(result[RgbIndexes.a], hexRadix) / alphaFactor : defaultAlpha,
|
|
35
|
-
b: parseInt(result[RgbIndexes.b] ?? "0", hexRadix),
|
|
36
|
-
g: parseInt(result[RgbIndexes.g] ?? "0", hexRadix),
|
|
37
|
-
r: parseInt(result[RgbIndexes.r] ?? "0", hexRadix),
|
|
31
|
+
a: result[RgbIndexes.a] ? Number.parseInt(result[RgbIndexes.a], hexRadix) / alphaFactor : defaultAlpha,
|
|
32
|
+
b: Number.parseInt(result[RgbIndexes.b] ?? "0", hexRadix),
|
|
33
|
+
g: Number.parseInt(result[RgbIndexes.g] ?? "0", hexRadix),
|
|
34
|
+
r: Number.parseInt(result[RgbIndexes.r] ?? "0", hexRadix),
|
|
38
35
|
}
|
|
39
36
|
: undefined;
|
|
40
37
|
}
|
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export function loadHexColorPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(async (e) => {
|
|
1
|
+
export async function loadHexColorPlugin(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.20");
|
|
3
|
+
await engine.register(async (e) => {
|
|
4
4
|
const { HexColorManager } = await import("./HexColorManager.js");
|
|
5
|
-
e.addColorManager(new HexColorManager());
|
|
5
|
+
e.addColorManager("hex", new HexColorManager());
|
|
6
6
|
});
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v4.0.0-alpha.
|
|
7
|
+
* v4.0.0-alpha.20
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
\*****************************************/
|
|
24
24
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
25
|
|
|
26
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HexColorManager: () => (/* binding */ HexColorManager)\n/* harmony export */ });\nvar RgbIndexes;\n(function
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HexColorManager: () => (/* binding */ HexColorManager)\n/* harmony export */ });\nvar RgbIndexes;\n(function(RgbIndexes) {\n RgbIndexes[RgbIndexes[\"r\"] = 1] = \"r\";\n RgbIndexes[RgbIndexes[\"g\"] = 2] = \"g\";\n RgbIndexes[RgbIndexes[\"b\"] = 3] = \"b\";\n RgbIndexes[RgbIndexes[\"a\"] = 4] = \"a\";\n})(RgbIndexes || (RgbIndexes = {}));\nconst shorthandHexRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])([a-f\\d])?$/i, hexRegex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})?$/i, hexRadix = 16, defaultAlpha = 1, alphaFactor = 0xff;\nclass HexColorManager {\n accepts(input) {\n return input.startsWith(\"#\");\n }\n handleColor(color) {\n return this._parseString(color.value);\n }\n handleRangeColor(color) {\n return this._parseString(color.value);\n }\n parseString(input) {\n return this._parseString(input);\n }\n _parseString(hexColor) {\n if (typeof hexColor !== \"string\" || !this.accepts(hexColor)) {\n return;\n }\n const hexFixed = hexColor.replace(shorthandHexRegex, (_, r, g, b, a)=>{\n return r + r + g + g + b + b + (a === undefined ? \"\" : a + a);\n }), result = hexRegex.exec(hexFixed);\n return result ? {\n a: result[RgbIndexes.a] ? Number.parseInt(result[RgbIndexes.a], hexRadix) / alphaFactor : defaultAlpha,\n b: Number.parseInt(result[RgbIndexes.b] ?? \"0\", hexRadix),\n g: Number.parseInt(result[RgbIndexes.g] ?? \"0\", hexRadix),\n r: Number.parseInt(result[RgbIndexes.r] ?? \"0\", hexRadix)\n } : undefined;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-hex-color/./dist/browser/HexColorManager.js?\n}");
|
|
27
27
|
|
|
28
28
|
/***/ }
|
|
29
29
|
|
package/esm/HexColorManager.js
CHANGED
|
@@ -7,9 +7,6 @@ var RgbIndexes;
|
|
|
7
7
|
})(RgbIndexes || (RgbIndexes = {}));
|
|
8
8
|
const shorthandHexRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i, hexRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i, hexRadix = 16, defaultAlpha = 1, alphaFactor = 0xff;
|
|
9
9
|
export class HexColorManager {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.key = "hex";
|
|
12
|
-
}
|
|
13
10
|
accepts(input) {
|
|
14
11
|
return input.startsWith("#");
|
|
15
12
|
}
|
|
@@ -27,14 +24,14 @@ export class HexColorManager {
|
|
|
27
24
|
return;
|
|
28
25
|
}
|
|
29
26
|
const hexFixed = hexColor.replace(shorthandHexRegex, (_, r, g, b, a) => {
|
|
30
|
-
return r + r + g + g + b + b + (a
|
|
27
|
+
return r + r + g + g + b + b + (a === undefined ? "" : a + a);
|
|
31
28
|
}), result = hexRegex.exec(hexFixed);
|
|
32
29
|
return result
|
|
33
30
|
? {
|
|
34
|
-
a: result[RgbIndexes.a] ? parseInt(result[RgbIndexes.a], hexRadix) / alphaFactor : defaultAlpha,
|
|
35
|
-
b: parseInt(result[RgbIndexes.b] ?? "0", hexRadix),
|
|
36
|
-
g: parseInt(result[RgbIndexes.g] ?? "0", hexRadix),
|
|
37
|
-
r: parseInt(result[RgbIndexes.r] ?? "0", hexRadix),
|
|
31
|
+
a: result[RgbIndexes.a] ? Number.parseInt(result[RgbIndexes.a], hexRadix) / alphaFactor : defaultAlpha,
|
|
32
|
+
b: Number.parseInt(result[RgbIndexes.b] ?? "0", hexRadix),
|
|
33
|
+
g: Number.parseInt(result[RgbIndexes.g] ?? "0", hexRadix),
|
|
34
|
+
r: Number.parseInt(result[RgbIndexes.r] ?? "0", hexRadix),
|
|
38
35
|
}
|
|
39
36
|
: undefined;
|
|
40
37
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export function loadHexColorPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(async (e) => {
|
|
1
|
+
export async function loadHexColorPlugin(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.20");
|
|
3
|
+
await engine.register(async (e) => {
|
|
4
4
|
const { HexColorManager } = await import("./HexColorManager.js");
|
|
5
|
-
e.addColorManager(new HexColorManager());
|
|
5
|
+
e.addColorManager("hex", new HexColorManager());
|
|
6
6
|
});
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-hex-color",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.20",
|
|
4
4
|
"description": "tsParticles hex color plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"./package.json": "./package.json"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@tsparticles/engine": "4.0.0-alpha.
|
|
103
|
+
"@tsparticles/engine": "4.0.0-alpha.20"
|
|
104
104
|
},
|
|
105
105
|
"publishConfig": {
|
|
106
106
|
"access": "public"
|