tsparticles 1.39.3 → 1.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/Core/Container.d.ts +3 -1
  2. package/Core/Container.js +27 -12
  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 +3 -1
  10. package/Core/Utils/InteractionManager.js +17 -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 +13 -6
  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 +29 -13
  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 +3 -1
  43. package/browser/Core/Utils/InteractionManager.js +17 -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 +13 -6
  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 +28 -13
  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 +3 -1
  79. package/esm/Core/Utils/InteractionManager.js +17 -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 +13 -6
  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 +1 -1
  105. package/report.html +2 -2
  106. package/report.slim.html +2 -2
  107. package/tsparticles.engine.js +221 -114
  108. package/tsparticles.engine.min.js +2 -2
  109. package/tsparticles.interaction.external.attract.js +199 -96
  110. package/tsparticles.interaction.external.attract.min.js +2 -2
  111. package/tsparticles.interaction.external.bounce.js +199 -96
  112. package/tsparticles.interaction.external.bounce.min.js +2 -2
  113. package/tsparticles.interaction.external.bubble.js +199 -96
  114. package/tsparticles.interaction.external.bubble.min.js +2 -2
  115. package/tsparticles.interaction.external.connect.js +199 -96
  116. package/tsparticles.interaction.external.connect.min.js +2 -2
  117. package/tsparticles.interaction.external.grab.js +199 -96
  118. package/tsparticles.interaction.external.grab.min.js +2 -2
  119. package/tsparticles.interaction.external.repulse.js +199 -96
  120. package/tsparticles.interaction.external.repulse.min.js +2 -2
  121. package/tsparticles.interaction.external.trail.js +199 -96
  122. package/tsparticles.interaction.external.trail.min.js +2 -2
  123. package/tsparticles.interaction.particles.attract.js +199 -96
  124. package/tsparticles.interaction.particles.attract.min.js +2 -2
  125. package/tsparticles.interaction.particles.collisions.js +199 -96
  126. package/tsparticles.interaction.particles.collisions.min.js +2 -2
  127. package/tsparticles.interaction.particles.links.js +199 -96
  128. package/tsparticles.interaction.particles.links.min.js +2 -2
  129. package/tsparticles.js +341 -152
  130. package/tsparticles.min.js +2 -2
  131. package/tsparticles.pathseg.min.js +1 -1
  132. package/tsparticles.plugins.absorbers.js +199 -96
  133. package/tsparticles.plugins.absorbers.min.js +2 -2
  134. package/tsparticles.plugins.emitters.js +324 -139
  135. package/tsparticles.plugins.emitters.min.js +2 -2
  136. package/tsparticles.plugins.polygonMask.js +199 -96
  137. package/tsparticles.plugins.polygonMask.min.js +2 -2
  138. package/tsparticles.shape.circle.min.js +1 -1
  139. package/tsparticles.shape.image.js +202 -99
  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 +199 -96
  146. package/tsparticles.shape.text.min.js +2 -2
  147. package/tsparticles.slim.js +221 -114
  148. package/tsparticles.slim.min.js +2 -2
  149. package/tsparticles.updater.angle.js +199 -96
  150. package/tsparticles.updater.angle.min.js +2 -2
  151. package/tsparticles.updater.color.js +199 -96
  152. package/tsparticles.updater.color.min.js +2 -2
  153. package/tsparticles.updater.life.js +199 -96
  154. package/tsparticles.updater.life.min.js +2 -2
  155. package/tsparticles.updater.opacity.js +199 -96
  156. package/tsparticles.updater.opacity.min.js +2 -2
  157. package/tsparticles.updater.outModes.js +199 -96
  158. package/tsparticles.updater.outModes.min.js +2 -2
  159. package/tsparticles.updater.roll.js +199 -96
  160. package/tsparticles.updater.roll.min.js +2 -2
  161. package/tsparticles.updater.size.js +199 -96
  162. package/tsparticles.updater.size.min.js +2 -2
  163. package/tsparticles.updater.strokeColor.js +199 -96
  164. package/tsparticles.updater.strokeColor.min.js +2 -2
  165. package/tsparticles.updater.tilt.js +199 -96
  166. package/tsparticles.updater.tilt.min.js +2 -2
  167. package/tsparticles.updater.wobble.js +199 -96
  168. package/tsparticles.updater.wobble.min.js +2 -2
