@tsparticles/interaction-particles-repulse 4.0.0-beta.0 → 4.0.0-beta.10

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.
@@ -1 +1 @@
1
- "use strict";(this.webpackChunk_tsparticles_interaction_particles_repulse=this.webpackChunk_tsparticles_interaction_particles_repulse||[]).push([[794],{794(e,t,s){s.d(t,{Repulser:()=>n});var i=s(702),a=s(303);class r extends a.ValueWithRandom{distance;duration;enabled;factor;speed;constructor(){super(),this.enabled=!1,this.distance=1,this.duration=1,this.factor=1,this.speed=1}load(e){super.load(e),(0,a.isNull)(e)||(void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.distance&&(this.distance=(0,a.setRangeValue)(e.distance)),void 0!==e.duration&&(this.duration=(0,a.setRangeValue)(e.duration)),void 0!==e.factor&&(this.factor=(0,a.setRangeValue)(e.factor)),void 0!==e.speed&&(this.speed=(0,a.setRangeValue)(e.speed)))}}class n extends i.ParticlesInteractorBase{_maxDistance;_normVec;_velocityVec;constructor(e){super(e),this._maxDistance=0,this._normVec=a.Vector.origin,this._velocityVec=a.Vector.origin}get maxDistance(){return this._maxDistance}clear(){}init(){}interact(e){let t=this.container;if(!e.repulse){let s=e.options.repulse;if(!s)return;let i=(0,a.getRangeValue)(s.distance);i>this.maxDistance&&(this._maxDistance=i),e.repulse={distance:i*t.retina.pixelRatio,speed:(0,a.getRangeValue)(s.speed),factor:(0,a.getRangeValue)(s.factor)}}let s=e.getPosition(),i=t.particles.grid.queryCircle(s,e.repulse.distance),r=1/e.repulse.distance;for(let t of i){if(e===t||t.destroyed)continue;let i=t.getPosition(),{dx:n,dy:o,distance:c}=(0,a.getDistances)(i,s),l=1/c,d=e.repulse.speed*e.repulse.factor;if(c>0){let e=(0,a.clamp)((1-Math.pow(c*r,2))*d,0,d)*l;this._normVec.x=n*e,this._normVec.y=o*e,t.position.addTo(this._normVec)}else this._velocityVec.x=d,this._velocityVec.y=d,t.position.addTo(this._velocityVec)}}isEnabled(e){return e.options.repulse?.enabled??!1}loadParticlesOptions(e,...t){for(let s of(e.repulse??=new r,t))e.repulse.load(s?.repulse)}reset(){}}}}]);
1
+ "use strict";(this.webpackChunk_tsparticles_interaction_particles_repulse=this.webpackChunk_tsparticles_interaction_particles_repulse||[]).push([[817],{817(e,t,s){s.d(t,{Repulser:()=>n});var i=s(702),a=s(303);class r extends a.ValueWithRandom{distance;duration;enabled;factor;speed;constructor(){super(),this.enabled=!1,this.distance=1,this.duration=1,this.factor=1,this.speed=1}load(e){super.load(e),(0,a.isNull)(e)||(void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.distance&&(this.distance=(0,a.setRangeValue)(e.distance)),void 0!==e.duration&&(this.duration=(0,a.setRangeValue)(e.duration)),void 0!==e.factor&&(this.factor=(0,a.setRangeValue)(e.factor)),void 0!==e.speed&&(this.speed=(0,a.setRangeValue)(e.speed)))}}class n extends i.ParticlesInteractorBase{_maxDistance;_normVec;_velocityVec;constructor(e){super(e),this._maxDistance=0,this._normVec=a.Vector.origin,this._velocityVec=a.Vector.origin}get maxDistance(){return this._maxDistance}clear(){}init(){}interact(e){let t=this.container;if(!e.repulse){let s=e.options.repulse;if(!s)return;let i=(0,a.getRangeValue)(s.distance);i>this.maxDistance&&(this._maxDistance=i),e.repulse={distance:i*t.retina.pixelRatio,speed:(0,a.getRangeValue)(s.speed),factor:(0,a.getRangeValue)(s.factor)}}let s=e.getPosition(),i=t.particles.grid.queryCircle(s,e.repulse.distance),r=1/e.repulse.distance;for(let t of i){if(e===t||t.destroyed)continue;let i=t.getPosition(),{dx:n,dy:o,distance:c}=(0,a.getDistances)(i,s),l=1/c,d=e.repulse.speed*e.repulse.factor;if(c>0){let e=(0,a.clamp)((1-Math.pow(c*r,2))*d,0,d)*l;this._normVec.x=n*e,this._normVec.y=o*e,t.position.addTo(this._normVec)}else this._velocityVec.x=d,this._velocityVec.y=d,t.position.addTo(this._velocityVec)}}isEnabled(e){return e.options.repulse?.enabled??!1}loadParticlesOptions(e,...t){for(let s of(e.repulse??=new r,t))e.repulse.load(s?.repulse)}reset(){}}}}]);
package/README.md CHANGED
@@ -8,6 +8,12 @@
8
8
 
