@tsparticles/plugin-infection 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.
Files changed (49) hide show
  1. package/202.min.js +1 -0
  2. package/901.min.js +1 -0
  3. package/926.min.js +1 -0
  4. package/README.md +5 -0
  5. package/browser/Infecter.js +22 -21
  6. package/browser/InfectionPlugin.js +5 -7
  7. package/browser/{InfectionInstance.js → InfectionPluginInstance.js} +3 -3
  8. package/browser/Options/Classes/Infection.js +5 -0
  9. package/browser/Options/Classes/InfectionStage.js +5 -0
  10. package/browser/ParticlesInfecter.js +4 -3
  11. package/browser/index.js +9 -5
  12. package/cjs/Infecter.js +22 -21
  13. package/cjs/InfectionPlugin.js +5 -7
  14. package/cjs/{InfectionInstance.js → InfectionPluginInstance.js} +3 -3
  15. package/cjs/Options/Classes/Infection.js +5 -0
  16. package/cjs/Options/Classes/InfectionStage.js +5 -0
  17. package/cjs/ParticlesInfecter.js +4 -3
  18. package/cjs/index.js +9 -5
  19. package/dist_browser_InfectionPluginInstance_js.js +40 -0
  20. package/dist_browser_InfectionPlugin_js.js +4 -24
  21. package/dist_browser_ParticlesInfecter_js.js +2 -2
  22. package/esm/Infecter.js +22 -21
  23. package/esm/InfectionPlugin.js +5 -7
  24. package/esm/{InfectionInstance.js → InfectionPluginInstance.js} +3 -3
  25. package/esm/Options/Classes/Infection.js +5 -0
  26. package/esm/Options/Classes/InfectionStage.js +5 -0
  27. package/esm/ParticlesInfecter.js +4 -3
  28. package/esm/index.js +9 -5
  29. package/package.json +3 -2
  30. package/report.html +3 -3
  31. package/tsparticles.plugin.infection.js +55 -15
  32. package/tsparticles.plugin.infection.min.js +2 -2
  33. package/types/InfectionPlugin.d.ts +4 -6
  34. package/types/{InfectionInstance.d.ts → InfectionPluginInstance.d.ts} +1 -1
  35. package/types/ParticlesInfecter.d.ts +3 -2
  36. package/types/Types.d.ts +5 -4
  37. package/types/index.d.ts +1 -1
  38. package/umd/Infecter.js +22 -21
  39. package/umd/InfectionPlugin.js +40 -8
  40. package/umd/{InfectionInstance.js → InfectionPluginInstance.js} +5 -5
  41. package/umd/Options/Classes/Infection.js +5 -0
  42. package/umd/Options/Classes/InfectionStage.js +5 -0
  43. package/umd/ParticlesInfecter.js +6 -5
  44. package/umd/index.js +10 -6
  45. package/492.min.js +0 -2
  46. package/492.min.js.LICENSE.txt +0 -1
  47. package/796.min.js +0 -2
  48. package/796.min.js.LICENSE.txt +0 -1
  49. package/tsparticles.plugin.infection.min.js.LICENSE.txt +0 -1
@@ -1,7 +1,8 @@
1
1
  import { itemFromArray } from "@tsparticles/engine";
2
2
  import { Infecter } from "./Infecter.js";
3
3
  const minStage = 0;
4
- export class InfectionInstance {
4
+ export class InfectionPluginInstance {
5
+ _container;
5
6
  constructor(container) {
6
7
  this._container = container;
7
8
  this._container.infecter = new Infecter(this._container);
@@ -27,8 +28,7 @@ export class InfectionInstance {
27
28
  const infP = p;
28
29
  infP.infection ??= {};
29
30
  return infP.infection.stage === undefined;
30
- });
31
- const infected = itemFromArray(notInfected);
31
+ }), infected = itemFromArray(notInfected);
32
32
  if (!infected) {
33
33
  continue;
34
34
  }
@@ -1,6 +1,11 @@
1
1
  import { isNull } from "@tsparticles/engine";
2
2
  import { InfectionStage } from "./InfectionStage.js";
3
3
  export class Infection {
4
+ cure;
5
+ delay;
6
+ enable;
7
+ infections;
8
+ stages;
4
9
  constructor() {
5
10
  this.cure = false;
6
11
  this.delay = 0;
@@ -1,5 +1,10 @@
1
1
  import { OptionsColor, isNull } from "@tsparticles/engine";
2
2
  export class InfectionStage {
3
+ color;
4
+ duration;
5
+ infectedStage;
6
+ radius;
7
+ rate;
3
8
  constructor() {
4
9
  this.color = new OptionsColor();
5
10
  this.color.value = "#ff0000";
@@ -1,5 +1,6 @@
1
- import { ParticlesInteractorBase, getRandom } from "@tsparticles/engine";
2
- const minStagesCount = 1, double = 2;
1
+ import { double, getRandom } from "@tsparticles/engine";
2
+ import { ParticlesInteractorBase } from "@tsparticles/plugin-interactivity";
3
+ const minStagesCount = 1;
3
4
  export class ParticlesInfecter extends ParticlesInteractorBase {
4
5
  constructor(container) {
5
6
  super(container);
@@ -8,7 +9,7 @@ export class ParticlesInfecter extends ParticlesInteractorBase {
8
9
  }
9
10
  init() {
10
11
  }
11
- interact(p1, delta) {
12
+ interact(p1, _interactivityData, delta) {
12
13
  const infecter = this.container.infecter;
13
14
  if (!infecter) {
14
15
  return;
package/esm/index.js CHANGED
@@ -1,9 +1,13 @@
1
- export function loadInfectionPlugin(engine) {
2
- engine.checkVersion("4.0.0-alpha.2");
3
- engine.register(async (e) => {
4
- const { InfectionPlugin } = await import("./InfectionPlugin.js");
1
+ export async function loadInfectionPlugin(engine) {
2
+ engine.checkVersion("4.0.0-alpha.20");
3
+ await engine.register(async (e) => {
4
+ const [{ ensureInteractivityPluginLoaded }, { InfectionPlugin },] = await Promise.all([
5
+ import("@tsparticles/plugin-interactivity"),
6
+ import("./InfectionPlugin.js"),
7
+ ]);
8
+ ensureInteractivityPluginLoaded(e);
5
9
  e.addPlugin(new InfectionPlugin());
6
- e.addInteractor("particlesInfection", async (container) => {
10
+ e.addInteractor?.("particlesInfection", async (container) => {
7
11
  const { ParticlesInfecter } = await import("./ParticlesInfecter.js");
8
12
  return new ParticlesInfecter(container);
9
13
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/plugin-infection",
3
- "version": "4.0.0-alpha.2",
3
+ "version": "4.0.0-alpha.20",
4
4
  "description": "tsParticles infection plugin",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -100,7 +100,8 @@
100
100
  "./package.json": "./package.json"
101
101
  },
102
102
  "dependencies": {
103
- "@tsparticles/engine": "4.0.0-alpha.2"
103
+ "@tsparticles/engine": "4.0.0-alpha.20",
104
+ "@tsparticles/plugin-interactivity": "4.0.0-alpha.20"
104
105
  },
105
106
  "publishConfig": {
106
107
  "access": "public"