@tsparticles/pjs 3.0.0-alpha.1 → 3.0.0-beta.4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +46 -8
- package/browser/VincentGarreau/particles.js +23 -0
- package/browser/bundle.js +2 -2
- package/browser/index.js +7 -20
- package/browser/marcbruederlin/Particles.js +83 -0
- package/browser/package.json +1 -0
- package/cjs/VincentGarreau/particles.js +26 -0
- package/cjs/bundle.js +3 -2
- package/cjs/index.js +7 -20
- package/cjs/marcbruederlin/Particles.js +87 -0
- package/cjs/package.json +1 -0
- package/esm/VincentGarreau/particles.js +23 -0
- package/esm/bundle.js +2 -2
- package/esm/index.js +7 -20
- package/esm/marcbruederlin/Particles.js +83 -0
- package/esm/package.json +1 -0
- package/package.json +36 -13
- package/report.html +5 -5
- package/tsparticles.pjs.bundle.js +2367 -2321
- package/tsparticles.pjs.bundle.min.js +1 -1
- package/tsparticles.pjs.bundle.min.js.LICENSE.txt +1 -8
- package/tsparticles.pjs.js +159 -12
- package/tsparticles.pjs.min.js +1 -1
- package/tsparticles.pjs.min.js.LICENSE.txt +1 -8
- package/types/VincentGarreau/particles.d.ts +7 -0
- package/types/bundle.d.ts +2 -2
- package/types/index.d.ts +11 -2
- package/types/marcbruederlin/Particles.d.ts +23 -0
- package/umd/VincentGarreau/particles.js +36 -0
- package/umd/bundle.js +3 -2
- package/umd/index.js +8 -21
- package/umd/marcbruederlin/Particles.js +97 -0
- /package/browser/{IParticlesJS.js → VincentGarreau/IParticlesJS.js} +0 -0
- /package/cjs/{IParticlesJS.js → VincentGarreau/IParticlesJS.js} +0 -0
- /package/esm/{IParticlesJS.js → VincentGarreau/IParticlesJS.js} +0 -0
- /package/types/{IParticlesJS.d.ts → VincentGarreau/IParticlesJS.d.ts} +0 -0
- /package/umd/{IParticlesJS.js → VincentGarreau/IParticlesJS.js} +0 -0
@@ -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 Particles.js v3.0.0-beta.4 by Matteo Bruni */
|
package/types/bundle.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
declare const particlesJS: import("./IParticlesJS").IParticlesJS, pJSDom: import("@tsparticles/engine").Container[];
|
1
|
+
declare const particlesJS: import("./VincentGarreau/IParticlesJS").IParticlesJS, pJSDom: import("@tsparticles/engine").Container[], Particles: typeof import("./marcbruederlin/Particles").Particles;
|
2
2
|
export * from "@tsparticles/engine";
|
3
|
-
export { particlesJS, pJSDom };
|
3
|
+
export { particlesJS, pJSDom, Particles };
|
package/types/index.d.ts
CHANGED
@@ -1,6 +1,15 @@
|
|
1
|
-
import type
|
2
|
-
import type { IParticlesJS } from "./IParticlesJS";
|
1
|
+
import { type Container, type Engine } from "@tsparticles/engine";
|
2
|
+
import type { IParticlesJS } from "./VincentGarreau/IParticlesJS.js";
|
3
|
+
import { Particles } from "./marcbruederlin/Particles.js";
|
4
|
+
declare global {
|
5
|
+
interface Window {
|
6
|
+
Particles: typeof Particles;
|
7
|
+
pJSDom: Container[];
|
8
|
+
particlesJS: IParticlesJS;
|
9
|
+
}
|
10
|
+
}
|
3
11
|
declare const initPjs: (engine: Engine) => {
|
12
|
+
Particles: typeof Particles;
|
4
13
|
pJSDom: Container[];
|
5
14
|
particlesJS: IParticlesJS;
|
6
15
|
};
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { type RecursivePartial, type SingleOrMultiple } from "@tsparticles/engine";
|
2
|
+
interface ResponsiveOptions {
|
3
|
+
breakpoint: number;
|
4
|
+
options: ParticlesOptions;
|
5
|
+
}
|
6
|
+
interface ParticlesOptions {
|
7
|
+
color: SingleOrMultiple<string>;
|
8
|
+
connectParticles: boolean;
|
9
|
+
maxParticles: number;
|
10
|
+
minDistance: number;
|
11
|
+
responsive: ResponsiveOptions[];
|
12
|
+
selector: string;
|
13
|
+
sizeVariations: number;
|
14
|
+
speed: number;
|
15
|
+
}
|
16
|
+
export declare class Particles {
|
17
|
+
private _container?;
|
18
|
+
static init(options: RecursivePartial<ParticlesOptions>): Particles;
|
19
|
+
destroy(): void;
|
20
|
+
pauseAnimation(): void;
|
21
|
+
resumeAnimation(): void;
|
22
|
+
}
|
23
|
+
export {};
|
@@ -0,0 +1,36 @@
|
|
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
|
+
exports.initParticlesJS = void 0;
|
13
|
+
const initParticlesJS = (engine) => {
|
14
|
+
const particlesJS = (tagId, options) => {
|
15
|
+
return engine.load({ id: tagId, options });
|
16
|
+
};
|
17
|
+
particlesJS.load = (tagId, pathConfigJson, callback) => {
|
18
|
+
engine
|
19
|
+
.load({ id: tagId, url: pathConfigJson })
|
20
|
+
.then((container) => {
|
21
|
+
if (container) {
|
22
|
+
callback(container);
|
23
|
+
}
|
24
|
+
})
|
25
|
+
.catch(() => {
|
26
|
+
callback(undefined);
|
27
|
+
});
|
28
|
+
};
|
29
|
+
particlesJS.setOnClickHandler = (callback) => {
|
30
|
+
engine.setOnClickHandler(callback);
|
31
|
+
};
|
32
|
+
const pJSDom = engine.dom();
|
33
|
+
return { particlesJS, pJSDom };
|
34
|
+
};
|
35
|
+
exports.initParticlesJS = initParticlesJS;
|
36
|
+
});
|
package/umd/bundle.js
CHANGED
@@ -23,11 +23,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
23
23
|
})(function (require, exports) {
|
24
24
|
"use strict";
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.pJSDom = exports.particlesJS = void 0;
|
26
|
+
exports.Particles = exports.pJSDom = exports.particlesJS = void 0;
|
27
27
|
const _1 = require(".");
|
28
28
|
const engine_1 = require("@tsparticles/engine");
|
29
|
-
const { particlesJS, pJSDom } = (0, _1.initPjs)(engine_1.tsParticles);
|
29
|
+
const { particlesJS, pJSDom, Particles } = (0, _1.initPjs)(engine_1.tsParticles);
|
30
30
|
exports.particlesJS = particlesJS;
|
31
31
|
exports.pJSDom = pJSDom;
|
32
|
+
exports.Particles = Particles;
|
32
33
|
__exportStar(require("@tsparticles/engine"), exports);
|
33
34
|
});
|
package/umd/index.js
CHANGED
@@ -4,33 +4,20 @@
|
|
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", "./marcbruederlin/Particles.js", "./VincentGarreau/particles.js"], factory);
|
8
8
|
}
|
9
9
|
})(function (require, exports) {
|
10
10
|
"use strict";
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.initPjs = void 0;
|
13
|
+
const Particles_js_1 = require("./marcbruederlin/Particles.js");
|
14
|
+
const particles_js_1 = require("./VincentGarreau/particles.js");
|
13
15
|
const initPjs = (engine) => {
|
14
|
-
const particlesJS = (
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
.load({ id: tagId, url: pathConfigJson })
|
20
|
-
.then((container) => {
|
21
|
-
if (container) {
|
22
|
-
callback(container);
|
23
|
-
}
|
24
|
-
})
|
25
|
-
.catch(() => {
|
26
|
-
callback(undefined);
|
27
|
-
});
|
28
|
-
};
|
29
|
-
particlesJS.setOnClickHandler = (callback) => {
|
30
|
-
engine.setOnClickHandler(callback);
|
31
|
-
};
|
32
|
-
const pJSDom = engine.dom();
|
33
|
-
return { particlesJS, pJSDom };
|
16
|
+
const { particlesJS, pJSDom } = (0, particles_js_1.initParticlesJS)(engine);
|
17
|
+
window.particlesJS = particlesJS;
|
18
|
+
window.pJSDom = pJSDom;
|
19
|
+
window.Particles = Particles_js_1.Particles;
|
20
|
+
return { particlesJS, pJSDom, Particles: Particles_js_1.Particles };
|
34
21
|
};
|
35
22
|
exports.initPjs = initPjs;
|
36
23
|
});
|
@@ -0,0 +1,97 @@
|
|
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", "@tsparticles/engine"], factory);
|
8
|
+
}
|
9
|
+
})(function (require, exports) {
|
10
|
+
"use strict";
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.Particles = void 0;
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
14
|
+
class Particles {
|
15
|
+
static init(options) {
|
16
|
+
const particles = new Particles(), selector = options.selector;
|
17
|
+
if (!selector) {
|
18
|
+
throw new Error("No selector provided");
|
19
|
+
}
|
20
|
+
const el = document.querySelector(selector);
|
21
|
+
if (!el) {
|
22
|
+
throw new Error("No element found for selector");
|
23
|
+
}
|
24
|
+
engine_1.tsParticles
|
25
|
+
.load({
|
26
|
+
id: selector.replace(".", "").replace("!", ""),
|
27
|
+
element: el,
|
28
|
+
options: {
|
29
|
+
fullScreen: {
|
30
|
+
enable: false,
|
31
|
+
},
|
32
|
+
particles: {
|
33
|
+
color: {
|
34
|
+
value: options.color ?? "!000000",
|
35
|
+
},
|
36
|
+
links: {
|
37
|
+
color: "random",
|
38
|
+
distance: options.minDistance ?? 120,
|
39
|
+
enable: options.connectParticles ?? false,
|
40
|
+
},
|
41
|
+
move: {
|
42
|
+
enable: true,
|
43
|
+
speed: options.speed ?? 0.5,
|
44
|
+
},
|
45
|
+
number: {
|
46
|
+
value: options.maxParticles ?? 100,
|
47
|
+
},
|
48
|
+
size: {
|
49
|
+
value: { min: 1, max: options.sizeVariations ?? 3 },
|
50
|
+
},
|
51
|
+
},
|
52
|
+
responsive: options.responsive?.map((responsive) => ({
|
53
|
+
maxWidth: responsive.breakpoint,
|
54
|
+
options: {
|
55
|
+
particles: {
|
56
|
+
color: {
|
57
|
+
value: responsive.options?.color,
|
58
|
+
},
|
59
|
+
links: {
|
60
|
+
distance: responsive.options?.minDistance,
|
61
|
+
enable: responsive.options?.connectParticles,
|
62
|
+
},
|
63
|
+
number: {
|
64
|
+
value: options.maxParticles,
|
65
|
+
},
|
66
|
+
move: {
|
67
|
+
enable: true,
|
68
|
+
speed: responsive.options?.speed,
|
69
|
+
},
|
70
|
+
size: {
|
71
|
+
value: responsive.options?.sizeVariations,
|
72
|
+
},
|
73
|
+
},
|
74
|
+
},
|
75
|
+
})),
|
76
|
+
},
|
77
|
+
})
|
78
|
+
.then((container) => {
|
79
|
+
particles._container = container;
|
80
|
+
});
|
81
|
+
return particles;
|
82
|
+
}
|
83
|
+
destroy() {
|
84
|
+
const container = this._container;
|
85
|
+
container && container.destroy();
|
86
|
+
}
|
87
|
+
pauseAnimation() {
|
88
|
+
const container = this._container;
|
89
|
+
container && container.pause();
|
90
|
+
}
|
91
|
+
resumeAnimation() {
|
92
|
+
const container = this._container;
|
93
|
+
container && container.play();
|
94
|
+
}
|
95
|
+
}
|
96
|
+
exports.Particles = Particles;
|
97
|
+
});
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|