@@ -540,15 +540,30 @@
540
540
  }
541
541
  }
542
542
  }
543
+ var __classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
544
+ if (kind === "m") throw new TypeError("Private method is not writable");
545
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
546
+ 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");
547
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
548
+ value;
549
+ };
550
+ var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
551
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
552
+ 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");
553
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
554
+ };
555
+ var _InteractionManager_engine;
543
556
  class InteractionManager_InteractionManager {
544
- constructor(container) {
557
+ constructor(engine, container) {
545
558
  this.container = container;
559
+ _InteractionManager_engine.set(this, void 0);
560
+ __classPrivateFieldSet(this, _InteractionManager_engine, engine, "f");
546
561
  this.externalInteractors = [];
547
562
  this.particleInteractors = [];
548
563
  this.init();
549
564
  }
550
565
  init() {
551
- const interactors = Plugins.getInteractors(this.container, true);
566
+ const interactors = __classPrivateFieldGet(this, _InteractionManager_engine, "f").plugins.getInteractors(this.container, true);
552
567
  this.externalInteractors = [];
553
568
  this.particleInteractors = [];
554
569
  for (const interactor of interactors) {
@@ -581,6 +596,7 @@
581
596
  }
582
597
  }
583
598
  }
599
+ _InteractionManager_engine = new WeakMap;
584
600
  function applyDistance(particle) {
585
601
  const initialPosition = particle.initialPosition;
586
602
  const {dx: dx, dy: dy} = getDistances(initialPosition, particle.position);
@@ -754,26 +770,38 @@
754
770
  return proximityFactor / slowFactor;
755
771
  }
756
772
  }
757
- const plugins = null && [];
758
- const interactorsInitializers = new Map;
759
- const updatersInitializers = new Map;
760
- const interactors = new Map;
761
- const updaters = new Map;
762
- const presets = new Map;
763
- const drawers = new Map;
764
- const pathGenerators = new Map;
765
- class Plugins_Plugins {
766
- static getPlugin(plugin) {
767
- return plugins.find((t => t.id === plugin));
773
+ var Plugins_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
774
+ if (kind === "m") throw new TypeError("Private method is not writable");
775
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
776
+ 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");
777
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
778
+ value;
779
+ };
780
+ var _Plugins_engine;
781
+ class Plugins {
782
+ constructor(engine) {
783
+ _Plugins_engine.set(this, void 0);
784
+ Plugins_classPrivateFieldSet(this, _Plugins_engine, engine, "f");
785
+ this.plugins = [];
786
+ this.interactorsInitializers = new Map;
787
+ this.updatersInitializers = new Map;
788
+ this.interactors = new Map;
789
+ this.updaters = new Map;
790
+ this.presets = new Map;
791
+ this.drawers = new Map;
792
+ this.pathGenerators = new Map;
768
793
  }
769
- static addPlugin(plugin) {
770
- if (!Plugins_Plugins.getPlugin(plugin.id)) {
771
- plugins.push(plugin);
794
+ getPlugin(plugin) {
795
+ return this.plugins.find((t => t.id === plugin));
796
+ }
797
+ addPlugin(plugin) {
798
+ if (!this.getPlugin(plugin.id)) {
799
+ this.plugins.push(plugin);
772
800
  }
773
801
  }
774
- static getAvailablePlugins(container) {
802
+ getAvailablePlugins(container) {
775
803
  const res = new Map;
776
- for (const plugin of plugins) {
804
+ for (const plugin of this.plugins) {
777
805
  if (!plugin.needsPlugin(container.actualOptions)) {
778
806
  continue;
779
807
  }
@@ -781,61 +809,62 @@
781
809
  }
782
810
  return res;
783
811
  }
784
- static loadOptions(options, sourceOptions) {
785
- for (const plugin of plugins) {
812
+ loadOptions(options, sourceOptions) {
813
+ for (const plugin of this.plugins) {
786
814
  plugin.loadOptions(options, sourceOptions);
787
815
  }
788
816
  }
789
- static getPreset(preset) {
790
- return presets.get(preset);
817
+ getPreset(preset) {
818
+ return this.presets.get(preset);
791
819
  }
792
- static addPreset(presetKey, options, override = false) {
793
- if (override || !Plugins_Plugins.getPreset(presetKey)) {
794
- presets.set(presetKey, options);
820
+ addPreset(presetKey, options, override = false) {
821
+ if (override || !this.getPreset(presetKey)) {
822
+ this.presets.set(presetKey, options);
795
823
  }
796
824
  }
797
- static addShapeDrawer(type, drawer) {
798
- if (!Plugins_Plugins.getShapeDrawer(type)) {
799
- drawers.set(type, drawer);
825
+ addShapeDrawer(type, drawer) {
826
+ if (!this.getShapeDrawer(type)) {
827
+ this.drawers.set(type, drawer);
800
828
  }
801
829
  }
802
- static getShapeDrawer(type) {
803
- return drawers.get(type);
830
+ getShapeDrawer(type) {
831
+ return this.drawers.get(type);
804
832
  }
805
- static getSupportedShapes() {
806
- return drawers.keys();
833
+ getSupportedShapes() {
834
+ return this.drawers.keys();
807
835
  }
808
- static getPathGenerator(type) {
809
- return pathGenerators.get(type);
836
+ getPathGenerator(type) {
837
+ return this.pathGenerators.get(type);
810
838
  }
811
- static addPathGenerator(type, pathGenerator) {
812
- if (!Plugins_Plugins.getPathGenerator(type)) {
813
- pathGenerators.set(type, pathGenerator);
839
+ addPathGenerator(type, pathGenerator) {
840
+ if (!this.getPathGenerator(type)) {
841
+ this.pathGenerators.set(type, pathGenerator);
814
842
  }
815
843
  }
816
- static getInteractors(container, force = false) {
817
- let res = interactors.get(container);
844
+ getInteractors(container, force = false) {
845
+ let res = this.interactors.get(container);
818
846
  if (!res || force) {
819
- res = [ ...interactorsInitializers.values() ].map((t => t(container)));
820
- interactors.set(container, res);
847
+ res = [ ...this.interactorsInitializers.values() ].map((t => t(container)));
848
+ this.interactors.set(container, res);
821
849
  }
822
850
  return res;
823
851
  }
824
- static addInteractor(name, initInteractor) {
825
- interactorsInitializers.set(name, initInteractor);
852
+ addInteractor(name, initInteractor) {
853
+ this.interactorsInitializers.set(name, initInteractor);
826
854
  }
827
- static getUpdaters(container, force = false) {
828
- let res = updaters.get(container);
855
+ getUpdaters(container, force = false) {
856
+ let res = this.updaters.get(container);
829
857
  if (!res || force) {
830
- res = [ ...updatersInitializers.values() ].map((t => t(container)));
831
- updaters.set(container, res);
858
+ res = [ ...this.updatersInitializers.values() ].map((t => t(container)));
859
+ this.updaters.set(container, res);
832
860
  }
833
861
  return res;
834
862
  }
835
- static addParticleUpdater(name, initUpdater) {
836
- updatersInitializers.set(name, initUpdater);
863
+ addParticleUpdater(name, initUpdater) {
864
+ this.updatersInitializers.set(name, initUpdater);
837
865
  }
838
866
  }
867
+ _Plugins_engine = new WeakMap;
839
868
  class QuadTree_QuadTree {
840
869
  constructor(rectangle, capacity) {
841
870
  this.rectangle = rectangle;
@@ -2434,15 +2463,24 @@
2434
2463
  }
2435
2464
  }
2436
2465
  }
2437
- var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
2466
+ var Options_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2467
+ if (kind === "m") throw new TypeError("Private method is not writable");
2468
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
2469
+ 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");
2470
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
2471
+ value;
2472
+ };
2473
+ var Options_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
2438
2474
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2439
2475
  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");
2440
2476
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2441
2477
  };
2442
- var _Options_instances, _Options_findDefaultTheme;
2478
+ var _Options_instances, _Options_engine, _Options_findDefaultTheme;
2443
2479
  class Options_Options {
2444
- constructor() {
2480
+ constructor(engine) {
2445
2481
  _Options_instances.add(this);
2482
+ _Options_engine.set(this, void 0);
2483
+ Options_classPrivateFieldSet(this, _Options_engine, engine, "f");
2446
2484
  this.autoPlay = true;
2447
2485
  this.background = new Background;
2448
2486
  this.backgroundMask = new BackgroundMask;
@@ -2535,7 +2573,7 @@
2535
2573
  this.motion.load(data.motion);
2536
2574
  this.particles.load(data.particles);
2537
2575
  this.style = deepExtend(this.style, data.style);
2538
- Plugins.loadOptions(this, data);
2576
+ Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.loadOptions(this, data);
2539
2577
  if (data.responsive !== undefined) {
2540
2578
  for (const responsive of data.responsive) {
2541
2579
  const optResponsive = new Responsive;
@@ -2551,8 +2589,8 @@
2551
2589
  this.themes.push(optTheme);
2552
2590
  }
2553
2591
  }
2554
- this.defaultDarkTheme = (_d = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
2555
- this.defaultLightTheme = (_e = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
2592
+ this.defaultDarkTheme = (_d = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
2593
+ this.defaultLightTheme = (_e = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
2556
2594
  }
2557
2595
  setTheme(name) {
2558
2596
  if (name) {
@@ -2561,7 +2599,7 @@
2561
2599
  this.load(chosenTheme.options);
2562
2600
  }
2563
2601
  } else {
2564
- 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");
2602
+ 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");
2565
2603
  if (defaultTheme) {
2566
2604
  this.load(defaultTheme.options);
2567
2605
  }
@@ -2574,13 +2612,26 @@
2574
2612
  return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
2575
2613
  }
2576
2614
  importPreset(preset) {
2577
- this.load(Plugins.getPreset(preset));
2615
+ this.load(Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.getPreset(preset));
2578
2616
  }
2579
2617
  }
2580
- _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
2618
+ _Options_engine = new WeakMap, _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
2581
2619
  var _a;
2582
2620
  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"));
2583
2621
  };
2622
+ var Particle_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2623
+ if (kind === "m") throw new TypeError("Private method is not writable");
2624
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
2625
+ 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");
2626
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
2627
+ value;
2628
+ };
2629
+ var Particle_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
2630
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2631
+ 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");
2632
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2633
+ };
2634
+ var _Particle_engine;
2584
2635
  const fixOutMode = data => {
2585
2636
  if (isInArray(data.outMode, data.checkModes) || isInArray(data.outMode, data.checkModes)) {
2586
2637
  if (data.coord > data.maxCoord - data.radius * 2) {
@@ -2591,11 +2642,13 @@
2591
2642
  }
2592
2643
  };
2593
2644
  class Particle_Particle {
2594
- constructor(id, container, position, overrideOptions, group) {
2645
+ constructor(engine, id, container, position, overrideOptions, group) {
2595
2646
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2596
2647
  this.id = id;
2597
2648
  this.container = container;
2598
2649
  this.group = group;
2650
+ _Particle_engine.set(this, void 0);
2651
+ Particle_classPrivateFieldSet(this, _Particle_engine, engine, "f");
2599
2652
  this.fill = true;
2600
2653
  this.close = true;
2601
2654
  this.lastPathTime = 0;
@@ -2689,7 +2742,7 @@
2689
2742
  this.sides = 24;
2690
2743
  let drawer = container.drawers.get(this.shape);
2691
2744
  if (!drawer) {
2692
- drawer = Plugins.getShapeDrawer(this.shape);
2745
+ drawer = Particle_classPrivateFieldGet(this, _Particle_engine, "f").plugins.getShapeDrawer(this.shape);
2693
2746
  if (drawer) {
2694
2747
  container.drawers.set(this.shape, drawer);
2695
2748
  }
@@ -2929,9 +2982,25 @@
2929
2982
  return life;
2930
2983
  }
2931
2984
  }
2985
+ _Particle_engine = new WeakMap;
2986
+ var Particles_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2987
+ if (kind === "m") throw new TypeError("Private method is not writable");
2988
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
2989
+ 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");
2990
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
2991
+ value;
2992
+ };
2993
+ var Particles_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
2994
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2995
+ 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");
2996
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2997
+ };
2998
+ var _Particles_engine;
2932
2999
  class Particles_Particles {
2933
- constructor(container) {
3000
+ constructor(engine, container) {
2934
3001
  this.container = container;
3002
+ _Particles_engine.set(this, void 0);
3003
+ Particles_classPrivateFieldSet(this, _Particles_engine, engine, "f");
2935
3004
  this.nextId = 0;
2936
3005
  this.array = [];
2937
3006
  this.zArray = [];
@@ -2943,11 +3012,11 @@
2943
3012
  links: new Map,
2944
3013
  triangles: new Map
2945
3014
  };
2946
- this.interactionManager = new InteractionManager(container);
3015
+ this.interactionManager = new InteractionManager(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), container);
2947
3016
  const canvasSize = this.container.canvas.size;
2948
3017
  this.linksColors = new Map;
2949
3018
  this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
2950
- this.updaters = Plugins.getUpdaters(container, true);
3019
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
2951
3020
  }
2952
3021
  get count() {
2953
3022
  return this.array.length;
@@ -2961,7 +3030,7 @@
2961
3030
  this.freqs.links = new Map;
2962
3031
  this.freqs.triangles = new Map;
2963
3032
  let handled = false;
2964
- this.updaters = Plugins.getUpdaters(container, true);
3033
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
2965
3034
  this.interactionManager.init();
2966
3035
  for (const [, plugin] of container.plugins) {
2967
3036
  if (plugin.particlesInitialization !== undefined) {
@@ -3208,7 +3277,7 @@
3208
3277
  }
3209
3278
  pushParticle(position, overrideOptions, group, initializer) {
3210
3279
  try {
3211
- const particle = new Particle(this.nextId, this.container, position, overrideOptions, group);
3280
+ const particle = new Particle(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), this.nextId, this.container, position, overrideOptions, group);
3212
3281
  let canAdd = true;
3213
3282
  if (initializer) {
3214
3283
  canAdd = initializer(particle);
@@ -3226,6 +3295,7 @@
3226
3295
  }
3227
3296
  }
3228
3297
  }
3298
+ _Particles_engine = new WeakMap;
3229
3299
  class Retina_Retina {
3230
3300
  constructor(container) {
3231
3301
  this.container = container;
@@ -3313,9 +3383,24 @@
3313
3383
  }
3314
3384
  }
3315
3385
  }
3386
+ var Container_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
3387
+ if (kind === "m") throw new TypeError("Private method is not writable");
3388
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3389
+ 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");
3390
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
3391
+ value;
3392
+ };
3393
+ var Container_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3394
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3395
+ 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");
3396
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3397
+ };
3398
+ var _Container_engine;
3316
3399
  class Container_Container {
3317
- constructor(id, sourceOptions, ...presets) {
3400
+ constructor(engine, id, sourceOptions, ...presets) {
3318
3401
  this.id = id;
3402
+ _Container_engine.set(this, void 0);
3403
+ Container_classPrivateFieldSet(this, _Container_engine, engine, "f");
3319
3404
  this.fpsLimit = 120;
3320
3405
  this.duration = 0;
3321
3406
  this.lifeTime = 0;
@@ -3330,7 +3415,7 @@
3330
3415
  this._initialSourceOptions = sourceOptions;
3331
3416
  this.retina = new Retina(this);
3332
3417
  this.canvas = new Canvas(this);
3333
- this.particles = new Particles(this);
3418
+ this.particles = new Particles(Container_classPrivateFieldGet(this, _Container_engine, "f"), this);
3334
3419
  this.drawer = new FrameManager(this);
3335
3420
  this.presets = presets;
3336
3421
  this.pathGenerator = {
@@ -3359,8 +3444,8 @@
3359
3444
  this.plugins = new Map;
3360
3445
  this.drawers = new Map;
3361
3446
  this.density = 1;
3362
- this._options = new Options;
3363
- this.actualOptions = new Options;
3447
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3448
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3364
3449
  this.eventListeners = new EventListeners(this);
3365
3450
  if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
3366
3451
  this.intersectionObserver = new IntersectionObserver((entries => this.intersectionManager(entries)));
@@ -3475,7 +3560,7 @@
3475
3560
  return this.start();
3476
3561
  }
3477
3562
  reset() {
3478
- this._options = new Options;
3563
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3479
3564
  return this.refresh();
3480
3565
  }
3481
3566
  stop() {
@@ -3616,20 +3701,20 @@
3616
3701
  return false;
3617
3702
  }
3618
3703
  async init() {
3619
- this._options = new Options;
3704
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3620
3705
  for (const preset of this.presets) {
3621
- this._options.load(Plugins.getPreset(preset));
3706
+ this._options.load(Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPreset(preset));
3622
3707
  }
3623
- const shapes = Plugins.getSupportedShapes();
3708
+ const shapes = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getSupportedShapes();
3624
3709
  for (const type of shapes) {
3625
- const drawer = Plugins.getShapeDrawer(type);
3710
+ const drawer = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getShapeDrawer(type);
3626
3711
  if (drawer) {
3627
3712
  this.drawers.set(type, drawer);
3628
3713
  }
3629
3714
  }
3630
3715
  this._options.load(this._initialSourceOptions);
3631
3716
  this._options.load(this._sourceOptions);
3632
- this.actualOptions = new Options;
3717
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3633
3718
  this.actualOptions.load(this._options);
3634
3719
  this.retina.init();
3635
3720
  this.canvas.init();
@@ -3640,7 +3725,7 @@
3640
3725
  this.duration = getRangeValue(this.actualOptions.duration);
3641
3726
  this.lifeTime = 0;
3642
3727
  this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 120;
3643
- const availablePlugins = Plugins.getAvailablePlugins(this);
3728
+ const availablePlugins = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getAvailablePlugins(this);
3644
3729
  for (const [id, plugin] of availablePlugins) {
3645
3730
  this.plugins.set(id, plugin);
3646
3731
  }
@@ -3658,7 +3743,7 @@
3658
3743
  }
3659
3744
  const pathOptions = this.actualOptions.particles.move.path;
3660
3745
  if (pathOptions.generator) {
3661
- const customGenerator = Plugins.getPathGenerator(pathOptions.generator);
3746
+ const customGenerator = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPathGenerator(pathOptions.generator);
3662
3747
  if (customGenerator) {
3663
3748
  if (customGenerator.init) {
3664
3749
  this.pathGenerator.init = customGenerator.init;
@@ -3695,24 +3780,41 @@
3695
3780
  }
3696
3781
  }
3697
3782
  }
3698
- const tsParticlesDom = null && [];
3783
+ _Container_engine = new WeakMap;
3784
+ var Loader_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
3785
+ if (kind === "m") throw new TypeError("Private method is not writable");
3786
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3787
+ 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");
3788
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
3789
+ value;
3790
+ };
3791
+ var Loader_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
3792
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3793
+ 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");
3794
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3795
+ };
3796
+ var _Loader_engine;
3699
3797
  function fetchError(statusCode) {
3700
3798
  console.error(`Error tsParticles - fetch status: ${statusCode}`);
3701
3799
  console.error("Error tsParticles - File config not found");
3702
3800
  }
3703
3801
  class Loader {
3704
- static dom() {
3705
- return tsParticlesDom;
3802
+ constructor(engine) {
3803
+ _Loader_engine.set(this, void 0);
3804
+ Loader_classPrivateFieldSet(this, _Loader_engine, engine, "f");
3805
+ }
3806
+ dom() {
3807
+ return Loader_classPrivateFieldGet(this, _Loader_engine, "f").domArray;
3706
3808
  }
3707
- static domItem(index) {
3708
- const dom = Loader.dom();
3809
+ domItem(index) {
3810
+ const dom = this.dom();
3709
3811
  const item = dom[index];
3710
3812
  if (item && !item.destroyed) {
3711
3813
  return item;
3712
3814
  }
3713
3815
  dom.splice(index, 1);
3714
3816
  }
3715
- static async loadOptions(params) {
3817
+ async loadOptions(params) {
3716
3818
  var _a, _b, _c;
3717
3819
  const tagId = (_a = params.tagId) !== null && _a !== void 0 ? _a : `tsparticles${Math.floor(Math.random() * 1e4)}`;
3718
3820
  const {options: options, index: index} = params;
@@ -3723,10 +3825,10 @@
3723
3825
  (_c = document.querySelector("body")) === null || _c === void 0 ? void 0 : _c.append(domContainer);
3724
3826
  }
3725
3827
  const currentOptions = options instanceof Array ? itemFromArray(options, index) : options;
3726
- const dom = Loader.dom();
3828
+ const dom = this.dom();
3727
3829
  const oldIndex = dom.findIndex((v => v.id === tagId));
3728
3830
  if (oldIndex >= 0) {
3729
- const old = Loader.domItem(oldIndex);
3831
+ const old = this.domItem(oldIndex);
3730
3832
  if (old && !old.destroyed) {
3731
3833
  old.destroy();
3732
3834
  dom.splice(oldIndex, 1);
@@ -3749,7 +3851,7 @@
3749
3851
  domContainer.appendChild(canvasEl);
3750
3852
  }
3751
3853
  }
3752
- const newItem = new Container(tagId, currentOptions);
3854
+ const newItem = new Container(Loader_classPrivateFieldGet(this, _Loader_engine, "f"), tagId, currentOptions);
3753
3855
  if (oldIndex >= 0) {
3754
3856
  dom.splice(oldIndex, 0, newItem);
3755
3857
  } else {
@@ -3759,7 +3861,7 @@
3759
3861
  await newItem.start();
3760
3862
  return newItem;
3761
3863
  }
3762
- static async loadRemoteOptions(params) {
3864
+ async loadRemoteOptions(params) {
3763
3865
  const {url: jsonUrl, index: index} = params;
3764
3866
  const url = jsonUrl instanceof Array ? itemFromArray(jsonUrl, index) : jsonUrl;
3765
3867
  if (!url) {
@@ -3771,14 +3873,14 @@
3771
3873
  return;
3772
3874
  }
3773
3875
  const data = await response.json();
3774
- return await Loader.loadOptions({
3876
+ return this.loadOptions({
3775
3877
  tagId: params.tagId,
3776
3878
  element: params.element,
3777
3879
  index: index,
3778
3880
  options: data
3779
3881
  });
3780
3882
  }
3781
- static load(tagId, options, index) {
3883
+ load(tagId, options, index) {
3782
3884
  const params = {
3783
3885
  index: index
3784
3886
  };
@@ -3794,7 +3896,7 @@
3794
3896
  }
3795
3897
  return this.loadOptions(params);
3796
3898
  }
3797
- static async set(id, domContainer, options, index) {
3899
+ async set(id, domContainer, options, index) {
3798
3900
  const params = {
3799
3901
  index: index
3800
3902
  };
@@ -3815,7 +3917,7 @@
3815
3917
  }
3816
3918
  return this.loadOptions(params);
3817
3919
  }
3818
- static async loadJSON(tagId, jsonUrl, index) {
3920
+ async loadJSON(tagId, jsonUrl, index) {
3819
3921
  let url, id;
3820
3922
  if (typeof jsonUrl === "number" || jsonUrl === undefined) {
3821
3923
  url = tagId;
@@ -3823,13 +3925,13 @@
3823
3925
  id = tagId;
3824
3926
  url = jsonUrl;
3825
3927
  }
3826
- return await Loader.loadRemoteOptions({
3928
+ return this.loadRemoteOptions({
3827
3929
  tagId: id,
3828
3930
  url: url,
3829
3931
  index: index
3830
3932
  });
3831
3933
  }
3832
- static async setJSON(id, domContainer, jsonUrl, index) {
3934
+ async setJSON(id, domContainer, jsonUrl, index) {
3833
3935
  let url, newId, newIndex, element;
3834
3936
  if (id instanceof HTMLElement) {
3835
3937
  element = id;
@@ -3841,15 +3943,15 @@
3841
3943
  url = jsonUrl;
3842
3944
  newIndex = index;
3843
3945
  }
3844
- return await Loader.loadRemoteOptions({
3946
+ return this.loadRemoteOptions({
3845
3947
  tagId: newId,
3846
3948
  url: url,
3847
3949
  index: newIndex,
3848
3950
  element: element
3849
3951
  });
3850
3952
  }
3851
- static setOnClickHandler(callback) {
3852
- const dom = Loader.dom();
3953
+ setOnClickHandler(callback) {
3954
+ const dom = this.dom();
3853
3955
  if (dom.length === 0) {
3854
3956
  throw new Error("Can only set click handlers after calling tsParticles.load() or tsParticles.loadJSON()");
3855
3957
  }
@@ -3858,6 +3960,7 @@
3858
3960
  }
3859
3961
  }
3860
3962
  }
3963
+ _Loader_engine = new WeakMap;
3861
3964
  function NumberUtils_clamp(num, min, max) {
3862
3965
  return Math.min(Math.max(num, min), max);
3863
3966
  }