@tsparticles/interaction-external-pause 4.0.0-alpha.5 → 4.0.0-beta.0

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/363.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_interaction_external_pause=this.webpackChunk_tsparticles_interaction_external_pause||[]).push([[363],{363(t,e,a){a.d(e,{Pauser:()=>r});var i=a(702),n=a(303);let s="pause";class r extends i.ExternalInteractorBase{handleClickMode;maxDistance=0;constructor(t){super(t),this.handleClickMode=t=>{if(t!==s)return;let e=this.container;e.animationStatus?e.pause():e.play()}}clear(){}init(){}interact(){}isEnabled(t,e){let a=this.container.actualOptions,i=(e?.interactivity??a.interactivity)?.events;return!!i&&(0,n.isInArray)(s,i.onClick.mode)}reset(){}}}}]);
package/README.md CHANGED
@@ -28,6 +28,7 @@ Once the scripts are loaded you can set up `tsParticles` and the interaction plu
28
28
 
29
29
  ```javascript
30
30
  (async () => {
31
+ await loadInteractivityPlugin(tsParticles);
31
32
  await loadExternalPauseInteraction(tsParticles);
32
33
 
33
34
  await tsParticles.load({
@@ -57,9 +58,11 @@ Then you need to import it in the app, like this:
57
58
 
58
59
  ```javascript
59
60
  const { tsParticles } = require("@tsparticles/engine");
61
+ const { loadInteractivityPlugin } = require("@tsparticles/plugin-interactivity");
60
62
  const { loadExternalPauseInteraction } = require("@tsparticles/interaction-external-pause");
61
63
 
62
64
  (async () => {
65
+ await loadInteractivityPlugin(tsParticles);
63
66
  await loadExternalPauseInteraction(tsParticles);
64
67
  })();
65
68
  ```
@@ -68,9 +71,11 @@ or
68
71
 
69
72
  ```javascript
70
73
  import { tsParticles } from "@tsparticles/engine";
74
+ import { loadInteractivityPlugin } from "@tsparticles/plugin-interactivity";
71
75
  import { loadExternalPauseInteraction } from "@tsparticles/interaction-external-pause";
72
76
 
73
77
  (async () => {
78
+ await loadInteractivityPlugin(tsParticles);
74
79
  await loadExternalPauseInteraction(tsParticles);
75
80
  })();
