@tsparticles/engine 3.0.0-beta.4 → 3.0.0-beta.5

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.
@@ -51,7 +51,7 @@ export class Engine {
51
51
  return res;
52
52
  }
53
53
  get version() {
54
- return "3.0.0-beta.4";
54
+ return "3.0.0-beta.5";
55
55
  }
56
56
  addConfig(config) {
57
57
  const name = config.name ?? "default";
@@ -159,7 +159,8 @@ export class Particle {
159
159
  this.destroyed = true;
160
160
  this.bubble.inRange = false;
161
161
  this.slow.inRange = false;
162
- const container = this.container, pathGenerator = this.pathGenerator;
162
+ const container = this.container, pathGenerator = this.pathGenerator, shapeDrawer = container.shapeDrawers.get(this.shape);
163
+ shapeDrawer && shapeDrawer.particleDestroy && shapeDrawer.particleDestroy(this);
163
164
  for (const [, plugin] of container.plugins) {
164
165
  plugin.particleDestroyed && plugin.particleDestroyed(this, override);
165
166
  }
@@ -1,8 +1,8 @@
1
- import { executeOnSingleOrMultiple, isBoolean } from "../../../../Utils/Utils.js";
2
1
  import { ClickEvent } from "./ClickEvent.js";
3
2
  import { DivEvent } from "./DivEvent.js";
4
3
  import { HoverEvent } from "./HoverEvent.js";
5
4
  import { ResizeEvent } from "./ResizeEvent.js";
5
+ import { executeOnSingleOrMultiple } from "../../../../Utils/Utils.js";
6
6
  export class Events {
7
7
  constructor() {
8
8
  this.onClick = new ClickEvent();
@@ -24,11 +24,6 @@ export class Events {
24
24
  });
25
25
  }
26
26
  this.onHover.load(data.onHover);
27
- if (isBoolean(data.resize)) {
28
- this.resize.enable = data.resize;
29
- }
30
- else {
31
- this.resize.load(data.resize);
32
- }
27
+ this.resize.load(data.resize);
33
28
  }
34
29
  }
