@tsparticles/plugin-lch-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.
@@ -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.2
7
+ * v4.0.0-alpha.20
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -28,16 +28,6 @@ return /******/ (() => { // webpackBootstrap
28
28
  /******/ "use strict";
29
29
  /******/ var __webpack_modules__ = ({
30
30
 
31
- /***/ "./dist/browser/index.js"
32
- /*!*******************************!*\
33
- !*** ./dist/browser/index.js ***!
34
- \*******************************/
35
- (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
36
-
37
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadLchColorPlugin: () => (/* binding */ loadLchColorPlugin)\n/* harmony export */ });\nfunction loadLchColorPlugin(engine) {\n engine.checkVersion(\"4.0.0-alpha.2\");\n engine.register(async e => {\n const {\n LchColorManager\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_LchColorManager_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./LchColorManager.js */ \"./dist/browser/LchColorManager.js\"));\n e.addColorManager(new LchColorManager());\n });\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-lch-color/./dist/browser/index.js?\n}");
38
-
39
- /***/ },
40
-
41
31
  /***/ "@tsparticles/engine"
42
32
  /*!*********************************************************************************************************************************!*\
43
33
  !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
@@ -46,6 +36,16 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
46
36
 
47
37
  module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
48
38
 
39
+ /***/ },
40
+
41
+ /***/ "./dist/browser/index.js"
42
+ /*!*******************************!*\
43
+ !*** ./dist/browser/index.js ***!
44
+ \*******************************/
45
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
46
+
47
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadLchColorPlugin: () => (/* binding */ loadLchColorPlugin)\n/* harmony export */ });\nasync function loadLchColorPlugin(engine) {\n engine.checkVersion(\"4.0.0-alpha.20\");\n await engine.register(async (e)=>{\n const { LchColorManager } = await __webpack_require__.e(/*! import() */ \"dist_browser_LchColorManager_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./LchColorManager.js */ \"./dist/browser/LchColorManager.js\"));\n e.addColorManager(\"lch\", new LchColorManager());\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-lch-color/./dist/browser/index.js?\n}");
48
+
49
49
  /***/ }
50
50
 
51
51
  /******/ });
