@tsparticles/interaction-external-push 4.0.0-alpha.1 → 4.0.0-alpha.14
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/243.min.js +1 -0
- package/browser/Options/Classes/Push.js +4 -0
- package/browser/Pusher.js +9 -6
- package/browser/index.js +6 -4
- package/cjs/Options/Classes/Push.js +4 -0
- package/cjs/Pusher.js +9 -6
- package/cjs/index.js +6 -4
- package/dist_browser_Pusher_js.js +2 -2
- package/esm/Options/Classes/Push.js +4 -0
- package/esm/Pusher.js +9 -6
- package/esm/index.js +6 -4
- package/package.json +3 -2
- package/report.html +3 -3
- package/tsparticles.interaction.external.push.js +47 -7
- package/tsparticles.interaction.external.push.min.js +2 -2
- package/types/Pusher.d.ts +4 -3
- package/types/Types.d.ts +4 -4
- package/types/index.d.ts +1 -1
- package/umd/Options/Classes/Push.js +4 -0
- package/umd/Pusher.js +10 -7
- package/umd/index.js +7 -5
- package/611.min.js +0 -2
- package/611.min.js.LICENSE.txt +0 -1
- package/tsparticles.interaction.external.push.min.js.LICENSE.txt +0 -1
package/243.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_interaction_external_push=this.webpackChunk_tsparticles_interaction_external_push||[]).push([[243],{243(t,e,i){i.d(e,{Pusher:()=>o});var s=i(702),n=i(303),r=i(26);let a="push";class o extends s.ExternalInteractorBase{handleClickMode;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/browser/Pusher.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { ExternalInteractorBase,
|
|
1
|
+
import { ExternalInteractorBase, } from "@tsparticles/plugin-interactivity";
|
|
2
|
+
import { deepExtend, getRangeValue, isInArray, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";
|
|
2
3
|
import { Push } from "./Options/Classes/Push.js";
|
|
3
4
|
const pushMode = "push", minQuantity = 0;
|
|
4
5
|
export class Pusher extends ExternalInteractorBase {
|
|
6
|
+
handleClickMode;
|
|
5
7
|
constructor(container) {
|
|
6
8
|
super(container);
|
|
7
|
-
this.handleClickMode = (mode) => {
|
|
9
|
+
this.handleClickMode = (mode, interactivityData) => {
|
|
8
10
|
if (mode !== pushMode) {
|
|
9
11
|
return;
|
|
10
12
|
}
|
|
11
|
-
const container = this.container, options = container.actualOptions, pushOptions = options.interactivity
|
|
13
|
+
const container = this.container, options = container.actualOptions, pushOptions = options.interactivity?.modes.push;
|
|
12
14
|
if (!pushOptions) {
|
|
13
15
|
return;
|
|
14
16
|
}
|
|
@@ -17,7 +19,7 @@ export class Pusher extends ExternalInteractorBase {
|
|
|
17
19
|
return;
|
|
18
20
|
}
|
|
19
21
|
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,
|
|
22
|
+
container.particles.push(quantity, interactivityData.mouse.position, overrideOptions, group);
|
|
21
23
|
};
|
|
22
24
|
}
|
|
23
25
|
clear() {
|
|
@@ -26,8 +28,9 @@ export class Pusher extends ExternalInteractorBase {
|
|
|
26
28
|
}
|
|
27
29
|
interact() {
|
|
28
30
|
}
|
|
29
|
-
isEnabled() {
|
|
30
|
-
|
|
31
|
+
isEnabled(interactivityData, particle) {
|
|
32
|
+
const container = this.container, options = container.actualOptions, mouse = interactivityData.mouse, events = (particle?.interactivity ?? options.interactivity)?.events;
|
|
33
|
+
return !!events && mouse.clicking && mouse.inside && !!mouse.position && isInArray(pushMode, events.onClick.mode);
|
|
31
34
|
}
|
|
32
35
|
loadModeOptions(options, ...sources) {
|
|
33
36
|
options.push ??= new Push();
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export function loadExternalPushInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(e => {
|
|
4
|
-
|
|
1
|
+
export async function loadExternalPushInteraction(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.14");
|
|
3
|
+
await engine.register(async (e) => {
|
|
4
|
+
const { loadInteractivityPlugin } = await import("@tsparticles/plugin-interactivity");
|
|
5
|
+
await loadInteractivityPlugin(e);
|
|
6
|
+
e.addInteractor?.("externalPush", async (container) => {
|
|
5
7
|
const { Pusher } = await import("./Pusher.js");
|
|
6
8
|
return new Pusher(container);
|
|
7
9
|
});
|
package/cjs/Pusher.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { ExternalInteractorBase,
|
|
1
|
+
import { ExternalInteractorBase, } from "@tsparticles/plugin-interactivity";
|
|
2
|
+
import { deepExtend, getRangeValue, isInArray, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";
|
|
2
3
|
import { Push } from "./Options/Classes/Push.js";
|
|
3
4
|
const pushMode = "push", minQuantity = 0;
|
|
4
5
|
export class Pusher extends ExternalInteractorBase {
|
|
6
|
+
handleClickMode;
|
|
5
7
|
constructor(container) {
|
|
6
8
|
super(container);
|
|
7
|
-
this.handleClickMode = (mode) => {
|
|
9
|
+
this.handleClickMode = (mode, interactivityData) => {
|
|
8
10
|
if (mode !== pushMode) {
|
|
9
11
|
return;
|
|
10
12
|
}
|
|
11
|
-
const container = this.container, options = container.actualOptions, pushOptions = options.interactivity
|
|
13
|
+
const container = this.container, options = container.actualOptions, pushOptions = options.interactivity?.modes.push;
|
|
12
14
|
if (!pushOptions) {
|
|
13
15
|
return;
|
|
14
16
|
}
|
|
@@ -17,7 +19,7 @@ export class Pusher extends ExternalInteractorBase {
|
|
|
17
19
|
return;
|
|
18
20
|
}
|
|
19
21
|
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,
|
|
22
|
+
container.particles.push(quantity, interactivityData.mouse.position, overrideOptions, group);
|
|
21
23
|
};
|
|
22
24
|
}
|
|
23
25
|
clear() {
|
|
@@ -26,8 +28,9 @@ export class Pusher extends ExternalInteractorBase {
|
|
|
26
28
|
}
|
|
27
29
|
interact() {
|
|
28
30
|
}
|
|
29
|
-
isEnabled() {
|
|
30
|
-
|
|
31
|
+
isEnabled(interactivityData, particle) {
|
|
32
|
+
const container = this.container, options = container.actualOptions, mouse = interactivityData.mouse, events = (particle?.interactivity ?? options.interactivity)?.events;
|
|
33
|
+
return !!events && mouse.clicking && mouse.inside && !!mouse.position && isInArray(pushMode, events.onClick.mode);
|
|
31
34
|
}
|
|
32
35
|
loadModeOptions(options, ...sources) {
|
|
33
36
|
options.push ??= new Push();
|
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export function loadExternalPushInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(e => {
|
|
4
|
-
|
|
1
|
+
export async function loadExternalPushInteraction(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.14");
|
|
3
|
+
await engine.register(async (e) => {
|
|
4
|
+
const { loadInteractivityPlugin } = await import("@tsparticles/plugin-interactivity");
|
|
5
|
+
await loadInteractivityPlugin(e);
|
|
6
|
+
e.addInteractor?.("externalPush", async (container) => {
|
|
5
7
|
const { Pusher } = await import("./Pusher.js");
|
|
6
8
|
return new Pusher(container);
|
|
7
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-alpha.
|
|
7
|
+
* v4.0.0-alpha.14
|
|
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
|
|
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 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,14 +1,16 @@
|
|
|
1
|
-
import { ExternalInteractorBase,
|
|
1
|
+
import { ExternalInteractorBase, } from "@tsparticles/plugin-interactivity";
|
|
2
|
+
import { deepExtend, getRangeValue, isInArray, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";
|
|
2
3
|
import { Push } from "./Options/Classes/Push.js";
|
|
3
4
|
const pushMode = "push", minQuantity = 0;
|
|
4
5
|
export class Pusher extends ExternalInteractorBase {
|
|
6
|
+
handleClickMode;
|
|
5
7
|
constructor(container) {
|
|
6
8
|
super(container);
|
|
7
|
-
this.handleClickMode = (mode) => {
|
|
9
|
+
this.handleClickMode = (mode, interactivityData) => {
|
|
8
10
|
if (mode !== pushMode) {
|
|
9
11
|
return;
|
|
10
12
|
}
|
|
11
|
-
const container = this.container, options = container.actualOptions, pushOptions = options.interactivity
|
|
13
|
+
const container = this.container, options = container.actualOptions, pushOptions = options.interactivity?.modes.push;
|
|
12
14
|
if (!pushOptions) {
|
|
13
15
|
return;
|
|
14
16
|
}
|
|
@@ -17,7 +19,7 @@ export class Pusher extends ExternalInteractorBase {
|
|
|
17
19
|
return;
|
|
18
20
|
}
|
|
19
21
|
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,
|
|
22
|
+
container.particles.push(quantity, interactivityData.mouse.position, overrideOptions, group);
|
|
21
23
|
};
|
|
22
24
|
}
|
|
23
25
|
clear() {
|
|
@@ -26,8 +28,9 @@ export class Pusher extends ExternalInteractorBase {
|
|
|
26
28
|
}
|
|
27
29
|
interact() {
|
|
28
30
|
}
|
|
29
|
-
isEnabled() {
|
|
30
|
-
|
|
31
|
+
isEnabled(interactivityData, particle) {
|
|
32
|
+
const container = this.container, options = container.actualOptions, mouse = interactivityData.mouse, events = (particle?.interactivity ?? options.interactivity)?.events;
|
|
33
|
+
return !!events && mouse.clicking && mouse.inside && !!mouse.position && isInArray(pushMode, events.onClick.mode);
|
|
31
34
|
}
|
|
32
35
|
loadModeOptions(options, ...sources) {
|
|
33
36
|
options.push ??= new Push();
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export function loadExternalPushInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(e => {
|
|
4
|
-
|
|
1
|
+
export async function loadExternalPushInteraction(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.14");
|
|
3
|
+
await engine.register(async (e) => {
|
|
4
|
+
const { loadInteractivityPlugin } = await import("@tsparticles/plugin-interactivity");
|
|
5
|
+
await loadInteractivityPlugin(e);
|
|
6
|
+
e.addInteractor?.("externalPush", async (container) => {
|
|
5
7
|
const { Pusher } = await import("./Pusher.js");
|
|
6
8
|
return new Pusher(container);
|
|
7
9
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-push",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.14",
|
|
4
4
|
"description": "tsParticles push external interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -87,7 +87,8 @@
|
|
|
87
87
|
"./package.json": "./package.json"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@tsparticles/engine": "4.0.0-alpha.
|
|
90
|
+
"@tsparticles/engine": "4.0.0-alpha.14",
|
|
91
|
+
"@tsparticles/plugin-interactivity": "4.0.0-alpha.14"
|
|
91
92
|
},
|
|
92
93
|
"publishConfig": {
|
|
93
94
|
"access": "public"
|