@tsparticles/updater-color 3.9.0 → 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/517.min.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 517.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_updater_color=this.webpackChunk_tsparticles_updater_color||[]).push([[517],{517(o,e,t){t.d(e,{ColorUpdater:()=>i});var n=t(303);class i{constructor(o,e){this._container=e,this._engine=o}init(o){const e=(0,n.rangeColorToHsl)(this._engine,o.options.color,o.id,o.options.reduceDuplicates);e&&(o.color=(0,n.getHslAnimationFromHsl)(e,o.options.color.animation,this._container.retina.reduceFactor))}isEnabled(o){const{h:e,s:t,l:n}=o.options.color.animation,{color:i}=o;return!o.destroyed&&!o.spawning&&(void 0!==i?.h.value&&e.enable||void 0!==i?.s.value&&t.enable||void 0!==i?.l.value&&n.enable)}update(o,e){(0,n.updateColor)(o.color,e)}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Color Updater v4.0.0-alpha.0 by Matteo Bruni */
@@ -1,6 +1,6 @@
1
1
  import { getHslAnimationFromHsl, rangeColorToHsl, updateColor, } from "@tsparticles/engine";
2
2
  export class ColorUpdater {
3
- constructor(container, engine) {
3
+ constructor(engine, container) {
4
4
  this._container = container;
5
5
  this._engine = engine;
6
6
  }
package/browser/index.js CHANGED
@@ -1,7 +1,9 @@
1
- import { ColorUpdater } from "./ColorUpdater.js";
2
- export async function loadColorUpdater(engine, refresh = true) {
3
- engine.checkVersion("3.9.0");
4
- await engine.addParticleUpdater("color", container => {
5
- return Promise.resolve(new ColorUpdater(container, engine));
6
- }, refresh);
1
+ export function loadColorUpdater(engine) {
2
+ engine.checkVersion("4.0.0-alpha.0");
3
+ engine.register(e => {
4
+ e.addParticleUpdater("color", async (container) => {
5
+ const { ColorUpdater } = await import("./ColorUpdater.js");
6
+ return new ColorUpdater(e, container);
7
+ });
8
+ });
7
9
  }
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ColorUpdater = void 0;
4
- const engine_1 = require("@tsparticles/engine");
5
- class ColorUpdater {
6
- constructor(container, engine) {
1
+ import { getHslAnimationFromHsl, rangeColorToHsl, updateColor, } from "@tsparticles/engine";
2
+ export class ColorUpdater {
3
+ constructor(engine, container) {
7
4
  this._container = container;
8
5
  this._engine = engine;
9
6
  }
10
7
  init(particle) {
11
- const hslColor = (0, engine_1.rangeColorToHsl)(this._engine, particle.options.color, particle.id, particle.options.reduceDuplicates);
8
+ const hslColor = rangeColorToHsl(this._engine, particle.options.color, particle.id, particle.options.reduceDuplicates);
12
9
  if (hslColor) {
13
- particle.color = (0, engine_1.getHslAnimationFromHsl)(hslColor, particle.options.color.animation, this._container.retina.reduceFactor);
10
+ particle.color = getHslAnimationFromHsl(hslColor, particle.options.color.animation, this._container.retina.reduceFactor);
14
11
  }
15
12
  }
16
13
  isEnabled(particle) {
@@ -22,7 +19,6 @@ class ColorUpdater {
22
19
  (color?.l.value !== undefined && lAnimation.enable)));
23
20
  }
24
21
  update(particle, delta) {
25
- (0, engine_1.updateColor)(particle.color, delta);
22
+ updateColor(particle.color, delta);
26
23
  }
27
24
  }
28
- exports.ColorUpdater = ColorUpdater;
package/cjs/index.js CHANGED
@@ -1,10 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadColorUpdater = loadColorUpdater;
4
- const ColorUpdater_js_1 = require("./ColorUpdater.js");
5
- async function loadColorUpdater(engine, refresh = true) {
6
- engine.checkVersion("3.9.0");
7
- await engine.addParticleUpdater("color", container => {
8
- return Promise.resolve(new ColorUpdater_js_1.ColorUpdater(container, engine));
9
- }, refresh);
1
+ export function loadColorUpdater(engine) {
2
+ engine.checkVersion("4.0.0-alpha.0");
3
+ engine.register(e => {
4
+ e.addParticleUpdater("color", async (container) => {
5
+ const { ColorUpdater } = await import("./ColorUpdater.js");
6
+ return new ColorUpdater(e, container);
7
+ });
8
+ });
10
9
  }
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * Author : Matteo Bruni
3
+ * MIT license: https://opensource.org/licenses/MIT
4
+ * Demo / Generator : https://particles.js.org/
5
+ * GitHub : https://www.github.com/matteobruni/tsparticles
6
+ * How to use? : Check the GitHub README
7
+ * v4.0.0-alpha.0
8
+ */
9
+ "use strict";
10
+ /*
11
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
+ * This devtool is neither made for production nor for readable output files.
13
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
14
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
+ * or disable the default devtool with "devtool: false".
16
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
+ */
18
+ (this["webpackChunk_tsparticles_updater_color"] = this["webpackChunk_tsparticles_updater_color"] || []).push([["dist_browser_ColorUpdater_js"],{
19
+
20
+ /***/ "./dist/browser/ColorUpdater.js"
21
+ /*!**************************************!*\
22
+ !*** ./dist/browser/ColorUpdater.js ***!
23
+ \**************************************/
24
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
+
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ColorUpdater: () => (/* binding */ ColorUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass ColorUpdater {\n constructor(engine, container) {\n this._container = container;\n this._engine = engine;\n }\n init(particle) {\n const hslColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToHsl)(this._engine, particle.options.color, particle.id, particle.options.reduceDuplicates);\n if (hslColor) {\n particle.color = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getHslAnimationFromHsl)(hslColor, particle.options.color.animation, this._container.retina.reduceFactor);\n }\n }\n isEnabled(particle) {\n const {\n h: hAnimation,\n s: sAnimation,\n l: lAnimation\n } = particle.options.color.animation,\n {\n color\n } = particle;\n return !particle.destroyed && !particle.spawning && (color?.h.value !== undefined && hAnimation.enable || color?.s.value !== undefined && sAnimation.enable || color?.l.value !== undefined && lAnimation.enable);\n }\n update(particle, delta) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.updateColor)(particle.color, delta);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-color/./dist/browser/ColorUpdater.js?\n}");
27
+
28
+ /***/ }
29
+
30
+ }]);
@@ -1,6 +1,6 @@
1
1
  import { getHslAnimationFromHsl, rangeColorToHsl, updateColor, } from "@tsparticles/engine";
2
2
  export class ColorUpdater {
3
- constructor(container, engine) {
3
+ constructor(engine, container) {
4
4
  this._container = container;
5
5
  this._engine = engine;
6
6
  }
package/esm/index.js CHANGED
@@ -1,7 +1,9 @@
1
- import { ColorUpdater } from "./ColorUpdater.js";
2
- export async function loadColorUpdater(engine, refresh = true) {
3
- engine.checkVersion("3.9.0");
4
- await engine.addParticleUpdater("color", container => {
5
- return Promise.resolve(new ColorUpdater(container, engine));
6
- }, refresh);
1
+ export function loadColorUpdater(engine) {
2
+ engine.checkVersion("4.0.0-alpha.0");
3
+ engine.register(e => {
4
+ e.addParticleUpdater("color", async (container) => {
5
+ const { ColorUpdater } = await import("./ColorUpdater.js");
6
+ return new ColorUpdater(e, container);
7
+ });
8
+ });
7
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/updater-color",
3
- "version": "3.9.0",
3
+ "version": "4.0.0-alpha.0",
4
4
  "description": "tsParticles particles color updater",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -87,9 +87,10 @@
87
87
  "./package.json": "./package.json"
88
88
  },
89
89
  "dependencies": {
90
- "@tsparticles/engine": "3.9.0"
90
+ "@tsparticles/engine": "4.0.0-alpha.0"
91
91
  },
92
92
  "publishConfig": {
93
93
  "access": "public"
94
- }
94
+ },
95
+ "type": "module"
95
96
  }