@tsparticles/preset-fireworks 3.0.0 → 3.0.1

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/browser/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- import { loadFireworksPreset } from ".";
1
+ import { loadFireworksPreset } from "./index.js";
2
2
  import { tsParticles } from "@tsparticles/engine";
3
- loadFireworksPreset(tsParticles);
3
+ void loadFireworksPreset(tsParticles);
4
4
  export { loadFireworksPreset, tsParticles };
package/browser/index.js CHANGED
@@ -7,7 +7,7 @@ import { loadLineShape } from "@tsparticles/shape-line";
7
7
  import { loadRotateUpdater } from "@tsparticles/updater-rotate";
8
8
  import { loadSoundsPlugin } from "@tsparticles/plugin-sounds";
9
9
  import { loadStrokeColorUpdater } from "@tsparticles/updater-stroke-color";
10
- import { options } from "./options";
10
+ import { options } from "./options.js";
11
11
  export async function loadFireworksPreset(engine, refresh = true) {
12
12
  await loadBasic(engine, false);
13
13
  await loadEmittersPlugin(engine, false);
@@ -4,14 +4,14 @@ const explodeSoundCheck = (args) => {
4
4
  return data.particle.shape === "line";
5
5
  };
6
6
  const fixRange = (value, min, max) => {
7
- const diffSMax = value.max > max ? value.max - max : 0;
7
+ const minValue = 0, diffSMax = value.max > max ? value.max - max : minValue;
8
8
  let res = setRangeValue(value);
9
9
  if (diffSMax) {
10
10
  res = setRangeValue(value.min - diffSMax, max);
11
11
  }
12
- const diffSMin = value.min < min ? value.min : 0;
12
+ const diffSMin = value.min < min ? value.min : minValue;
13
13
  if (diffSMin) {
14
- res = setRangeValue(0, value.max + diffSMin);
14
+ res = setRangeValue(minValue, value.max + diffSMin);
15
15
  }
16
16
  return res;
17
17
  };
@@ -21,7 +21,13 @@ const fireworksOptions = ["#ff595e", "#ffca3a", "#8ac926", "#1982c4", "#6a4c93"]
21
21
  if (!rgb) {
22
22
  return undefined;
23
23
  }
24
- const hsl = rgbToHsl(rgb), sRange = fixRange({ min: hsl.s - 30, max: hsl.s + 30 }, 0, 100), lRange = fixRange({ min: hsl.l - 30, max: hsl.l + 30 }, 0, 100);
24
+ const hsl = rgbToHsl(rgb), sOffset = 30, lOffset = 30, sBounds = {
25
+ min: 0,
26
+ max: 100,
27
+ }, lBounds = {
28
+ min: 0,
29
+ max: 100,
30
+ }, sRange = fixRange({ min: hsl.s - sOffset, max: hsl.s + sOffset }, sBounds.min, sBounds.max), lRange = fixRange({ min: hsl.l - lOffset, max: hsl.l + lOffset }, lBounds.min, lBounds.max);
25
31
  return {
26
32
  color: {
27
33
  value: {
package/cjs/bundle.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tsParticles = exports.loadFireworksPreset = void 0;
4
- const _1 = require(".");
5
- Object.defineProperty(exports, "loadFireworksPreset", { enumerable: true, get: function () { return _1.loadFireworksPreset; } });
4
+ const index_js_1 = require("./index.js");
5
+ Object.defineProperty(exports, "loadFireworksPreset", { enumerable: true, get: function () { return index_js_1.loadFireworksPreset; } });
6
6
  const engine_1 = require("@tsparticles/engine");
7
7
  Object.defineProperty(exports, "tsParticles", { enumerable: true, get: function () { return engine_1.tsParticles; } });
8
- (0, _1.loadFireworksPreset)(engine_1.tsParticles);
8
+ void (0, index_js_1.loadFireworksPreset)(engine_1.tsParticles);
package/cjs/index.js CHANGED
@@ -10,7 +10,7 @@ const shape_line_1 = require("@tsparticles/shape-line");
10
10
  const updater_rotate_1 = require("@tsparticles/updater-rotate");
11
11
  const plugin_sounds_1 = require("@tsparticles/plugin-sounds");
12
12
  const updater_stroke_color_1 = require("@tsparticles/updater-stroke-color");
13
- const options_1 = require("./options");
13
+ const options_js_1 = require("./options.js");
14
14
  async function loadFireworksPreset(engine, refresh = true) {
15
15
  await (0, basic_1.loadBasic)(engine, false);
16
16
  await (0, plugin_emitters_1.loadEmittersPlugin)(engine, false);
@@ -21,6 +21,6 @@ async function loadFireworksPreset(engine, refresh = true) {
21
21
  await (0, updater_destroy_1.loadDestroyUpdater)(engine, false);
22
22
  await (0, updater_life_1.loadLifeUpdater)(engine, false);
23
23
  await (0, updater_stroke_color_1.loadStrokeColorUpdater)(engine, false);
24
- await engine.addPreset("fireworks", options_1.options, refresh);
24
+ await engine.addPreset("fireworks", options_js_1.options, refresh);
25
25
  }
26
26
  exports.loadFireworksPreset = loadFireworksPreset;
package/cjs/options.js CHANGED
@@ -7,14 +7,14 @@ const explodeSoundCheck = (args) => {
7
7
  return data.particle.shape === "line";
8
8
  };
9
9
  const fixRange = (value, min, max) => {
10
- const diffSMax = value.max > max ? value.max - max : 0;
10
+ const minValue = 0, diffSMax = value.max > max ? value.max - max : minValue;
11
11
  let res = (0, engine_1.setRangeValue)(value);
12
12
  if (diffSMax) {
13
13
  res = (0, engine_1.setRangeValue)(value.min - diffSMax, max);
14
14
  }
15
- const diffSMin = value.min < min ? value.min : 0;
15
+ const diffSMin = value.min < min ? value.min : minValue;
16
16
  if (diffSMin) {
17
- res = (0, engine_1.setRangeValue)(0, value.max + diffSMin);
17
+ res = (0, engine_1.setRangeValue)(minValue, value.max + diffSMin);
18
18
  }
19
19
  return res;
20
20
  };
@@ -24,7 +24,13 @@ const fireworksOptions = ["#ff595e", "#ffca3a", "#8ac926", "#1982c4", "#6a4c93"]
24
24
  if (!rgb) {
25
25
  return undefined;
26
26
  }
27
- const hsl = (0, engine_1.rgbToHsl)(rgb), sRange = fixRange({ min: hsl.s - 30, max: hsl.s + 30 }, 0, 100), lRange = fixRange({ min: hsl.l - 30, max: hsl.l + 30 }, 0, 100);
27
+ const hsl = (0, engine_1.rgbToHsl)(rgb), sOffset = 30, lOffset = 30, sBounds = {
28
+ min: 0,
29
+ max: 100,
30
+ }, lBounds = {
31
+ min: 0,
32
+ max: 100,
33
+ }, sRange = fixRange({ min: hsl.s - sOffset, max: hsl.s + sOffset }, sBounds.min, sBounds.max), lRange = fixRange({ min: hsl.l - lOffset, max: hsl.l + lOffset }, lBounds.min, lBounds.max);
28
34
  return {
29
35
  color: {
30
36
  value: {
package/esm/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- import { loadFireworksPreset } from ".";
1
+ import { loadFireworksPreset } from "./index.js";
2
2
  import { tsParticles } from "@tsparticles/engine";
3
- loadFireworksPreset(tsParticles);
3
+ void loadFireworksPreset(tsParticles);
4
4
  export { loadFireworksPreset, tsParticles };
package/esm/index.js CHANGED
@@ -7,7 +7,7 @@ import { loadLineShape } from "@tsparticles/shape-line";
7
7
  import { loadRotateUpdater } from "@tsparticles/updater-rotate";
8
8
  import { loadSoundsPlugin } from "@tsparticles/plugin-sounds";
9
9
  import { loadStrokeColorUpdater } from "@tsparticles/updater-stroke-color";
10
- import { options } from "./options";
10
+ import { options } from "./options.js";
11
11
  export async function loadFireworksPreset(engine, refresh = true) {
12
12
  await loadBasic(engine, false);
13
13
  await loadEmittersPlugin(engine, false);
package/esm/options.js CHANGED
@@ -4,14 +4,14 @@ const explodeSoundCheck = (args) => {
4
4
  return data.particle.shape === "line";
5
5
  };
6
6
  const fixRange = (value, min, max) => {
7
- const diffSMax = value.max > max ? value.max - max : 0;
7
+ const minValue = 0, diffSMax = value.max > max ? value.max - max : minValue;
8
8
  let res = setRangeValue(value);
9
9
  if (diffSMax) {
10
10
  res = setRangeValue(value.min - diffSMax, max);
11
11
  }
12
- const diffSMin = value.min < min ? value.min : 0;
12
+ const diffSMin = value.min < min ? value.min : minValue;
13
13
  if (diffSMin) {
14
- res = setRangeValue(0, value.max + diffSMin);
14
+ res = setRangeValue(minValue, value.max + diffSMin);
15
15
  }
16
16
  return res;
17
17
  };
@@ -21,7 +21,13 @@ const fireworksOptions = ["#ff595e", "#ffca3a", "#8ac926", "#1982c4", "#6a4c93"]
21
21
  if (!rgb) {
22
22
  return undefined;
23
23
  }
24
- const hsl = rgbToHsl(rgb), sRange = fixRange({ min: hsl.s - 30, max: hsl.s + 30 }, 0, 100), lRange = fixRange({ min: hsl.l - 30, max: hsl.l + 30 }, 0, 100);
24
+ const hsl = rgbToHsl(rgb), sOffset = 30, lOffset = 30, sBounds = {
25
+ min: 0,
26
+ max: 100,
27
+ }, lBounds = {
28
+ min: 0,
29
+ max: 100,
30
+ }, sRange = fixRange({ min: hsl.s - sOffset, max: hsl.s + sOffset }, sBounds.min, sBounds.max), lRange = fixRange({ min: hsl.l - lOffset, max: hsl.l + lOffset }, lBounds.min, lBounds.max);
25
31
  return {
26
32
  color: {
27
33
  value: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/preset-fireworks",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "tsParticles fireworks preset",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {