tsparticles 1.39.1 → 1.40.1

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.
Files changed (168) hide show
  1. package/Core/Container.d.ts +3 -1
  2. package/Core/Container.js +30 -15
  3. package/Core/Loader.d.ts +12 -9
  4. package/Core/Loader.js +35 -19
  5. package/Core/Particle.d.ts +3 -1
  6. package/Core/Particle.js +17 -2
  7. package/Core/Particles.d.ts +3 -1
  8. package/Core/Particles.js +20 -5
  9. package/Core/Utils/InteractionManager.d.ts +5 -3
  10. package/Core/Utils/InteractionManager.js +19 -3
  11. package/Core/Utils/Plugins.d.ts +29 -15
  12. package/Core/Utils/Plugins.js +58 -46
  13. package/Options/Classes/Options.d.ts +2 -1
  14. package/Options/Classes/Options.js +14 -7
  15. package/Plugins/Emitters/EmitterInstance.d.ts +6 -3
  16. package/Plugins/Emitters/EmitterInstance.js +46 -16
  17. package/Plugins/Emitters/Emitters.d.ts +3 -1
  18. package/Plugins/Emitters/Emitters.js +17 -2
  19. package/Plugins/Emitters/{EmittersMain.d.ts → EmittersEngine.d.ts} +3 -1
  20. package/Plugins/Emitters/{EmittersMain.js → EmittersEngine.js} +0 -0
  21. package/Plugins/Emitters/IEmitterShape.d.ts +2 -2
  22. package/Plugins/Emitters/Options/Classes/Emitter.d.ts +1 -0
  23. package/Plugins/Emitters/Options/Classes/Emitter.js +1 -0
  24. package/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +1 -0
  25. package/Plugins/Emitters/ShapeManager.d.ts +6 -3
  26. package/Plugins/Emitters/ShapeManager.js +16 -4
  27. package/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +2 -2
  28. package/Plugins/Emitters/Shapes/Circle/CircleShape.js +2 -2
  29. package/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +2 -2
  30. package/Plugins/Emitters/Shapes/Square/SquareShape.js +4 -4
  31. package/Plugins/Emitters/index.d.ts +3 -3
  32. package/Plugins/Emitters/index.js +25 -6
  33. package/README.md +3 -3
  34. package/browser/Core/Container.d.ts +4 -1
  35. package/browser/Core/Container.js +32 -16
  36. package/browser/Core/Loader.d.ts +12 -9
  37. package/browser/Core/Loader.js +35 -19
  38. package/browser/Core/Particle.d.ts +3 -1
  39. package/browser/Core/Particle.js +18 -3
  40. package/browser/Core/Particles.d.ts +3 -1
  41. package/browser/Core/Particles.js +21 -6
  42. package/browser/Core/Utils/InteractionManager.d.ts +5 -3
  43. package/browser/Core/Utils/InteractionManager.js +19 -3
  44. package/browser/Core/Utils/Plugins.d.ts +29 -15
  45. package/browser/Core/Utils/Plugins.js +58 -46
  46. package/browser/Options/Classes/Options.d.ts +2 -1
  47. package/browser/Options/Classes/Options.js +14 -7
  48. package/browser/Plugins/Emitters/EmitterInstance.d.ts +6 -3
  49. package/browser/Plugins/Emitters/EmitterInstance.js +46 -16
  50. package/browser/Plugins/Emitters/Emitters.d.ts +3 -1
  51. package/browser/Plugins/Emitters/Emitters.js +17 -2
  52. package/{esm/Plugins/Emitters/EmittersMain.d.ts → browser/Plugins/Emitters/EmittersEngine.d.ts} +3 -1
  53. package/browser/Plugins/Emitters/{EmittersMain.js → EmittersEngine.js} +0 -0
  54. package/browser/Plugins/Emitters/IEmitterShape.d.ts +2 -2
  55. package/browser/Plugins/Emitters/Options/Classes/Emitter.d.ts +1 -0
  56. package/browser/Plugins/Emitters/Options/Classes/Emitter.js +1 -0
  57. package/browser/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +4 -0
  58. package/browser/Plugins/Emitters/ShapeManager.d.ts +6 -3
  59. package/browser/Plugins/Emitters/ShapeManager.js +16 -4
  60. package/browser/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +2 -2
  61. package/browser/Plugins/Emitters/Shapes/Circle/CircleShape.js +2 -2
  62. package/browser/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +2 -2
  63. package/browser/Plugins/Emitters/Shapes/Square/SquareShape.js +4 -4
  64. package/browser/Plugins/Emitters/index.d.ts +3 -3
  65. package/browser/Plugins/Emitters/index.js +25 -6
  66. package/browser/engine.d.ts +5 -1
  67. package/browser/engine.js +22 -17
  68. package/engine.d.ts +3 -0
  69. package/engine.js +20 -16
  70. package/esm/Core/Container.d.ts +3 -1
  71. package/esm/Core/Container.js +31 -16
  72. package/esm/Core/Loader.d.ts +12 -9
  73. package/esm/Core/Loader.js +35 -19
  74. package/esm/Core/Particle.d.ts +3 -1
  75. package/esm/Core/Particle.js +18 -3
  76. package/esm/Core/Particles.d.ts +3 -1
  77. package/esm/Core/Particles.js +21 -6
  78. package/esm/Core/Utils/InteractionManager.d.ts +5 -3
  79. package/esm/Core/Utils/InteractionManager.js +19 -3
  80. package/esm/Core/Utils/Plugins.d.ts +29 -15
  81. package/esm/Core/Utils/Plugins.js +58 -46
  82. package/esm/Options/Classes/Options.d.ts +2 -1
  83. package/esm/Options/Classes/Options.js +14 -7
  84. package/esm/Plugins/Emitters/EmitterInstance.d.ts +6 -3
  85. package/esm/Plugins/Emitters/EmitterInstance.js +46 -16
  86. package/esm/Plugins/Emitters/Emitters.d.ts +3 -1
  87. package/esm/Plugins/Emitters/Emitters.js +17 -2
  88. package/{browser/Plugins/Emitters/EmittersMain.d.ts → esm/Plugins/Emitters/EmittersEngine.d.ts} +3 -1
  89. package/esm/Plugins/Emitters/{EmittersMain.js → EmittersEngine.js} +0 -0
  90. package/esm/Plugins/Emitters/IEmitterShape.d.ts +2 -2
  91. package/esm/Plugins/Emitters/Options/Classes/Emitter.d.ts +1 -0
  92. package/esm/Plugins/Emitters/Options/Classes/Emitter.js +1 -0
  93. package/esm/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +1 -0
  94. package/esm/Plugins/Emitters/ShapeManager.d.ts +6 -3
  95. package/esm/Plugins/Emitters/ShapeManager.js +16 -4
  96. package/esm/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +2 -2
  97. package/esm/Plugins/Emitters/Shapes/Circle/CircleShape.js +2 -2
  98. package/esm/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +2 -2
  99. package/esm/Plugins/Emitters/Shapes/Square/SquareShape.js +4 -4
  100. package/esm/Plugins/Emitters/index.d.ts +3 -3
  101. package/esm/Plugins/Emitters/index.js +25 -6
  102. package/esm/engine.d.ts +3 -0
  103. package/esm/engine.js +20 -16
  104. package/package.json +11 -5
  105. package/report.html +2 -2
  106. package/report.slim.html +2 -2
  107. package/tsparticles.engine.js +227 -118
  108. package/tsparticles.engine.min.js +2 -2
  109. package/tsparticles.interaction.external.attract.js +205 -100
  110. package/tsparticles.interaction.external.attract.min.js +2 -2
  111. package/tsparticles.interaction.external.bounce.js +205 -100
  112. package/tsparticles.interaction.external.bounce.min.js +2 -2
  113. package/tsparticles.interaction.external.bubble.js +205 -100
  114. package/tsparticles.interaction.external.bubble.min.js +2 -2
  115. package/tsparticles.interaction.external.connect.js +205 -100
  116. package/tsparticles.interaction.external.connect.min.js +2 -2
  117. package/tsparticles.interaction.external.grab.js +205 -100
  118. package/tsparticles.interaction.external.grab.min.js +2 -2
  119. package/tsparticles.interaction.external.repulse.js +205 -100
  120. package/tsparticles.interaction.external.repulse.min.js +2 -2
  121. package/tsparticles.interaction.external.trail.js +205 -100
  122. package/tsparticles.interaction.external.trail.min.js +2 -2
  123. package/tsparticles.interaction.particles.attract.js +205 -100
  124. package/tsparticles.interaction.particles.attract.min.js +2 -2
  125. package/tsparticles.interaction.particles.collisions.js +205 -100
  126. package/tsparticles.interaction.particles.collisions.min.js +2 -2
  127. package/tsparticles.interaction.particles.links.js +205 -100
  128. package/tsparticles.interaction.particles.links.min.js +2 -2
  129. package/tsparticles.js +347 -156
  130. package/tsparticles.min.js +2 -2
  131. package/tsparticles.pathseg.min.js +1 -1
  132. package/tsparticles.plugins.absorbers.js +205 -100
  133. package/tsparticles.plugins.absorbers.min.js +2 -2
  134. package/tsparticles.plugins.emitters.js +330 -143
  135. package/tsparticles.plugins.emitters.min.js +2 -2
  136. package/tsparticles.plugins.polygonMask.js +205 -100
  137. package/tsparticles.plugins.polygonMask.min.js +2 -2
  138. package/tsparticles.shape.circle.min.js +1 -1
  139. package/tsparticles.shape.image.js +208 -103
  140. package/tsparticles.shape.image.min.js +2 -2
  141. package/tsparticles.shape.line.min.js +1 -1
  142. package/tsparticles.shape.polygon.min.js +1 -1
  143. package/tsparticles.shape.square.min.js +1 -1
  144. package/tsparticles.shape.star.min.js +1 -1
  145. package/tsparticles.shape.text.js +205 -100
  146. package/tsparticles.shape.text.min.js +2 -2
  147. package/tsparticles.slim.js +227 -118
  148. package/tsparticles.slim.min.js +2 -2
  149. package/tsparticles.updater.angle.js +205 -100
  150. package/tsparticles.updater.angle.min.js +2 -2
  151. package/tsparticles.updater.color.js +205 -100
  152. package/tsparticles.updater.color.min.js +2 -2
  153. package/tsparticles.updater.life.js +205 -100
  154. package/tsparticles.updater.life.min.js +2 -2
  155. package/tsparticles.updater.opacity.js +205 -100
  156. package/tsparticles.updater.opacity.min.js +2 -2
  157. package/tsparticles.updater.outModes.js +205 -100
  158. package/tsparticles.updater.outModes.min.js +2 -2
  159. package/tsparticles.updater.roll.js +205 -100
  160. package/tsparticles.updater.roll.min.js +2 -2
  161. package/tsparticles.updater.size.js +205 -100
  162. package/tsparticles.updater.size.min.js +2 -2
  163. package/tsparticles.updater.strokeColor.js +205 -100
  164. package/tsparticles.updater.strokeColor.min.js +2 -2
  165. package/tsparticles.updater.tilt.js +205 -100
  166. package/tsparticles.updater.tilt.min.js +2 -2
  167. package/tsparticles.updater.wobble.js +205 -100
  168. package/tsparticles.updater.wobble.min.js +2 -2
