tsparticles 1.39.2 → 1.40.2

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 +1 -1
  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 -6
  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;
@@ -3478,22 +3509,31 @@
3478
3509
  }
3479
3510
  }
3480
3511
  }
3481
- var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3512
+ var Options_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
3513
+ if (kind === "m") throw new TypeError("Private method is not writable");
3514
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3515
+ 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");
3516
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
3517
+ value;
3518
+ };
3519
+ var Options_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3482
3520
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3483
3521
  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");
3484
3522
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3485
3523
  };
3486
- var _Options_instances, _Options_findDefaultTheme;
3524
+ var _Options_instances, _Options_engine, _Options_findDefaultTheme;
3487
3525
  class Options_Options {
3488
- constructor() {
3526
+ constructor(engine) {
3489
3527
  _Options_instances.add(this);
3528
+ _Options_engine.set(this, void 0);
3529
+ Options_classPrivateFieldSet(this, _Options_engine, engine, "f");
3490
3530
  this.autoPlay = true;
3491
3531
  this.background = new Background;
3492
3532
  this.backgroundMask = new BackgroundMask;
3493
3533
  this.fullScreen = new FullScreen;
3494
3534
  this.detectRetina = true;
3495
3535
  this.duration = 0;
3496
- this.fpsLimit = 60;
3536
+ this.fpsLimit = 120;
3497
3537
  this.interactivity = new Interactivity;
3498
3538
  this.manualParticles = [];
3499
3539
  this.motion = new Motion;
@@ -3579,7 +3619,7 @@
3579
3619
  this.motion.load(data.motion);
3580
3620
  this.particles.load(data.particles);
3581
3621
  this.style = deepExtend(this.style, data.style);
3582
- Plugins.loadOptions(this, data);
3622
+ Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.loadOptions(this, data);
3583
3623
  if (data.responsive !== undefined) {
3584
3624
  for (const responsive of data.responsive) {
3585
3625
  const optResponsive = new Responsive;
@@ -3595,8 +3635,8 @@
3595
3635
  this.themes.push(optTheme);
3596
3636
  }
3597
3637
  }
3598
- this.defaultDarkTheme = (_d = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
3599
- this.defaultLightTheme = (_e = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
3638
+ this.defaultDarkTheme = (_d = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
3639
+ this.defaultLightTheme = (_e = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
3600
3640
  }
3601
3641
  setTheme(name) {
3602
3642
  if (name) {
@@ -3605,7 +3645,7 @@
3605
3645
  this.load(chosenTheme.options);
3606
3646
  }
3607
3647
  } else {
3608
- 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");
3648
+ 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");
3609
3649
  if (defaultTheme) {
3610
3650
  this.load(defaultTheme.options);
3611
3651
  }
@@ -3618,13 +3658,26 @@
3618
3658
  return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
3619
3659
  }
3620
3660
  importPreset(preset) {
3621
- this.load(Plugins.getPreset(preset));
3661
+ this.load(Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.getPreset(preset));
3622
3662
  }
3623
3663
  }
3624
- _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
3664
+ _Options_engine = new WeakMap, _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
3625
3665
  var _a;
3626
3666
  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"));
3627
3667
  };
3668
+ var Particle_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
3669
+ if (kind === "m") throw new TypeError("Private method is not writable");
3670
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3671
+ 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");
3672
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
3673
+ value;
3674
+ };
3675
+ var Particle_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3676
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3677
+ 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");
3678
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3679
+ };
3680
+ var _Particle_engine;
3628
3681
  const fixOutMode = data => {
3629
3682
  if (isInArray(data.outMode, data.checkModes) || isInArray(data.outMode, data.checkModes)) {
3630
3683
  if (data.coord > data.maxCoord - data.radius * 2) {
@@ -3635,11 +3688,13 @@
3635
3688
  }
3636
3689
  };
3637
3690
  class Particle_Particle {
3638
- constructor(id, container, position, overrideOptions, group) {
3691
+ constructor(engine, id, container, position, overrideOptions, group) {
3639
3692
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
3640
3693
  this.id = id;
3641
3694
  this.container = container;
3642
3695
  this.group = group;
3696
+ _Particle_engine.set(this, void 0);
3697
+ Particle_classPrivateFieldSet(this, _Particle_engine, engine, "f");
3643
3698
  this.fill = true;
3644
3699
  this.close = true;
3645
3700
  this.lastPathTime = 0;
@@ -3733,7 +3788,7 @@
3733
3788
  this.sides = 24;
3734
3789
  let drawer = container.drawers.get(this.shape);
3735
3790
  if (!drawer) {
3736
- drawer = Plugins.getShapeDrawer(this.shape);
3791
+ drawer = Particle_classPrivateFieldGet(this, _Particle_engine, "f").plugins.getShapeDrawer(this.shape);
3737
3792
  if (drawer) {
3738
3793
  container.drawers.set(this.shape, drawer);
3739
3794
  }
@@ -3973,9 +4028,25 @@
3973
4028
  return life;
3974
4029
  }
3975
4030
  }
4031
+ _Particle_engine = new WeakMap;
4032
+ var Particles_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
4033
+ if (kind === "m") throw new TypeError("Private method is not writable");
4034
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4035
+ 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");
4036
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
4037
+ value;
4038
+ };
4039
+ var Particles_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
4040
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4041
+ 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");
4042
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4043
+ };
4044
+ var _Particles_engine;
3976
4045
  class Particles_Particles {
3977
- constructor(container) {
4046
+ constructor(engine, container) {
3978
4047
  this.container = container;
4048
+ _Particles_engine.set(this, void 0);
4049
+ Particles_classPrivateFieldSet(this, _Particles_engine, engine, "f");
3979
4050
  this.nextId = 0;
3980
4051
  this.array = [];
3981
4052
  this.zArray = [];
@@ -3987,11 +4058,11 @@
3987
4058
  links: new Map,
3988
4059
  triangles: new Map
3989
4060
  };
3990
- this.interactionManager = new InteractionManager(container);
4061
+ this.interactionManager = new InteractionManager(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), container);
3991
4062
  const canvasSize = this.container.canvas.size;
3992
4063
  this.linksColors = new Map;
3993
4064
  this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
3994
- this.updaters = Plugins.getUpdaters(container, true);
4065
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
3995
4066
  }
3996
4067
  get count() {
3997
4068
  return this.array.length;
@@ -4005,7 +4076,7 @@
4005
4076
  this.freqs.links = new Map;
4006
4077
  this.freqs.triangles = new Map;
4007
4078
  let handled = false;
4008
- this.updaters = Plugins.getUpdaters(container, true);
4079
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
4009
4080
  this.interactionManager.init();
4010
4081
  for (const [, plugin] of container.plugins) {
4011
4082
  if (plugin.particlesInitialization !== undefined) {
@@ -4252,7 +4323,7 @@
4252
4323
  }
4253
4324
  pushParticle(position, overrideOptions, group, initializer) {
4254
4325
  try {
4255
- const particle = new Particle(this.nextId, this.container, position, overrideOptions, group);
4326
+ const particle = new Particle(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), this.nextId, this.container, position, overrideOptions, group);
4256
4327
  let canAdd = true;
4257
4328
  if (initializer) {
4258
4329
  canAdd = initializer(particle);
@@ -4270,6 +4341,7 @@
4270
4341
  }
4271
4342
  }
4272
4343
  }
4344
+ _Particles_engine = new WeakMap;
4273
4345
  class Retina_Retina {
4274
4346
  constructor(container) {
4275
4347
  this.container = container;
@@ -4357,10 +4429,25 @@
4357
4429
  }
4358
4430
  }
4359
4431
  }
4432
+ var Container_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
4433
+ if (kind === "m") throw new TypeError("Private method is not writable");
4434
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4435
+ 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");
4436
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
4437
+ value;
4438
+ };
4439
+ var Container_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
4440
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4441
+ 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");
4442
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4443
+ };
4444
+ var _Container_engine;
4360
4445
  class Container_Container {
4361
- constructor(id, sourceOptions, ...presets) {
4446
+ constructor(engine, id, sourceOptions, ...presets) {
4362
4447
  this.id = id;
4363
- this.fpsLimit = 60;
4448
+ _Container_engine.set(this, void 0);
4449
+ Container_classPrivateFieldSet(this, _Container_engine, engine, "f");
4450
+ this.fpsLimit = 120;
4364
4451
  this.duration = 0;
4365
4452
  this.lifeTime = 0;
4366
4453
  this.firstStart = true;
@@ -4374,7 +4461,7 @@
4374
4461
  this._initialSourceOptions = sourceOptions;
4375
4462
  this.retina = new Retina(this);
4376
4463
  this.canvas = new Canvas(this);
4377
- this.particles = new Particles(this);
4464
+ this.particles = new Particles(Container_classPrivateFieldGet(this, _Container_engine, "f"), this);
4378
4465
  this.drawer = new FrameManager(this);
4379
4466
  this.presets = presets;
4380
4467
  this.pathGenerator = {
@@ -4403,8 +4490,8 @@
4403
4490
  this.plugins = new Map;
4404
4491
  this.drawers = new Map;
4405
4492
  this.density = 1;
4406
- this._options = new Options;
4407
- this.actualOptions = new Options;
4493
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4494
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4408
4495
  this.eventListeners = new EventListeners(this);
4409
4496
  if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
4410
4497
  this.intersectionObserver = new IntersectionObserver((entries => this.intersectionManager(entries)));
@@ -4519,7 +4606,7 @@
4519
4606
  return this.start();
4520
4607
  }
4521
4608
  reset() {
4522
- this._options = new Options;
4609
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4523
4610
  return this.refresh();
4524
4611
  }
4525
4612
  stop() {
@@ -4533,7 +4620,7 @@
4533
4620
  this.particles.clear();
4534
4621
  this.canvas.clear();
4535
4622
  if (this.interactivity.element instanceof HTMLElement && this.intersectionObserver) {
4536
- this.intersectionObserver.observe(this.interactivity.element);
4623
+ this.intersectionObserver.unobserve(this.interactivity.element);
4537
4624
  }
4538
4625
  for (const [, plugin] of this.plugins) {
4539
4626
  if (plugin.stop) {
@@ -4660,20 +4747,20 @@
4660
4747
  return false;
4661
4748
  }
4662
4749
  async init() {
4663
- this._options = new Options;
4750
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4664
4751
  for (const preset of this.presets) {
4665
- this._options.load(Plugins.getPreset(preset));
4752
+ this._options.load(Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPreset(preset));
4666
4753
  }
4667
- const shapes = Plugins.getSupportedShapes();
4754
+ const shapes = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getSupportedShapes();
4668
4755
  for (const type of shapes) {
4669
- const drawer = Plugins.getShapeDrawer(type);
4756
+ const drawer = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getShapeDrawer(type);
4670
4757
  if (drawer) {
4671
4758
  this.drawers.set(type, drawer);
4672
4759
  }
4673
4760
  }
4674
4761
  this._options.load(this._initialSourceOptions);
4675
4762
  this._options.load(this._sourceOptions);
4676
- this.actualOptions = new Options;
4763
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4677
4764
  this.actualOptions.load(this._options);
4678
4765
  this.retina.init();
4679
4766
  this.canvas.init();
@@ -4683,8 +4770,8 @@
4683
4770
  this.zLayers = this.actualOptions.zLayers;
4684
4771
  this.duration = getRangeValue(this.actualOptions.duration);
4685
4772
  this.lifeTime = 0;
4686
- this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 60;
4687
- const availablePlugins = Plugins.getAvailablePlugins(this);
4773
+ this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 120;
4774
+ const availablePlugins = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getAvailablePlugins(this);
4688
4775
  for (const [id, plugin] of availablePlugins) {
4689
4776
  this.plugins.set(id, plugin);
4690
4777
  }
@@ -4702,7 +4789,7 @@
4702
4789
  }
4703
4790
  const pathOptions = this.actualOptions.particles.move.path;
4704
4791
  if (pathOptions.generator) {
4705
- const customGenerator = Plugins.getPathGenerator(pathOptions.generator);
4792
+ const customGenerator = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPathGenerator(pathOptions.generator);
4706
4793
  if (customGenerator) {
4707
4794
  if (customGenerator.init) {
4708
4795
  this.pathGenerator.init = customGenerator.init;
@@ -4739,24 +4826,41 @@
4739
4826
  }
4740
4827
  }
4741
4828
  }
4742
- const tsParticlesDom = null && [];
4829
+ _Container_engine = new WeakMap;
4830
+ var Loader_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
4831
+ if (kind === "m") throw new TypeError("Private method is not writable");
4832
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4833
+ 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");
4834
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
4835
+ value;
4836
+ };
4837
+ var Loader_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
4838
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4839
+ 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");
4840
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4841
+ };
4842
+ var _Loader_engine;
4743
4843
  function fetchError(statusCode) {
4744
4844
  console.error(`Error tsParticles - fetch status: ${statusCode}`);
4745
4845
  console.error("Error tsParticles - File config not found");
4746
4846
  }
4747
4847
  class Loader {
4748
- static dom() {
4749
- return tsParticlesDom;
4848
+ constructor(engine) {
4849
+ _Loader_engine.set(this, void 0);
4850
+ Loader_classPrivateFieldSet(this, _Loader_engine, engine, "f");
4851
+ }
4852
+ dom() {
4853
+ return Loader_classPrivateFieldGet(this, _Loader_engine, "f").domArray;
4750
4854
  }
4751
- static domItem(index) {
4752
- const dom = Loader.dom();
4855
+ domItem(index) {
4856
+ const dom = this.dom();
4753
4857
  const item = dom[index];
4754
4858
  if (item && !item.destroyed) {
4755
4859
  return item;
4756
4860
  }
4757
4861
  dom.splice(index, 1);
4758
4862
  }
4759
- static async loadOptions(params) {
4863
+ async loadOptions(params) {
4760
4864
  var _a, _b, _c;
4761
4865
  const tagId = (_a = params.tagId) !== null && _a !== void 0 ? _a : `tsparticles${Math.floor(Math.random() * 1e4)}`;
4762
4866
  const {options: options, index: index} = params;
@@ -4767,10 +4871,10 @@
4767
4871
  (_c = document.querySelector("body")) === null || _c === void 0 ? void 0 : _c.append(domContainer);
4768
4872
  }
4769
4873
  const currentOptions = options instanceof Array ? itemFromArray(options, index) : options;
4770
- const dom = Loader.dom();
4874
+ const dom = this.dom();
4771
4875
  const oldIndex = dom.findIndex((v => v.id === tagId));
4772
4876
  if (oldIndex >= 0) {
4773
- const old = Loader.domItem(oldIndex);
4877
+ const old = this.domItem(oldIndex);
4774
4878
  if (old && !old.destroyed) {
4775
4879
  old.destroy();
4776
4880
  dom.splice(oldIndex, 1);
@@ -4793,7 +4897,7 @@
4793
4897
  domContainer.appendChild(canvasEl);
4794
4898
  }
4795
4899
  }
4796
- const newItem = new Container(tagId, currentOptions);
4900
+ const newItem = new Container(Loader_classPrivateFieldGet(this, _Loader_engine, "f"), tagId, currentOptions);
4797
4901
  if (oldIndex >= 0) {
4798
4902
  dom.splice(oldIndex, 0, newItem);
4799
4903
  } else {
@@ -4803,7 +4907,7 @@
4803
4907
  await newItem.start();
4804
4908
  return newItem;
4805
4909
  }
4806
- static async loadRemoteOptions(params) {
4910
+ async loadRemoteOptions(params) {
4807
4911
  const {url: jsonUrl, index: index} = params;
4808
4912
  const url = jsonUrl instanceof Array ? itemFromArray(jsonUrl, index) : jsonUrl;
4809
4913
  if (!url) {
@@ -4815,14 +4919,14 @@
4815
4919
  return;
4816
4920
  }
4817
4921
  const data = await response.json();
4818
- return await Loader.loadOptions({
4922
+ return this.loadOptions({
4819
4923
  tagId: params.tagId,
4820
4924
  element: params.element,
4821
4925
  index: index,
4822
4926
  options: data
4823
4927
  });
4824
4928
  }
4825
- static load(tagId, options, index) {
4929
+ load(tagId, options, index) {
4826
4930
  const params = {
4827
4931
  index: index
4828
4932
  };
@@ -4838,7 +4942,7 @@
4838
4942
  }
4839
4943
  return this.loadOptions(params);
4840
4944
  }
4841
- static async set(id, domContainer, options, index) {
4945
+ async set(id, domContainer, options, index) {
4842
4946
  const params = {
4843
4947
  index: index
4844
4948
  };
@@ -4859,7 +4963,7 @@
4859
4963
  }
4860
4964
  return this.loadOptions(params);
4861
4965
  }
4862
- static async loadJSON(tagId, jsonUrl, index) {
4966
+ async loadJSON(tagId, jsonUrl, index) {
4863
4967
  let url, id;
4864
4968
  if (typeof jsonUrl === "number" || jsonUrl === undefined) {
4865
4969
  url = tagId;
@@ -4867,13 +4971,13 @@
4867
4971
  id = tagId;
4868
4972
  url = jsonUrl;
4869
4973
  }
4870
- return await Loader.loadRemoteOptions({
4974
+ return this.loadRemoteOptions({
4871
4975
  tagId: id,
4872
4976
  url: url,
4873
4977
  index: index
4874
4978
  });
4875
4979
  }
4876
- static async setJSON(id, domContainer, jsonUrl, index) {
4980
+ async setJSON(id, domContainer, jsonUrl, index) {
4877
4981
  let url, newId, newIndex, element;
4878
4982
  if (id instanceof HTMLElement) {
4879
4983
  element = id;
@@ -4885,15 +4989,15 @@
4885
4989
  url = jsonUrl;
4886
4990
  newIndex = index;
4887
4991
  }
4888
- return await Loader.loadRemoteOptions({
4992
+ return this.loadRemoteOptions({
4889
4993
  tagId: newId,
4890
4994
  url: url,
4891
4995
  index: newIndex,
4892
4996
  element: element
4893
4997
  });
4894
4998
  }
4895
- static setOnClickHandler(callback) {
4896
- const dom = Loader.dom();
4999
+ setOnClickHandler(callback) {
5000
+ const dom = this.dom();
4897
5001
  if (dom.length === 0) {
4898
5002
  throw new Error("Can only set click handlers after calling tsParticles.load() or tsParticles.loadJSON()");
4899
5003
  }
@@ -4902,6 +5006,7 @@
4902
5006
  }
4903
5007
  }
4904
5008
  }
5009
+ _Loader_engine = new WeakMap;
4905
5010
  class Attractor extends ExternalInteractorBase {
4906
5011
  constructor(container) {
4907
5012
  super(container);