@@ -35,23 +35,26 @@ export class ParticlesOptions {
35
35
  if (!data) {
36
36
  return;
37
37
  }
38
- this.bounce.load(data.bounce);
39
- this.color.load(AnimatableColor.create(this.color, data.color));
40
- this.effect.load(data.effect);
41
38
  if (data.groups !== undefined) {
42
- for (const group in data.groups) {
39
+ for (const group of Object.keys(data.groups)) {
40
+ if (!Object.hasOwn(data.groups, group)) {
41
+ continue;
42
+ }
43
43
  const item = data.groups[group];
44
44
  if (item !== undefined) {
45
45
  this.groups[group] = deepExtend(this.groups[group] ?? {}, item);
46
46
  }
47
47
  }
48
48
  }
49
- this.move.load(data.move);
50
- this.number.load(data.number);
51
- this.opacity.load(data.opacity);
52
49
  if (data.reduceDuplicates !== undefined) {
53
50
  this.reduceDuplicates = data.reduceDuplicates;
54
51
  }
52
+ this.bounce.load(data.bounce);
53
+ this.color.load(AnimatableColor.create(this.color, data.color));
54
+ this.effect.load(data.effect);
55
+ this.move.load(data.move);
56
+ this.number.load(data.number);
57
+ this.opacity.load(data.opacity);
55
58
  this.shape.load(data.shape);
56
59
  this.size.load(data.size);
57
60
  this.shadow.load(data.shadow);
@@ -54,7 +54,7 @@ class Engine {
54
54
  return res;
55
55
  }
56
56
  get version() {
57
- return "3.0.0-beta.4";
57
+ return "3.0.0-beta.5";
58
58
  }
59
59
  addConfig(config) {
60
60
  const name = config.name ?? "default";
@@ -162,7 +162,8 @@ class Particle {
162
162
  this.destroyed = true;
163
163
  this.bubble.inRange = false;
164
164
  this.slow.inRange = false;
165
- const container = this.container, pathGenerator = this.pathGenerator;
165
+ const container = this.container, pathGenerator = this.pathGenerator, shapeDrawer = container.shapeDrawers.get(this.shape);
166
+ shapeDrawer && shapeDrawer.particleDestroy && shapeDrawer.particleDestroy(this);
166
167
  for (const [, plugin] of container.plugins) {
167
168
  plugin.particleDestroyed && plugin.particleDestroyed(this, override);
168
169
  }
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Events = void 0;
4
- const Utils_js_1 = require("../../../../Utils/Utils.js");
5
4
  const ClickEvent_js_1 = require("./ClickEvent.js");
6
5
  const DivEvent_js_1 = require("./DivEvent.js");
7
6
  const HoverEvent_js_1 = require("./HoverEvent.js");
8
7
  const ResizeEvent_js_1 = require("./ResizeEvent.js");
8
+ const Utils_js_1 = require("../../../../Utils/Utils.js");
9
9
  class Events {
10
10
  constructor() {
11
11
  this.onClick = new ClickEvent_js_1.ClickEvent();
@@ -27,12 +27,7 @@ class Events {
27
27
  });
28
28
  }
29
29
  this.onHover.load(data.onHover);
30
- if ((0, Utils_js_1.isBoolean)(data.resize)) {
31
- this.resize.enable = data.resize;
32
- }
33
- else {
34
- this.resize.load(data.resize);
35
- }
30
+ this.resize.load(data.resize);
36
31
  }
37
32
  }
38
33
  exports.Events = Events;
@@ -38,23 +38,26 @@ class ParticlesOptions {
38
38
  if (!data) {
39
39
  return;
40
40
  }
41
- this.bounce.load(data.bounce);
42
- this.color.load(AnimatableColor_js_1.AnimatableColor.create(this.color, data.color));
43
- this.effect.load(data.effect);
44
41
  if (data.groups !== undefined) {
45
- for (const group in data.groups) {
42
+ for (const group of Object.keys(data.groups)) {
43
+ if (!Object.hasOwn(data.groups, group)) {
44
+ continue;
45
+ }
46
46
  const item = data.groups[group];
47
47
  if (item !== undefined) {
48
48
  this.groups[group] = (0, Utils_js_1.deepExtend)(this.groups[group] ?? {}, item);
49
49
  }
50
50
  }
51
51
  }
52
- this.move.load(data.move);
53
- this.number.load(data.number);
54
- this.opacity.load(data.opacity);
55
52
  if (data.reduceDuplicates !== undefined) {
56
53
  this.reduceDuplicates = data.reduceDuplicates;
57
54
  }
55
+ this.bounce.load(data.bounce);
56
+ this.color.load(AnimatableColor_js_1.AnimatableColor.create(this.color, data.color));
57
+ this.effect.load(data.effect);
58
+ this.move.load(data.move);
59
+ this.number.load(data.number);
60
+ this.opacity.load(data.opacity);
58
61
  this.shape.load(data.shape);
59
62
  this.size.load(data.size);
60
63
  this.shadow.load(data.shadow);
@@ -51,7 +51,7 @@ export class Engine {
51
51
  return res;
52
52
  }
53
53
  get version() {
54
- return "3.0.0-beta.4";
54
+ return "3.0.0-beta.5";
55
55
  }
56
56
  addConfig(config) {
57
57
  const name = config.name ?? "default";
@@ -159,7 +159,8 @@ export class Particle {
159
159
  this.destroyed = true;
160
160
  this.bubble.inRange = false;
161
161
  this.slow.inRange = false;
162
- const container = this.container, pathGenerator = this.pathGenerator;
162
+ const container = this.container, pathGenerator = this.pathGenerator, shapeDrawer = container.shapeDrawers.get(this.shape);
163
+ shapeDrawer && shapeDrawer.particleDestroy && shapeDrawer.particleDestroy(this);
163
164
  for (const [, plugin] of container.plugins) {
164
165
  plugin.particleDestroyed && plugin.particleDestroyed(this, override);
165
166
  }
@@ -1,8 +1,8 @@
1
- import { executeOnSingleOrMultiple, isBoolean } from "../../../../Utils/Utils.js";
2
1
  import { ClickEvent } from "./ClickEvent.js";
3
2
  import { DivEvent } from "./DivEvent.js";
4
3
  import { HoverEvent } from "./HoverEvent.js";
5
4
  import { ResizeEvent } from "./ResizeEvent.js";
5
+ import { executeOnSingleOrMultiple } from "../../../../Utils/Utils.js";
6
6
  export class Events {
7
7
  constructor() {
8
8
  this.onClick = new ClickEvent();
@@ -24,11 +24,6 @@ export class Events {
24
24
  });
25
25
  }
26
26
  this.onHover.load(data.onHover);
27
- if (isBoolean(data.resize)) {
28
- this.resize.enable = data.resize;
29
- }
30
- else {
31
- this.resize.load(data.resize);
32
- }
27
+ this.resize.load(data.resize);
33
28
  }
34
29
  }
@@ -35,23 +35,26 @@ export class ParticlesOptions {
35
35
  if (!data) {
36
36
  return;
37
37
  }
38
- this.bounce.load(data.bounce);
39
- this.color.load(AnimatableColor.create(this.color, data.color));
40
- this.effect.load(data.effect);
41
38
  if (data.groups !== undefined) {
42
- for (const group in data.groups) {
39
+ for (const group of Object.keys(data.groups)) {
40
+ if (!Object.hasOwn(data.groups, group)) {
41
+ continue;
42
+ }
43
43
  const item = data.groups[group];
44
44
  if (item !== undefined) {
45
45
  this.groups[group] = deepExtend(this.groups[group] ?? {}, item);
46
46
  }
47
47
  }
48
48
  }
49
- this.move.load(data.move);
50
- this.number.load(data.number);
51
- this.opacity.load(data.opacity);
52
49
  if (data.reduceDuplicates !== undefined) {
53
50
  this.reduceDuplicates = data.reduceDuplicates;
54
51
  }
52
+ this.bounce.load(data.bounce);
53
+ this.color.load(AnimatableColor.create(this.color, data.color));
54
+ this.effect.load(data.effect);
55
+ this.move.load(data.move);
56
+ this.number.load(data.number);
57
+ this.opacity.load(data.opacity);
55
58
  this.shape.load(data.shape);
56
59
  this.size.load(data.size);
57
60
  this.shadow.load(data.shadow);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/engine",
3
- "version": "3.0.0-beta.4",
3
+ "version": "3.0.0-beta.5",
4
4
  "description": "Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.",
5
5
  "homepage": "https://particles.js.org",
6
6
  "scripts": {