76
81
  ```
package/browser/Pauser.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import { ExternalInteractorBase, } from "@tsparticles/plugin-interactivity";
2
+ import { isInArray } from "@tsparticles/engine";
2
3
  const pauseMode = "pause";
3
4
  export class Pauser extends ExternalInteractorBase {
5
+ handleClickMode;
6
+ maxDistance = 0;
4
7
  constructor(container) {
5
8
  super(container);
6
9
  this.handleClickMode = (mode) => {
@@ -22,8 +25,9 @@ export class Pauser extends ExternalInteractorBase {
22
25
  }
23
26
  interact() {
24
27
  }
25
- isEnabled() {
26
- return true;
28
+ isEnabled(_interactivityData, particle) {
29
+ const container = this.container, options = container.actualOptions, events = (particle?.interactivity ?? options.interactivity)?.events;
30
+ return !!events && isInArray(pauseMode, events.onClick.mode);
27
31
  }
28
32
  reset() {
29
33
  }
package/browser/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export async function loadExternalPauseInteraction(engine) {
2
- engine.checkVersion("4.0.0-alpha.5");
2
+ engine.checkVersion("4.0.0-beta.0");
3
3
  await engine.register(async (e) => {
4
- const { loadInteractivityPlugin } = await import("@tsparticles/plugin-interactivity");
5
- await loadInteractivityPlugin(e);
4
+ const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
5
+ ensureInteractivityPluginLoaded(e);
6
6
  e.addInteractor?.("externalPause", async (container) => {
7
7
  const { Pauser } = await import("./Pauser.js");
8
8
  return new Pauser(container);
package/cjs/Pauser.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import { ExternalInteractorBase, } from "@tsparticles/plugin-interactivity";
2
+ import { isInArray } from "@tsparticles/engine";
2
3
  const pauseMode = "pause";
3
4
  export class Pauser extends ExternalInteractorBase {
5
+ handleClickMode;
6
+ maxDistance = 0;
4
7
  constructor(container) {
5
8
  super(container);
6
9
  this.handleClickMode = (mode) => {
@@ -22,8 +25,9 @@ export class Pauser extends ExternalInteractorBase {
22
25
  }
23
26
  interact() {
24
27
  }
25
- isEnabled() {
26
- return true;
28
+ isEnabled(_interactivityData, particle) {
29
+ const container = this.container, options = container.actualOptions, events = (particle?.interactivity ?? options.interactivity)?.events;
30
+ return !!events && isInArray(pauseMode, events.onClick.mode);
27
31
  }
28
32
  reset() {
29
33
  }
package/cjs/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export async function loadExternalPauseInteraction(engine) {
2
- engine.checkVersion("4.0.0-alpha.5");
2
+ engine.checkVersion("4.0.0-beta.0");
3
3
  await engine.register(async (e) => {
4
- const { loadInteractivityPlugin } = await import("@tsparticles/plugin-interactivity");
5
- await loadInteractivityPlugin(e);
4
+ const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
5
+ ensureInteractivityPluginLoaded(e);
6
6
  e.addInteractor?.("externalPause", async (container) => {
7
7
  const { Pauser } = await import("./Pauser.js");
8
8
  return new Pauser(container);
@@ -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-alpha.5
7
+ * v4.0.0-beta.0
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 */ Pauser: () => (/* binding */ Pauser)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\");\n\nconst pauseMode = \"pause\";\nclass Pauser extends _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(container) {\n super(container);\n this.handleClickMode = mode => {\n if (mode !== pauseMode) {\n return;\n }\n const container = this.container;\n if (container.animationStatus) {\n container.pause();\n } else {\n container.play();\n }\n };\n }\n clear() {}\n init() {}\n interact() {}\n isEnabled() {\n return true;\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-pause/./dist/browser/Pauser.js?\n}");
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Pauser: () => (/* binding */ Pauser)\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 pauseMode = \"pause\";\nclass Pauser extends _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n handleClickMode;\n maxDistance = 0;\n constructor(container){\n super(container);\n this.handleClickMode = (mode)=>{\n if (mode !== pauseMode) {\n return;\n }\n const container = this.container;\n if (container.animationStatus) {\n container.pause();\n } else {\n container.play();\n }\n };\n }\n clear() {}\n init() {}\n interact() {}\n isEnabled(_interactivityData, particle) {\n const container = this.container, options = container.actualOptions, events = (particle?.interactivity ?? options.interactivity)?.events;\n return !!events && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.isInArray)(pauseMode, events.onClick.mode);\n }\n reset() {}\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-pause/./dist/browser/Pauser.js?\n}");
27
27
 
28
28
  /***/ }
29
29
 
package/esm/Pauser.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import { ExternalInteractorBase, } from "@tsparticles/plugin-interactivity";
2
+ import { isInArray } from "@tsparticles/engine";
2
3
  const pauseMode = "pause";
3
4
  export class Pauser extends ExternalInteractorBase {
5
+ handleClickMode;
6
+ maxDistance = 0;
4
7
  constructor(container) {
5
8
  super(container);
6
9
  this.handleClickMode = (mode) => {
@@ -22,8 +25,9 @@ export class Pauser extends ExternalInteractorBase {
22
25
  }
23
26
  interact() {
24
27
  }
25
- isEnabled() {
26
- return true;
28
+ isEnabled(_interactivityData, particle) {
29
+ const container = this.container, options = container.actualOptions, events = (particle?.interactivity ?? options.interactivity)?.events;
30
+ return !!events && isInArray(pauseMode, events.onClick.mode);
27
31
  }
28
32
  reset() {
29
33
  }
package/esm/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export async function loadExternalPauseInteraction(engine) {
2
- engine.checkVersion("4.0.0-alpha.5");
2
+ engine.checkVersion("4.0.0-beta.0");
3
3
  await engine.register(async (e) => {
4
- const { loadInteractivityPlugin } = await import("@tsparticles/plugin-interactivity");
5
- await loadInteractivityPlugin(e);
4
+ const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
5
+ ensureInteractivityPluginLoaded(e);
6
6
  e.addInteractor?.("externalPause", async (container) => {
7
7
  const { Pauser } = await import("./Pauser.js");
8
8
  return new Pauser(container);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/interaction-external-pause",
3
- "version": "4.0.0-alpha.5",
3
+ "version": "4.0.0-beta.0",
4
4
  "description": "tsParticles pause external interaction",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -87,8 +87,8 @@
87
87
  "./package.json": "./package.json"
88
88
  },
89
89
  "dependencies": {
90
- "@tsparticles/engine": "4.0.0-alpha.5",
91
- "@tsparticles/plugin-interactivity": "4.0.0-alpha.5"
90
+ "@tsparticles/engine": "4.0.0-beta.0",
91
+ "@tsparticles/plugin-interactivity": "4.0.0-beta.0"
92
92
  },
93
93
  "publishConfig": {
94
94
  "access": "public"