@tsparticles/interaction-external-pop 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.
package/430.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_interaction_external_pop=this.webpackChunk_tsparticles_interaction_external_pop||[]).push([[430],{430(t,e,i){i.d(e,{Popper:()=>s});var n=i(702),r=i(303);class s extends n.ExternalInteractorBase{handleClickMode;maxDistance=0;constructor(t){super(t),this.handleClickMode=(t,e)=>{let i=this.container;if("pop"!==t)return;let n=e.mouse.clickPosition;if(!n)return;let r=i.particles.grid.queryCircle(n,i.retina.pixelRatio);if(r.length)for(let t of r)t.destroy()}}clear(){}init(){}interact(){}isEnabled(t,e){let i=this.container.actualOptions,n=t.mouse,s=(e?.interactivity??i.interactivity)?.events;return!!s&&n.clicking&&n.inside&&!!n.position&&(0,r.isInArray)("pop",s.onClick.mode)}reset(){}}}}]);
package/README.md CHANGED
@@ -9,6 +9,12 @@
9
9
  [tsParticles](https://github.com/tsparticles/tsparticles) interaction plugin for pop effect around mouse or HTML
10
10
  elements.
11
11
 
12
+ ## Quick checklist
13
+
14
+ 1. Install `@tsparticles/engine` (or use the CDN bundle below)
15
+ 2. Call the package loader function(s) before `tsParticles.load(...)`
16
+ 3. Apply the package options in your `tsParticles.load(...)` config
17
+
12
18
  ## How to use it
13
19
 
14
20
  ### CDN / Vanilla JS / jQuery
@@ -77,3 +83,35 @@ import { loadExternalPopInteraction } from "@tsparticles/interaction-external-po
77
83
  await loadExternalPopInteraction(tsParticles);
78
84
  })();