9
9
  [tsParticles](https://github.com/tsparticles/tsparticles) interaction plugin for repulse effect between particles.
10
10
 
11
+ ## Quick checklist
12
+
13
+ 1. Install `@tsparticles/engine` (or use the CDN bundle below)
14
+ 2. Call the package loader function(s) before `tsParticles.load(...)`
15
+ 3. Apply the package options in your `tsParticles.load(...)` config
16
+
11
17
  ## How to use it
12
18
 
13
19
  ### CDN / Vanilla JS / jQuery
@@ -78,3 +84,28 @@ import { loadParticlesRepulseInteraction } from "@tsparticles/interaction-partic
78
84
  await loadParticlesRepulseInteraction(tsParticles);
79
85
  })();
80
86
  ```
87
+
88
+ ## Option mapping
89
+
90
+ - Primary options key: `particles.repulse`
91
+
92
+ ```json
93
+ {
94
+ "particles": {
95
+ "repulse": {
96
+ "enable": true
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ ## Common pitfalls
103
+
104
+ - Calling `tsParticles.load(...)` before `loadInteractivityPlugin(...)`
105
+ - Verify required peer packages before enabling advanced options
106
+ - Change one option group at a time to isolate regressions quickly
107
+
108
+ ## Related docs
109
+
110
+ - All packages catalog: <https://github.com/tsparticles/tsparticles>
111
+ - Main docs: <https://particles.js.org/docs/>
package/browser/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export async function loadParticlesRepulseInteraction(engine) {
2
- engine.checkVersion("4.0.0-beta.0");
3
- await engine.register(async (e) => {
2
+ engine.checkVersion("4.0.0-beta.10");
3
+ await engine.pluginManager.register(async (e) => {
4
4
  const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
5
5
  ensureInteractivityPluginLoaded(e);
6
- e.addInteractor?.("particlesRepulse", async (container) => {
6
+ e.pluginManager.addInteractor?.("particlesRepulse", async (container) => {
7
7
  const { Repulser } = await import("./Repulser.js");
8
8
  return new Repulser(container);
9
9
  });
package/cjs/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export async function loadParticlesRepulseInteraction(engine) {
2
- engine.checkVersion("4.0.0-beta.0");
3
- await engine.register(async (e) => {
2
+ engine.checkVersion("4.0.0-beta.10");
3
+ await engine.pluginManager.register(async (e) => {
4
4
  const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
5
5
  ensureInteractivityPluginLoaded(e);
6
- e.addInteractor?.("particlesRepulse", async (container) => {
6
+ e.pluginManager.addInteractor?.("particlesRepulse", async (container) => {
7
7
  const { Repulser } = await import("./Repulser.js");
8
8
  return new Repulser(container);
9
9
  });
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v4.0.0-beta.0
7
+ * v4.0.0-beta.10
8
8
  */
9
9
  "use strict";
10
10
  /*
package/esm/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export async function loadParticlesRepulseInteraction(engine) {
2
- engine.checkVersion("4.0.0-beta.0");
3
- await engine.register(async (e) => {
2
+ engine.checkVersion("4.0.0-beta.10");
3
+ await engine.pluginManager.register(async (e) => {
4
4
  const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
5
5
  ensureInteractivityPluginLoaded(e);
6
- e.addInteractor?.("particlesRepulse", async (container) => {
6
+ e.pluginManager.addInteractor?.("particlesRepulse", async (container) => {
7
7
  const { Repulser } = await import("./Repulser.js");
8
8
  return new Repulser(container);
9
9
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/interaction-particles-repulse",
3
- "version": "4.0.0-beta.0",
3
+ "version": "4.0.0-beta.10",
4
4
  "description": "tsParticles repulse particles interaction",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -95,14 +95,13 @@
95
95
  "browser": "./browser/index.js",
96
96
  "import": "./esm/index.js",
97
97
  "require": "./cjs/index.js",
98
- "umd": "./umd/index.js",
99
- "default": "./cjs/index.js"
98
+ "default": "./esm/index.js"
100
99
  },
101
100
  "./package.json": "./package.json"
102
101
  },
103
- "dependencies": {
104
- "@tsparticles/engine": "4.0.0-beta.0",
105
- "@tsparticles/plugin-interactivity": "4.0.0-beta.0"
102
+ "peerDependencies": {
103
+ "@tsparticles/engine": "4.0.0-beta.10",
104
+ "@tsparticles/plugin-interactivity": "4.0.0-beta.10"
106
105
  },
107
106
  "publishConfig": {
108
107
  "access": "public"