@@ -1,2 +1,2 @@
1
- /*! For license information please see tsparticles.plugin.lchColor.min.js.LICENSE.txt */
2
- !function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],r);else{var t="object"==typeof exports?r(require("@tsparticles/engine")):r(e.window);for(var o in t)("object"==typeof exports?exports:e)[o]=t[o]}}(this,(e=>(()=>{var r,t,o={303(r){r.exports=e}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var t=n[e]={exports:{}};return o[e](t,t.exports,i),t.exports}i.m=o,i.d=(e,r)=>{for(var t in r)i.o(r,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((r,t)=>(i.f[t](e,r),r)),[])),i.u=e=>e+".min.js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},t="@tsparticles/plugin-lch-color:",i.l=(e,o,n,a)=>{if(r[e])r[e].push(o);else{var l,c;if(void 0!==n)for(var s=document.getElementsByTagName("script"),p=0;p<s.length;p++){var u=s[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==t+n){l=u;break}}l||(c=!0,(l=document.createElement("script")).charset="utf-8",i.nc&&l.setAttribute("nonce",i.nc),l.setAttribute("data-webpack",t+n),l.src=e),r[e]=[o];var d=(t,o)=>{l.onerror=l.onload=null,clearTimeout(f);var n=r[e];if(delete r[e],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach((e=>e(o))),t)return t(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),c&&document.head.appendChild(l)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var r=i.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{var e={554:0};i.f.j=(r,t)=>{var o=i.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else{var n=new Promise(((t,n)=>o=e[r]=[t,n]));t.push(o[2]=n);var a=i.p+i.u(r),l=new Error;i.l(a,(t=>{if(i.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var n=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;l.message="Loading chunk "+r+" failed.\n("+n+": "+a+")",l.name="ChunkLoadError",l.type=n,l.request=a,o[1](l)}}),"chunk-"+r,r)}};var r=(r,t)=>{var o,n,[a,l,c]=t,s=0;if(a.some((r=>0!==e[r]))){for(o in l)i.o(l,o)&&(i.m[o]=l[o]);if(c)c(i)}for(r&&r(t);s<a.length;s++)n=a[s],i.o(e,n)&&e[n]&&e[n][0](),e[n]=0},t=this.webpackChunk_tsparticles_plugin_lch_color=this.webpackChunk_tsparticles_plugin_lch_color||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var a={};function l(e){e.checkVersion("4.0.0-alpha.2"),e.register((async e=>{const{LchColorManager:r}=await i.e(904).then(i.bind(i,904));e.addColorManager(new r)}))}return i.r(a),i.d(a,{loadLchColorPlugin:()=>l}),a})()));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,e=>(()=>{"use strict";var t,r,o,i={303(t){t.exports=e}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return i[e](r,r.exports,a),r.exports}a.m=i,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,r)=>(a.f[r](e,t),t),[])),a.u=e=>""+e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l={},a.l=(e,t,r,o)=>{if(l[e])return void l[e].push(t);if(void 0!==r)for(var i,n,c=document.getElementsByTagName("script"),s=0;s<c.length;s++){var p=c[s];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")=="@tsparticles/plugin-lch-color:"+r){i=p;break}}i||(n=!0,(i=document.createElement("script")).charset="utf-8",a.nc&&i.setAttribute("nonce",a.nc),i.setAttribute("data-webpack","@tsparticles/plugin-lch-color:"+r),i.src=e),l[e]=[t];var u=(t,r)=>{i.onerror=i.onload=null,clearTimeout(d);var o=l[e];if(delete l[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=u.bind(null,i.onerror),i.onload=u.bind(null,i.onload),n&&document.head.appendChild(i)},a.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(c=a.g.location+"");var l,c,s=a.g.document;if(!c&&s&&(s.currentScript&&"SCRIPT"===s.currentScript.tagName.toUpperCase()&&(c=s.currentScript.src),!c)){var p=s.getElementsByTagName("script");if(p.length)for(var u=p.length-1;u>-1&&(!c||!/^http(s?):/.test(c));)c=p[u--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");a.p=c=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={554:0},a.f.j=(e,r)=>{var o=a.o(t,e)?t[e]:void 0;if(0!==o)if(o)r.push(o[2]);else{var i=new Promise((r,i)=>o=t[e]=[r,i]);r.push(o[2]=i);var n=a.p+a.u(e),l=Error();a.l(n,r=>{if(a.o(t,e)&&(0!==(o=t[e])&&(t[e]=void 0),o)){var i=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;l.message="Loading chunk "+e+` failed.
2
+ (`+i+": "+n+")",l.name="ChunkLoadError",l.type=i,l.request=n,o[1](l)}},"chunk-"+e,e)}},r=(e,r)=>{var o,i,[n,l,c]=r,s=0;if(n.some(e=>0!==t[e])){for(o in l)a.o(l,o)&&(a.m[o]=l[o]);c&&c(a)}for(e&&e(r);s<n.length;s++)i=n[s],a.o(t,i)&&t[i]&&t[i][0](),t[i]=0},(o=this.webpackChunk_tsparticles_plugin_lch_color=this.webpackChunk_tsparticles_plugin_lch_color||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};async function f(e){e.checkVersion("4.0.0-alpha.20"),await e.register(async e=>{let{LchColorManager:t}=await a.e(912).then(a.bind(a,912));e.addColorManager("lch",new t)})}return a.r(d),a.d(d,{loadLchColorPlugin:()=>f}),d})());
@@ -1,7 +1,5 @@
1
1
  import { type IColor, type IColorManager, type IRangeColor, type IRgb, type IRgba } from "@tsparticles/engine";
2
2
  export declare class LchColorManager implements IColorManager {
3
- readonly key: string;
4
- constructor();
5
3
  accepts(input: string): boolean;
6
4
  handleColor(color: IColor): IRgb | undefined;
7
5
  handleRangeColor(color: IRangeColor): IRgb | undefined;
package/types/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import { type Engine } from "@tsparticles/engine";
2
- export declare function loadLchColorPlugin(engine: Engine): void;
2
+ export declare function loadLchColorPlugin(engine: Engine): Promise<void>;
@@ -14,22 +14,19 @@
14
14
  const utils_js_1 = require("./utils.js");
15
15
  const lchRegex = /lch\(\s*(\d+(\.\d+)?)%\s+(\d+(\.\d+)?)\s+(\d+(\.\d+)?)(?:\s*\/\s*(0|1|0?\.\d+|\d{1,3}%))?\s*\)/i;
16
16
  class LchColorManager {
17
- constructor() {
18
- this.key = "lch";
19
- }
20
17
  accepts(input) {
21
18
  return input.startsWith("lch");
22
19
  }
23
20
  handleColor(color) {
24
21
  const colorValue = color.value, lchColor = colorValue.lch ?? color.value;
25
- if (!Object.hasOwn(lchColor, "l") && !Object.hasOwn(lchColor, "c") && !Object.hasOwn(lchColor, "h")) {
22
+ if (!Object.hasOwn(lchColor, "l") || !Object.hasOwn(lchColor, "c") || !Object.hasOwn(lchColor, "h")) {
26
23
  return;
27
24
  }
28
25
  return (0, utils_js_1.lchToRgb)(lchColor);
29
26
  }
30
27
  handleRangeColor(color) {
31
28
  const colorValue = color.value, lchColor = colorValue.lch ?? color.value;
32
- if (!Object.hasOwn(lchColor, "l") && !Object.hasOwn(lchColor, "c") && !Object.hasOwn(lchColor, "h")) {
29
+ if (!Object.hasOwn(lchColor, "l") || !Object.hasOwn(lchColor, "c") || !Object.hasOwn(lchColor, "h")) {
33
30
  return;
34
31
  }
35
32
  return (0, utils_js_1.lchToRgb)({
package/umd/index.js CHANGED
@@ -44,11 +44,11 @@ var __importStar = (this && this.__importStar) || (function () {
44
44
  var __syncRequire = typeof module === "object" && typeof module.exports === "object";
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.loadLchColorPlugin = loadLchColorPlugin;
47
- function loadLchColorPlugin(engine) {
48
- engine.checkVersion("4.0.0-alpha.2");
49
- engine.register(async (e) => {
47
+ async function loadLchColorPlugin(engine) {
48
+ engine.checkVersion("4.0.0-alpha.20");
49
+ await engine.register(async (e) => {
50
50
  const { LchColorManager } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./LchColorManager.js"))) : new Promise((resolve_1, reject_1) => { require(["./LchColorManager.js"], resolve_1, reject_1); }).then(__importStar));
51
- e.addColorManager(new LchColorManager());
51
+ e.addColorManager("lch", new LchColorManager());
52
52
  });
53
53
  }
54
54
  });
package/904.min.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 904.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_plugin_lch_color=this.webpackChunk_tsparticles_plugin_lch_color||[]).push([[904],{904(a,e,t){t.d(e,{LchColorManager:()=>k});var c=t(303);const s=255,r=.95047,l=1,n=1.08883,h=216/24389,o=24389/27,u=16,i=116,p=500,d=200,g={x:3.2404542,y:-1.5371385,z:-.4985314},O={x:-.969266,y:1.8760108,z:.041556},b={x:.0556434,y:-.2040259,z:1.0572252},v=2.4,w=.0031308,_=12.92,x=1.055,y=.055;function j(a){const e=a.l,t=a.c,j=(0,c.degToRad)(a.h),z=t*Math.cos(j),k=t*Math.sin(j),C=(e+u)/i,M=C+z/p,R=C-k/d,f=M**3,F=R**3,V=(f>h?f:(i*M-u)/o)*r,m=(e>o*h?C**3:e/o)*l,A=(F>h?F:(i*R-u)/o)*n,L=g.x*V+g.y*m+g.z*A,N=O.x*V+O.y*m+O.z*A,S=b.x*V+b.y*m+b.z*A,T=a=>{return Math.round((0,c.clamp)((e=a)<=w?_*e:x*Math.pow(e,c.inverseFactorNumerator/v)-y,0,1)*s);var e};return{r:T(L),g:T(N),b:T(S)}}const z=/lch\(\s*(\d+(\.\d+)?)%\s+(\d+(\.\d+)?)\s+(\d+(\.\d+)?)(?:\s*\/\s*(0|1|0?\.\d+|\d{1,3}%))?\s*\)/i;class k{constructor(){this.key="lch"}accepts(a){return a.startsWith("lch")}handleColor(a){const e=a.value.lch??a.value;if(Object.hasOwn(e,"l")||Object.hasOwn(e,"c")||Object.hasOwn(e,"h"))return j(e)}handleRangeColor(a){const e=a.value.lch??a.value;if(Object.hasOwn(e,"l")||Object.hasOwn(e,"c")||Object.hasOwn(e,"h"))return j({l:(0,c.getRangeValue)(e.l),c:(0,c.getRangeValue)(e.c),h:(0,c.getRangeValue)(e.h)})}parseString(a){if(!this.accepts(a))return;const e=z.exec(a),t=1,s=3,r=5,l=7;return e?{a:(n={a:e[l]?(0,c.parseAlpha)(e[l]):1,c:parseFloat(e[s]??"0"),h:parseFloat(e[r]??"0"),l:parseFloat(e[t]??"0")}).a,...j(n)}:void 0;var n}}}}]);
@@ -1 +0,0 @@
1
- /*! tsParticles LCH Color Plugin v4.0.0-alpha.2 by Matteo Bruni */
@@ -1 +0,0 @@
1
- /*! tsParticles LCH Color Plugin v4.0.0-alpha.2 by Matteo Bruni */