tsparticles 1.39.2 → 1.40.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/Core/Container.d.ts +3 -1
  2. package/Core/Container.js +30 -15
  3. package/Core/Loader.d.ts +12 -9
  4. package/Core/Loader.js +35 -19
  5. package/Core/Particle.d.ts +3 -1
  6. package/Core/Particle.js +17 -2
  7. package/Core/Particles.d.ts +3 -1
  8. package/Core/Particles.js +20 -5
  9. package/Core/Utils/InteractionManager.d.ts +5 -3
  10. package/Core/Utils/InteractionManager.js +19 -3
  11. package/Core/Utils/Plugins.d.ts +29 -15
  12. package/Core/Utils/Plugins.js +58 -46
  13. package/Options/Classes/Options.d.ts +2 -1
  14. package/Options/Classes/Options.js +14 -7
  15. package/Plugins/Emitters/EmitterInstance.d.ts +6 -3
  16. package/Plugins/Emitters/EmitterInstance.js +46 -16
  17. package/Plugins/Emitters/Emitters.d.ts +3 -1
  18. package/Plugins/Emitters/Emitters.js +17 -2
  19. package/Plugins/Emitters/{EmittersMain.d.ts → EmittersEngine.d.ts} +3 -1
  20. package/Plugins/Emitters/{EmittersMain.js → EmittersEngine.js} +0 -0
  21. package/Plugins/Emitters/IEmitterShape.d.ts +2 -2
  22. package/Plugins/Emitters/Options/Classes/Emitter.d.ts +1 -0
  23. package/Plugins/Emitters/Options/Classes/Emitter.js +1 -0
  24. package/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +1 -0
  25. package/Plugins/Emitters/ShapeManager.d.ts +6 -3
  26. package/Plugins/Emitters/ShapeManager.js +16 -4
  27. package/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +2 -2
  28. package/Plugins/Emitters/Shapes/Circle/CircleShape.js +2 -2
  29. package/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +2 -2
  30. package/Plugins/Emitters/Shapes/Square/SquareShape.js +4 -4
  31. package/Plugins/Emitters/index.d.ts +3 -3
  32. package/Plugins/Emitters/index.js +25 -6
  33. package/README.md +1 -1
  34. package/browser/Core/Container.d.ts +4 -1
  35. package/browser/Core/Container.js +32 -16
  36. package/browser/Core/Loader.d.ts +12 -9
  37. package/browser/Core/Loader.js +35 -19
  38. package/browser/Core/Particle.d.ts +3 -1
  39. package/browser/Core/Particle.js +18 -3
  40. package/browser/Core/Particles.d.ts +3 -1
  41. package/browser/Core/Particles.js +21 -6
  42. package/browser/Core/Utils/InteractionManager.d.ts +5 -3
  43. package/browser/Core/Utils/InteractionManager.js +19 -3
  44. package/browser/Core/Utils/Plugins.d.ts +29 -15
  45. package/browser/Core/Utils/Plugins.js +58 -46
  46. package/browser/Options/Classes/Options.d.ts +2 -1
  47. package/browser/Options/Classes/Options.js +14 -7
  48. package/browser/Plugins/Emitters/EmitterInstance.d.ts +6 -3
  49. package/browser/Plugins/Emitters/EmitterInstance.js +46 -16
  50. package/browser/Plugins/Emitters/Emitters.d.ts +3 -1
  51. package/browser/Plugins/Emitters/Emitters.js +17 -2
  52. package/{esm/Plugins/Emitters/EmittersMain.d.ts → browser/Plugins/Emitters/EmittersEngine.d.ts} +3 -1
  53. package/browser/Plugins/Emitters/{EmittersMain.js → EmittersEngine.js} +0 -0
  54. package/browser/Plugins/Emitters/IEmitterShape.d.ts +2 -2
  55. package/browser/Plugins/Emitters/Options/Classes/Emitter.d.ts +1 -0
  56. package/browser/Plugins/Emitters/Options/Classes/Emitter.js +1 -0
  57. package/browser/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +4 -0
  58. package/browser/Plugins/Emitters/ShapeManager.d.ts +6 -3
  59. package/browser/Plugins/Emitters/ShapeManager.js +16 -4
  60. package/browser/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +2 -2
  61. package/browser/Plugins/Emitters/Shapes/Circle/CircleShape.js +2 -2
  62. package/browser/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +2 -2
  63. package/browser/Plugins/Emitters/Shapes/Square/SquareShape.js +4 -4
  64. package/browser/Plugins/Emitters/index.d.ts +3 -3
  65. package/browser/Plugins/Emitters/index.js +25 -6
  66. package/browser/engine.d.ts +5 -1
  67. package/browser/engine.js +22 -17
  68. package/engine.d.ts +3 -0
  69. package/engine.js +20 -16
  70. package/esm/Core/Container.d.ts +3 -1
  71. package/esm/Core/Container.js +31 -16
  72. package/esm/Core/Loader.d.ts +12 -9
  73. package/esm/Core/Loader.js +35 -19
  74. package/esm/Core/Particle.d.ts +3 -1
  75. package/esm/Core/Particle.js +18 -3
  76. package/esm/Core/Particles.d.ts +3 -1
  77. package/esm/Core/Particles.js +21 -6
  78. package/esm/Core/Utils/InteractionManager.d.ts +5 -3
  79. package/esm/Core/Utils/InteractionManager.js +19 -3
  80. package/esm/Core/Utils/Plugins.d.ts +29 -15
  81. package/esm/Core/Utils/Plugins.js +58 -46
  82. package/esm/Options/Classes/Options.d.ts +2 -1
  83. package/esm/Options/Classes/Options.js +14 -7
  84. package/esm/Plugins/Emitters/EmitterInstance.d.ts +6 -3
  85. package/esm/Plugins/Emitters/EmitterInstance.js +46 -16
  86. package/esm/Plugins/Emitters/Emitters.d.ts +3 -1
  87. package/esm/Plugins/Emitters/Emitters.js +17 -2
  88. package/{browser/Plugins/Emitters/EmittersMain.d.ts → esm/Plugins/Emitters/EmittersEngine.d.ts} +3 -1
  89. package/esm/Plugins/Emitters/{EmittersMain.js → EmittersEngine.js} +0 -0
  90. package/esm/Plugins/Emitters/IEmitterShape.d.ts +2 -2
  91. package/esm/Plugins/Emitters/Options/Classes/Emitter.d.ts +1 -0
  92. package/esm/Plugins/Emitters/Options/Classes/Emitter.js +1 -0
  93. package/esm/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +1 -0
  94. package/esm/Plugins/Emitters/ShapeManager.d.ts +6 -3
  95. package/esm/Plugins/Emitters/ShapeManager.js +16 -4
  96. package/esm/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +2 -2
  97. package/esm/Plugins/Emitters/Shapes/Circle/CircleShape.js +2 -2
  98. package/esm/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +2 -2
  99. package/esm/Plugins/Emitters/Shapes/Square/SquareShape.js +4 -4
  100. package/esm/Plugins/Emitters/index.d.ts +3 -3
  101. package/esm/Plugins/Emitters/index.js +25 -6
  102. package/esm/engine.d.ts +3 -0
  103. package/esm/engine.js +20 -16
  104. package/package.json +11 -6
  105. package/report.html +2 -2
  106. package/report.slim.html +2 -2
  107. package/tsparticles.engine.js +227 -118
  108. package/tsparticles.engine.min.js +2 -2
  109. package/tsparticles.interaction.external.attract.js +205 -100
  110. package/tsparticles.interaction.external.attract.min.js +2 -2
  111. package/tsparticles.interaction.external.bounce.js +205 -100
  112. package/tsparticles.interaction.external.bounce.min.js +2 -2
  113. package/tsparticles.interaction.external.bubble.js +205 -100
  114. package/tsparticles.interaction.external.bubble.min.js +2 -2
  115. package/tsparticles.interaction.external.connect.js +205 -100
  116. package/tsparticles.interaction.external.connect.min.js +2 -2
  117. package/tsparticles.interaction.external.grab.js +205 -100
  118. package/tsparticles.interaction.external.grab.min.js +2 -2
  119. package/tsparticles.interaction.external.repulse.js +205 -100
  120. package/tsparticles.interaction.external.repulse.min.js +2 -2
  121. package/tsparticles.interaction.external.trail.js +205 -100
  122. package/tsparticles.interaction.external.trail.min.js +2 -2
  123. package/tsparticles.interaction.particles.attract.js +205 -100
  124. package/tsparticles.interaction.particles.attract.min.js +2 -2
  125. package/tsparticles.interaction.particles.collisions.js +205 -100
  126. package/tsparticles.interaction.particles.collisions.min.js +2 -2
  127. package/tsparticles.interaction.particles.links.js +205 -100
  128. package/tsparticles.interaction.particles.links.min.js +2 -2
  129. package/tsparticles.js +347 -156
  130. package/tsparticles.min.js +2 -2
  131. package/tsparticles.pathseg.min.js +1 -1
  132. package/tsparticles.plugins.absorbers.js +205 -100
  133. package/tsparticles.plugins.absorbers.min.js +2 -2
  134. package/tsparticles.plugins.emitters.js +330 -143
  135. package/tsparticles.plugins.emitters.min.js +2 -2
  136. package/tsparticles.plugins.polygonMask.js +205 -100
  137. package/tsparticles.plugins.polygonMask.min.js +2 -2
  138. package/tsparticles.shape.circle.min.js +1 -1
  139. package/tsparticles.shape.image.js +208 -103
  140. package/tsparticles.shape.image.min.js +2 -2
  141. package/tsparticles.shape.line.min.js +1 -1
  142. package/tsparticles.shape.polygon.min.js +1 -1
  143. package/tsparticles.shape.square.min.js +1 -1
  144. package/tsparticles.shape.star.min.js +1 -1
  145. package/tsparticles.shape.text.js +205 -100
  146. package/tsparticles.shape.text.min.js +2 -2
  147. package/tsparticles.slim.js +227 -118
  148. package/tsparticles.slim.min.js +2 -2
  149. package/tsparticles.updater.angle.js +205 -100
  150. package/tsparticles.updater.angle.min.js +2 -2
  151. package/tsparticles.updater.color.js +205 -100
  152. package/tsparticles.updater.color.min.js +2 -2
  153. package/tsparticles.updater.life.js +205 -100
  154. package/tsparticles.updater.life.min.js +2 -2
  155. package/tsparticles.updater.opacity.js +205 -100
  156. package/tsparticles.updater.opacity.min.js +2 -2
  157. package/tsparticles.updater.outModes.js +205 -100
  158. package/tsparticles.updater.outModes.min.js +2 -2
  159. package/tsparticles.updater.roll.js +205 -100
  160. package/tsparticles.updater.roll.min.js +2 -2
  161. package/tsparticles.updater.size.js +205 -100
  162. package/tsparticles.updater.size.min.js +2 -2
  163. package/tsparticles.updater.strokeColor.js +205 -100
  164. package/tsparticles.updater.strokeColor.min.js +2 -2
  165. package/tsparticles.updater.tilt.js +205 -100
  166. package/tsparticles.updater.tilt.min.js +2 -2
  167. package/tsparticles.updater.wobble.js +205 -100
  168. package/tsparticles.updater.wobble.min.js +2 -2