79
85
  ```
86
+
87
+ ## Option mapping
88
+
89
+ - Event mode key: `interactivity.events.onHover.mode` or `interactivity.events.onClick.mode` with value `"pop"`
90
+ - Mode options key: `interactivity.modes.pop`
91
+
92
+ ```json
93
+ {
94
+ "interactivity": {
95
+ "events": {
96
+ "onHover": {
97
+ "enable": true,
98
+ "mode": "pop"
99
+ }
100
+ },
101
+ "modes": {
102
+ "pop": {}
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ ## Common pitfalls
109
+
110
+ - Calling `tsParticles.load(...)` before `loadInteractivityPlugin(...)`
111
+ - Verify required peer packages before enabling advanced options
112
+ - Change one option group at a time to isolate regressions quickly
113
+
114
+ ## Related docs
115
+
116
+ - All packages catalog: <https://github.com/tsparticles/tsparticles>
117
+ - Main docs: <https://particles.js.org/docs/>
package/browser/Popper.js CHANGED
@@ -20,7 +20,7 @@ export class Popper extends ExternalInteractorBase {
20
20
  return;
21
21
  }
22
22
  for (const particle of poppedParticles) {
23
- container.particles.remove(particle);
23
+ particle.destroy();
24
24
  }
25
25
  };
26
26
  }
package/browser/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export async function loadExternalPopInteraction(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?.("externalPop", async (container) => {
6
+ e.pluginManager.addInteractor?.("externalPop", async (container) => {
7
7
  const { Popper } = await import("./Popper.js");
8
8
  return new Popper(container);
9
9
  });
package/cjs/Popper.js CHANGED
@@ -20,7 +20,7 @@ export class Popper extends ExternalInteractorBase {
20
20
  return;
21
21
  }
22
22
  for (const particle of poppedParticles) {
23
- container.particles.remove(particle);
23
+ particle.destroy();
24
24
  }
25
25
  };
26
26
  }
package/cjs/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export async function loadExternalPopInteraction(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?.("externalPop", async (container) => {
6
+ e.pluginManager.addInteractor?.("externalPop", async (container) => {
7
7
  const { Popper } = await import("./Popper.js");
8
8
  return new Popper(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
  /*
@@ -23,7 +23,7 @@
23
23
  \********************************/
24
24
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
25
 
26
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Popper: () => (/* binding */ Popper)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\n\nconst popMode = \"pop\";\nclass Popper extends _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n handleClickMode;\n maxDistance = 0;\n constructor(container){\n super(container);\n this.handleClickMode = (mode, interactivityData)=>{\n const container = this.container;\n if (mode !== popMode) {\n return;\n }\n const clickPos = interactivityData.mouse.clickPosition;\n if (!clickPos) {\n return;\n }\n const poppedParticles = container.particles.grid.queryCircle(clickPos, container.retina.pixelRatio);\n if (!poppedParticles.length) {\n return;\n }\n for (const particle of poppedParticles){\n container.particles.remove(particle);\n }\n };\n }\n clear() {}\n init() {}\n interact() {}\n isEnabled(interactivityData, particle) {\n const container = this.container, options = container.actualOptions, mouse = interactivityData.mouse, events = (particle?.interactivity ?? options.interactivity)?.events;\n return !!events && mouse.clicking && mouse.inside && !!mouse.position && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.isInArray)(popMode, events.onClick.mode);\n }\n reset() {}\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-pop/./dist/browser/Popper.js?\n}");
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Popper: () => (/* binding */ Popper)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\n\nconst popMode = \"pop\";\nclass Popper extends _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n handleClickMode;\n maxDistance = 0;\n constructor(container){\n super(container);\n this.handleClickMode = (mode, interactivityData)=>{\n const container = this.container;\n if (mode !== popMode) {\n return;\n }\n const clickPos = interactivityData.mouse.clickPosition;\n if (!clickPos) {\n return;\n }\n const poppedParticles = container.particles.grid.queryCircle(clickPos, container.retina.pixelRatio);\n if (!poppedParticles.length) {\n return;\n }\n for (const particle of poppedParticles){\n particle.destroy();\n }\n };\n }\n clear() {}\n init() {}\n interact() {}\n isEnabled(interactivityData, particle) {\n const container = this.container, options = container.actualOptions, mouse = interactivityData.mouse, events = (particle?.interactivity ?? options.interactivity)?.events;\n return !!events && mouse.clicking && mouse.inside && !!mouse.position && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.isInArray)(popMode, events.onClick.mode);\n }\n reset() {}\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-pop/./dist/browser/Popper.js?\n}");
27
27
 
28
28
  /***/ }
29
29
 
package/esm/Popper.js CHANGED
@@ -20,7 +20,7 @@ export class Popper extends ExternalInteractorBase {
20
20
  return;
21
21
  }
22
22
  for (const particle of poppedParticles) {
23
- container.particles.remove(particle);
23
+ particle.destroy();
24
24
  }
25
25
  };
26
26
  }
package/esm/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export async function loadExternalPopInteraction(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?.("externalPop", async (container) => {
6
+ e.pluginManager.addInteractor?.("externalPop", async (container) => {
7
7
  const { Popper } = await import("./Popper.js");
8
8
  return new Popper(container);
9
9
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/interaction-external-pop",
3
- "version": "4.0.0-beta.0",
3
+ "version": "4.0.0-beta.10",
4
4
  "description": "tsParticles pop external interaction",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -81,17 +81,20 @@
81
81
  "browser": "./browser/index.js",
82
82
  "import": "./esm/index.js",
83
83
  "require": "./cjs/index.js",
84
- "umd": "./umd/index.js",
85
- "default": "./cjs/index.js"
84
+ "default": "./esm/index.js"
86
85
  },
87
86
  "./package.json": "./package.json"
88
87
  },
89
- "dependencies": {
90
- "@tsparticles/engine": "4.0.0-beta.0",
91
- "@tsparticles/plugin-interactivity": "4.0.0-beta.0"
88
+ "peerDepdendencies": {
89
+ "@tsparticles/engine": "4.0.0-beta.1",
90
+ "@tsparticles/plugin-interactivity": "4.0.0-beta.1"
92
91
  },
93
92
  "publishConfig": {
94
93
  "access": "public"
95
94
  },
96
- "type": "module"
95
+ "type": "module",
96
+ "peerDependencies": {
97
+ "@tsparticles/engine": "4.0.0-beta.10",
98
+ "@tsparticles/plugin-interactivity": "4.0.0-beta.10"
99
+ }
97
100
  }