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
@@ -796,15 +796,32 @@
796
796
  }
797
797
  }
798
798
  }
799
+ var __classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
800
+ if (kind === "m") throw new TypeError("Private method is not writable");
801
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
802
+ 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");
803
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
804
+ value;
805
+ };
806
+ var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
807
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
808
+ 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");
809
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
810
+ };
811
+ var _InteractionManager_engine;
799
812
  class InteractionManager_InteractionManager {
800
- constructor(container) {
813
+ constructor(engine, container) {
801
814
  this.container = container;
815
+ _InteractionManager_engine.set(this, void 0);
816
+ __classPrivateFieldSet(this, _InteractionManager_engine, engine, "f");
802
817
  this.externalInteractors = [];
803
818
  this.particleInteractors = [];
804
819
  this.init();
805
820
  }
806
821
  init() {
807
- const interactors = Plugins.getInteractors(this.container, true);
822
+ const interactors = __classPrivateFieldGet(this, _InteractionManager_engine, "f").plugins.getInteractors(this.container, true);
823
+ this.externalInteractors = [];
824
+ this.particleInteractors = [];
808
825
  for (const interactor of interactors) {
809
826
  switch (interactor.type) {
810
827
  case 0:
@@ -835,6 +852,7 @@
835
852
  }
836
853
  }
837
854
  }
855
+ _InteractionManager_engine = new WeakMap;
838
856
  function applyDistance(particle) {
839
857
  const initialPosition = particle.initialPosition;
840
858
  const {dx: dx, dy: dy} = getDistances(initialPosition, particle.position);
@@ -1008,26 +1026,38 @@
1008
1026
  return proximityFactor / slowFactor;
1009
1027
  }
1010
1028
  }
1011
- const plugins = null && [];
1012
- const interactorsInitializers = new Map;
1013
- const updatersInitializers = new Map;
1014
- const interactors = new Map;
1015
- const updaters = new Map;
1016
- const presets = new Map;
1017
- const drawers = new Map;
1018
- const pathGenerators = new Map;
1019
- class Plugins_Plugins {
1020
- static getPlugin(plugin) {
1021
- return plugins.find((t => t.id === plugin));
1029
+ var Plugins_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
1030
+ if (kind === "m") throw new TypeError("Private method is not writable");
1031
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1032
+ 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");
1033
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
1034
+ value;
1035
+ };
1036
+ var _Plugins_engine;
1037
+ class Plugins {
1038
+ constructor(engine) {
1039
+ _Plugins_engine.set(this, void 0);
1040
+ Plugins_classPrivateFieldSet(this, _Plugins_engine, engine, "f");
1041
+ this.plugins = [];
1042
+ this.interactorsInitializers = new Map;
1043
+ this.updatersInitializers = new Map;
1044
+ this.interactors = new Map;
1045
+ this.updaters = new Map;
1046
+ this.presets = new Map;
1047
+ this.drawers = new Map;
1048
+ this.pathGenerators = new Map;
1049
+ }
1050
+ getPlugin(plugin) {
1051
+ return this.plugins.find((t => t.id === plugin));
1022
1052
  }
1023
- static addPlugin(plugin) {
1024
- if (!Plugins_Plugins.getPlugin(plugin.id)) {
1025
- plugins.push(plugin);
1053
+ addPlugin(plugin) {
1054
+ if (!this.getPlugin(plugin.id)) {
1055
+ this.plugins.push(plugin);
1026
1056
  }
1027
1057
  }
1028
- static getAvailablePlugins(container) {
1058
+ getAvailablePlugins(container) {
1029
1059
  const res = new Map;
1030
- for (const plugin of plugins) {
1060
+ for (const plugin of this.plugins) {
1031
1061
  if (!plugin.needsPlugin(container.actualOptions)) {
1032
1062
  continue;
1033
1063
  }
@@ -1035,61 +1065,62 @@
1035
1065
  }
1036
1066
  return res;
1037
1067
  }
1038
- static loadOptions(options, sourceOptions) {
1039
- for (const plugin of plugins) {
1068
+ loadOptions(options, sourceOptions) {
1069
+ for (const plugin of this.plugins) {
1040
1070
  plugin.loadOptions(options, sourceOptions);
1041
1071
  }
1042
1072
  }
1043
- static getPreset(preset) {
1044
- return presets.get(preset);
1073
+ getPreset(preset) {
1074
+ return this.presets.get(preset);
1045
1075
  }
1046
- static addPreset(presetKey, options, override = false) {
1047
- if (override || !Plugins_Plugins.getPreset(presetKey)) {
1048
- presets.set(presetKey, options);
1076
+ addPreset(presetKey, options, override = false) {
1077
+ if (override || !this.getPreset(presetKey)) {
1078
+ this.presets.set(presetKey, options);
1049
1079
  }
1050
1080
  }
1051
- static addShapeDrawer(type, drawer) {
1052
- if (!Plugins_Plugins.getShapeDrawer(type)) {
1053
- drawers.set(type, drawer);
1081
+ addShapeDrawer(type, drawer) {
1082
+ if (!this.getShapeDrawer(type)) {
1083
+ this.drawers.set(type, drawer);
1054
1084
  }
1055
1085
  }
1056
- static getShapeDrawer(type) {
1057
- return drawers.get(type);
1086
+ getShapeDrawer(type) {
1087
+ return this.drawers.get(type);
1058
1088
  }
1059
- static getSupportedShapes() {
1060
- return drawers.keys();
1089
+ getSupportedShapes() {
1090
+ return this.drawers.keys();
1061
1091
  }
1062
- static getPathGenerator(type) {
1063
- return pathGenerators.get(type);
1092
+ getPathGenerator(type) {
1093
+ return this.pathGenerators.get(type);
1064
1094
  }
1065
- static addPathGenerator(type, pathGenerator) {
1066
- if (!Plugins_Plugins.getPathGenerator(type)) {
1067
- pathGenerators.set(type, pathGenerator);
1095
+ addPathGenerator(type, pathGenerator) {
1096
+ if (!this.getPathGenerator(type)) {
1097
+ this.pathGenerators.set(type, pathGenerator);
1068
1098
  }
1069
1099
  }
1070
- static getInteractors(container, force = false) {
1071
- let res = interactors.get(container);
1100
+ getInteractors(container, force = false) {
1101
+ let res = this.interactors.get(container);
1072
1102
  if (!res || force) {
1073
- res = [ ...interactorsInitializers.values() ].map((t => t(container)));
1074
- interactors.set(container, res);
1103
+ res = [ ...this.interactorsInitializers.values() ].map((t => t(container)));
1104
+ this.interactors.set(container, res);
1075
1105
  }
1076
1106
  return res;
1077
1107
  }
1078
- static addInteractor(name, initInteractor) {
1079
- interactorsInitializers.set(name, initInteractor);
1108
+ addInteractor(name, initInteractor) {
1109
+ this.interactorsInitializers.set(name, initInteractor);
1080
1110
  }
1081
- static getUpdaters(container, force = false) {
1082
- let res = updaters.get(container);
1111
+ getUpdaters(container, force = false) {
1112
+ let res = this.updaters.get(container);
1083
1113
  if (!res || force) {
1084
- res = [ ...updatersInitializers.values() ].map((t => t(container)));
1085
- updaters.set(container, res);
1114
+ res = [ ...this.updatersInitializers.values() ].map((t => t(container)));
1115
+ this.updaters.set(container, res);
1086
1116
  }
1087
1117
  return res;
1088
1118
  }
1089
- static addParticleUpdater(name, initUpdater) {
1090
- updatersInitializers.set(name, initUpdater);
1119
+ addParticleUpdater(name, initUpdater) {
1120
+ this.updatersInitializers.set(name, initUpdater);
1091
1121
  }
1092
1122
  }
1123
+ _Plugins_engine = new WeakMap;
1093
1124
  class QuadTree_QuadTree {
1094
1125
  constructor(rectangle, capacity) {
1095
1126
  this.rectangle = rectangle;
@@ -2707,22 +2738,31 @@
2707
2738
  }
2708
2739
  }
2709
2740
  }
2710
- var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
2741
+ var Options_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2742
+ if (kind === "m") throw new TypeError("Private method is not writable");
2743
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
2744
+ 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");
2745
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
2746
+ value;
2747
+ };
2748
+ var Options_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
2711
2749
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2712
2750
  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");
2713
2751
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2714
2752
  };
2715
- var _Options_instances, _Options_findDefaultTheme;
2753
+ var _Options_instances, _Options_engine, _Options_findDefaultTheme;
2716
2754
  class Options_Options {
2717
- constructor() {
2755
+ constructor(engine) {
2718
2756
  _Options_instances.add(this);
2757
+ _Options_engine.set(this, void 0);
2758
+ Options_classPrivateFieldSet(this, _Options_engine, engine, "f");
2719
2759
  this.autoPlay = true;
2720
2760
  this.background = new Background;
2721
2761
  this.backgroundMask = new BackgroundMask;
2722
2762
  this.fullScreen = new FullScreen;
2723
2763
  this.detectRetina = true;
2724
2764
  this.duration = 0;
2725
- this.fpsLimit = 60;
2765
+ this.fpsLimit = 120;
2726
2766
  this.interactivity = new Interactivity;
2727
2767
  this.manualParticles = [];
2728
2768
  this.motion = new Motion;
@@ -2808,7 +2848,7 @@
2808
2848
  this.motion.load(data.motion);
2809
2849
  this.particles.load(data.particles);
2810
2850
  this.style = deepExtend(this.style, data.style);
2811
- Plugins.loadOptions(this, data);
2851
+ Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.loadOptions(this, data);
2812
2852
  if (data.responsive !== undefined) {
2813
2853
  for (const responsive of data.responsive) {
2814
2854
  const optResponsive = new Responsive;
@@ -2824,8 +2864,8 @@
2824
2864
  this.themes.push(optTheme);
2825
2865
  }
2826
2866
  }
2827
- this.defaultDarkTheme = (_d = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
2828
- this.defaultLightTheme = (_e = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
2867
+ this.defaultDarkTheme = (_d = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
2868
+ this.defaultLightTheme = (_e = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
2829
2869
  }
2830
2870
  setTheme(name) {
2831
2871
  if (name) {
@@ -2834,7 +2874,7 @@
2834
2874
  this.load(chosenTheme.options);
2835
2875
  }
2836
2876
  } else {
2837
- 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");
2877
+ 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");
2838
2878
  if (defaultTheme) {
2839
2879
  this.load(defaultTheme.options);
2840
2880
  }
@@ -2847,13 +2887,26 @@
2847
2887
  return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
2848
2888
  }
2849
2889
  importPreset(preset) {
2850
- this.load(Plugins.getPreset(preset));
2890
+ this.load(Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.getPreset(preset));
2851
2891
  }
2852
2892
  }
2853
- _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
2893
+ _Options_engine = new WeakMap, _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
2854
2894
  var _a;
2855
2895
  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"));
2856
2896
  };
2897
+ var Particle_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2898
+ if (kind === "m") throw new TypeError("Private method is not writable");
2899
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
2900
+ 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");
2901
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
2902
+ value;
2903
+ };
2904
+ var Particle_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
2905
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2906
+ 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");
2907
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2908
+ };
2909
+ var _Particle_engine;
2857
2910
  const fixOutMode = data => {
2858
2911
  if (isInArray(data.outMode, data.checkModes) || isInArray(data.outMode, data.checkModes)) {
2859
2912
  if (data.coord > data.maxCoord - data.radius * 2) {
@@ -2864,11 +2917,13 @@
2864
2917
  }
2865
2918
  };
2866
2919
  class Particle_Particle {
2867
- constructor(id, container, position, overrideOptions, group) {
2920
+ constructor(engine, id, container, position, overrideOptions, group) {
2868
2921
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2869
2922
  this.id = id;
2870
2923
  this.container = container;
2871
2924
  this.group = group;
2925
+ _Particle_engine.set(this, void 0);
2926
+ Particle_classPrivateFieldSet(this, _Particle_engine, engine, "f");
2872
2927
  this.fill = true;
2873
2928
  this.close = true;
2874
2929
  this.lastPathTime = 0;
@@ -2962,7 +3017,7 @@
2962
3017
  this.sides = 24;
2963
3018
  let drawer = container.drawers.get(this.shape);
2964
3019
  if (!drawer) {
2965
- drawer = Plugins.getShapeDrawer(this.shape);
3020
+ drawer = Particle_classPrivateFieldGet(this, _Particle_engine, "f").plugins.getShapeDrawer(this.shape);
2966
3021
  if (drawer) {
2967
3022
  container.drawers.set(this.shape, drawer);
2968
3023
  }
@@ -3202,9 +3257,25 @@
3202
3257
  return life;
3203
3258
  }
3204
3259
  }
3260
+ _Particle_engine = new WeakMap;
3261
+ var Particles_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
3262
+ if (kind === "m") throw new TypeError("Private method is not writable");
3263
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3264
+ 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");
3265
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
3266
+ value;
3267
+ };
3268
+ var Particles_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3269
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3270
+ 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");
3271
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3272
+ };
3273
+ var _Particles_engine;
3205
3274
  class Particles_Particles {
3206
- constructor(container) {
3275
+ constructor(engine, container) {
3207
3276
  this.container = container;
3277
+ _Particles_engine.set(this, void 0);
3278
+ Particles_classPrivateFieldSet(this, _Particles_engine, engine, "f");
3208
3279
  this.nextId = 0;
3209
3280
  this.array = [];
3210
3281
  this.zArray = [];
@@ -3216,11 +3287,11 @@
3216
3287
  links: new Map,
3217
3288
  triangles: new Map
3218
3289
  };
3219
- this.interactionManager = new InteractionManager(container);
3290
+ this.interactionManager = new InteractionManager(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), container);
3220
3291
  const canvasSize = this.container.canvas.size;
3221
3292
  this.linksColors = new Map;
3222
3293
  this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
3223
- this.updaters = Plugins.getUpdaters(container, true);
3294
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
3224
3295
  }
3225
3296
  get count() {
3226
3297
  return this.array.length;
@@ -3234,7 +3305,7 @@
3234
3305
  this.freqs.links = new Map;
3235
3306
  this.freqs.triangles = new Map;
3236
3307
  let handled = false;
3237
- this.updaters = Plugins.getUpdaters(container, true);
3308
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
3238
3309
  this.interactionManager.init();
3239
3310
  for (const [, plugin] of container.plugins) {
3240
3311
  if (plugin.particlesInitialization !== undefined) {
@@ -3481,7 +3552,7 @@
3481
3552
  }
3482
3553
  pushParticle(position, overrideOptions, group, initializer) {
3483
3554
  try {
3484
- const particle = new Particle(this.nextId, this.container, position, overrideOptions, group);
3555
+ const particle = new Particle(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), this.nextId, this.container, position, overrideOptions, group);
3485
3556
  let canAdd = true;
3486
3557
  if (initializer) {
3487
3558
  canAdd = initializer(particle);
@@ -3499,6 +3570,7 @@
3499
3570
  }
3500
3571
  }
3501
3572
  }
3573
+ _Particles_engine = new WeakMap;
3502
3574
  class Retina_Retina {
3503
3575
  constructor(container) {
3504
3576
  this.container = container;
@@ -3586,10 +3658,25 @@
3586
3658
  }
3587
3659
  }
3588
3660
  }
3661
+ var Container_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
3662
+ if (kind === "m") throw new TypeError("Private method is not writable");
3663
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3664
+ 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");
3665
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
3666
+ value;
3667
+ };
3668
+ var Container_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3669
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3670
+ 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");
3671
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3672
+ };
3673
+ var _Container_engine;
3589
3674
  class Container_Container {
3590
- constructor(id, sourceOptions, ...presets) {
3675
+ constructor(engine, id, sourceOptions, ...presets) {
3591
3676
  this.id = id;
3592
- this.fpsLimit = 60;
3677
+ _Container_engine.set(this, void 0);
3678
+ Container_classPrivateFieldSet(this, _Container_engine, engine, "f");
3679
+ this.fpsLimit = 120;
3593
3680
  this.duration = 0;
3594
3681
  this.lifeTime = 0;
3595
3682
  this.firstStart = true;
@@ -3603,7 +3690,7 @@
3603
3690
  this._initialSourceOptions = sourceOptions;
3604
3691
  this.retina = new Retina(this);
3605
3692
  this.canvas = new Canvas(this);
3606
- this.particles = new Particles(this);
3693
+ this.particles = new Particles(Container_classPrivateFieldGet(this, _Container_engine, "f"), this);
3607
3694
  this.drawer = new FrameManager(this);
3608
3695
  this.presets = presets;
3609
3696
  this.pathGenerator = {
@@ -3632,8 +3719,8 @@
3632
3719
  this.plugins = new Map;
3633
3720
  this.drawers = new Map;
3634
3721
  this.density = 1;
3635
- this._options = new Options;
3636
- this.actualOptions = new Options;
3722
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3723
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3637
3724
  this.eventListeners = new EventListeners(this);
3638
3725
  if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
3639
3726
  this.intersectionObserver = new IntersectionObserver((entries => this.intersectionManager(entries)));
@@ -3748,7 +3835,7 @@
3748
3835
  return this.start();
3749
3836
  }
3750
3837
  reset() {
3751
- this._options = new Options;
3838
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3752
3839
  return this.refresh();
3753
3840
  }
3754
3841
  stop() {
@@ -3762,7 +3849,7 @@
3762
3849
  this.particles.clear();
3763
3850
  this.canvas.clear();
3764
3851
  if (this.interactivity.element instanceof HTMLElement && this.intersectionObserver) {
3765
- this.intersectionObserver.observe(this.interactivity.element);
3852
+ this.intersectionObserver.unobserve(this.interactivity.element);
3766
3853
  }
3767
3854
  for (const [, plugin] of this.plugins) {
3768
3855
  if (plugin.stop) {
@@ -3889,20 +3976,20 @@
3889
3976
  return false;
3890
3977
  }
3891
3978
  async init() {
3892
- this._options = new Options;
3979
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3893
3980
  for (const preset of this.presets) {
3894
- this._options.load(Plugins.getPreset(preset));
3981
+ this._options.load(Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPreset(preset));
3895
3982
  }
3896
- const shapes = Plugins.getSupportedShapes();
3983
+ const shapes = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getSupportedShapes();
3897
3984
  for (const type of shapes) {
3898
- const drawer = Plugins.getShapeDrawer(type);
3985
+ const drawer = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getShapeDrawer(type);
3899
3986
  if (drawer) {
3900
3987
  this.drawers.set(type, drawer);
3901
3988
  }
3902
3989
  }
3903
3990
  this._options.load(this._initialSourceOptions);
3904
3991
  this._options.load(this._sourceOptions);
3905
- this.actualOptions = new Options;
3992
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3906
3993
  this.actualOptions.load(this._options);
3907
3994
  this.retina.init();
3908
3995
  this.canvas.init();
@@ -3912,8 +3999,8 @@
3912
3999
  this.zLayers = this.actualOptions.zLayers;
3913
4000
  this.duration = getRangeValue(this.actualOptions.duration);
3914
4001
  this.lifeTime = 0;
3915
- this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 60;
3916
- const availablePlugins = Plugins.getAvailablePlugins(this);
4002
+ this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 120;
4003
+ const availablePlugins = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getAvailablePlugins(this);
3917
4004
  for (const [id, plugin] of availablePlugins) {
3918
4005
  this.plugins.set(id, plugin);
3919
4006
  }
@@ -3931,7 +4018,7 @@
3931
4018
  }
3932
4019
  const pathOptions = this.actualOptions.particles.move.path;
3933
4020
  if (pathOptions.generator) {
3934
- const customGenerator = Plugins.getPathGenerator(pathOptions.generator);
4021
+ const customGenerator = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPathGenerator(pathOptions.generator);
3935
4022
  if (customGenerator) {
3936
4023
  if (customGenerator.init) {
3937
4024
  this.pathGenerator.init = customGenerator.init;
@@ -3968,24 +4055,41 @@
3968
4055
  }
3969
4056
  }
3970
4057
  }
3971
- const tsParticlesDom = null && [];
4058
+ _Container_engine = new WeakMap;
4059
+ var Loader_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
4060
+ if (kind === "m") throw new TypeError("Private method is not writable");
4061
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4062
+ 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");
4063
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
4064
+ value;
4065
+ };
4066
+ var Loader_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
4067
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4068
+ 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");
4069
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4070
+ };
4071
+ var _Loader_engine;
3972
4072
  function fetchError(statusCode) {
3973
4073
  console.error(`Error tsParticles - fetch status: ${statusCode}`);
3974
4074
  console.error("Error tsParticles - File config not found");
3975
4075
  }
3976
4076
  class Loader {
3977
- static dom() {
3978
- return tsParticlesDom;
4077
+ constructor(engine) {
4078
+ _Loader_engine.set(this, void 0);
4079
+ Loader_classPrivateFieldSet(this, _Loader_engine, engine, "f");
4080
+ }
4081
+ dom() {
4082
+ return Loader_classPrivateFieldGet(this, _Loader_engine, "f").domArray;
3979
4083
  }
3980
- static domItem(index) {
3981
- const dom = Loader.dom();
4084
+ domItem(index) {
4085
+ const dom = this.dom();
3982
4086
  const item = dom[index];
3983
4087
  if (item && !item.destroyed) {
3984
4088
  return item;
3985
4089
  }
3986
4090
  dom.splice(index, 1);
3987
4091
  }
3988
- static async loadOptions(params) {
4092
+ async loadOptions(params) {
3989
4093
  var _a, _b, _c;
3990
4094
  const tagId = (_a = params.tagId) !== null && _a !== void 0 ? _a : `tsparticles${Math.floor(Math.random() * 1e4)}`;
3991
4095
  const {options: options, index: index} = params;
@@ -3996,10 +4100,10 @@
3996
4100
  (_c = document.querySelector("body")) === null || _c === void 0 ? void 0 : _c.append(domContainer);
3997
4101
  }
3998
4102
  const currentOptions = options instanceof Array ? itemFromArray(options, index) : options;
3999
- const dom = Loader.dom();
4103
+ const dom = this.dom();
4000
4104
  const oldIndex = dom.findIndex((v => v.id === tagId));
4001
4105
  if (oldIndex >= 0) {
4002
- const old = Loader.domItem(oldIndex);
4106
+ const old = this.domItem(oldIndex);
4003
4107
  if (old && !old.destroyed) {
4004
4108
  old.destroy();
4005
4109
  dom.splice(oldIndex, 1);
@@ -4022,7 +4126,7 @@
4022
4126
  domContainer.appendChild(canvasEl);
4023
4127
  }
4024
4128
  }
4025
- const newItem = new Container(tagId, currentOptions);
4129
+ const newItem = new Container(Loader_classPrivateFieldGet(this, _Loader_engine, "f"), tagId, currentOptions);
4026
4130
  if (oldIndex >= 0) {
4027
4131
  dom.splice(oldIndex, 0, newItem);
4028
4132
  } else {
@@ -4032,7 +4136,7 @@
4032
4136
  await newItem.start();
4033
4137
  return newItem;
4034
4138
  }
4035
- static async loadRemoteOptions(params) {
4139
+ async loadRemoteOptions(params) {
4036
4140
  const {url: jsonUrl, index: index} = params;
4037
4141
  const url = jsonUrl instanceof Array ? itemFromArray(jsonUrl, index) : jsonUrl;
4038
4142
  if (!url) {
@@ -4044,14 +4148,14 @@
4044
4148
  return;
4045
4149
  }
4046
4150
  const data = await response.json();
4047
- return await Loader.loadOptions({
4151
+ return this.loadOptions({
4048
4152
  tagId: params.tagId,
4049
4153
  element: params.element,
4050
4154
  index: index,
4051
4155
  options: data
4052
4156
  });
4053
4157
  }
4054
- static load(tagId, options, index) {
4158
+ load(tagId, options, index) {
4055
4159
  const params = {
4056
4160
  index: index
4057
4161
  };
@@ -4067,7 +4171,7 @@
4067
4171
  }
4068
4172
  return this.loadOptions(params);
4069
4173
  }
4070
- static async set(id, domContainer, options, index) {
4174
+ async set(id, domContainer, options, index) {
4071
4175
  const params = {
4072
4176
  index: index
4073
4177
  };
@@ -4088,7 +4192,7 @@
4088
4192
  }
4089
4193
  return this.loadOptions(params);
4090
4194
  }
4091
- static async loadJSON(tagId, jsonUrl, index) {
4195
+ async loadJSON(tagId, jsonUrl, index) {
4092
4196
  let url, id;
4093
4197
  if (typeof jsonUrl === "number" || jsonUrl === undefined) {
4094
4198
  url = tagId;
@@ -4096,13 +4200,13 @@
4096
4200
  id = tagId;
4097
4201
  url = jsonUrl;
4098
4202
  }
4099
- return await Loader.loadRemoteOptions({
4203
+ return this.loadRemoteOptions({
4100
4204
  tagId: id,
4101
4205
  url: url,
4102
4206
  index: index
4103
4207
  });
4104
4208
  }
4105
- static async setJSON(id, domContainer, jsonUrl, index) {
4209
+ async setJSON(id, domContainer, jsonUrl, index) {
4106
4210
  let url, newId, newIndex, element;
4107
4211
  if (id instanceof HTMLElement) {
4108
4212
  element = id;
@@ -4114,15 +4218,15 @@
4114
4218
  url = jsonUrl;
4115
4219
  newIndex = index;
4116
4220
  }
4117
- return await Loader.loadRemoteOptions({
4221
+ return this.loadRemoteOptions({
4118
4222
  tagId: newId,
4119
4223
  url: url,
4120
4224
  index: newIndex,
4121
4225
  element: element
4122
4226
  });
4123
4227
  }
4124
- static setOnClickHandler(callback) {
4125
- const dom = Loader.dom();
4228
+ setOnClickHandler(callback) {
4229
+ const dom = this.dom();
4126
4230
  if (dom.length === 0) {
4127
4231
  throw new Error("Can only set click handlers after calling tsParticles.load() or tsParticles.loadJSON()");
4128
4232
  }
@@ -4131,6 +4235,7 @@
4131
4235
  }
4132
4236
  }
4133
4237
  }
4238
+ _Loader_engine = new WeakMap;
4134
4239
  function NumberUtils_clamp(num, min, max) {
4135
4240
  return Math.min(Math.max(num, min), max);
4136
4241
  }