@@ -540,15 +540,32 @@
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);
567
+ this.externalInteractors = [];
568
+ this.particleInteractors = [];
552
569
  for (const interactor of interactors) {
553
570
  switch (interactor.type) {
554
571
  case 0:
@@ -579,6 +596,7 @@
579
596
  }
580
597
  }
581
598
  }
599
+ _InteractionManager_engine = new WeakMap;
582
600
  function applyDistance(particle) {
583
601
  const initialPosition = particle.initialPosition;
584
602
  const {dx: dx, dy: dy} = getDistances(initialPosition, particle.position);
@@ -752,26 +770,38 @@
752
770
  return proximityFactor / slowFactor;
753
771
  }
754
772
  }
755
- const plugins = null && [];
756
- const interactorsInitializers = new Map;
757
- const updatersInitializers = new Map;
758
- const interactors = new Map;
759
- const updaters = new Map;
760
- const presets = new Map;
761
- const drawers = new Map;
762
- const pathGenerators = new Map;
763
- class Plugins_Plugins {
764
- static getPlugin(plugin) {
765
- 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;
793
+ }
794
+ getPlugin(plugin) {
795
+ return this.plugins.find((t => t.id === plugin));
766
796
  }
767
- static addPlugin(plugin) {
768
- if (!Plugins_Plugins.getPlugin(plugin.id)) {
769
- plugins.push(plugin);
797
+ addPlugin(plugin) {
798
+ if (!this.getPlugin(plugin.id)) {
799
+ this.plugins.push(plugin);
770
800
  }
771
801
  }
772
- static getAvailablePlugins(container) {
802
+ getAvailablePlugins(container) {
773
803
  const res = new Map;
774
- for (const plugin of plugins) {
804
+ for (const plugin of this.plugins) {
775
805
  if (!plugin.needsPlugin(container.actualOptions)) {
776
806
  continue;
777
807
  }
@@ -779,61 +809,62 @@
779
809
  }
780
810
  return res;
781
811
  }
782
- static loadOptions(options, sourceOptions) {
783
- for (const plugin of plugins) {
812
+ loadOptions(options, sourceOptions) {
813
+ for (const plugin of this.plugins) {
784
814
  plugin.loadOptions(options, sourceOptions);
785
815
  }
786
816
  }
787
- static getPreset(preset) {
788
- return presets.get(preset);
817
+ getPreset(preset) {
818
+ return this.presets.get(preset);
789
819
  }
790
- static addPreset(presetKey, options, override = false) {
791
- if (override || !Plugins_Plugins.getPreset(presetKey)) {
792
- presets.set(presetKey, options);
820
+ addPreset(presetKey, options, override = false) {
821
+ if (override || !this.getPreset(presetKey)) {
822
+ this.presets.set(presetKey, options);
793
823
  }
794
824
  }
795
- static addShapeDrawer(type, drawer) {
796
- if (!Plugins_Plugins.getShapeDrawer(type)) {
797
- drawers.set(type, drawer);
825
+ addShapeDrawer(type, drawer) {
826
+ if (!this.getShapeDrawer(type)) {
827
+ this.drawers.set(type, drawer);
798
828
  }
799
829
  }
800
- static getShapeDrawer(type) {
801
- return drawers.get(type);
830
+ getShapeDrawer(type) {
831
+ return this.drawers.get(type);
802
832
  }
803
- static getSupportedShapes() {
804
- return drawers.keys();
833
+ getSupportedShapes() {
834
+ return this.drawers.keys();
805
835
  }
806
- static getPathGenerator(type) {
807
- return pathGenerators.get(type);
836
+ getPathGenerator(type) {
837
+ return this.pathGenerators.get(type);
808
838
  }
809
- static addPathGenerator(type, pathGenerator) {
810
- if (!Plugins_Plugins.getPathGenerator(type)) {
811
- pathGenerators.set(type, pathGenerator);
839
+ addPathGenerator(type, pathGenerator) {
840
+ if (!this.getPathGenerator(type)) {
841
+ this.pathGenerators.set(type, pathGenerator);
812
842
  }
813
843
  }
814
- static getInteractors(container, force = false) {
815
- let res = interactors.get(container);
844
+ getInteractors(container, force = false) {
845
+ let res = this.interactors.get(container);
816
846
  if (!res || force) {
817
- res = [ ...interactorsInitializers.values() ].map((t => t(container)));
818
- interactors.set(container, res);
847
+ res = [ ...this.interactorsInitializers.values() ].map((t => t(container)));
848
+ this.interactors.set(container, res);
819
849
  }
820
850
  return res;
821
851
  }
822
- static addInteractor(name, initInteractor) {
823
- interactorsInitializers.set(name, initInteractor);
852
+ addInteractor(name, initInteractor) {
853
+ this.interactorsInitializers.set(name, initInteractor);
824
854
  }
825
- static getUpdaters(container, force = false) {
826
- let res = updaters.get(container);
855
+ getUpdaters(container, force = false) {
856
+ let res = this.updaters.get(container);
827
857
  if (!res || force) {
828
- res = [ ...updatersInitializers.values() ].map((t => t(container)));
829
- updaters.set(container, res);
858
+ res = [ ...this.updatersInitializers.values() ].map((t => t(container)));
859
+ this.updaters.set(container, res);
830
860
  }
831
861
  return res;
832
862
  }
833
- static addParticleUpdater(name, initUpdater) {
834
- updatersInitializers.set(name, initUpdater);
863
+ addParticleUpdater(name, initUpdater) {
864
+ this.updatersInitializers.set(name, initUpdater);
835
865
  }
836
866
  }
867
+ _Plugins_engine = new WeakMap;
837
868
  class QuadTree_QuadTree {
838
869
  constructor(rectangle, capacity) {
839
870
  this.rectangle = rectangle;
@@ -2432,22 +2463,31 @@
2432
2463
  }
2433
2464
  }
2434
2465
  }
2435
- 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) {
2436
2474
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2437
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");
2438
2476
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2439
2477
  };
2440
- var _Options_instances, _Options_findDefaultTheme;
2478
+ var _Options_instances, _Options_engine, _Options_findDefaultTheme;
2441
2479
  class Options_Options {
2442
- constructor() {
2480
+ constructor(engine) {
2443
2481
  _Options_instances.add(this);
2482
+ _Options_engine.set(this, void 0);
2483
+ Options_classPrivateFieldSet(this, _Options_engine, engine, "f");
2444
2484
  this.autoPlay = true;
2445
2485
  this.background = new Background;
2446
2486
  this.backgroundMask = new BackgroundMask;
2447
2487
  this.fullScreen = new FullScreen;
2448
2488
  this.detectRetina = true;
2449
2489
  this.duration = 0;
2450
- this.fpsLimit = 60;
2490
+ this.fpsLimit = 120;
2451
2491
  this.interactivity = new Interactivity;
2452
2492
  this.manualParticles = [];
2453
2493
  this.motion = new Motion;
@@ -2533,7 +2573,7 @@
2533
2573
  this.motion.load(data.motion);
2534
2574
  this.particles.load(data.particles);
2535
2575
  this.style = deepExtend(this.style, data.style);
2536
- Plugins.loadOptions(this, data);
2576
+ Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.loadOptions(this, data);
2537
2577
  if (data.responsive !== undefined) {
2538
2578
  for (const responsive of data.responsive) {
2539
2579
  const optResponsive = new Responsive;
@@ -2549,8 +2589,8 @@
2549
2589
  this.themes.push(optTheme);
2550
2590
  }
2551
2591
  }
2552
- this.defaultDarkTheme = (_d = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
2553
- 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;
2554
2594
  }
2555
2595
  setTheme(name) {
2556
2596
  if (name) {
@@ -2559,7 +2599,7 @@
2559
2599
  this.load(chosenTheme.options);
2560
2600
  }
2561
2601
  } else {
2562
- 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");
2563
2603
  if (defaultTheme) {
2564
2604
  this.load(defaultTheme.options);
2565
2605
  }
@@ -2572,13 +2612,26 @@
2572
2612
  return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
2573
2613
  }
2574
2614
  importPreset(preset) {
2575
- this.load(Plugins.getPreset(preset));
2615
+ this.load(Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.getPreset(preset));
2576
2616
  }
2577
2617
  }
2578
- _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) {
2579
2619
  var _a;
2580
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"));
2581
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;
2582
2635
  const fixOutMode = data => {
2583
2636
  if (isInArray(data.outMode, data.checkModes) || isInArray(data.outMode, data.checkModes)) {
2584
2637
  if (data.coord > data.maxCoord - data.radius * 2) {
@@ -2589,11 +2642,13 @@
2589
2642
  }
2590
2643
  };
2591
2644
  class Particle_Particle {
2592
- constructor(id, container, position, overrideOptions, group) {
2645
+ constructor(engine, id, container, position, overrideOptions, group) {
2593
2646
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2594
2647
  this.id = id;
2595
2648
  this.container = container;
2596
2649
  this.group = group;
2650
+ _Particle_engine.set(this, void 0);
2651
+ Particle_classPrivateFieldSet(this, _Particle_engine, engine, "f");
2597
2652
  this.fill = true;
2598
2653
  this.close = true;
2599
2654
  this.lastPathTime = 0;
@@ -2687,7 +2742,7 @@
2687
2742
  this.sides = 24;
2688
2743
  let drawer = container.drawers.get(this.shape);
2689
2744
  if (!drawer) {
2690
- drawer = Plugins.getShapeDrawer(this.shape);
2745
+ drawer = Particle_classPrivateFieldGet(this, _Particle_engine, "f").plugins.getShapeDrawer(this.shape);
2691
2746
  if (drawer) {
2692
2747
  container.drawers.set(this.shape, drawer);
2693
2748
  }
@@ -2927,9 +2982,25 @@
2927
2982
  return life;
2928
2983
  }
2929
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;
2930
2999
  class Particles_Particles {
2931
- constructor(container) {
3000
+ constructor(engine, container) {
2932
3001
  this.container = container;
3002
+ _Particles_engine.set(this, void 0);
3003
+ Particles_classPrivateFieldSet(this, _Particles_engine, engine, "f");
2933
3004
  this.nextId = 0;
2934
3005
  this.array = [];
2935
3006
  this.zArray = [];
@@ -2941,11 +3012,11 @@
2941
3012
  links: new Map,
2942
3013
  triangles: new Map
2943
3014
  };
2944
- this.interactionManager = new InteractionManager(container);
3015
+ this.interactionManager = new InteractionManager(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), container);
2945
3016
  const canvasSize = this.container.canvas.size;
2946
3017
  this.linksColors = new Map;
2947
3018
  this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
2948
- this.updaters = Plugins.getUpdaters(container, true);
3019
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
2949
3020
  }
2950
3021
  get count() {
2951
3022
  return this.array.length;
@@ -2959,7 +3030,7 @@
2959
3030
  this.freqs.links = new Map;
2960
3031
  this.freqs.triangles = new Map;
2961
3032
  let handled = false;
2962
- this.updaters = Plugins.getUpdaters(container, true);
3033
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
2963
3034
  this.interactionManager.init();
2964
3035
  for (const [, plugin] of container.plugins) {
2965
3036
  if (plugin.particlesInitialization !== undefined) {
@@ -3206,7 +3277,7 @@
3206
3277
  }
3207
3278
  pushParticle(position, overrideOptions, group, initializer) {
3208
3279
  try {
3209
- 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);
3210
3281
  let canAdd = true;
3211
3282
  if (initializer) {
3212
3283
  canAdd = initializer(particle);
@@ -3224,6 +3295,7 @@
3224
3295
  }
3225
3296
  }
3226
3297
  }
3298
+ _Particles_engine = new WeakMap;
3227
3299
  class Retina_Retina {
3228
3300
  constructor(container) {
3229
3301
  this.container = container;
@@ -3311,10 +3383,25 @@
3311
3383
  }
3312
3384
  }
3313
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;
3314
3399
  class Container_Container {
3315
- constructor(id, sourceOptions, ...presets) {
3400
+ constructor(engine, id, sourceOptions, ...presets) {
3316
3401
  this.id = id;
3317
- this.fpsLimit = 60;
3402
+ _Container_engine.set(this, void 0);
3403
+ Container_classPrivateFieldSet(this, _Container_engine, engine, "f");
3404
+ this.fpsLimit = 120;
3318
3405
  this.duration = 0;
3319
3406
  this.lifeTime = 0;
3320
3407
  this.firstStart = true;
@@ -3328,7 +3415,7 @@
3328
3415
  this._initialSourceOptions = sourceOptions;
3329
3416
  this.retina = new Retina(this);
3330
3417
  this.canvas = new Canvas(this);
3331
- this.particles = new Particles(this);
3418
+ this.particles = new Particles(Container_classPrivateFieldGet(this, _Container_engine, "f"), this);
3332
3419
  this.drawer = new FrameManager(this);
3333
3420
  this.presets = presets;
3334
3421
  this.pathGenerator = {
@@ -3357,8 +3444,8 @@
3357
3444
  this.plugins = new Map;
3358
3445
  this.drawers = new Map;
3359
3446
  this.density = 1;
3360
- this._options = new Options;
3361
- 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"));
3362
3449
  this.eventListeners = new EventListeners(this);
3363
3450
  if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
3364
3451
  this.intersectionObserver = new IntersectionObserver((entries => this.intersectionManager(entries)));
@@ -3473,7 +3560,7 @@
3473
3560
  return this.start();
3474
3561
  }
3475
3562
  reset() {
3476
- this._options = new Options;
3563
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3477
3564
  return this.refresh();
3478
3565
  }
3479
3566
  stop() {
@@ -3487,7 +3574,7 @@
3487
3574
  this.particles.clear();
3488
3575
  this.canvas.clear();
3489
3576
  if (this.interactivity.element instanceof HTMLElement && this.intersectionObserver) {
3490
- this.intersectionObserver.observe(this.interactivity.element);
3577
+ this.intersectionObserver.unobserve(this.interactivity.element);
3491
3578
  }
3492
3579
  for (const [, plugin] of this.plugins) {
3493
3580
  if (plugin.stop) {
@@ -3614,20 +3701,20 @@
3614
3701
  return false;
3615
3702
  }
3616
3703
  async init() {
3617
- this._options = new Options;
3704
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3618
3705
  for (const preset of this.presets) {
3619
- this._options.load(Plugins.getPreset(preset));
3706
+ this._options.load(Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPreset(preset));
3620
3707
  }
3621
- const shapes = Plugins.getSupportedShapes();
3708
+ const shapes = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getSupportedShapes();
3622
3709
  for (const type of shapes) {
3623
- const drawer = Plugins.getShapeDrawer(type);
3710
+ const drawer = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getShapeDrawer(type);
3624
3711
  if (drawer) {
3625
3712
  this.drawers.set(type, drawer);
3626
3713
  }
3627
3714
  }
3628
3715
  this._options.load(this._initialSourceOptions);
3629
3716
  this._options.load(this._sourceOptions);
3630
- this.actualOptions = new Options;
3717
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
3631
3718
  this.actualOptions.load(this._options);
3632
3719
  this.retina.init();
3633
3720
  this.canvas.init();
@@ -3637,8 +3724,8 @@
3637
3724
  this.zLayers = this.actualOptions.zLayers;
3638
3725
  this.duration = getRangeValue(this.actualOptions.duration);
3639
3726
  this.lifeTime = 0;
3640
- this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 60;
3641
- const availablePlugins = Plugins.getAvailablePlugins(this);
3727
+ this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 120;
3728
+ const availablePlugins = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getAvailablePlugins(this);
3642
3729
  for (const [id, plugin] of availablePlugins) {
3643
3730
  this.plugins.set(id, plugin);
3644
3731
  }
@@ -3656,7 +3743,7 @@
3656
3743
  }
3657
3744
  const pathOptions = this.actualOptions.particles.move.path;
3658
3745
  if (pathOptions.generator) {
3659
- const customGenerator = Plugins.getPathGenerator(pathOptions.generator);
3746
+ const customGenerator = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPathGenerator(pathOptions.generator);
3660
3747
  if (customGenerator) {
3661
3748
  if (customGenerator.init) {
3662
3749
  this.pathGenerator.init = customGenerator.init;
@@ -3693,24 +3780,41 @@
3693
3780
  }
3694
3781
  }
3695
3782
  }
3696
- 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;
3697
3797
  function fetchError(statusCode) {
3698
3798
  console.error(`Error tsParticles - fetch status: ${statusCode}`);
3699
3799
  console.error("Error tsParticles - File config not found");
3700
3800
  }
3701
3801
  class Loader {
3702
- static dom() {
3703
- 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;
3704
3808
  }
3705
- static domItem(index) {
3706
- const dom = Loader.dom();
3809
+ domItem(index) {
3810
+ const dom = this.dom();
3707
3811
  const item = dom[index];
3708
3812
  if (item && !item.destroyed) {
3709
3813
  return item;
3710
3814
  }
3711
3815
  dom.splice(index, 1);
3712
3816
  }
3713
- static async loadOptions(params) {
3817
+ async loadOptions(params) {
3714
3818
  var _a, _b, _c;
3715
3819
  const tagId = (_a = params.tagId) !== null && _a !== void 0 ? _a : `tsparticles${Math.floor(Math.random() * 1e4)}`;
3716
3820
  const {options: options, index: index} = params;
@@ -3721,10 +3825,10 @@
3721
3825
  (_c = document.querySelector("body")) === null || _c === void 0 ? void 0 : _c.append(domContainer);
3722
3826
  }
3723
3827
  const currentOptions = options instanceof Array ? itemFromArray(options, index) : options;
3724
- const dom = Loader.dom();
3828
+ const dom = this.dom();
3725
3829
  const oldIndex = dom.findIndex((v => v.id === tagId));
3726
3830
  if (oldIndex >= 0) {
3727
- const old = Loader.domItem(oldIndex);
3831
+ const old = this.domItem(oldIndex);
3728
3832
  if (old && !old.destroyed) {
3729
3833
  old.destroy();
3730
3834
  dom.splice(oldIndex, 1);
@@ -3747,7 +3851,7 @@
3747
3851
  domContainer.appendChild(canvasEl);
3748
3852
  }
3749
3853
  }
3750
- const newItem = new Container(tagId, currentOptions);
3854
+ const newItem = new Container(Loader_classPrivateFieldGet(this, _Loader_engine, "f"), tagId, currentOptions);
3751
3855
  if (oldIndex >= 0) {
3752
3856
  dom.splice(oldIndex, 0, newItem);
3753
3857
  } else {
@@ -3757,7 +3861,7 @@
3757
3861
  await newItem.start();
3758
3862
  return newItem;
3759
3863
  }
3760
- static async loadRemoteOptions(params) {
3864
+ async loadRemoteOptions(params) {
3761
3865
  const {url: jsonUrl, index: index} = params;
3762
3866
  const url = jsonUrl instanceof Array ? itemFromArray(jsonUrl, index) : jsonUrl;
3763
3867
  if (!url) {
@@ -3769,14 +3873,14 @@
3769
3873
  return;
3770
3874
  }
3771
3875
  const data = await response.json();
3772
- return await Loader.loadOptions({
3876
+ return this.loadOptions({
3773
3877
  tagId: params.tagId,
3774
3878
  element: params.element,
3775
3879
  index: index,
3776
3880
  options: data
3777
3881
  });
3778
3882
  }
3779
- static load(tagId, options, index) {
3883
+ load(tagId, options, index) {
3780
3884
  const params = {
3781
3885
  index: index
3782
3886
  };
@@ -3792,7 +3896,7 @@
3792
3896
  }
3793
3897
  return this.loadOptions(params);
3794
3898
  }
3795
- static async set(id, domContainer, options, index) {
3899
+ async set(id, domContainer, options, index) {
3796
3900
  const params = {
3797
3901
  index: index
3798
3902
  };
@@ -3813,7 +3917,7 @@
3813
3917
  }
3814
3918
  return this.loadOptions(params);
3815
3919
  }
3816
- static async loadJSON(tagId, jsonUrl, index) {
3920
+ async loadJSON(tagId, jsonUrl, index) {
3817
3921
  let url, id;
3818
3922
  if (typeof jsonUrl === "number" || jsonUrl === undefined) {
3819
3923
  url = tagId;
@@ -3821,13 +3925,13 @@
3821
3925
  id = tagId;
3822
3926
  url = jsonUrl;
3823
3927
  }
3824
- return await Loader.loadRemoteOptions({
3928
+ return this.loadRemoteOptions({
3825
3929
  tagId: id,
3826
3930
  url: url,
3827
3931
  index: index
3828
3932
  });
3829
3933
  }
3830
- static async setJSON(id, domContainer, jsonUrl, index) {
3934
+ async setJSON(id, domContainer, jsonUrl, index) {
3831
3935
  let url, newId, newIndex, element;
3832
3936
  if (id instanceof HTMLElement) {
3833
3937
  element = id;
@@ -3839,15 +3943,15 @@
3839
3943
  url = jsonUrl;
3840
3944
  newIndex = index;
3841
3945
  }
3842
- return await Loader.loadRemoteOptions({
3946
+ return this.loadRemoteOptions({
3843
3947
  tagId: newId,
3844
3948
  url: url,
3845
3949
  index: newIndex,
3846
3950
  element: element
3847
3951
  });
3848
3952
  }
3849
- static setOnClickHandler(callback) {
3850
- const dom = Loader.dom();
3953
+ setOnClickHandler(callback) {
3954
+ const dom = this.dom();
3851
3955
  if (dom.length === 0) {
3852
3956
  throw new Error("Can only set click handlers after calling tsParticles.load() or tsParticles.loadJSON()");
3853
3957
  }
@@ -3856,6 +3960,7 @@
3856
3960
  }
3857
3961
  }
3858
3962
  }
3963
+ _Loader_engine = new WeakMap;
3859
3964
  function NumberUtils_clamp(num, min, max) {
3860
3965
  return Math.min(Math.max(num, min), max);
3861
3966
  }