@@ -1567,15 +1567,32 @@
1567
1567
  this.type = 0;
1568
1568
  }
1569
1569
  }
1570
+ var __classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
1571
+ if (kind === "m") throw new TypeError("Private method is not writable");
1572
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1573
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1574
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
1575
+ value;
1576
+ };
1577
+ var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
1578
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1579
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1580
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1581
+ };
1582
+ var _InteractionManager_engine;
1570
1583
  class InteractionManager_InteractionManager {
1571
- constructor(container) {
1584
+ constructor(engine, container) {
1572
1585
  this.container = container;
1586
+ _InteractionManager_engine.set(this, void 0);
1587
+ __classPrivateFieldSet(this, _InteractionManager_engine, engine, "f");
1573
1588
  this.externalInteractors = [];
1574
1589
  this.particleInteractors = [];
1575
1590
  this.init();
1576
1591
  }
1577
1592
  init() {
1578
- const interactors = Plugins.getInteractors(this.container, true);
1593
+ const interactors = __classPrivateFieldGet(this, _InteractionManager_engine, "f").plugins.getInteractors(this.container, true);
1594
+ this.externalInteractors = [];
1595
+ this.particleInteractors = [];
1579
1596
  for (const interactor of interactors) {
1580
1597
  switch (interactor.type) {
1581
1598
  case 0:
@@ -1606,6 +1623,7 @@
1606
1623
  }
1607
1624
  }
1608
1625
  }
1626
+ _InteractionManager_engine = new WeakMap;
1609
1627
  function applyDistance(particle) {
1610
1628
  const initialPosition = particle.initialPosition;
1611
1629
  const {dx: dx, dy: dy} = getDistances(initialPosition, particle.position);
@@ -1779,26 +1797,38 @@
1779
1797
  return proximityFactor / slowFactor;
1780
1798
  }
1781
1799
  }
1782
- const plugins = null && [];
1783
- const interactorsInitializers = new Map;
1784
- const updatersInitializers = new Map;
1785
- const interactors = new Map;
1786
- const updaters = new Map;
1787
- const presets = new Map;
1788
- const drawers = new Map;
1789
- const pathGenerators = new Map;
1790
- class Plugins_Plugins {
1791
- static getPlugin(plugin) {
1792
- return plugins.find((t => t.id === plugin));
1800
+ var Plugins_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
1801
+ if (kind === "m") throw new TypeError("Private method is not writable");
1802
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1803
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1804
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
1805
+ value;
1806
+ };
1807
+ var _Plugins_engine;
1808
+ class Plugins {
1809
+ constructor(engine) {
1810
+ _Plugins_engine.set(this, void 0);
1811
+ Plugins_classPrivateFieldSet(this, _Plugins_engine, engine, "f");
1812
+ this.plugins = [];
1813
+ this.interactorsInitializers = new Map;
1814
+ this.updatersInitializers = new Map;
1815
+ this.interactors = new Map;
1816
+ this.updaters = new Map;
1817
+ this.presets = new Map;
1818
+ this.drawers = new Map;
1819
+ this.pathGenerators = new Map;
1820
+ }
1821
+ getPlugin(plugin) {
1822
+ return this.plugins.find((t => t.id === plugin));
1793
1823
  }
1794
- static addPlugin(plugin) {
1795
- if (!Plugins_Plugins.getPlugin(plugin.id)) {
1796
- plugins.push(plugin);
1824
+ addPlugin(plugin) {
1825
+ if (!this.getPlugin(plugin.id)) {
1826
+ this.plugins.push(plugin);
1797
1827
  }
1798
1828
  }
1799
- static getAvailablePlugins(container) {
1829
+ getAvailablePlugins(container) {
1800
1830
  const res = new Map;
1801
- for (const plugin of plugins) {
1831
+ for (const plugin of this.plugins) {
1802
1832
  if (!plugin.needsPlugin(container.actualOptions)) {
1803
1833
  continue;
1804
1834
  }
@@ -1806,61 +1836,62 @@
1806
1836
  }
1807
1837
  return res;
1808
1838
  }
1809
- static loadOptions(options, sourceOptions) {
1810
- for (const plugin of plugins) {
1839
+ loadOptions(options, sourceOptions) {
1840
+ for (const plugin of this.plugins) {
1811
1841
  plugin.loadOptions(options, sourceOptions);
1812
1842
  }
1813
1843
  }
1814
- static getPreset(preset) {
1815
- return presets.get(preset);
1844
+ getPreset(preset) {
1845
+ return this.presets.get(preset);
1816
1846
  }
1817
- static addPreset(presetKey, options, override = false) {
1818
- if (override || !Plugins_Plugins.getPreset(presetKey)) {
1819
- presets.set(presetKey, options);
1847
+ addPreset(presetKey, options, override = false) {
1848
+ if (override || !this.getPreset(presetKey)) {
1849
+ this.presets.set(presetKey, options);
1820
1850
  }
1821
1851
  }
1822
- static addShapeDrawer(type, drawer) {
1823
- if (!Plugins_Plugins.getShapeDrawer(type)) {
1824
- drawers.set(type, drawer);
1852
+ addShapeDrawer(type, drawer) {
1853
+ if (!this.getShapeDrawer(type)) {
1854
+ this.drawers.set(type, drawer);
1825
1855
  }
1826
1856
  }
1827
- static getShapeDrawer(type) {
1828
- return drawers.get(type);
1857
+ getShapeDrawer(type) {
1858
+ return this.drawers.get(type);
1829
1859
  }
1830
- static getSupportedShapes() {
1831
- return drawers.keys();
1860
+ getSupportedShapes() {
1861
+ return this.drawers.keys();
1832
1862
  }
1833
- static getPathGenerator(type) {
1834
- return pathGenerators.get(type);
1863
+ getPathGenerator(type) {
1864
+ return this.pathGenerators.get(type);
1835
1865
  }
1836
- static addPathGenerator(type, pathGenerator) {
1837
- if (!Plugins_Plugins.getPathGenerator(type)) {
1838
- pathGenerators.set(type, pathGenerator);
1866
+ addPathGenerator(type, pathGenerator) {
1867
+ if (!this.getPathGenerator(type)) {
1868
+ this.pathGenerators.set(type, pathGenerator);
1839
1869
  }
1840
1870
  }
1841
- static getInteractors(container, force = false) {
1842
- let res = interactors.get(container);
1871
+ getInteractors(container, force = false) {
1872
+ let res = this.interactors.get(container);
1843
1873
  if (!res || force) {
1844
- res = [ ...interactorsInitializers.values() ].map((t => t(container)));
1845
- interactors.set(container, res);
1874
+ res = [ ...this.interactorsInitializers.values() ].map((t => t(container)));
1875
+ this.interactors.set(container, res);
1846
1876
  }
1847
1877
  return res;
1848
1878
  }
1849
- static addInteractor(name, initInteractor) {
1850
- interactorsInitializers.set(name, initInteractor);
1879
+ addInteractor(name, initInteractor) {
1880
+ this.interactorsInitializers.set(name, initInteractor);
1851
1881
  }
1852
- static getUpdaters(container, force = false) {
1853
- let res = updaters.get(container);
1882
+ getUpdaters(container, force = false) {
1883
+ let res = this.updaters.get(container);
1854
1884
  if (!res || force) {
1855
- res = [ ...updatersInitializers.values() ].map((t => t(container)));
1856
- updaters.set(container, res);
1885
+ res = [ ...this.updatersInitializers.values() ].map((t => t(container)));
1886
+ this.updaters.set(container, res);
1857
1887
  }
1858
1888
  return res;
1859
1889
  }
1860
- static addParticleUpdater(name, initUpdater) {
1861
- updatersInitializers.set(name, initUpdater);
1890
+ addParticleUpdater(name, initUpdater) {
1891
+ this.updatersInitializers.set(name, initUpdater);
1862
1892
  }
1863
1893
  }
1894
+ _Plugins_engine = new WeakMap;
1864
1895
  class QuadTree_QuadTree {
1865
1896
  constructor(rectangle, capacity) {
1866
1897
  this.rectangle = rectangle;
@@ -3510,22 +3541,31 @@
3510
3541
  }
3511
3542
  }
3512
3543
  }
3513
- var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3544
+ var Options_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
3545
+ if (kind === "m") throw new TypeError("Private method is not writable");
3546
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3547
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
3548
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
3549
+ value;
3550
+ };
3551
+ var Options_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3514
3552
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3515
3553
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
3516
3554
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3517
3555
  };
3518
- var _Options_instances, _Options_findDefaultTheme;
3556
+ var _Options_instances, _Options_engine, _Options_findDefaultTheme;
3519
3557
  class Options_Options {
3520
- constructor() {
3558
+ constructor(engine) {
3521
3559
  _Options_instances.add(this);
3560
+ _Options_engine.set(this, void 0);
3561
+ Options_classPrivateFieldSet(this, _Options_engine, engine, "f");
3522
3562
  this.autoPlay = true;
3523
3563
  this.background = new Background;
3524
3564
  this.backgroundMask = new BackgroundMask;
3525
3565
  this.fullScreen = new FullScreen;
3526
3566
  this.detectRetina = true;
3527
3567
  this.duration = 0;
3528
- this.fpsLimit = 60;
3568
+ this.fpsLimit = 120;
3529
3569
  this.interactivity = new Interactivity;
3530
3570
  this.manualParticles = [];
3531
3571
  this.motion = new Motion;
@@ -3611,7 +3651,7 @@
3611
3651
  this.motion.load(data.motion);
3612
3652
  this.particles.load(data.particles);
3613
3653
  this.style = deepExtend(this.style, data.style);
3614
- Plugins.loadOptions(this, data);
3654
+ Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.loadOptions(this, data);
3615
3655
  if (data.responsive !== undefined) {
3616
3656
  for (const responsive of data.responsive) {
3617
3657
  const optResponsive = new Responsive;
@@ -3627,8 +3667,8 @@
3627
3667
  this.themes.push(optTheme);
3628
3668
  }
3629
3669
  }
3630
- this.defaultDarkTheme = (_d = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
3631
- this.defaultLightTheme = (_e = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
3670
+ this.defaultDarkTheme = (_d = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
3671
+ this.defaultLightTheme = (_e = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
3632
3672
  }
3633
3673
  setTheme(name) {
3634
3674
  if (name) {
@@ -3637,7 +3677,7 @@
3637
3677
  this.load(chosenTheme.options);
3638
3678
  }
3639
3679
  } else {
3640
- const mediaMatch = typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)"), clientDarkMode = mediaMatch && mediaMatch.matches, defaultTheme = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, clientDarkMode ? "dark" : "light");
3680
+ const mediaMatch = typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)"), clientDarkMode = mediaMatch && mediaMatch.matches, defaultTheme = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, clientDarkMode ? "dark" : "light");
3641
3681
  if (defaultTheme) {
3642
3682
  this.load(defaultTheme.options);
3643
3683
  }
@@ -3650,13 +3690,26 @@
3650
3690
  return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
3651
3691
  }
3652
3692
  importPreset(preset) {
3653
- this.load(Plugins.getPreset(preset));
3693
+ this.load(Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.getPreset(preset));
3654
3694
  }
3655
3695
  }
3656
- _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
3696
+ _Options_engine = new WeakMap, _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
3657
3697
  var _a;
3658
3698
  return (_a = this.themes.find((theme => theme.default.value && theme.default.mode === mode))) !== null && _a !== void 0 ? _a : this.themes.find((theme => theme.default.value && theme.default.mode === "any"));
3659
3699
  };
3700
+ var Particle_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
3701
+ if (kind === "m") throw new TypeError("Private method is not writable");
3702
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3703
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
3704
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
3705
+ value;
3706
+ };
3707
+ var Particle_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3708
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3709
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
3710
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3711
+ };
3712
+ var _Particle_engine;
3660
3713
  const fixOutMode = data => {
3661
3714
  if (isInArray(data.outMode, data.checkModes) || isInArray(data.outMode, data.checkModes)) {
3662
3715
  if (data.coord > data.maxCoord - data.radius * 2) {
@@ -3667,11 +3720,13 @@
3667
3720
  }
3668
3721
  };
3669
3722
  class Particle_Particle {
3670
- constructor(id, container, position, overrideOptions, group) {
3723
+ constructor(engine, id, container, position, overrideOptions, group) {
3671
3724
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
3672
3725
  this.id = id;
3673
3726
  this.container = container;
3674
3727
  this.group = group;
3728
+ _Particle_engine.set(this, void 0);
3729
+ Particle_classPrivateFieldSet(this, _Particle_engine, engine, "f");
3675
3730
  this.fill = true;
3676
3731
  this.close = true;
3677
3732
  this.lastPathTime = 0;
@@ -3765,7 +3820,7 @@
3765
3820
  this.sides = 24;
3766
3821
  let drawer = container.drawers.get(this.shape);
3767
3822
  if (!drawer) {
3768
- drawer = Plugins.getShapeDrawer(this.shape);
3823
+ drawer = Particle_classPrivateFieldGet(this, _Particle_engine, "f").plugins.getShapeDrawer(this.shape);
3769
3824
  if (drawer) {
3770
3825
  container.drawers.set(this.shape, drawer);
3771
3826
  }
@@ -4005,9 +4060,25 @@
4005
4060
  return life;
4006
4061
  }
4007
4062
  }
4063
+ _Particle_engine = new WeakMap;
4064
+ var Particles_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
4065
+ if (kind === "m") throw new TypeError("Private method is not writable");
4066
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4067
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
4068
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
4069
+ value;
4070
+ };
4071
+ var Particles_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
4072
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4073
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4074
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4075
+ };
4076
+ var _Particles_engine;
4008
4077
  class Particles_Particles {
4009
- constructor(container) {
4078
+ constructor(engine, container) {
4010
4079
  this.container = container;
4080
+ _Particles_engine.set(this, void 0);
4081
+ Particles_classPrivateFieldSet(this, _Particles_engine, engine, "f");
4011
4082
  this.nextId = 0;
4012
4083
  this.array = [];
4013
4084
  this.zArray = [];
@@ -4019,11 +4090,11 @@
4019
4090
  links: new Map,
4020
4091
  triangles: new Map
4021
4092
  };
4022
- this.interactionManager = new InteractionManager(container);
4093
+ this.interactionManager = new InteractionManager(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), container);
4023
4094
  const canvasSize = this.container.canvas.size;
4024
4095
  this.linksColors = new Map;
4025
4096
  this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
4026
- this.updaters = Plugins.getUpdaters(container, true);
4097
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
4027
4098
  }
4028
4099
  get count() {
4029
4100
  return this.array.length;
@@ -4037,7 +4108,7 @@
4037
4108
  this.freqs.links = new Map;
4038
4109
  this.freqs.triangles = new Map;
4039
4110
  let handled = false;
4040
- this.updaters = Plugins.getUpdaters(container, true);
4111
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
4041
4112
  this.interactionManager.init();
4042
4113
  for (const [, plugin] of container.plugins) {
4043
4114
  if (plugin.particlesInitialization !== undefined) {
@@ -4284,7 +4355,7 @@
4284
4355
  }
4285
4356
  pushParticle(position, overrideOptions, group, initializer) {
4286
4357
  try {
4287
- const particle = new Particle(this.nextId, this.container, position, overrideOptions, group);
4358
+ const particle = new Particle(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), this.nextId, this.container, position, overrideOptions, group);
4288
4359
  let canAdd = true;
4289
4360
  if (initializer) {
4290
4361
  canAdd = initializer(particle);
@@ -4302,6 +4373,7 @@
4302
4373
  }
4303
4374
  }
4304
4375
  }
4376
+ _Particles_engine = new WeakMap;
4305
4377
  class Retina_Retina {
4306
4378
  constructor(container) {
4307
4379
  this.container = container;
@@ -4389,10 +4461,25 @@
4389
4461
  }
4390
4462
  }
4391
4463
  }
4464
+ var Container_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
4465
+ if (kind === "m") throw new TypeError("Private method is not writable");
4466
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4467
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
4468
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
4469
+ value;
4470
+ };
4471
+ var Container_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
4472
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4473
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4474
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4475
+ };
4476
+ var _Container_engine;
4392
4477
  class Container_Container {
4393
- constructor(id, sourceOptions, ...presets) {
4478
+ constructor(engine, id, sourceOptions, ...presets) {
4394
4479
  this.id = id;
4395
- this.fpsLimit = 60;
4480
+ _Container_engine.set(this, void 0);
4481
+ Container_classPrivateFieldSet(this, _Container_engine, engine, "f");
4482
+ this.fpsLimit = 120;
4396
4483
  this.duration = 0;
4397
4484
  this.lifeTime = 0;
4398
4485
  this.firstStart = true;
@@ -4406,7 +4493,7 @@
4406
4493
  this._initialSourceOptions = sourceOptions;
4407
4494
  this.retina = new Retina(this);
4408
4495
  this.canvas = new Canvas(this);
4409
- this.particles = new Particles(this);
4496
+ this.particles = new Particles(Container_classPrivateFieldGet(this, _Container_engine, "f"), this);
4410
4497
  this.drawer = new FrameManager(this);
4411
4498
  this.presets = presets;
4412
4499
  this.pathGenerator = {
@@ -4435,8 +4522,8 @@
4435
4522
  this.plugins = new Map;
4436
4523
  this.drawers = new Map;
4437
4524
  this.density = 1;
4438
- this._options = new Options;
4439
- this.actualOptions = new Options;
4525
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4526
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4440
4527
  this.eventListeners = new EventListeners(this);
4441
4528
  if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
4442
4529
  this.intersectionObserver = new IntersectionObserver((entries => this.intersectionManager(entries)));
@@ -4551,7 +4638,7 @@
4551
4638
  return this.start();
4552
4639
  }
4553
4640
  reset() {
4554
- this._options = new Options;
4641
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4555
4642
  return this.refresh();
4556
4643
  }
4557
4644
  stop() {
@@ -4565,7 +4652,7 @@
4565
4652
  this.particles.clear();
4566
4653
  this.canvas.clear();
4567
4654
  if (this.interactivity.element instanceof HTMLElement && this.intersectionObserver) {
4568
- this.intersectionObserver.observe(this.interactivity.element);
4655
+ this.intersectionObserver.unobserve(this.interactivity.element);
4569
4656
  }
4570
4657
  for (const [, plugin] of this.plugins) {
4571
4658
  if (plugin.stop) {
@@ -4692,20 +4779,20 @@
4692
4779
  return false;
4693
4780
  }
4694
4781
  async init() {
4695
- this._options = new Options;
4782
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4696
4783
  for (const preset of this.presets) {
4697
- this._options.load(Plugins.getPreset(preset));
4784
+ this._options.load(Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPreset(preset));
4698
4785
  }
4699
- const shapes = Plugins.getSupportedShapes();
4786
+ const shapes = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getSupportedShapes();
4700
4787
  for (const type of shapes) {
4701
- const drawer = Plugins.getShapeDrawer(type);
4788
+ const drawer = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getShapeDrawer(type);
4702
4789
  if (drawer) {
4703
4790
  this.drawers.set(type, drawer);
4704
4791
  }
4705
4792
  }
4706
4793
  this._options.load(this._initialSourceOptions);
4707
4794
  this._options.load(this._sourceOptions);
4708
- this.actualOptions = new Options;
4795
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4709
4796
  this.actualOptions.load(this._options);
4710
4797
  this.retina.init();
4711
4798
  this.canvas.init();
@@ -4715,8 +4802,8 @@
4715
4802
  this.zLayers = this.actualOptions.zLayers;
4716
4803
  this.duration = getRangeValue(this.actualOptions.duration);
4717
4804
  this.lifeTime = 0;
4718
- this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 60;
4719
- const availablePlugins = Plugins.getAvailablePlugins(this);
4805
+ this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 120;
4806
+ const availablePlugins = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getAvailablePlugins(this);
4720
4807
  for (const [id, plugin] of availablePlugins) {
4721
4808
  this.plugins.set(id, plugin);
4722
4809
  }
@@ -4734,7 +4821,7 @@
4734
4821
  }
4735
4822
  const pathOptions = this.actualOptions.particles.move.path;
4736
4823
  if (pathOptions.generator) {
4737
- const customGenerator = Plugins.getPathGenerator(pathOptions.generator);
4824
+ const customGenerator = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPathGenerator(pathOptions.generator);
4738
4825
  if (customGenerator) {
4739
4826
  if (customGenerator.init) {
4740
4827
  this.pathGenerator.init = customGenerator.init;
@@ -4771,24 +4858,41 @@
4771
4858
  }
4772
4859
  }
4773
4860
  }
4774
- const tsParticlesDom = null && [];
4861
+ _Container_engine = new WeakMap;
4862
+ var Loader_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
4863
+ if (kind === "m") throw new TypeError("Private method is not writable");
4864
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4865
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
4866
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
4867
+ value;
4868
+ };
4869
+ var Loader_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
4870
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4871
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4872
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4873
+ };
4874
+ var _Loader_engine;
4775
4875
  function fetchError(statusCode) {
4776
4876
  console.error(`Error tsParticles - fetch status: ${statusCode}`);
4777
4877
  console.error("Error tsParticles - File config not found");
4778
4878
  }
4779
4879
  class Loader {
4780
- static dom() {
4781
- return tsParticlesDom;
4880
+ constructor(engine) {
4881
+ _Loader_engine.set(this, void 0);
4882
+ Loader_classPrivateFieldSet(this, _Loader_engine, engine, "f");
4883
+ }
4884
+ dom() {
4885
+ return Loader_classPrivateFieldGet(this, _Loader_engine, "f").domArray;
4782
4886
  }
4783
- static domItem(index) {
4784
- const dom = Loader.dom();
4887
+ domItem(index) {
4888
+ const dom = this.dom();
4785
4889
  const item = dom[index];
4786
4890
  if (item && !item.destroyed) {
4787
4891
  return item;
4788
4892
  }
4789
4893
  dom.splice(index, 1);
4790
4894
  }
4791
- static async loadOptions(params) {
4895
+ async loadOptions(params) {
4792
4896
  var _a, _b, _c;
4793
4897
  const tagId = (_a = params.tagId) !== null && _a !== void 0 ? _a : `tsparticles${Math.floor(Math.random() * 1e4)}`;
4794
4898
  const {options: options, index: index} = params;
@@ -4799,10 +4903,10 @@
4799
4903
  (_c = document.querySelector("body")) === null || _c === void 0 ? void 0 : _c.append(domContainer);
4800
4904
  }
4801
4905
  const currentOptions = options instanceof Array ? itemFromArray(options, index) : options;
4802
- const dom = Loader.dom();
4906
+ const dom = this.dom();
4803
4907
  const oldIndex = dom.findIndex((v => v.id === tagId));
4804
4908
  if (oldIndex >= 0) {
4805
- const old = Loader.domItem(oldIndex);
4909
+ const old = this.domItem(oldIndex);
4806
4910
  if (old && !old.destroyed) {
4807
4911
  old.destroy();
4808
4912
  dom.splice(oldIndex, 1);
@@ -4825,7 +4929,7 @@
4825
4929
  domContainer.appendChild(canvasEl);
4826
4930
  }
4827
4931
  }
4828
- const newItem = new Container(tagId, currentOptions);
4932
+ const newItem = new Container(Loader_classPrivateFieldGet(this, _Loader_engine, "f"), tagId, currentOptions);
4829
4933
  if (oldIndex >= 0) {
4830
4934
  dom.splice(oldIndex, 0, newItem);
4831
4935
  } else {
@@ -4835,7 +4939,7 @@
4835
4939
  await newItem.start();
4836
4940
  return newItem;
4837
4941
  }
4838
- static async loadRemoteOptions(params) {
4942
+ async loadRemoteOptions(params) {
4839
4943
  const {url: jsonUrl, index: index} = params;
4840
4944
  const url = jsonUrl instanceof Array ? itemFromArray(jsonUrl, index) : jsonUrl;
4841
4945
  if (!url) {
@@ -4847,14 +4951,14 @@
4847
4951
  return;
4848
4952
  }
4849
4953
  const data = await response.json();
4850
- return await Loader.loadOptions({
4954
+ return this.loadOptions({
4851
4955
  tagId: params.tagId,
4852
4956
  element: params.element,
4853
4957
  index: index,
4854
4958
  options: data
4855
4959
  });
4856
4960
  }
4857
- static load(tagId, options, index) {
4961
+ load(tagId, options, index) {
4858
4962
  const params = {
4859
4963
  index: index
4860
4964
  };
@@ -4870,7 +4974,7 @@
4870
4974
  }
4871
4975
  return this.loadOptions(params);
4872
4976
  }
4873
- static async set(id, domContainer, options, index) {
4977
+ async set(id, domContainer, options, index) {
4874
4978
  const params = {
4875
4979
  index: index
4876
4980
  };
@@ -4891,7 +4995,7 @@
4891
4995
  }
4892
4996
  return this.loadOptions(params);
4893
4997
  }
4894
- static async loadJSON(tagId, jsonUrl, index) {
4998
+ async loadJSON(tagId, jsonUrl, index) {
4895
4999
  let url, id;
4896
5000
  if (typeof jsonUrl === "number" || jsonUrl === undefined) {
4897
5001
  url = tagId;
@@ -4899,13 +5003,13 @@
4899
5003
  id = tagId;
4900
5004
  url = jsonUrl;
4901
5005
  }
4902
- return await Loader.loadRemoteOptions({
5006
+ return this.loadRemoteOptions({
4903
5007
  tagId: id,
4904
5008
  url: url,
4905
5009
  index: index
4906
5010
  });
4907
5011
  }
4908
- static async setJSON(id, domContainer, jsonUrl, index) {
5012
+ async setJSON(id, domContainer, jsonUrl, index) {
4909
5013
  let url, newId, newIndex, element;
4910
5014
  if (id instanceof HTMLElement) {
4911
5015
  element = id;
@@ -4917,15 +5021,15 @@
4917
5021
  url = jsonUrl;
4918
5022
  newIndex = index;
4919
5023
  }
4920
- return await Loader.loadRemoteOptions({
5024
+ return this.loadRemoteOptions({
4921
5025
  tagId: newId,
4922
5026
  url: url,
4923
5027
  index: newIndex,
4924
5028
  element: element
4925
5029
  });
4926
5030
  }
4927
- static setOnClickHandler(callback) {
4928
- const dom = Loader.dom();
5031
+ setOnClickHandler(callback) {
5032
+ const dom = this.dom();
4929
5033
  if (dom.length === 0) {
4930
5034
  throw new Error("Can only set click handlers after calling tsParticles.load() or tsParticles.loadJSON()");
4931
5035
  }
@@ -4934,6 +5038,7 @@
4934
5038
  }
4935
5039
  }
4936
5040
  }
5041
+ _Loader_engine = new WeakMap;
4937
5042
  class Bouncer extends ExternalInteractorBase {
4938
5043
  constructor(container) {
4939
5044
  super(container);