@tsparticles/interaction-external-push 3.9.0 → 4.0.0-alpha.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/611.min.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 611.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_interaction_external_push=this.webpackChunk_tsparticles_interaction_external_push||[]).push([[611],{611(t,e,s){s.d(e,{Pusher:()=>n});var i=s(303),r=s(602);class n extends i.ExternalInteractorBase{constructor(t){super(t),this.handleClickMode=t=>{if("push"!==t)return;const e=this.container,s=e.actualOptions.interactivity.modes.push;if(!s)return;const r=(0,i.getRangeValue)(s.quantity);if(r<=0)return;const n=(0,i.itemFromArray)([void 0,...s.groups]),a=void 0!==n?e.actualOptions.particles.groups[n]:void 0,o=(0,i.itemFromSingleOrMultiple)(s.particles),u=(0,i.deepExtend)(a,o);e.particles.push(r,e.interactivity.mouse,u,n)}}clear(){}init(){}interact(){}isEnabled(){return!0}loadModeOptions(t,...e){t.push??=new r.$;for(const s of e)t.push.load(s?.push)}reset(){}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Push External Interaction v4.0.0-alpha.0 by Matteo Bruni */
package/browser/Pusher.js CHANGED
@@ -17,7 +17,7 @@ export class Pusher extends ExternalInteractorBase {
17
17
  return;
18
18
  }
19
19
  const group = itemFromArray([undefined, ...pushOptions.groups]), groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined, particlesOptions = itemFromSingleOrMultiple(pushOptions.particles), overrideOptions = deepExtend(groupOptions, particlesOptions);
20
- void container.particles.push(quantity, container.interactivity.mouse, overrideOptions, group);
20
+ container.particles.push(quantity, container.interactivity.mouse, overrideOptions, group);
21
21
  };
22
22
  }
23
23
  clear() {
@@ -30,9 +30,7 @@ export class Pusher extends ExternalInteractorBase {
30
30
  return true;
31
31
  }
32
32
  loadModeOptions(options, ...sources) {
33
- if (!options.push) {
34
- options.push = new Push();
35
- }
33
+ options.push ??= new Push();
36
34
  for (const source of sources) {
37
35
  options.push.load(source?.push);
38
36
  }
package/browser/index.js CHANGED
@@ -1,9 +1,10 @@
1
- import { Pusher } from "./Pusher.js";
2
- export async function loadExternalPushInteraction(engine, refresh = true) {
3
- engine.checkVersion("3.9.0");
4
- await engine.addInteractor("externalPush", container => {
5
- return Promise.resolve(new Pusher(container));
6
- }, refresh);
1
+ export function loadExternalPushInteraction(engine) {
2
+ engine.checkVersion("4.0.0-alpha.0");
3
+ engine.register(e => {
4
+ e.addInteractor("externalPush", async (container) => {
5
+ const { Pusher } = await import("./Pusher.js");
6
+ return new Pusher(container);
7
+ });
8
+ });
7
9
  }
8
10
  export * from "./Options/Classes/Push.js";
9
- export * from "./Options/Interfaces/IPush.js";
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Push = void 0;
4
- const engine_1 = require("@tsparticles/engine");
5
- class Push {
1
+ import { deepExtend, executeOnSingleOrMultiple, isNull, setRangeValue, } from "@tsparticles/engine";
2
+ export class Push {
6
3
  constructor() {
7
4
  this.default = true;
8
5
  this.groups = [];
9
6
  this.quantity = 4;
10
7
  }
11
8
  load(data) {
12
- if ((0, engine_1.isNull)(data)) {
9
+ if (isNull(data)) {
13
10
  return;
14
11
  }
15
12
  if (data.default !== undefined) {
@@ -23,11 +20,10 @@ class Push {
23
20
  }
24
21
  const quantity = data.quantity;
25
22
  if (quantity !== undefined) {
26
- this.quantity = (0, engine_1.setRangeValue)(quantity);
23
+ this.quantity = setRangeValue(quantity);
27
24
  }
28
- this.particles = (0, engine_1.executeOnSingleOrMultiple)(data.particles, particles => {
29
- return (0, engine_1.deepExtend)({}, particles);
25
+ this.particles = executeOnSingleOrMultiple(data.particles, particles => {
26
+ return deepExtend({}, particles);
30
27
  });
31
28
  }
32
29
  }
33
- exports.Push = Push;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/cjs/Pusher.js CHANGED
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Pusher = void 0;
4
- const engine_1 = require("@tsparticles/engine");
5
- const Push_js_1 = require("./Options/Classes/Push.js");
1
+ import { ExternalInteractorBase, deepExtend, getRangeValue, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";
2
+ import { Push } from "./Options/Classes/Push.js";
6
3
  const pushMode = "push", minQuantity = 0;
7
- class Pusher extends engine_1.ExternalInteractorBase {
4
+ export class Pusher extends ExternalInteractorBase {
8
5
  constructor(container) {
9
6
  super(container);
10
7
  this.handleClickMode = (mode) => {
@@ -15,12 +12,12 @@ class Pusher extends engine_1.ExternalInteractorBase {
15
12
  if (!pushOptions) {
16
13
  return;
17
14
  }
18
- const quantity = (0, engine_1.getRangeValue)(pushOptions.quantity);
15
+ const quantity = getRangeValue(pushOptions.quantity);
19
16
  if (quantity <= minQuantity) {
20
17
  return;
21
18
  }
22
- const group = (0, engine_1.itemFromArray)([undefined, ...pushOptions.groups]), groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined, particlesOptions = (0, engine_1.itemFromSingleOrMultiple)(pushOptions.particles), overrideOptions = (0, engine_1.deepExtend)(groupOptions, particlesOptions);
23
- void container.particles.push(quantity, container.interactivity.mouse, overrideOptions, group);
19
+ const group = itemFromArray([undefined, ...pushOptions.groups]), groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined, particlesOptions = itemFromSingleOrMultiple(pushOptions.particles), overrideOptions = deepExtend(groupOptions, particlesOptions);
20
+ container.particles.push(quantity, container.interactivity.mouse, overrideOptions, group);
24
21
  };
25
22
  }
26
23
  clear() {
@@ -33,9 +30,7 @@ class Pusher extends engine_1.ExternalInteractorBase {
33
30
  return true;
34
31
  }
35
32
  loadModeOptions(options, ...sources) {
36
- if (!options.push) {
37
- options.push = new Push_js_1.Push();
38
- }
33
+ options.push ??= new Push();
39
34
  for (const source of sources) {
40
35
  options.push.load(source?.push);
41
36
  }
@@ -43,4 +38,3 @@ class Pusher extends engine_1.ExternalInteractorBase {
43
38
  reset() {
44
39
  }
45
40
  }
46
- exports.Pusher = Pusher;
package/cjs/Types.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/cjs/index.js CHANGED
@@ -1,26 +1,10 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.loadExternalPushInteraction = loadExternalPushInteraction;
18
- const Pusher_js_1 = require("./Pusher.js");
19
- async function loadExternalPushInteraction(engine, refresh = true) {
20
- engine.checkVersion("3.9.0");
21
- await engine.addInteractor("externalPush", container => {
22
- return Promise.resolve(new Pusher_js_1.Pusher(container));
23
- }, refresh);
1
+ export function loadExternalPushInteraction(engine) {
2
+ engine.checkVersion("4.0.0-alpha.0");
3
+ engine.register(e => {
4
+ e.addInteractor("externalPush", async (container) => {
5
+ const { Pusher } = await import("./Pusher.js");
6
+ return new Pusher(container);
7
+ });
8
+ });
24
9
  }
25
- __exportStar(require("./Options/Classes/Push.js"), exports);
26
- __exportStar(require("./Options/Interfaces/IPush.js"), exports);
10
+ export * from "./Options/Classes/Push.js";
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * Author : Matteo Bruni
3
+ * MIT license: https://opensource.org/licenses/MIT
4
+ * Demo / Generator : https://particles.js.org/
5
+ * GitHub : https://www.github.com/matteobruni/tsparticles
6
+ * How to use? : Check the GitHub README
7
+ * v4.0.0-alpha.0
8
+ */
9
+ "use strict";
10
+ /*
11
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
+ * This devtool is neither made for production nor for readable output files.
13
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
14
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
+ * or disable the default devtool with "devtool: false".
16
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
+ */
18
+ (this["webpackChunk_tsparticles_interaction_external_push"] = this["webpackChunk_tsparticles_interaction_external_push"] || []).push([["dist_browser_Pusher_js"],{
19
+
20
+ /***/ "./dist/browser/Pusher.js"
21
+ /*!********************************!*\
22
+ !*** ./dist/browser/Pusher.js ***!
23
+ \********************************/
24
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
+
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Pusher: () => (/* binding */ Pusher)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Options_Classes_Push_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Push.js */ \"./dist/browser/Options/Classes/Push.js\");\n\n\nconst pushMode = \"push\",\n minQuantity = 0;\nclass Pusher extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(container) {\n super(container);\n this.handleClickMode = mode => {\n if (mode !== pushMode) {\n return;\n }\n const container = this.container,\n options = container.actualOptions,\n pushOptions = options.interactivity.modes.push;\n if (!pushOptions) {\n return;\n }\n const quantity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(pushOptions.quantity);\n if (quantity <= minQuantity) {\n return;\n }\n const group = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromArray)([undefined, ...pushOptions.groups]),\n groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined,\n particlesOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(pushOptions.particles),\n overrideOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)(groupOptions, particlesOptions);\n container.particles.push(quantity, container.interactivity.mouse, overrideOptions, group);\n };\n }\n clear() {}\n init() {}\n interact() {}\n isEnabled() {\n return true;\n }\n loadModeOptions(options, ...sources) {\n options.push ??= new _Options_Classes_Push_js__WEBPACK_IMPORTED_MODULE_1__.Push();\n for (const source of sources) {\n options.push.load(source?.push);\n }\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-push/./dist/browser/Pusher.js?\n}");
27
+
28
+ /***/ }
29
+
30
+ }]);
package/esm/Pusher.js CHANGED
@@ -17,7 +17,7 @@ export class Pusher extends ExternalInteractorBase {
17
17
  return;
18
18
  }
19
19
  const group = itemFromArray([undefined, ...pushOptions.groups]), groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined, particlesOptions = itemFromSingleOrMultiple(pushOptions.particles), overrideOptions = deepExtend(groupOptions, particlesOptions);
20
- void container.particles.push(quantity, container.interactivity.mouse, overrideOptions, group);
20
+ container.particles.push(quantity, container.interactivity.mouse, overrideOptions, group);
21
21
  };
22
22
  }
23
23
  clear() {
@@ -30,9 +30,7 @@ export class Pusher extends ExternalInteractorBase {
30
30
  return true;
31
31
  }
32
32
  loadModeOptions(options, ...sources) {
33
- if (!options.push) {
34
- options.push = new Push();
35
- }
33
+ options.push ??= new Push();
36
34
  for (const source of sources) {
37
35
  options.push.load(source?.push);
38
36
  }
package/esm/index.js CHANGED
@@ -1,9 +1,10 @@
1
- import { Pusher } from "./Pusher.js";
2
- export async function loadExternalPushInteraction(engine, refresh = true) {
3
- engine.checkVersion("3.9.0");
4
- await engine.addInteractor("externalPush", container => {
5
- return Promise.resolve(new Pusher(container));
6
- }, refresh);
1
+ export function loadExternalPushInteraction(engine) {
2
+ engine.checkVersion("4.0.0-alpha.0");
3
+ engine.register(e => {
4
+ e.addInteractor("externalPush", async (container) => {
5
+ const { Pusher } = await import("./Pusher.js");
6
+ return new Pusher(container);
7
+ });
8
+ });
7
9
  }
8
10
  export * from "./Options/Classes/Push.js";
9
- export * from "./Options/Interfaces/IPush.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/interaction-external-push",
3
- "version": "3.9.0",
3
+ "version": "4.0.0-alpha.0",
4
4
  "description": "tsParticles push external interaction",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -87,9 +87,10 @@
87
87
  "./package.json": "./package.json"
88
88
  },
89
89
  "dependencies": {
90
- "@tsparticles/engine": "3.9.0"
90
+ "@tsparticles/engine": "4.0.0-alpha.0"
91
91
  },
92
92
  "publishConfig": {
93
93
  "access": "public"
94
- }
94
+ },
95
+ "type": "module"
95
96
  }