@tsparticles/interaction-external-remove 3.0.0-alpha.0 → 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/Remove.js +4 -4
- package/browser/Remover.js +3 -3
- package/browser/index.js +2 -2
- package/cjs/Options/Classes/Remove.js +4 -4
- package/cjs/Remover.js +3 -14
- package/cjs/index.js +2 -2
- package/esm/Options/Classes/Remove.js +4 -4
- package/esm/Remover.js +3 -3
- package/esm/index.js +2 -2
- package/package.json +6 -5
- package/report.html +4 -4
- package/tsparticles.interaction.external.remove.js +11 -11
- package/tsparticles.interaction.external.remove.min.js +1 -1
- package/tsparticles.interaction.external.remove.min.js.LICENSE.txt +1 -8
- package/types/Options/Classes/Remove.d.ts +4 -4
- package/types/Options/Interfaces/IRemove.d.ts +3 -2
- package/types/Remover.d.ts +1 -2
- package/types/Types.d.ts +6 -2
- package/types/index.d.ts +1 -1
- package/umd/Options/Classes/Remove.js +5 -5
- package/umd/Remover.js +2 -2
- package/umd/index.js +2 -2
- package/browser/Options/Classes/RemoveOptions.js +0 -1
- package/cjs/Options/Classes/RemoveOptions.js +0 -2
- package/esm/Options/Classes/RemoveOptions.js +0 -1
- package/types/Options/Classes/RemoveOptions.d.ts +0 -7
- package/umd/Options/Classes/RemoveOptions.js +0 -12
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# tsParticles External Remove Interaction
|
|
4
4
|
|
|
5
|
-
[](https://www.jsdelivr.com/package/npm/@tsparticles/interaction-external-remove)
|
|
6
|
+
[](https://www.npmjs.com/package/@tsparticles/interaction-external-remove)
|
|
7
|
+
[](https://www.npmjs.com/package/@tsparticles/interaction-external-remove) [](https://github.com/sponsors/matteobruni)
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/matteobruni/tsparticles) interaction plugin for remove effect around mouse or HTML
|
|
10
10
|
elements.
|
|
@@ -27,14 +27,16 @@ loadExternalRemoveInteraction;
|
|
|
27
27
|
Once the scripts are loaded you can set up `tsParticles` and the interaction plugin like this:
|
|
28
28
|
|
|
29
29
|
```javascript
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
30
|
+
(async () => {
|
|
31
|
+
await loadExternalRemoveInteraction(tsParticles);
|
|
32
|
+
|
|
33
|
+
await tsParticles.load({
|
|
34
|
+
id: "tsparticles",
|
|
35
|
+
options: {
|
|
36
|
+
/* options */
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
})();
|
|
38
40
|
```
|
|
39
41
|
|
|
40
42
|
### ESM / CommonJS
|
|
@@ -42,29 +44,33 @@ tsParticles.load({
|
|
|
42
44
|
This package is compatible also with ES or CommonJS modules, firstly this needs to be installed, like this:
|
|
43
45
|
|
|
44
46
|
```shell
|
|
45
|
-
$ npm install tsparticles
|
|
47
|
+
$ npm install @tsparticles/interaction-external-remove
|
|
46
48
|
```
|
|
47
49
|
|
|
48
50
|
or
|
|
49
51
|
|
|
50
52
|
```shell
|
|
51
|
-
$ yarn add tsparticles
|
|
53
|
+
$ yarn add @tsparticles/interaction-external-remove
|
|
52
54
|
```
|
|
53
55
|
|
|
54
56
|
Then you need to import it in the app, like this:
|
|
55
57
|
|
|
56
58
|
```javascript
|
|
57
|
-
const { tsParticles } = require("tsparticles
|
|
58
|
-
const { loadExternalRemoveInteraction } = require("tsparticles
|
|
59
|
+
const { tsParticles } = require("@tsparticles/engine");
|
|
60
|
+
const { loadExternalRemoveInteraction } = require("@tsparticles/interaction-external-remove");
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
(async () => {
|
|
63
|
+
await loadExternalRemoveInteraction(tsParticles);
|
|
64
|
+
})();
|
|
61
65
|
```
|
|
62
66
|
|
|
63
67
|
or
|
|
64
68
|
|
|
65
69
|
```javascript
|
|
66
|
-
import { tsParticles } from "tsparticles
|
|
67
|
-
import { loadExternalRemoveInteraction } from "tsparticles
|
|
70
|
+
import { tsParticles } from "@tsparticles/engine";
|
|
71
|
+
import { loadExternalRemoveInteraction } from "@tsparticles/interaction-external-remove";
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
(async () => {
|
|
74
|
+
await loadExternalRemoveInteraction(tsParticles);
|
|
75
|
+
})();
|
|
70
76
|
```
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setRangeValue } from "@tsparticles/engine";
|
|
1
2
|
export class Remove {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.quantity = 2;
|
|
@@ -6,16 +7,15 @@ export class Remove {
|
|
|
6
7
|
return this.quantity;
|
|
7
8
|
}
|
|
8
9
|
set particles_nb(value) {
|
|
9
|
-
this.quantity = value;
|
|
10
|
+
this.quantity = setRangeValue(value);
|
|
10
11
|
}
|
|
11
12
|
load(data) {
|
|
12
|
-
var _a;
|
|
13
13
|
if (!data) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
const quantity =
|
|
16
|
+
const quantity = data.quantity ?? data.particles_nb;
|
|
17
17
|
if (quantity !== undefined) {
|
|
18
|
-
this.quantity = quantity;
|
|
18
|
+
this.quantity = setRangeValue(quantity);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
package/browser/Remover.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExternalInteractorBase } from "@tsparticles/engine";
|
|
1
|
+
import { ExternalInteractorBase, getRangeValue, } from "@tsparticles/engine";
|
|
2
2
|
import { Remove } from "./Options/Classes/Remove";
|
|
3
3
|
export class Remover extends ExternalInteractorBase {
|
|
4
4
|
constructor(container) {
|
|
@@ -8,7 +8,7 @@ export class Remover extends ExternalInteractorBase {
|
|
|
8
8
|
if (!options.interactivity.modes.remove || mode !== "remove") {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
const removeNb = options.interactivity.modes.remove.quantity;
|
|
11
|
+
const removeNb = getRangeValue(options.interactivity.modes.remove.quantity);
|
|
12
12
|
container.particles.removeQuantity(removeNb);
|
|
13
13
|
};
|
|
14
14
|
}
|
|
@@ -26,7 +26,7 @@ export class Remover extends ExternalInteractorBase {
|
|
|
26
26
|
options.remove = new Remove();
|
|
27
27
|
}
|
|
28
28
|
for (const source of sources) {
|
|
29
|
-
options.remove.load(source
|
|
29
|
+
options.remove.load(source?.remove);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
reset() {
|
package/browser/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Remover } from "./Remover";
|
|
2
|
-
export function loadExternalRemoveInteraction(engine) {
|
|
3
|
-
engine.addInteractor("externalRemove", (container) => new Remover(container));
|
|
2
|
+
export async function loadExternalRemoveInteraction(engine, refresh = true) {
|
|
3
|
+
await engine.addInteractor("externalRemove", (container) => new Remover(container), refresh);
|
|
4
4
|
}
|
|
5
5
|
export * from "./Options/Classes/Remove";
|
|
6
6
|
export * from "./Options/Interfaces/IRemove";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Remove = void 0;
|
|
4
|
+
const engine_1 = require("@tsparticles/engine");
|
|
4
5
|
class Remove {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.quantity = 2;
|
|
@@ -9,16 +10,15 @@ class Remove {
|
|
|
9
10
|
return this.quantity;
|
|
10
11
|
}
|
|
11
12
|
set particles_nb(value) {
|
|
12
|
-
this.quantity = value;
|
|
13
|
+
this.quantity = (0, engine_1.setRangeValue)(value);
|
|
13
14
|
}
|
|
14
15
|
load(data) {
|
|
15
|
-
var _a;
|
|
16
16
|
if (!data) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
const quantity =
|
|
19
|
+
const quantity = data.quantity ?? data.particles_nb;
|
|
20
20
|
if (quantity !== undefined) {
|
|
21
|
-
this.quantity = quantity;
|
|
21
|
+
this.quantity = (0, engine_1.setRangeValue)(quantity);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
package/cjs/Remover.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.Remover = void 0;
|
|
13
4
|
const engine_1 = require("@tsparticles/engine");
|
|
@@ -20,7 +11,7 @@ class Remover extends engine_1.ExternalInteractorBase {
|
|
|
20
11
|
if (!options.interactivity.modes.remove || mode !== "remove") {
|
|
21
12
|
return;
|
|
22
13
|
}
|
|
23
|
-
const removeNb = options.interactivity.modes.remove.quantity;
|
|
14
|
+
const removeNb = (0, engine_1.getRangeValue)(options.interactivity.modes.remove.quantity);
|
|
24
15
|
container.particles.removeQuantity(removeNb);
|
|
25
16
|
};
|
|
26
17
|
}
|
|
@@ -28,9 +19,7 @@ class Remover extends engine_1.ExternalInteractorBase {
|
|
|
28
19
|
}
|
|
29
20
|
init() {
|
|
30
21
|
}
|
|
31
|
-
interact() {
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
});
|
|
22
|
+
async interact() {
|
|
34
23
|
}
|
|
35
24
|
isEnabled() {
|
|
36
25
|
return true;
|
|
@@ -40,7 +29,7 @@ class Remover extends engine_1.ExternalInteractorBase {
|
|
|
40
29
|
options.remove = new Remove_1.Remove();
|
|
41
30
|
}
|
|
42
31
|
for (const source of sources) {
|
|
43
|
-
options.remove.load(source
|
|
32
|
+
options.remove.load(source?.remove);
|
|
44
33
|
}
|
|
45
34
|
}
|
|
46
35
|
reset() {
|
package/cjs/index.js
CHANGED
|
@@ -16,8 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.loadExternalRemoveInteraction = void 0;
|
|
18
18
|
const Remover_1 = require("./Remover");
|
|
19
|
-
function loadExternalRemoveInteraction(engine) {
|
|
20
|
-
engine.addInteractor("externalRemove", (container) => new Remover_1.Remover(container));
|
|
19
|
+
async function loadExternalRemoveInteraction(engine, refresh = true) {
|
|
20
|
+
await engine.addInteractor("externalRemove", (container) => new Remover_1.Remover(container), refresh);
|
|
21
21
|
}
|
|
22
22
|
exports.loadExternalRemoveInteraction = loadExternalRemoveInteraction;
|
|
23
23
|
__exportStar(require("./Options/Classes/Remove"), exports);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setRangeValue } from "@tsparticles/engine";
|
|
1
2
|
export class Remove {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.quantity = 2;
|
|
@@ -6,16 +7,15 @@ export class Remove {
|
|
|
6
7
|
return this.quantity;
|
|
7
8
|
}
|
|
8
9
|
set particles_nb(value) {
|
|
9
|
-
this.quantity = value;
|
|
10
|
+
this.quantity = setRangeValue(value);
|
|
10
11
|
}
|
|
11
12
|
load(data) {
|
|
12
|
-
var _a;
|
|
13
13
|
if (!data) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
const quantity =
|
|
16
|
+
const quantity = data.quantity ?? data.particles_nb;
|
|
17
17
|
if (quantity !== undefined) {
|
|
18
|
-
this.quantity = quantity;
|
|
18
|
+
this.quantity = setRangeValue(quantity);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
package/esm/Remover.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExternalInteractorBase } from "@tsparticles/engine";
|
|
1
|
+
import { ExternalInteractorBase, getRangeValue, } from "@tsparticles/engine";
|
|
2
2
|
import { Remove } from "./Options/Classes/Remove";
|
|
3
3
|
export class Remover extends ExternalInteractorBase {
|
|
4
4
|
constructor(container) {
|
|
@@ -8,7 +8,7 @@ export class Remover extends ExternalInteractorBase {
|
|
|
8
8
|
if (!options.interactivity.modes.remove || mode !== "remove") {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
const removeNb = options.interactivity.modes.remove.quantity;
|
|
11
|
+
const removeNb = getRangeValue(options.interactivity.modes.remove.quantity);
|
|
12
12
|
container.particles.removeQuantity(removeNb);
|
|
13
13
|
};
|
|
14
14
|
}
|
|
@@ -26,7 +26,7 @@ export class Remover extends ExternalInteractorBase {
|
|
|
26
26
|
options.remove = new Remove();
|
|
27
27
|
}
|
|
28
28
|
for (const source of sources) {
|
|
29
|
-
options.remove.load(source
|
|
29
|
+
options.remove.load(source?.remove);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
reset() {
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Remover } from "./Remover";
|
|
2
|
-
export function loadExternalRemoveInteraction(engine) {
|
|
3
|
-
engine.addInteractor("externalRemove", (container) => new Remover(container));
|
|
2
|
+
export async function loadExternalRemoveInteraction(engine, refresh = true) {
|
|
3
|
+
await engine.addInteractor("externalRemove", (container) => new Remover(container), refresh);
|
|
4
4
|
}
|
|
5
5
|
export * from "./Options/Classes/Remove";
|
|
6
6
|
export * from "./Options/Interfaces/IRemove";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-remove",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta.0",
|
|
4
4
|
"description": "tsParticles remove external interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -73,10 +73,11 @@
|
|
|
73
73
|
"unpkg": "tsparticles.interaction.external.remove.min.js",
|
|
74
74
|
"module": "esm/index.js",
|
|
75
75
|
"types": "types/index.d.ts",
|
|
76
|
+
"sideEffects": false,
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"@tsparticles/engine": "^3.0.0-beta.0"
|
|
79
|
+
},
|
|
76
80
|
"publishConfig": {
|
|
77
81
|
"access": "public"
|
|
78
|
-
},
|
|
79
|
-
"dependencies": {
|
|
80
|
-
"@tsparticles/engine": "^3.0.0-alpha.0"
|
|
81
82
|
}
|
|
82
|
-
}
|
|
83
|
+
}
|