@tsparticles/interaction-external-push 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/836.min.js +1 -0
- package/README.md +5 -0
- package/browser/Options/Classes/Push.js +4 -0
- package/browser/Pusher.js +6 -3
- package/browser/index.js +3 -3
- package/cjs/Options/Classes/Push.js +4 -0
- package/cjs/Pusher.js +6 -3
- package/cjs/index.js +3 -3
- package/dist_browser_Pusher_js.js +2 -2
- package/esm/Options/Classes/Push.js +4 -0
- package/esm/Pusher.js +6 -3
- package/esm/index.js +3 -3
- package/package.json +3 -3
- package/report.html +3 -3
- package/tsparticles.interaction.external.push.js +41 -29
- package/tsparticles.interaction.external.push.min.js +2 -2
- package/types/Pusher.d.ts +3 -2
- package/umd/Options/Classes/Push.js +4 -0
- package/umd/Pusher.js +5 -2
- package/umd/index.js +3 -3
- package/48.min.js +0 -2
- package/48.min.js.LICENSE.txt +0 -1
- package/tsparticles.interaction.external.push.min.js.LICENSE.txt +0 -1
package/836.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_interaction_external_push=this.webpackChunk_tsparticles_interaction_external_push||[]).push([[836],{836(t,e,i){i.d(e,{Pusher:()=>o});var s=i(702),n=i(303),r=i(193);let a="push";class o extends s.ExternalInteractorBase{handleClickMode;maxDistance=0;constructor(t){super(t),this.handleClickMode=(t,e)=>{if(t!==a)return;let i=this.container,s=i.actualOptions,r=s.interactivity?.modes.push;if(!r)return;let o=(0,n.getRangeValue)(r.quantity);if(o<=0)return;let l=(0,n.itemFromArray)([void 0,...r.groups]),c=void 0!==l?i.actualOptions.particles.groups[l]:void 0,u=(0,n.itemFromSingleOrMultiple)(r.particles),p=(0,n.deepExtend)(c,u);i.particles.push(o,e.mouse.position,p,l)}}clear(){}init(){}interact(){}isEnabled(t,e){let i=this.container.actualOptions,s=t.mouse,r=(e?.interactivity??i.interactivity)?.events;return!!r&&s.clicking&&s.inside&&!!s.position&&(0,n.isInArray)(a,r.onClick.mode)}loadModeOptions(t,...e){for(let i of(t.push??=new r.$,e))t.push.load(i?.push)}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 loadExternalPushInteraction(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 { loadExternalPushInteraction } = require("@tsparticles/interaction-external-push");
|
|
61
63
|
|
|
62
64
|
(async () => {
|
|
65
|
+
await loadInteractivityPlugin(tsParticles);
|
|
63
66
|
await loadExternalPushInteraction(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 { loadExternalPushInteraction } from "@tsparticles/interaction-external-push";
|
|
72
76
|
|
|
73
77
|
(async () => {
|
|
78
|
+
await loadInteractivityPlugin(tsParticles);
|
|
74
79
|
await loadExternalPushInteraction(tsParticles);
|
|
75
80
|
})();
|
|
76
81
|
```
|
package/browser/Pusher.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ExternalInteractorBase, } from "@tsparticles/plugin-interactivity";
|
|
2
|
-
import { deepExtend, getRangeValue, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";
|
|
2
|
+
import { deepExtend, getRangeValue, isInArray, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";
|
|
3
3
|
import { Push } from "./Options/Classes/Push.js";
|
|
4
4
|
const pushMode = "push", minQuantity = 0;
|
|
5
5
|
export class Pusher extends ExternalInteractorBase {
|
|
6
|
+
handleClickMode;
|
|
7
|
+
maxDistance = 0;
|
|
6
8
|
constructor(container) {
|
|
7
9
|
super(container);
|
|
8
10
|
this.handleClickMode = (mode, interactivityData) => {
|
|
@@ -27,8 +29,9 @@ export class Pusher extends ExternalInteractorBase {
|
|
|
27
29
|
}
|
|
28
30
|
interact() {
|
|
29
31
|
}
|
|
30
|
-
isEnabled() {
|
|
31
|
-
|
|
32
|
+
isEnabled(interactivityData, particle) {
|
|
33
|
+
const container = this.container, options = container.actualOptions, mouse = interactivityData.mouse, events = (particle?.interactivity ?? options.interactivity)?.events;
|
|
34
|
+
return !!events && mouse.clicking && mouse.inside && !!mouse.position && isInArray(pushMode, events.onClick.mode);
|
|
32
35
|
}
|
|
33
36
|
loadModeOptions(options, ...sources) {
|
|
34
37
|
options.push ??= new Push();
|
package/browser/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export async function loadExternalPushInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-
|
|
2
|
+
engine.checkVersion("4.0.0-beta.0");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
|
-
const {
|
|
5
|
-
|
|
4
|
+
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
|
|
5
|
+
ensureInteractivityPluginLoaded(e);
|
|
6
6
|
e.addInteractor?.("externalPush", async (container) => {
|
|
7
7
|
const { Pusher } = await import("./Pusher.js");
|
|
8
8
|
return new Pusher(container);
|
package/cjs/Pusher.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ExternalInteractorBase, } from "@tsparticles/plugin-interactivity";
|
|
2
|
-
import { deepExtend, getRangeValue, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";
|
|
2
|
+
import { deepExtend, getRangeValue, isInArray, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";
|
|
3
3
|
import { Push } from "./Options/Classes/Push.js";
|
|
4
4
|
const pushMode = "push", minQuantity = 0;
|
|
5
5
|
export class Pusher extends ExternalInteractorBase {
|
|
6
|
+
handleClickMode;
|
|
7
|
+
maxDistance = 0;
|
|
6
8
|
constructor(container) {
|
|
7
9
|
super(container);
|
|
8
10
|
this.handleClickMode = (mode, interactivityData) => {
|
|
@@ -27,8 +29,9 @@ export class Pusher extends ExternalInteractorBase {
|
|
|
27
29
|
}
|
|
28
30
|
interact() {
|
|
29
31
|
}
|
|
30
|
-
isEnabled() {
|
|
31
|
-
|
|
32
|
+
isEnabled(interactivityData, particle) {
|
|
33
|
+
const container = this.container, options = container.actualOptions, mouse = interactivityData.mouse, events = (particle?.interactivity ?? options.interactivity)?.events;
|
|
34
|
+
return !!events && mouse.clicking && mouse.inside && !!mouse.position && isInArray(pushMode, events.onClick.mode);
|
|
32
35
|
}
|
|
33
36
|
loadModeOptions(options, ...sources) {
|
|
34
37
|
options.push ??= new Push();
|
package/cjs/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export async function loadExternalPushInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-
|
|
2
|
+
engine.checkVersion("4.0.0-beta.0");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
|
-
const {
|
|
5
|
-
|
|
4
|
+
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
|
|
5
|
+
ensureInteractivityPluginLoaded(e);
|
|
6
6
|
e.addInteractor?.("externalPush", async (container) => {
|
|
7
7
|
const { Pusher } = await import("./Pusher.js");
|
|
8
8
|
return new Pusher(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-
|
|
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 */ Pusher: () => (/* binding */ Pusher)\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/* harmony import */ var _Options_Classes_Push_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Push.js */ \"./dist/browser/Options/Classes/Push.js\");\n\n\n\nconst pushMode = \"push\"
|
|
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_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/* harmony import */ var _Options_Classes_Push_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Push.js */ \"./dist/browser/Options/Classes/Push.js\");\n\n\n\nconst pushMode = \"push\", minQuantity = 0;\nclass Pusher 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 if (mode !== pushMode) {\n return;\n }\n const container = this.container, options = container.actualOptions, pushOptions = options.interactivity?.modes.push;\n if (!pushOptions) {\n return;\n }\n const quantity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.getRangeValue)(pushOptions.quantity);\n if (quantity <= minQuantity) {\n return;\n }\n const group = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.itemFromArray)([\n undefined,\n ...pushOptions.groups\n ]), groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined, particlesOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.itemFromSingleOrMultiple)(pushOptions.particles), overrideOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.deepExtend)(groupOptions, particlesOptions);\n container.particles.push(quantity, interactivityData.mouse.position, overrideOptions, group);\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)(pushMode, events.onClick.mode);\n }\n loadModeOptions(options, ...sources) {\n options.push ??= new _Options_Classes_Push_js__WEBPACK_IMPORTED_MODULE_2__.Push();\n for (const source of sources){\n options.push.load(source?.push);\n }\n }\n reset() {}\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-push/./dist/browser/Pusher.js?\n}");
|
|
27
27
|
|
|
28
28
|
/***/ }
|
|
29
29
|
|
package/esm/Pusher.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ExternalInteractorBase, } from "@tsparticles/plugin-interactivity";
|
|
2
|
-
import { deepExtend, getRangeValue, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";
|
|
2
|
+
import { deepExtend, getRangeValue, isInArray, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";
|
|
3
3
|
import { Push } from "./Options/Classes/Push.js";
|
|
4
4
|
const pushMode = "push", minQuantity = 0;
|
|
5
5
|
export class Pusher extends ExternalInteractorBase {
|
|
6
|
+
handleClickMode;
|
|
7
|
+
maxDistance = 0;
|
|
6
8
|
constructor(container) {
|
|
7
9
|
super(container);
|
|
8
10
|
this.handleClickMode = (mode, interactivityData) => {
|
|
@@ -27,8 +29,9 @@ export class Pusher extends ExternalInteractorBase {
|
|
|
27
29
|
}
|
|
28
30
|
interact() {
|
|
29
31
|
}
|
|
30
|
-
isEnabled() {
|
|
31
|
-
|
|
32
|
+
isEnabled(interactivityData, particle) {
|
|
33
|
+
const container = this.container, options = container.actualOptions, mouse = interactivityData.mouse, events = (particle?.interactivity ?? options.interactivity)?.events;
|
|
34
|
+
return !!events && mouse.clicking && mouse.inside && !!mouse.position && isInArray(pushMode, events.onClick.mode);
|
|
32
35
|
}
|
|
33
36
|
loadModeOptions(options, ...sources) {
|
|
34
37
|
options.push ??= new Push();
|
package/esm/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export async function loadExternalPushInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-
|
|
2
|
+
engine.checkVersion("4.0.0-beta.0");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
|
-
const {
|
|
5
|
-
|
|
4
|
+
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity");
|
|
5
|
+
ensureInteractivityPluginLoaded(e);
|
|
6
6
|
e.addInteractor?.("externalPush", async (container) => {
|
|
7
7
|
const { Pusher } = await import("./Pusher.js");
|
|
8
8
|
return new Pusher(container);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-push",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
4
4
|
"description": "tsParticles push 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-
|
|
91
|
-
"@tsparticles/plugin-interactivity": "4.0.0-
|
|
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"
|