@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.
- package/202.min.js +1 -0
- package/901.min.js +1 -0
- package/926.min.js +1 -0
- package/README.md +5 -0
- package/browser/Infecter.js +22 -21
- package/browser/InfectionPlugin.js +5 -7
- package/browser/{InfectionInstance.js → InfectionPluginInstance.js} +3 -3
- package/browser/Options/Classes/Infection.js +5 -0
- package/browser/Options/Classes/InfectionStage.js +5 -0
- package/browser/ParticlesInfecter.js +4 -3
- package/browser/index.js +9 -5
- package/cjs/Infecter.js +22 -21
- package/cjs/InfectionPlugin.js +5 -7
- package/cjs/{InfectionInstance.js → InfectionPluginInstance.js} +3 -3
- package/cjs/Options/Classes/Infection.js +5 -0
- package/cjs/Options/Classes/InfectionStage.js +5 -0
- package/cjs/ParticlesInfecter.js +4 -3
- package/cjs/index.js +9 -5
- package/dist_browser_InfectionPluginInstance_js.js +40 -0
- package/dist_browser_InfectionPlugin_js.js +4 -24
- package/dist_browser_ParticlesInfecter_js.js +2 -2
- package/esm/Infecter.js +22 -21
- package/esm/InfectionPlugin.js +5 -7
- package/esm/{InfectionInstance.js → InfectionPluginInstance.js} +3 -3
- package/esm/Options/Classes/Infection.js +5 -0
- package/esm/Options/Classes/InfectionStage.js +5 -0
- package/esm/ParticlesInfecter.js +4 -3
- package/esm/index.js +9 -5
- package/package.json +3 -2
- package/report.html +3 -3
- package/tsparticles.plugin.infection.js +55 -15
- package/tsparticles.plugin.infection.min.js +2 -2
- package/types/InfectionPlugin.d.ts +4 -6
- package/types/{InfectionInstance.d.ts → InfectionPluginInstance.d.ts} +1 -1
- package/types/ParticlesInfecter.d.ts +3 -2
- package/types/Types.d.ts +5 -4
- package/types/index.d.ts +1 -1
- package/umd/Infecter.js +22 -21
- package/umd/InfectionPlugin.js +40 -8
- package/umd/{InfectionInstance.js → InfectionPluginInstance.js} +5 -5
- package/umd/Options/Classes/Infection.js +5 -0
- package/umd/Options/Classes/InfectionStage.js +5 -0
- package/umd/ParticlesInfecter.js +6 -5
- package/umd/index.js +10 -6
- package/492.min.js +0 -2
- package/492.min.js.LICENSE.txt +0 -1
- package/796.min.js +0 -2
- package/796.min.js.LICENSE.txt +0 -1
- 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
|
|
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
|
}
|
package/esm/ParticlesInfecter.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
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.
|
|
3
|
-
engine.register(async (e) => {
|
|
4
|
-
const { InfectionPlugin } = await
|
|
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.
|
|
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.
|
|
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"
|