@tsparticles/plugin-rgb-color 4.0.0-alpha.2 → 4.0.0-alpha.21
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/783.min.js +1 -0
- package/browser/RgbColorManager.js +2 -5
- package/browser/index.js +4 -4
- package/cjs/RgbColorManager.js +2 -5
- package/cjs/index.js +4 -4
- package/dist_browser_RgbColorManager_js.js +2 -2
- package/esm/RgbColorManager.js +2 -5
- package/esm/index.js +4 -4
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.plugin.rgbColor.js +11 -11
- package/tsparticles.plugin.rgbColor.min.js +2 -2
- package/types/RgbColorManager.d.ts +0 -2
- package/types/index.d.ts +1 -1
- package/umd/RgbColorManager.js +2 -5
- package/umd/index.js +4 -4
- package/379.min.js +0 -2
- package/379.min.js.LICENSE.txt +0 -1
- package/tsparticles.plugin.rgbColor.min.js.LICENSE.txt +0 -1
package/783.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_plugin_rgb_color=this.webpackChunk_tsparticles_plugin_rgb_color||[]).push([[783],{783(e,a,r){r.d(a,{RgbColorManager:()=>l});var s,t,g=r(303);(s=t||(t={}))[s.r=1]="r",s[s.g=2]="g",s[s.b=3]="b",s[s.a=5]="a";let n=/rgba?\(\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*([\s,]\s*(0|1|0?\.\d+|(\d{1,3})%)\s*)?\)/i;class l{accepts(e){return e.startsWith("rgb")}handleColor(e){let a=e.value.rgb??e.value;if(Object.hasOwn(a,"r")&&Object.hasOwn(a,"g")&&Object.hasOwn(a,"b"))return a}handleRangeColor(e){let a=e.value.rgb??e.value;if(Object.hasOwn(a,"r")&&Object.hasOwn(a,"g")&&Object.hasOwn(a,"b"))return{r:(0,g.getRangeValue)(a.r),g:(0,g.getRangeValue)(a.g),b:(0,g.getRangeValue)(a.b)}}parseString(e){if(!this.accepts(e))return;let a=n.exec(e);return a?{a:a.length>4?(0,g.parseAlpha)(a[t.a]):1,b:parseInt(a[t.b]??"0",10),g:parseInt(a[t.g]??"0",10),r:parseInt(a[t.r]??"0",10)}:void 0}}}}]);
|
|
@@ -8,22 +8,19 @@ var RgbIndexes;
|
|
|
8
8
|
})(RgbIndexes || (RgbIndexes = {}));
|
|
9
9
|
const rgbRegex = /rgba?\(\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*([\s,]\s*(0|1|0?\.\d+|(\d{1,3})%)\s*)?\)/i;
|
|
10
10
|
export class RgbColorManager {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.key = "rgb";
|
|
13
|
-
}
|
|
14
11
|
accepts(input) {
|
|
15
12
|
return input.startsWith("rgb");
|
|
16
13
|
}
|
|
17
14
|
handleColor(color) {
|
|
18
15
|
const colorValue = color.value, rgbColor = colorValue.rgb ?? color.value;
|
|
19
|
-
if (!Object.hasOwn(rgbColor, "r")) {
|
|
16
|
+
if (!Object.hasOwn(rgbColor, "r") || !Object.hasOwn(rgbColor, "g") || !Object.hasOwn(rgbColor, "b")) {
|
|
20
17
|
return;
|
|
21
18
|
}
|
|
22
19
|
return rgbColor;
|
|
23
20
|
}
|
|
24
21
|
handleRangeColor(color) {
|
|
25
22
|
const colorValue = color.value, rgbColor = colorValue.rgb ?? color.value;
|
|
26
|
-
if (!Object.hasOwn(rgbColor, "r")) {
|
|
23
|
+
if (!Object.hasOwn(rgbColor, "r") || !Object.hasOwn(rgbColor, "g") || !Object.hasOwn(rgbColor, "b")) {
|
|
27
24
|
return;
|
|
28
25
|
}
|
|
29
26
|
return {
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export function loadRgbColorPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(async (e) => {
|
|
1
|
+
export async function loadRgbColorPlugin(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.21");
|
|
3
|
+
await engine.register(async (e) => {
|
|
4
4
|
const { RgbColorManager } = await import("./RgbColorManager.js");
|
|
5
|
-
e.addColorManager(new RgbColorManager());
|
|
5
|
+
e.addColorManager("rgb", new RgbColorManager());
|
|
6
6
|
});
|
|
7
7
|
}
|
package/cjs/RgbColorManager.js
CHANGED
|
@@ -8,22 +8,19 @@ var RgbIndexes;
|
|
|
8
8
|
})(RgbIndexes || (RgbIndexes = {}));
|
|
9
9
|
const rgbRegex = /rgba?\(\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*([\s,]\s*(0|1|0?\.\d+|(\d{1,3})%)\s*)?\)/i;
|
|
10
10
|
export class RgbColorManager {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.key = "rgb";
|
|
13
|
-
}
|
|
14
11
|
accepts(input) {
|
|
15
12
|
return input.startsWith("rgb");
|
|
16
13
|
}
|
|
17
14
|
handleColor(color) {
|
|
18
15
|
const colorValue = color.value, rgbColor = colorValue.rgb ?? color.value;
|
|
19
|
-
if (!Object.hasOwn(rgbColor, "r")) {
|
|
16
|
+
if (!Object.hasOwn(rgbColor, "r") || !Object.hasOwn(rgbColor, "g") || !Object.hasOwn(rgbColor, "b")) {
|
|
20
17
|
return;
|
|
21
18
|
}
|
|
22
19
|
return rgbColor;
|
|
23
20
|
}
|
|
24
21
|
handleRangeColor(color) {
|
|
25
22
|
const colorValue = color.value, rgbColor = colorValue.rgb ?? color.value;
|
|
26
|
-
if (!Object.hasOwn(rgbColor, "r")) {
|
|
23
|
+
if (!Object.hasOwn(rgbColor, "r") || !Object.hasOwn(rgbColor, "g") || !Object.hasOwn(rgbColor, "b")) {
|
|
27
24
|
return;
|
|
28
25
|
}
|
|
29
26
|
return {
|
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export function loadRgbColorPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(async (e) => {
|
|
1
|
+
export async function loadRgbColorPlugin(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.21");
|
|
3
|
+
await engine.register(async (e) => {
|
|
4
4
|
const { RgbColorManager } = await import("./RgbColorManager.js");
|
|
5
|
-
e.addColorManager(new RgbColorManager());
|
|
5
|
+
e.addColorManager("rgb", new RgbColorManager());
|
|
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.21
|
|
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 */ RgbColorManager: () => (/* binding */ RgbColorManager)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nvar RgbIndexes;\n(function
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RgbColorManager: () => (/* binding */ RgbColorManager)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\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\"] = 5] = \"a\";\n})(RgbIndexes || (RgbIndexes = {}));\nconst rgbRegex = /rgba?\\(\\s*(\\d{1,3})\\s*[\\s,]\\s*(\\d{1,3})\\s*[\\s,]\\s*(\\d{1,3})\\s*([\\s,]\\s*(0|1|0?\\.\\d+|(\\d{1,3})%)\\s*)?\\)/i;\nclass RgbColorManager {\n accepts(input) {\n return input.startsWith(\"rgb\");\n }\n handleColor(color) {\n const colorValue = color.value, rgbColor = colorValue.rgb ?? color.value;\n if (!Object.hasOwn(rgbColor, \"r\") || !Object.hasOwn(rgbColor, \"g\") || !Object.hasOwn(rgbColor, \"b\")) {\n return;\n }\n return rgbColor;\n }\n handleRangeColor(color) {\n const colorValue = color.value, rgbColor = colorValue.rgb ?? color.value;\n if (!Object.hasOwn(rgbColor, \"r\") || !Object.hasOwn(rgbColor, \"g\") || !Object.hasOwn(rgbColor, \"b\")) {\n return;\n }\n return {\n r: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(rgbColor.r),\n g: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(rgbColor.g),\n b: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(rgbColor.b)\n };\n }\n parseString(input) {\n if (!this.accepts(input)) {\n return;\n }\n const result = rgbRegex.exec(input), radix = 10, minLength = 4, defaultAlpha = 1;\n return result ? {\n a: result.length > minLength ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.parseAlpha)(result[RgbIndexes.a]) : defaultAlpha,\n b: parseInt(result[RgbIndexes.b] ?? \"0\", radix),\n g: parseInt(result[RgbIndexes.g] ?? \"0\", radix),\n r: parseInt(result[RgbIndexes.r] ?? \"0\", radix)\n } : undefined;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-rgb-color/./dist/browser/RgbColorManager.js?\n}");
|
|
27
27
|
|
|
28
28
|
/***/ }
|
|
29
29
|
|
package/esm/RgbColorManager.js
CHANGED
|
@@ -8,22 +8,19 @@ var RgbIndexes;
|
|
|
8
8
|
})(RgbIndexes || (RgbIndexes = {}));
|
|
9
9
|
const rgbRegex = /rgba?\(\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*([\s,]\s*(0|1|0?\.\d+|(\d{1,3})%)\s*)?\)/i;
|
|
10
10
|
export class RgbColorManager {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.key = "rgb";
|
|
13
|
-
}
|
|
14
11
|
accepts(input) {
|
|
15
12
|
return input.startsWith("rgb");
|
|
16
13
|
}
|
|
17
14
|
handleColor(color) {
|
|
18
15
|
const colorValue = color.value, rgbColor = colorValue.rgb ?? color.value;
|
|
19
|
-
if (!Object.hasOwn(rgbColor, "r")) {
|
|
16
|
+
if (!Object.hasOwn(rgbColor, "r") || !Object.hasOwn(rgbColor, "g") || !Object.hasOwn(rgbColor, "b")) {
|
|
20
17
|
return;
|
|
21
18
|
}
|
|
22
19
|
return rgbColor;
|
|
23
20
|
}
|
|
24
21
|
handleRangeColor(color) {
|
|
25
22
|
const colorValue = color.value, rgbColor = colorValue.rgb ?? color.value;
|
|
26
|
-
if (!Object.hasOwn(rgbColor, "r")) {
|
|
23
|
+
if (!Object.hasOwn(rgbColor, "r") || !Object.hasOwn(rgbColor, "g") || !Object.hasOwn(rgbColor, "b")) {
|
|
27
24
|
return;
|
|
28
25
|
}
|
|
29
26
|
return {
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export function loadRgbColorPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(async (e) => {
|
|
1
|
+
export async function loadRgbColorPlugin(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.21");
|
|
3
|
+
await engine.register(async (e) => {
|
|
4
4
|
const { RgbColorManager } = await import("./RgbColorManager.js");
|
|
5
|
-
e.addColorManager(new RgbColorManager());
|
|
5
|
+
e.addColorManager("rgb", new RgbColorManager());
|
|
6
6
|
});
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-rgb-color",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.21",
|
|
4
4
|
"description": "tsParticles RGB 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.21"
|
|
104
104
|
},
|
|
105
105
|
"publishConfig": {
|
|
106
106
|
"access": "public"
|