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;
@@ -3419,22 +3450,31 @@
3419
3450
  }
3420
3451
  }
3421
3452
  }
3422
- var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3453
+ var Options_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
3454
+ if (kind === "m") throw new TypeError("Private method is not writable");
3455
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3456
+ 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");
3457
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
3458
+ value;
3459
+ };
3460
+ var Options_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3423
3461
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3424
3462
  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");
3425
3463
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3426
3464
  };
3427
- var _Options_instances, _Options_findDefaultTheme;
3465
+ var _Options_instances, _Options_engine, _Options_findDefaultTheme;
3428
3466
  class Options_Options {
3429
- constructor() {
3467
+ constructor(engine) {
3430
3468
  _Options_instances.add(this);
3469
+ _Options_engine.set(this, void 0);
3470
+ Options_classPrivateFieldSet(this, _Options_engine, engine, "f");
3431
3471
  this.autoPlay = true;
3432
3472
  this.background = new Background;
3433
3473
  this.backgroundMask = new BackgroundMask;
3434
3474
  this.fullScreen = new FullScreen;
3435
3475
  this.detectRetina = true;
3436
3476
  this.duration = 0;
3437
- this.fpsLimit = 60;
3477
+ this.fpsLimit = 120;
3438
3478
  this.interactivity = new Interactivity;
3439
3479
  this.manualParticles = [];
3440
3480
  this.motion = new Motion;
@@ -3520,7 +3560,7 @@
3520
3560
  this.motion.load(data.motion);
3521
3561
  this.particles.load(data.particles);
3522
3562
  this.style = deepExtend(this.style, data.style);
3523
- Plugins.loadOptions(this, data);
3563
+ Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.loadOptions(this, data);
3524
3564
  if (data.responsive !== undefined) {
3525
3565
  for (const responsive of data.responsive) {
3526
3566
  const optResponsive = new Responsive;
@@ -3536,8 +3576,8 @@
3536
3576
  this.themes.push(optTheme);
3537
3577
  }
3538
3578
  }
3539
- this.defaultDarkTheme = (_d = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
3540
- this.defaultLightTheme = (_e = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
3579
+ this.defaultDarkTheme = (_d = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
3580
+ this.defaultLightTheme = (_e = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
3541
3581
  }
3542
3582
  setTheme(name) {
3543
3583
  if (name) {
@@ -3546,7 +3586,7 @@
3546
3586
  this.load(chosenTheme.options);
3547
3587
  }
3548
3588
  } else {
3549
- 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");
3589
+ 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");
3550
3590
  if (defaultTheme) {
3551
3591
  this.load(defaultTheme.options);
3552
3592
  }
@@ -3559,13 +3599,26 @@
3559
3599
  return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
3560
3600
  }
3561
3601
  importPreset(preset) {
3562
- this.load(Plugins.getPreset(preset));
3602
+ this.load(Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.getPreset(preset));
3563
3603
  }
3564
3604
  }
3565
- _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
3605
+ _Options_engine = new WeakMap, _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
3566
3606
  var _a;
3567
3607
  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"));
3568
3608
  };
3609
+ var Particle_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
3610
+ if (kind === "m") throw new TypeError("Private method is not writable");
3611
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3612
+ 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");
3613
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
3614
+ value;
3615
+ };
3616
+ var Particle_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3617
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3618
+ 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");
3619
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3620
+ };
3621
+ var _Particle_engine;
3569
3622
  const fixOutMode = data => {
3570
3623
  if (isInArray(data.outMode, data.checkModes) || isInArray(data.outMode, data.checkModes)) {
3571
3624
  if (data.coord > data.maxCoord - data.radius * 2) {
@@ -3576,11 +3629,13 @@
3576
3629
  }
3577
3630
  };
3578
3631
  class Particle_Particle {
3579
- constructor(id, container, position, overrideOptions, group) {
3632
+ constructor(engine, id, container, position, overrideOptions, group) {
3580
3633
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
3581
3634
  this.id = id;
3582
3635
  this.container = container;
3583
3636
  this.group = group;
3637
+ _Particle_engine.set(this, void 0);
3638
+ Particle_classPrivateFieldSet(this, _Particle_engine, engine, "f");
3584
3639
  this.fill = true;
3585
3640
  this.close = true;
3586
3641
  this.lastPathTime = 0;
@@ -3674,7 +3729,7 @@
3674
3729
  this.sides = 24;
3675
3730
  let drawer = container.drawers.get(this.shape);
3676
3731
  if (!drawer) {
3677
- drawer = Plugins.getShapeDrawer(this.shape);
3732
+ drawer = Particle_classPrivateFieldGet(this, _Particle_engine, "f").plugins.getShapeDrawer(this.shape);
3678
3733
  if (drawer) {
3679
3734
  container.drawers.set(this.shape, drawer);
3680
3735
  }
@@ -3914,9 +3969,25 @@
3914
3969
  return life;
3915
3970
  }
3916
3971
  }
3972
+ _Particle_engine = new WeakMap;
3973
+ var Particles_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
3974
+ if (kind === "m") throw new TypeError("Private method is not writable");
3975
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3976
+ 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");
3977
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
3978
+ value;
3979
+ };
3980
+ var Particles_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3981
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3982
+ 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");
3983
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3984
+ };
3985
+ var _Particles_engine;
3917
3986
  class Particles_Particles {
3918
- constructor(container) {
3987
+ constructor(engine, container) {
3919
3988
  this.container = container;
3989
+ _Particles_engine.set(this, void 0);
3990
+ Particles_classPrivateFieldSet(this, _Particles_engine, engine, "f");
3920
3991
  this.nextId = 0;
3921
3992
  this.array = [];
3922
3993
  this.zArray = [];
@@ -3928,11 +3999,11 @@
3928
3999
  links: new Map,
3929
4000
  triangles: new Map
3930
4001
  };
3931
- this.interactionManager = new InteractionManager(container);
4002
+ this.interactionManager = new InteractionManager(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), container);
3932
4003
  const canvasSize = this.container.canvas.size;
3933
4004
  this.linksColors = new Map;
3934
4005
  this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
3935
- this.updaters = Plugins.getUpdaters(container, true);
4006
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
3936
4007
  }
3937
4008
  get count() {
3938
4009
  return this.array.length;
@@ -3946,7 +4017,7 @@
3946
4017
  this.freqs.links = new Map;
3947
4018
  this.freqs.triangles = new Map;
3948
4019
  let handled = false;
3949
- this.updaters = Plugins.getUpdaters(container, true);
4020
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
3950
4021
  this.interactionManager.init();
3951
4022
  for (const [, plugin] of container.plugins) {
3952
4023
  if (plugin.particlesInitialization !== undefined) {
@@ -4193,7 +4264,7 @@
4193
4264
  }
4194
4265
  pushParticle(position, overrideOptions, group, initializer) {
4195
4266
  try {
4196
- const particle = new Particle(this.nextId, this.container, position, overrideOptions, group);
4267
+ const particle = new Particle(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), this.nextId, this.container, position, overrideOptions, group);
4197
4268
  let canAdd = true;
4198
4269
  if (initializer) {
4199
4270
  canAdd = initializer(particle);
@@ -4211,6 +4282,7 @@
4211
4282
  }
4212
4283
  }
4213
4284
  }
4285
+ _Particles_engine = new WeakMap;
4214
4286
  class Retina_Retina {
4215
4287
  constructor(container) {
4216
4288
  this.container = container;
@@ -4298,10 +4370,25 @@
4298
4370
  }
4299
4371
  }
4300
4372
  }
4373
+ var Container_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
4374
+ if (kind === "m") throw new TypeError("Private method is not writable");
4375
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4376
+ 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");
4377
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
4378
+ value;
4379
+ };
4380
+ var Container_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
4381
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4382
+ 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");
4383
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4384
+ };
4385
+ var _Container_engine;
4301
4386
  class Container_Container {
4302
- constructor(id, sourceOptions, ...presets) {
4387
+ constructor(engine, id, sourceOptions, ...presets) {
4303
4388
  this.id = id;
4304
- this.fpsLimit = 60;
4389
+ _Container_engine.set(this, void 0);
4390
+ Container_classPrivateFieldSet(this, _Container_engine, engine, "f");
4391
+ this.fpsLimit = 120;
4305
4392
  this.duration = 0;
4306
4393
  this.lifeTime = 0;
4307
4394
  this.firstStart = true;
@@ -4315,7 +4402,7 @@
4315
4402
  this._initialSourceOptions = sourceOptions;
4316
4403
  this.retina = new Retina(this);
4317
4404
  this.canvas = new Canvas(this);
4318
- this.particles = new Particles(this);
4405
+ this.particles = new Particles(Container_classPrivateFieldGet(this, _Container_engine, "f"), this);
4319
4406
  this.drawer = new FrameManager(this);
4320
4407
  this.presets = presets;
4321
4408
  this.pathGenerator = {
@@ -4344,8 +4431,8 @@
4344
4431
  this.plugins = new Map;
4345
4432
  this.drawers = new Map;
4346
4433
  this.density = 1;
4347
- this._options = new Options;
4348
- this.actualOptions = new Options;
4434
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4435
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4349
4436
  this.eventListeners = new EventListeners(this);
4350
4437
  if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
4351
4438
  this.intersectionObserver = new IntersectionObserver((entries => this.intersectionManager(entries)));
@@ -4460,7 +4547,7 @@
4460
4547
  return this.start();
4461
4548
  }
4462
4549
  reset() {
4463
- this._options = new Options;
4550
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4464
4551
  return this.refresh();
4465
4552
  }
4466
4553
  stop() {
@@ -4474,7 +4561,7 @@
4474
4561
  this.particles.clear();
4475
4562
  this.canvas.clear();
4476
4563
  if (this.interactivity.element instanceof HTMLElement && this.intersectionObserver) {
4477
- this.intersectionObserver.observe(this.interactivity.element);
4564
+ this.intersectionObserver.unobserve(this.interactivity.element);
4478
4565
  }
4479
4566
  for (const [, plugin] of this.plugins) {
4480
4567
  if (plugin.stop) {
@@ -4601,20 +4688,20 @@
4601
4688
  return false;
4602
4689
  }
4603
4690
  async init() {
4604
- this._options = new Options;
4691
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4605
4692
  for (const preset of this.presets) {
4606
- this._options.load(Plugins.getPreset(preset));
4693
+ this._options.load(Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPreset(preset));
4607
4694
  }
4608
- const shapes = Plugins.getSupportedShapes();
4695
+ const shapes = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getSupportedShapes();
4609
4696
  for (const type of shapes) {
4610
- const drawer = Plugins.getShapeDrawer(type);
4697
+ const drawer = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getShapeDrawer(type);
4611
4698
  if (drawer) {
4612
4699
  this.drawers.set(type, drawer);
4613
4700
  }
4614
4701
  }
4615
4702
  this._options.load(this._initialSourceOptions);
4616
4703
  this._options.load(this._sourceOptions);
4617
- this.actualOptions = new Options;
4704
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
4618
4705
  this.actualOptions.load(this._options);
4619
4706
  this.retina.init();
4620
4707
  this.canvas.init();
@@ -4624,8 +4711,8 @@
4624
4711
  this.zLayers = this.actualOptions.zLayers;
4625
4712
  this.duration = getRangeValue(this.actualOptions.duration);
4626
4713
  this.lifeTime = 0;
4627
- this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 60;
4628
- const availablePlugins = Plugins.getAvailablePlugins(this);
4714
+ this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 120;
4715
+ const availablePlugins = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getAvailablePlugins(this);
4629
4716
  for (const [id, plugin] of availablePlugins) {
4630
4717
  this.plugins.set(id, plugin);
4631
4718
  }
@@ -4643,7 +4730,7 @@
4643
4730
  }
4644
4731
  const pathOptions = this.actualOptions.particles.move.path;
4645
4732
  if (pathOptions.generator) {
4646
- const customGenerator = Plugins.getPathGenerator(pathOptions.generator);
4733
+ const customGenerator = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPathGenerator(pathOptions.generator);
4647
4734
  if (customGenerator) {
4648
4735
  if (customGenerator.init) {
4649
4736
  this.pathGenerator.init = customGenerator.init;
@@ -4680,24 +4767,41 @@
4680
4767
  }
4681
4768
  }
4682
4769
  }
4683
- const tsParticlesDom = null && [];
4770
+ _Container_engine = new WeakMap;
4771
+ var Loader_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
4772
+ if (kind === "m") throw new TypeError("Private method is not writable");
4773
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4774
+ 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");
4775
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
4776
+ value;
4777
+ };
4778
+ var Loader_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
4779
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4780
+ 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");
4781
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4782
+ };
4783
+ var _Loader_engine;
4684
4784
  function fetchError(statusCode) {
4685
4785
  console.error(`Error tsParticles - fetch status: ${statusCode}`);
4686
4786
  console.error("Error tsParticles - File config not found");
4687
4787
  }
4688
4788
  class Loader {
4689
- static dom() {
4690
- return tsParticlesDom;
4789
+ constructor(engine) {
4790
+ _Loader_engine.set(this, void 0);
4791
+ Loader_classPrivateFieldSet(this, _Loader_engine, engine, "f");
4792
+ }
4793
+ dom() {
4794
+ return Loader_classPrivateFieldGet(this, _Loader_engine, "f").domArray;
4691
4795
  }
4692
- static domItem(index) {
4693
- const dom = Loader.dom();
4796
+ domItem(index) {
4797
+ const dom = this.dom();
4694
4798
  const item = dom[index];
4695
4799
  if (item && !item.destroyed) {
4696
4800
  return item;
4697
4801
  }
4698
4802
  dom.splice(index, 1);
4699
4803
  }
4700
- static async loadOptions(params) {
4804
+ async loadOptions(params) {
4701
4805
  var _a, _b, _c;
4702
4806
  const tagId = (_a = params.tagId) !== null && _a !== void 0 ? _a : `tsparticles${Math.floor(Math.random() * 1e4)}`;
4703
4807
  const {options: options, index: index} = params;
@@ -4708,10 +4812,10 @@
4708
4812
  (_c = document.querySelector("body")) === null || _c === void 0 ? void 0 : _c.append(domContainer);
4709
4813
  }
4710
4814
  const currentOptions = options instanceof Array ? itemFromArray(options, index) : options;
4711
- const dom = Loader.dom();
4815
+ const dom = this.dom();
4712
4816
  const oldIndex = dom.findIndex((v => v.id === tagId));
4713
4817
  if (oldIndex >= 0) {
4714
- const old = Loader.domItem(oldIndex);
4818
+ const old = this.domItem(oldIndex);
4715
4819
  if (old && !old.destroyed) {
4716
4820
  old.destroy();
4717
4821
  dom.splice(oldIndex, 1);
@@ -4734,7 +4838,7 @@
4734
4838
  domContainer.appendChild(canvasEl);
4735
4839
  }
4736
4840
  }
4737
- const newItem = new Container(tagId, currentOptions);
4841
+ const newItem = new Container(Loader_classPrivateFieldGet(this, _Loader_engine, "f"), tagId, currentOptions);
4738
4842
  if (oldIndex >= 0) {
4739
4843
  dom.splice(oldIndex, 0, newItem);
4740
4844
  } else {
@@ -4744,7 +4848,7 @@
4744
4848
  await newItem.start();
4745
4849
  return newItem;
4746
4850
  }
4747
- static async loadRemoteOptions(params) {
4851
+ async loadRemoteOptions(params) {
4748
4852
  const {url: jsonUrl, index: index} = params;
4749
4853
  const url = jsonUrl instanceof Array ? itemFromArray(jsonUrl, index) : jsonUrl;
4750
4854
  if (!url) {
@@ -4756,14 +4860,14 @@
4756
4860
  return;
4757
4861
  }
4758
4862
  const data = await response.json();
4759
- return await Loader.loadOptions({
4863
+ return this.loadOptions({
4760
4864
  tagId: params.tagId,
4761
4865
  element: params.element,
4762
4866
  index: index,
4763
4867
  options: data
4764
4868
  });
4765
4869
  }
4766
- static load(tagId, options, index) {
4870
+ load(tagId, options, index) {
4767
4871
  const params = {
4768
4872
  index: index
4769
4873
  };
@@ -4779,7 +4883,7 @@
4779
4883
  }
4780
4884
  return this.loadOptions(params);
4781
4885
  }
4782
- static async set(id, domContainer, options, index) {
4886
+ async set(id, domContainer, options, index) {
4783
4887
  const params = {
4784
4888
  index: index
4785
4889
  };
@@ -4800,7 +4904,7 @@
4800
4904
  }
4801
4905
  return this.loadOptions(params);
4802
4906
  }
4803
- static async loadJSON(tagId, jsonUrl, index) {
4907
+ async loadJSON(tagId, jsonUrl, index) {
4804
4908
  let url, id;
4805
4909
  if (typeof jsonUrl === "number" || jsonUrl === undefined) {
4806
4910
  url = tagId;
@@ -4808,13 +4912,13 @@
4808
4912
  id = tagId;
4809
4913
  url = jsonUrl;
4810
4914
  }
4811
- return await Loader.loadRemoteOptions({
4915
+ return this.loadRemoteOptions({
4812
4916
  tagId: id,
4813
4917
  url: url,
4814
4918
  index: index
4815
4919
  });
4816
4920
  }
4817
- static async setJSON(id, domContainer, jsonUrl, index) {
4921
+ async setJSON(id, domContainer, jsonUrl, index) {
4818
4922
  let url, newId, newIndex, element;
4819
4923
  if (id instanceof HTMLElement) {
4820
4924
  element = id;
@@ -4826,15 +4930,15 @@
4826
4930
  url = jsonUrl;
4827
4931
  newIndex = index;
4828
4932
  }
4829
- return await Loader.loadRemoteOptions({
4933
+ return this.loadRemoteOptions({
4830
4934
  tagId: newId,
4831
4935
  url: url,
4832
4936
  index: newIndex,
4833
4937
  element: element
4834
4938
  });
4835
4939
  }
4836
- static setOnClickHandler(callback) {
4837
- const dom = Loader.dom();
4940
+ setOnClickHandler(callback) {
4941
+ const dom = this.dom();
4838
4942
  if (dom.length === 0) {
4839
4943
  throw new Error("Can only set click handlers after calling tsParticles.load() or tsParticles.loadJSON()");
4840
4944
  }
@@ -4843,6 +4947,7 @@
4843
4947
  }
4844
4948
  }
4845
4949
  }
4950
+ _Loader_engine = new WeakMap;
4846
4951
  function calculateBubbleValue(particleValue, modeValue, optionsValue, ratio) {
4847
4952
  if (modeValue >= optionsValue) {
4848
4953
  const value = particleValue + (modeValue - optionsValue) * ratio;