@tsparticles/pjs 3.9.1 → 4.0.0-alpha.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/types/index.d.ts CHANGED
@@ -1,15 +1,13 @@
1
1
  import { type Container, type Engine } from "@tsparticles/engine";
2
2
  import type { IParticlesJS } from "./VincentGarreau/IParticlesJS.js";
3
- import { Particles } from "./marcbruederlin/Particles.js";
3
+ import { MBParticles } from "./marcbruederlin/Particles.js";
4
4
  declare global {
5
- interface Window {
6
- Particles: typeof Particles;
7
- pJSDom: Container[];
8
- particlesJS: IParticlesJS;
9
- }
5
+ var Particles: typeof MBParticles;
6
+ var pJSDom: Container[];
7
+ var particlesJS: IParticlesJS;
10
8
  }
11
9
  declare const initPjs: (engine: Engine) => {
12
- Particles: typeof Particles;
10
+ Particles: typeof MBParticles;
13
11
  pJSDom: Container[];
14
12
  particlesJS: IParticlesJS;
15
13
  };
@@ -13,9 +13,9 @@ interface ParticlesOptions {
13
13
  sizeVariations: number;
14
14
  speed: number;
15
15
  }
16
- export declare class Particles {
16
+ export declare class MBParticles {
17
17
  private _container?;
18
- static init(options: RecursivePartial<ParticlesOptions>): Particles;
18
+ static init(options: RecursivePartial<ParticlesOptions>): MBParticles;
19
19
  destroy(): void;
20
20
  pauseAnimation(): void;
21
21
  resumeAnimation(): void;
package/umd/bundle.js CHANGED
@@ -18,15 +18,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
18
  if (v !== undefined) module.exports = v;
19
19
  }
20
20
  else if (typeof define === "function" && define.amd) {
21
- define(["require", "exports", ".", "@tsparticles/engine", "@tsparticles/engine"], factory);
21
+ define(["require", "exports", "./index.js", "@tsparticles/engine", "@tsparticles/engine"], factory);
22
22
  }
23
23
  })(function (require, exports) {
24
24
  "use strict";
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.Particles = exports.pJSDom = exports.particlesJS = void 0;
27
- const _1 = require(".");
27
+ const index_js_1 = require("./index.js");
28
28
  const engine_1 = require("@tsparticles/engine");
29
- const { particlesJS, pJSDom, Particles } = (0, _1.initPjs)(engine_1.tsParticles);
29
+ const { particlesJS, pJSDom, Particles } = (0, index_js_1.initPjs)(engine_1.tsParticles);
30
30
  exports.particlesJS = particlesJS;
31
31
  exports.pJSDom = pJSDom;
32
32
  exports.Particles = Particles;
package/umd/index.js CHANGED
@@ -13,12 +13,12 @@
13
13
  const Particles_js_1 = require("./marcbruederlin/Particles.js");
14
14
  const particles_js_1 = require("./VincentGarreau/particles.js");
15
15
  const initPjs = (engine) => {
16
- engine.checkVersion("3.9.1");
16
+ engine.checkVersion("4.0.0-alpha.0");
17
17
  const { particlesJS, pJSDom } = (0, particles_js_1.initParticlesJS)(engine);
18
- window.particlesJS = particlesJS;
19
- window.pJSDom = pJSDom;
20
- window.Particles = Particles_js_1.Particles;
21
- return { particlesJS, pJSDom, Particles: Particles_js_1.Particles };
18
+ globalThis.particlesJS = particlesJS;
19
+ globalThis.pJSDom = pJSDom;
20
+ globalThis.Particles = Particles_js_1.MBParticles;
21
+ return { particlesJS, pJSDom, Particles: Particles_js_1.MBParticles };
22
22
  };
23
23
  exports.initPjs = initPjs;
24
24
  });
@@ -9,16 +9,16 @@
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Particles = void 0;
12
+ exports.MBParticles = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
14
  const linksMinDistance = 120, moveMinSpeed = 0.5, particlesMinCount = 100, sizeMinValue = 3;
15
- class Particles {
15
+ class MBParticles {
16
16
  static init(options) {
17
- const particles = new Particles(), selector = options.selector;
17
+ const particles = new MBParticles(), selector = options.selector;
18
18
  if (!selector) {
19
19
  throw new Error("No selector provided");
20
20
  }
21
- const el = document.querySelector(selector);
21
+ const el = (0, engine_1.safeDocument)().querySelector(selector);
22
22
  if (!el) {
23
23
  throw new Error("No element found for selector");
24
24
  }
@@ -94,5 +94,5 @@
94
94
  container?.play();
95
95
  }
96
96
  }
97
- exports.Particles = Particles;
97
+ exports.MBParticles = MBParticles;
98
98
  });