@tsparticles/interaction-external-push 3.0.0-alpha.1 → 3.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/README.md +25 -19
- package/browser/Options/Classes/Push.js +4 -4
- package/browser/Pusher.js +5 -6
- package/browser/index.js +2 -2
- package/cjs/Options/Classes/Push.js +4 -4
- package/cjs/Pusher.js +6 -18
- package/cjs/index.js +2 -13
- package/esm/Options/Classes/Push.js +4 -4
- package/esm/Pusher.js +5 -6
- package/esm/index.js +2 -2
- package/package.json +6 -5
- package/report.html +4 -4
- package/tsparticles.interaction.external.push.js +13 -14
- package/tsparticles.interaction.external.push.min.js +1 -1
- package/tsparticles.interaction.external.push.min.js.LICENSE.txt +1 -8
- package/types/Options/Classes/Push.d.ts +4 -4
- package/types/Options/Interfaces/IPush.d.ts +3 -2
- package/types/Pusher.d.ts +1 -2
- package/types/Types.d.ts +6 -2
- package/types/index.d.ts +1 -1
- package/umd/Options/Classes/Push.js +5 -5
- package/umd/Pusher.js +6 -7
- package/umd/index.js +2 -2
- package/browser/Options/Classes/PushOptions.js +0 -1
- package/cjs/Options/Classes/PushOptions.js +0 -2
- package/esm/Options/Classes/PushOptions.js +0 -1
- package/types/Options/Classes/PushOptions.d.ts +0 -7
- package/umd/Options/Classes/PushOptions.js +0 -12
|
@@ -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
|
-
* v3.0.0-
|
|
7
|
+
* v3.0.0-beta.0
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -91,13 +91,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
91
91
|
|
|
92
92
|
// EXPORTS
|
|
93
93
|
__webpack_require__.d(__webpack_exports__, {
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
Push: () => (/* reexport */ Push),
|
|
95
|
+
loadExternalPushInteraction: () => (/* binding */ loadExternalPushInteraction)
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
|
|
99
99
|
var engine_root_window_ = __webpack_require__(533);
|
|
100
100
|
;// CONCATENATED MODULE: ./dist/browser/Options/Classes/Push.js
|
|
101
|
+
|
|
101
102
|
class Push {
|
|
102
103
|
constructor() {
|
|
103
104
|
this.default = true;
|
|
@@ -108,10 +109,9 @@ class Push {
|
|
|
108
109
|
return this.quantity;
|
|
109
110
|
}
|
|
110
111
|
set particles_nb(value) {
|
|
111
|
-
this.quantity = value;
|
|
112
|
+
this.quantity = (0,engine_root_window_.setRangeValue)(value);
|
|
112
113
|
}
|
|
113
114
|
load(data) {
|
|
114
|
-
var _a;
|
|
115
115
|
if (!data) {
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
@@ -124,16 +124,15 @@ class Push {
|
|
|
124
124
|
if (!this.groups.length) {
|
|
125
125
|
this.default = true;
|
|
126
126
|
}
|
|
127
|
-
const quantity =
|
|
127
|
+
const quantity = data.quantity ?? data.particles_nb;
|
|
128
128
|
if (quantity !== undefined) {
|
|
129
|
-
this.quantity = quantity;
|
|
129
|
+
this.quantity = (0,engine_root_window_.setRangeValue)(quantity);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
;// CONCATENATED MODULE: ./dist/browser/Pusher.js
|
|
134
134
|
|
|
135
135
|
|
|
136
|
-
|
|
137
136
|
class Pusher extends engine_root_window_.ExternalInteractorBase {
|
|
138
137
|
constructor(container) {
|
|
139
138
|
super(container);
|
|
@@ -147,13 +146,13 @@ class Pusher extends engine_root_window_.ExternalInteractorBase {
|
|
|
147
146
|
if (!pushOptions) {
|
|
148
147
|
return;
|
|
149
148
|
}
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
149
|
+
const quantity = (0,engine_root_window_.getRangeValue)(pushOptions.quantity);
|
|
150
|
+
if (quantity <= 0) {
|
|
152
151
|
return;
|
|
153
152
|
}
|
|
154
153
|
const group = (0,engine_root_window_.itemFromArray)([undefined, ...pushOptions.groups]),
|
|
155
154
|
groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined;
|
|
156
|
-
container.particles.push(
|
|
155
|
+
container.particles.push(quantity, container.interactivity.mouse, groupOptions, group);
|
|
157
156
|
};
|
|
158
157
|
}
|
|
159
158
|
clear() {}
|
|
@@ -167,15 +166,15 @@ class Pusher extends engine_root_window_.ExternalInteractorBase {
|
|
|
167
166
|
options.push = new Push();
|
|
168
167
|
}
|
|
169
168
|
for (const source of sources) {
|
|
170
|
-
options.push.load(source
|
|
169
|
+
options.push.load(source?.push);
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
172
|
reset() {}
|
|
174
173
|
}
|
|
175
174
|
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
176
175
|
|
|
177
|
-
async function loadExternalPushInteraction(engine) {
|
|
178
|
-
await engine.addInteractor("externalPush", container => new Pusher(container));
|
|
176
|
+
async function loadExternalPushInteraction(engine, refresh = true) {
|
|
177
|
+
await engine.addInteractor("externalPush", container => new Pusher(container), refresh);
|
|
179
178
|
}
|
|
180
179
|
|
|
181
180
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.interaction.external.push.min.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var r="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var o in r)("object"==typeof exports?exports:t)[o]=r[o]}}(this,(t=>(()=>{"use strict";var e={533:e=>{e.exports=t}},r={};function o(t){var
|
|
2
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],e);else{var r="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var o in r)("object"==typeof exports?exports:t)[o]=r[o]}}(this,(t=>(()=>{"use strict";var e={533:e=>{e.exports=t}},r={};function o(t){var s=r[t];if(void 0!==s)return s.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,o),i.exports}o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return(()=>{o.r(s),o.d(s,{Push:()=>e,loadExternalPushInteraction:()=>i});var t=o(533);class e{constructor(){this.default=!0,this.groups=[],this.quantity=4}get particles_nb(){return this.quantity}set particles_nb(e){this.quantity=(0,t.setRangeValue)(e)}load(e){if(!e)return;void 0!==e.default&&(this.default=e.default),void 0!==e.groups&&(this.groups=e.groups.map((t=>t))),this.groups.length||(this.default=!0);const r=e.quantity??e.particles_nb;void 0!==r&&(this.quantity=(0,t.setRangeValue)(r))}}class r extends t.ExternalInteractorBase{constructor(e){super(e),this.handleClickMode=e=>{if("push"!==e)return;const r=this.container,o=r.actualOptions.interactivity.modes.push;if(!o)return;const s=(0,t.getRangeValue)(o.quantity);if(s<=0)return;const i=(0,t.itemFromArray)([void 0,...o.groups]),n=void 0!==i?r.actualOptions.particles.groups[i]:void 0;r.particles.push(s,r.interactivity.mouse,n,i)}}clear(){}init(){}async interact(){}isEnabled(){return!0}loadModeOptions(t,...r){t.push||(t.push=new e);for(const e of r)t.push.load(e?.push)}reset(){}}async function i(t,e=!0){await t.addInteractor("externalPush",(t=>new r(t)),e)}})(),s})()));
|
|
@@ -1,8 +1 @@
|
|
|
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
|
-
* v3.0.0-alpha.1
|
|
8
|
-
*/
|
|
1
|
+
/*! tsParticles Push External Interaction v3.0.0-beta.0 by Matteo Bruni */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type IOptionLoader, type RangeValue, type RecursivePartial } from "@tsparticles/engine";
|
|
2
2
|
import type { IPush } from "../Interfaces/IPush";
|
|
3
3
|
export declare class Push implements IPush, IOptionLoader<IPush> {
|
|
4
4
|
default: boolean;
|
|
5
5
|
groups: string[];
|
|
6
|
-
quantity:
|
|
6
|
+
quantity: RangeValue;
|
|
7
7
|
constructor();
|
|
8
|
-
get particles_nb():
|
|
9
|
-
set particles_nb(value:
|
|
8
|
+
get particles_nb(): RangeValue;
|
|
9
|
+
set particles_nb(value: RangeValue);
|
|
10
10
|
load(data?: RecursivePartial<IPush>): void;
|
|
11
11
|
}
|
package/types/Pusher.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ExternalInteractorBase } from "@tsparticles/engine";
|
|
2
|
-
import type { IModes, Modes, RecursivePartial } from "@tsparticles/engine";
|
|
1
|
+
import { ExternalInteractorBase, type IModes, type Modes, type RecursivePartial } from "@tsparticles/engine";
|
|
3
2
|
import type { IPushMode, PushContainer, PushMode } from "./Types";
|
|
4
3
|
export declare class Pusher extends ExternalInteractorBase<PushContainer> {
|
|
5
4
|
handleClickMode: (mode: string) => void;
|
package/types/Types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { Container } from "@tsparticles/engine";
|
|
1
|
+
import type { Container, Options } from "@tsparticles/engine";
|
|
2
2
|
import type { IPush } from "./Options/Interfaces/IPush";
|
|
3
3
|
import type { Push } from "./Options/Classes/Push";
|
|
4
|
-
import type { PushOptions } from "./Options/Classes/PushOptions";
|
|
5
4
|
export type IPushMode = {
|
|
6
5
|
push: IPush;
|
|
7
6
|
};
|
|
@@ -11,3 +10,8 @@ export type PushMode = {
|
|
|
11
10
|
export type PushContainer = Container & {
|
|
12
11
|
actualOptions: PushOptions;
|
|
13
12
|
};
|
|
13
|
+
export type PushOptions = Options & {
|
|
14
|
+
interactivity: {
|
|
15
|
+
modes: PushMode;
|
|
16
|
+
};
|
|
17
|
+
};
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Engine } from "@tsparticles/engine";
|
|
2
|
-
export declare function loadExternalPushInteraction(engine: Engine): Promise<void>;
|
|
2
|
+
export declare function loadExternalPushInteraction(engine: Engine, refresh?: boolean): Promise<void>;
|
|
3
3
|
export * from "./Options/Classes/Push";
|
|
4
4
|
export * from "./Options/Interfaces/IPush";
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Push = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
13
14
|
class Push {
|
|
14
15
|
constructor() {
|
|
15
16
|
this.default = true;
|
|
@@ -20,10 +21,9 @@
|
|
|
20
21
|
return this.quantity;
|
|
21
22
|
}
|
|
22
23
|
set particles_nb(value) {
|
|
23
|
-
this.quantity = value;
|
|
24
|
+
this.quantity = (0, engine_1.setRangeValue)(value);
|
|
24
25
|
}
|
|
25
26
|
load(data) {
|
|
26
|
-
var _a;
|
|
27
27
|
if (!data) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
if (!this.groups.length) {
|
|
37
37
|
this.default = true;
|
|
38
38
|
}
|
|
39
|
-
const quantity =
|
|
39
|
+
const quantity = data.quantity ?? data.particles_nb;
|
|
40
40
|
if (quantity !== undefined) {
|
|
41
|
-
this.quantity = quantity;
|
|
41
|
+
this.quantity = (0, engine_1.setRangeValue)(quantity);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
package/umd/Pusher.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Push"
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Push"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
exports.Pusher = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const Push_1 = require("./Options/Classes/Push");
|
|
15
|
-
const engine_2 = require("@tsparticles/engine");
|
|
16
15
|
class Pusher extends engine_1.ExternalInteractorBase {
|
|
17
16
|
constructor(container) {
|
|
18
17
|
super(container);
|
|
@@ -24,12 +23,12 @@
|
|
|
24
23
|
if (!pushOptions) {
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
26
|
+
const quantity = (0, engine_1.getRangeValue)(pushOptions.quantity);
|
|
27
|
+
if (quantity <= 0) {
|
|
29
28
|
return;
|
|
30
29
|
}
|
|
31
|
-
const group = (0,
|
|
32
|
-
container.particles.push(
|
|
30
|
+
const group = (0, engine_1.itemFromArray)([undefined, ...pushOptions.groups]), groupOptions = group !== undefined ? container.actualOptions.particles.groups[group] : undefined;
|
|
31
|
+
container.particles.push(quantity, container.interactivity.mouse, groupOptions, group);
|
|
33
32
|
};
|
|
34
33
|
}
|
|
35
34
|
clear() {
|
|
@@ -46,7 +45,7 @@
|
|
|
46
45
|
options.push = new Push_1.Push();
|
|
47
46
|
}
|
|
48
47
|
for (const source of sources) {
|
|
49
|
-
options.push.load(source
|
|
48
|
+
options.push.load(source?.push);
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
reset() {
|
package/umd/index.js
CHANGED
|
@@ -25,8 +25,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.loadExternalPushInteraction = void 0;
|
|
27
27
|
const Pusher_1 = require("./Pusher");
|
|
28
|
-
async function loadExternalPushInteraction(engine) {
|
|
29
|
-
await engine.addInteractor("externalPush", (container) => new Pusher_1.Pusher(container));
|
|
28
|
+
async function loadExternalPushInteraction(engine, refresh = true) {
|
|
29
|
+
await engine.addInteractor("externalPush", (container) => new Pusher_1.Pusher(container), refresh);
|
|
30
30
|
}
|
|
31
31
|
exports.loadExternalPushInteraction = loadExternalPushInteraction;
|
|
32
32
|
__exportStar(require("./Options/Classes/Push"), exports);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
});
|