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
@@ -1924,15 +1924,32 @@
1924
1924
  }
1925
1925
  }
1926
1926
  }
1927
+ var __classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
1928
+ if (kind === "m") throw new TypeError("Private method is not writable");
1929
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1930
+ 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");
1931
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
1932
+ value;
1933
+ };
1934
+ var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
1935
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1936
+ 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");
1937
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1938
+ };
1939
+ var _InteractionManager_engine;
1927
1940
  class InteractionManager {
1928
- constructor(container) {
1941
+ constructor(engine, container) {
1929
1942
  this.container = container;
1943
+ _InteractionManager_engine.set(this, void 0);
1944
+ __classPrivateFieldSet(this, _InteractionManager_engine, engine, "f");
1930
1945
  this.externalInteractors = [];
1931
1946
  this.particleInteractors = [];
1932
1947
  this.init();
1933
1948
  }
1934
1949
  init() {
1935
- const interactors = Plugins.getInteractors(this.container, true);
1950
+ const interactors = __classPrivateFieldGet(this, _InteractionManager_engine, "f").plugins.getInteractors(this.container, true);
1951
+ this.externalInteractors = [];
1952
+ this.particleInteractors = [];
1936
1953
  for (const interactor of interactors) {
1937
1954
  switch (interactor.type) {
1938
1955
  case 0:
@@ -1963,6 +1980,7 @@
1963
1980
  }
1964
1981
  }
1965
1982
  }
1983
+ _InteractionManager_engine = new WeakMap;
1966
1984
  class ParticlesInteractorBase {
1967
1985
  constructor(container) {
1968
1986
  this.container = container;
@@ -2142,26 +2160,38 @@
2142
2160
  return proximityFactor / slowFactor;
2143
2161
  }
2144
2162
  }
2145
- const plugins = [];
2146
- const interactorsInitializers = new Map;
2147
- const updatersInitializers = new Map;
2148
- const interactors = new Map;
2149
- const updaters = new Map;
2150
- const presets = new Map;
2151
- const drawers = new Map;
2152
- const pathGenerators = new Map;
2163
+ var Plugins_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
2164
+ if (kind === "m") throw new TypeError("Private method is not writable");
2165
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
2166
+ 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");
2167
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
2168
+ value;
2169
+ };
2170
+ var _Plugins_engine;
2153
2171
  class Plugins {
2154
- static getPlugin(plugin) {
2155
- return plugins.find((t => t.id === plugin));
2172
+ constructor(engine) {
2173
+ _Plugins_engine.set(this, void 0);
2174
+ Plugins_classPrivateFieldSet(this, _Plugins_engine, engine, "f");
2175
+ this.plugins = [];
2176
+ this.interactorsInitializers = new Map;
2177
+ this.updatersInitializers = new Map;
2178
+ this.interactors = new Map;
2179
+ this.updaters = new Map;
2180
+ this.presets = new Map;
2181
+ this.drawers = new Map;
2182
+ this.pathGenerators = new Map;
2183
+ }
2184
+ getPlugin(plugin) {
2185
+ return this.plugins.find((t => t.id === plugin));
2156
2186
  }
2157
- static addPlugin(plugin) {
2158
- if (!Plugins.getPlugin(plugin.id)) {
2159
- plugins.push(plugin);
2187
+ addPlugin(plugin) {
2188
+ if (!this.getPlugin(plugin.id)) {
2189
+ this.plugins.push(plugin);
2160
2190
  }
2161
2191
  }
2162
- static getAvailablePlugins(container) {
2192
+ getAvailablePlugins(container) {
2163
2193
  const res = new Map;
2164
- for (const plugin of plugins) {
2194
+ for (const plugin of this.plugins) {
2165
2195
  if (!plugin.needsPlugin(container.actualOptions)) {
2166
2196
  continue;
2167
2197
  }
@@ -2169,61 +2199,62 @@
2169
2199
  }
2170
2200
  return res;
2171
2201
  }
2172
- static loadOptions(options, sourceOptions) {
2173
- for (const plugin of plugins) {
2202
+ loadOptions(options, sourceOptions) {
2203
+ for (const plugin of this.plugins) {
2174
2204
  plugin.loadOptions(options, sourceOptions);
2175
2205
  }
2176
2206
  }
2177
- static getPreset(preset) {
2178
- return presets.get(preset);
2207
+ getPreset(preset) {
2208
+ return this.presets.get(preset);
2179
2209
  }
2180
- static addPreset(presetKey, options, override = false) {
2181
- if (override || !Plugins.getPreset(presetKey)) {
2182
- presets.set(presetKey, options);
2210
+ addPreset(presetKey, options, override = false) {
2211
+ if (override || !this.getPreset(presetKey)) {
2212
+ this.presets.set(presetKey, options);
2183
2213
  }
2184
2214
  }
2185
- static addShapeDrawer(type, drawer) {
2186
- if (!Plugins.getShapeDrawer(type)) {
2187
- drawers.set(type, drawer);
2215
+ addShapeDrawer(type, drawer) {
2216
+ if (!this.getShapeDrawer(type)) {
2217
+ this.drawers.set(type, drawer);
2188
2218
  }
2189
2219
  }
2190
- static getShapeDrawer(type) {
2191
- return drawers.get(type);
2220
+ getShapeDrawer(type) {
2221
+ return this.drawers.get(type);
2192
2222
  }
2193
- static getSupportedShapes() {
2194
- return drawers.keys();
2223
+ getSupportedShapes() {
2224
+ return this.drawers.keys();
2195
2225
  }
2196
- static getPathGenerator(type) {
2197
- return pathGenerators.get(type);
2226
+ getPathGenerator(type) {
2227
+ return this.pathGenerators.get(type);
2198
2228
  }
2199
- static addPathGenerator(type, pathGenerator) {
2200
- if (!Plugins.getPathGenerator(type)) {
2201
- pathGenerators.set(type, pathGenerator);
2229
+ addPathGenerator(type, pathGenerator) {
2230
+ if (!this.getPathGenerator(type)) {
2231
+ this.pathGenerators.set(type, pathGenerator);
2202
2232
  }
2203
2233
  }
2204
- static getInteractors(container, force = false) {
2205
- let res = interactors.get(container);
2234
+ getInteractors(container, force = false) {
2235
+ let res = this.interactors.get(container);
2206
2236
  if (!res || force) {
2207
- res = [ ...interactorsInitializers.values() ].map((t => t(container)));
2208
- interactors.set(container, res);
2237
+ res = [ ...this.interactorsInitializers.values() ].map((t => t(container)));
2238
+ this.interactors.set(container, res);
2209
2239
  }
2210
2240
  return res;
2211
2241
  }
2212
- static addInteractor(name, initInteractor) {
2213
- interactorsInitializers.set(name, initInteractor);
2242
+ addInteractor(name, initInteractor) {
2243
+ this.interactorsInitializers.set(name, initInteractor);
2214
2244
  }
2215
- static getUpdaters(container, force = false) {
2216
- let res = updaters.get(container);
2245
+ getUpdaters(container, force = false) {
2246
+ let res = this.updaters.get(container);
2217
2247
  if (!res || force) {
2218
- res = [ ...updatersInitializers.values() ].map((t => t(container)));
2219
- updaters.set(container, res);
2248
+ res = [ ...this.updatersInitializers.values() ].map((t => t(container)));
2249
+ this.updaters.set(container, res);
2220
2250
  }
2221
2251
  return res;
2222
2252
  }
2223
- static addParticleUpdater(name, initUpdater) {
2224
- updatersInitializers.set(name, initUpdater);
2253
+ addParticleUpdater(name, initUpdater) {
2254
+ this.updatersInitializers.set(name, initUpdater);
2225
2255
  }
2226
2256
  }
2257
+ _Plugins_engine = new WeakMap;
2227
2258
  class Point {
2228
2259
  constructor(position, particle) {
2229
2260
  this.position = position;
@@ -5205,22 +5236,31 @@
5205
5236
  }
5206
5237
  }
5207
5238
  }
5208
- var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
5239
+ var Options_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
5240
+ if (kind === "m") throw new TypeError("Private method is not writable");
5241
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5242
+ 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");
5243
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
5244
+ value;
5245
+ };
5246
+ var Options_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
5209
5247
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
5210
5248
  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");
5211
5249
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5212
5250
  };
5213
- var _Options_instances, _Options_findDefaultTheme;
5251
+ var _Options_instances, _Options_engine, _Options_findDefaultTheme;
5214
5252
  class Options {
5215
- constructor() {
5253
+ constructor(engine) {
5216
5254
  _Options_instances.add(this);
5255
+ _Options_engine.set(this, void 0);
5256
+ Options_classPrivateFieldSet(this, _Options_engine, engine, "f");
5217
5257
  this.autoPlay = true;
5218
5258
  this.background = new Background;
5219
5259
  this.backgroundMask = new BackgroundMask;
5220
5260
  this.fullScreen = new FullScreen;
5221
5261
  this.detectRetina = true;
5222
5262
  this.duration = 0;
5223
- this.fpsLimit = 60;
5263
+ this.fpsLimit = 120;
5224
5264
  this.interactivity = new Interactivity;
5225
5265
  this.manualParticles = [];
5226
5266
  this.motion = new Motion;
@@ -5306,7 +5346,7 @@
5306
5346
  this.motion.load(data.motion);
5307
5347
  this.particles.load(data.particles);
5308
5348
  this.style = deepExtend(this.style, data.style);
5309
- Plugins.loadOptions(this, data);
5349
+ Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.loadOptions(this, data);
5310
5350
  if (data.responsive !== undefined) {
5311
5351
  for (const responsive of data.responsive) {
5312
5352
  const optResponsive = new Responsive;
@@ -5322,8 +5362,8 @@
5322
5362
  this.themes.push(optTheme);
5323
5363
  }
5324
5364
  }
5325
- this.defaultDarkTheme = (_d = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
5326
- this.defaultLightTheme = (_e = __classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
5365
+ this.defaultDarkTheme = (_d = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
5366
+ this.defaultLightTheme = (_e = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
5327
5367
  }
5328
5368
  setTheme(name) {
5329
5369
  if (name) {
@@ -5332,7 +5372,7 @@
5332
5372
  this.load(chosenTheme.options);
5333
5373
  }
5334
5374
  } else {
5335
- 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");
5375
+ 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");
5336
5376
  if (defaultTheme) {
5337
5377
  this.load(defaultTheme.options);
5338
5378
  }
@@ -5345,13 +5385,26 @@
5345
5385
  return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
5346
5386
  }
5347
5387
  importPreset(preset) {
5348
- this.load(Plugins.getPreset(preset));
5388
+ this.load(Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.getPreset(preset));
5349
5389
  }
5350
5390
  }
5351
- _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
5391
+ _Options_engine = new WeakMap, _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
5352
5392
  var _a;
5353
5393
  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"));
5354
5394
  };
5395
+ var Particle_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
5396
+ if (kind === "m") throw new TypeError("Private method is not writable");
5397
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5398
+ 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");
5399
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
5400
+ value;
5401
+ };
5402
+ var Particle_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
5403
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
5404
+ 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");
5405
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5406
+ };
5407
+ var _Particle_engine;
5355
5408
  const fixOutMode = data => {
5356
5409
  if (isInArray(data.outMode, data.checkModes) || isInArray(data.outMode, data.checkModes)) {
5357
5410
  if (data.coord > data.maxCoord - data.radius * 2) {
@@ -5362,11 +5415,13 @@
5362
5415
  }
5363
5416
  };
5364
5417
  class Particle {
5365
- constructor(id, container, position, overrideOptions, group) {
5418
+ constructor(engine, id, container, position, overrideOptions, group) {
5366
5419
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5367
5420
  this.id = id;
5368
5421
  this.container = container;
5369
5422
  this.group = group;
5423
+ _Particle_engine.set(this, void 0);
5424
+ Particle_classPrivateFieldSet(this, _Particle_engine, engine, "f");
5370
5425
  this.fill = true;
5371
5426
  this.close = true;
5372
5427
  this.lastPathTime = 0;
@@ -5460,7 +5515,7 @@
5460
5515
  this.sides = 24;
5461
5516
  let drawer = container.drawers.get(this.shape);
5462
5517
  if (!drawer) {
5463
- drawer = Plugins.getShapeDrawer(this.shape);
5518
+ drawer = Particle_classPrivateFieldGet(this, _Particle_engine, "f").plugins.getShapeDrawer(this.shape);
5464
5519
  if (drawer) {
5465
5520
  container.drawers.set(this.shape, drawer);
5466
5521
  }
@@ -5700,9 +5755,25 @@
5700
5755
  return life;
5701
5756
  }
5702
5757
  }
5758
+ _Particle_engine = new WeakMap;
5759
+ var Particles_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
5760
+ if (kind === "m") throw new TypeError("Private method is not writable");
5761
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5762
+ 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");
5763
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
5764
+ value;
5765
+ };
5766
+ var Particles_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
5767
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
5768
+ 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");
5769
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5770
+ };
5771
+ var _Particles_engine;
5703
5772
  class Particles {
5704
- constructor(container) {
5773
+ constructor(engine, container) {
5705
5774
  this.container = container;
5775
+ _Particles_engine.set(this, void 0);
5776
+ Particles_classPrivateFieldSet(this, _Particles_engine, engine, "f");
5706
5777
  this.nextId = 0;
5707
5778
  this.array = [];
5708
5779
  this.zArray = [];
@@ -5714,11 +5785,11 @@
5714
5785
  links: new Map,
5715
5786
  triangles: new Map
5716
5787
  };
5717
- this.interactionManager = new InteractionManager(container);
5788
+ this.interactionManager = new InteractionManager(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), container);
5718
5789
  const canvasSize = this.container.canvas.size;
5719
5790
  this.linksColors = new Map;
5720
5791
  this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
5721
- this.updaters = Plugins.getUpdaters(container, true);
5792
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
5722
5793
  }
5723
5794
  get count() {
5724
5795
  return this.array.length;
@@ -5732,7 +5803,7 @@
5732
5803
  this.freqs.links = new Map;
5733
5804
  this.freqs.triangles = new Map;
5734
5805
  let handled = false;
5735
- this.updaters = Plugins.getUpdaters(container, true);
5806
+ this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
5736
5807
  this.interactionManager.init();
5737
5808
  for (const [, plugin] of container.plugins) {
5738
5809
  if (plugin.particlesInitialization !== undefined) {
@@ -5979,7 +6050,7 @@
5979
6050
  }
5980
6051
  pushParticle(position, overrideOptions, group, initializer) {
5981
6052
  try {
5982
- const particle = new Particle(this.nextId, this.container, position, overrideOptions, group);
6053
+ const particle = new Particle(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), this.nextId, this.container, position, overrideOptions, group);
5983
6054
  let canAdd = true;
5984
6055
  if (initializer) {
5985
6056
  canAdd = initializer(particle);
@@ -5997,6 +6068,7 @@
5997
6068
  }
5998
6069
  }
5999
6070
  }
6071
+ _Particles_engine = new WeakMap;
6000
6072
  class Retina {
6001
6073
  constructor(container) {
6002
6074
  this.container = container;
@@ -6084,10 +6156,25 @@
6084
6156
  }
6085
6157
  }
6086
6158
  }
6159
+ var Container_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
6160
+ if (kind === "m") throw new TypeError("Private method is not writable");
6161
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
6162
+ 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");
6163
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
6164
+ value;
6165
+ };
6166
+ var Container_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
6167
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
6168
+ 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");
6169
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6170
+ };
6171
+ var _Container_engine;
6087
6172
  class Container {
6088
- constructor(id, sourceOptions, ...presets) {
6173
+ constructor(engine, id, sourceOptions, ...presets) {
6089
6174
  this.id = id;
6090
- this.fpsLimit = 60;
6175
+ _Container_engine.set(this, void 0);
6176
+ Container_classPrivateFieldSet(this, _Container_engine, engine, "f");
6177
+ this.fpsLimit = 120;
6091
6178
  this.duration = 0;
6092
6179
  this.lifeTime = 0;
6093
6180
  this.firstStart = true;
@@ -6101,7 +6188,7 @@
6101
6188
  this._initialSourceOptions = sourceOptions;
6102
6189
  this.retina = new Retina(this);
6103
6190
  this.canvas = new Canvas(this);
6104
- this.particles = new Particles(this);
6191
+ this.particles = new Particles(Container_classPrivateFieldGet(this, _Container_engine, "f"), this);
6105
6192
  this.drawer = new FrameManager(this);
6106
6193
  this.presets = presets;
6107
6194
  this.pathGenerator = {
@@ -6130,8 +6217,8 @@
6130
6217
  this.plugins = new Map;
6131
6218
  this.drawers = new Map;
6132
6219
  this.density = 1;
6133
- this._options = new Options;
6134
- this.actualOptions = new Options;
6220
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
6221
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
6135
6222
  this.eventListeners = new EventListeners(this);
6136
6223
  if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
6137
6224
  this.intersectionObserver = new IntersectionObserver((entries => this.intersectionManager(entries)));
@@ -6246,7 +6333,7 @@
6246
6333
  return this.start();
6247
6334
  }
6248
6335
  reset() {
6249
- this._options = new Options;
6336
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
6250
6337
  return this.refresh();
6251
6338
  }
6252
6339
  stop() {
@@ -6260,7 +6347,7 @@
6260
6347
  this.particles.clear();
6261
6348
  this.canvas.clear();
6262
6349
  if (this.interactivity.element instanceof HTMLElement && this.intersectionObserver) {
6263
- this.intersectionObserver.observe(this.interactivity.element);
6350
+ this.intersectionObserver.unobserve(this.interactivity.element);
6264
6351
  }
6265
6352
  for (const [, plugin] of this.plugins) {
6266
6353
  if (plugin.stop) {
@@ -6387,20 +6474,20 @@
6387
6474
  return false;
6388
6475
  }
6389
6476
  async init() {
6390
- this._options = new Options;
6477
+ this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
6391
6478
  for (const preset of this.presets) {
6392
- this._options.load(Plugins.getPreset(preset));
6479
+ this._options.load(Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPreset(preset));
6393
6480
  }
6394
- const shapes = Plugins.getSupportedShapes();
6481
+ const shapes = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getSupportedShapes();
6395
6482
  for (const type of shapes) {
6396
- const drawer = Plugins.getShapeDrawer(type);
6483
+ const drawer = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getShapeDrawer(type);
6397
6484
  if (drawer) {
6398
6485
  this.drawers.set(type, drawer);
6399
6486
  }
6400
6487
  }
6401
6488
  this._options.load(this._initialSourceOptions);
6402
6489
  this._options.load(this._sourceOptions);
6403
- this.actualOptions = new Options;
6490
+ this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
6404
6491
  this.actualOptions.load(this._options);
6405
6492
  this.retina.init();
6406
6493
  this.canvas.init();
@@ -6410,8 +6497,8 @@
6410
6497
  this.zLayers = this.actualOptions.zLayers;
6411
6498
  this.duration = getRangeValue(this.actualOptions.duration);
6412
6499
  this.lifeTime = 0;
6413
- this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 60;
6414
- const availablePlugins = Plugins.getAvailablePlugins(this);
6500
+ this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 120;
6501
+ const availablePlugins = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getAvailablePlugins(this);
6415
6502
  for (const [id, plugin] of availablePlugins) {
6416
6503
  this.plugins.set(id, plugin);
6417
6504
  }
@@ -6429,7 +6516,7 @@
6429
6516
  }
6430
6517
  const pathOptions = this.actualOptions.particles.move.path;
6431
6518
  if (pathOptions.generator) {
6432
- const customGenerator = Plugins.getPathGenerator(pathOptions.generator);
6519
+ const customGenerator = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPathGenerator(pathOptions.generator);
6433
6520
  if (customGenerator) {
6434
6521
  if (customGenerator.init) {
6435
6522
  this.pathGenerator.init = customGenerator.init;
@@ -6466,24 +6553,41 @@
6466
6553
  }
6467
6554
  }
6468
6555
  }
6469
- const tsParticlesDom = [];
6556
+ _Container_engine = new WeakMap;
6557
+ var Loader_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
6558
+ if (kind === "m") throw new TypeError("Private method is not writable");
6559
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
6560
+ 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");
6561
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
6562
+ value;
6563
+ };
6564
+ var Loader_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
6565
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
6566
+ 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");
6567
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6568
+ };
6569
+ var _Loader_engine;
6470
6570
  function fetchError(statusCode) {
6471
6571
  console.error(`Error tsParticles - fetch status: ${statusCode}`);
6472
6572
  console.error("Error tsParticles - File config not found");
6473
6573
  }
6474
6574
  class Loader {
6475
- static dom() {
6476
- return tsParticlesDom;
6575
+ constructor(engine) {
6576
+ _Loader_engine.set(this, void 0);
6577
+ Loader_classPrivateFieldSet(this, _Loader_engine, engine, "f");
6477
6578
  }
6478
- static domItem(index) {
6479
- const dom = Loader.dom();
6579
+ dom() {
6580
+ return Loader_classPrivateFieldGet(this, _Loader_engine, "f").domArray;
6581
+ }
6582
+ domItem(index) {
6583
+ const dom = this.dom();
6480
6584
  const item = dom[index];
6481
6585
  if (item && !item.destroyed) {
6482
6586
  return item;
6483
6587
  }
6484
6588
  dom.splice(index, 1);
6485
6589
  }
6486
- static async loadOptions(params) {
6590
+ async loadOptions(params) {
6487
6591
  var _a, _b, _c;
6488
6592
  const tagId = (_a = params.tagId) !== null && _a !== void 0 ? _a : `tsparticles${Math.floor(Math.random() * 1e4)}`;
6489
6593
  const {options: options, index: index} = params;
@@ -6494,10 +6598,10 @@
6494
6598
  (_c = document.querySelector("body")) === null || _c === void 0 ? void 0 : _c.append(domContainer);
6495
6599
  }
6496
6600
  const currentOptions = options instanceof Array ? itemFromArray(options, index) : options;
6497
- const dom = Loader.dom();
6601
+ const dom = this.dom();
6498
6602
  const oldIndex = dom.findIndex((v => v.id === tagId));
6499
6603
  if (oldIndex >= 0) {
6500
- const old = Loader.domItem(oldIndex);
6604
+ const old = this.domItem(oldIndex);
6501
6605
  if (old && !old.destroyed) {
6502
6606
  old.destroy();
6503
6607
  dom.splice(oldIndex, 1);
@@ -6520,7 +6624,7 @@
6520
6624
  domContainer.appendChild(canvasEl);
6521
6625
  }
6522
6626
  }
6523
- const newItem = new Container(tagId, currentOptions);
6627
+ const newItem = new Container(Loader_classPrivateFieldGet(this, _Loader_engine, "f"), tagId, currentOptions);
6524
6628
  if (oldIndex >= 0) {
6525
6629
  dom.splice(oldIndex, 0, newItem);
6526
6630
  } else {
@@ -6530,7 +6634,7 @@
6530
6634
  await newItem.start();
6531
6635
  return newItem;
6532
6636
  }
6533
- static async loadRemoteOptions(params) {
6637
+ async loadRemoteOptions(params) {
6534
6638
  const {url: jsonUrl, index: index} = params;
6535
6639
  const url = jsonUrl instanceof Array ? itemFromArray(jsonUrl, index) : jsonUrl;
6536
6640
  if (!url) {
@@ -6542,14 +6646,14 @@
6542
6646
  return;
6543
6647
  }
6544
6648
  const data = await response.json();
6545
- return await Loader.loadOptions({
6649
+ return this.loadOptions({
6546
6650
  tagId: params.tagId,
6547
6651
  element: params.element,
6548
6652
  index: index,
6549
6653
  options: data
6550
6654
  });
6551
6655
  }
6552
- static load(tagId, options, index) {
6656
+ load(tagId, options, index) {
6553
6657
  const params = {
6554
6658
  index: index
6555
6659
  };
@@ -6565,7 +6669,7 @@
6565
6669
  }
6566
6670
  return this.loadOptions(params);
6567
6671
  }
6568
- static async set(id, domContainer, options, index) {
6672
+ async set(id, domContainer, options, index) {
6569
6673
  const params = {
6570
6674
  index: index
6571
6675
  };
@@ -6586,7 +6690,7 @@
6586
6690
  }
6587
6691
  return this.loadOptions(params);
6588
6692
  }
6589
- static async loadJSON(tagId, jsonUrl, index) {
6693
+ async loadJSON(tagId, jsonUrl, index) {
6590
6694
  let url, id;
6591
6695
  if (typeof jsonUrl === "number" || jsonUrl === undefined) {
6592
6696
  url = tagId;
@@ -6594,13 +6698,13 @@
6594
6698
  id = tagId;
6595
6699
  url = jsonUrl;
6596
6700
  }
6597
- return await Loader.loadRemoteOptions({
6701
+ return this.loadRemoteOptions({
6598
6702
  tagId: id,
6599
6703
  url: url,
6600
6704
  index: index
6601
6705
  });
6602
6706
  }
6603
- static async setJSON(id, domContainer, jsonUrl, index) {
6707
+ async setJSON(id, domContainer, jsonUrl, index) {
6604
6708
  let url, newId, newIndex, element;
6605
6709
  if (id instanceof HTMLElement) {
6606
6710
  element = id;
@@ -6612,15 +6716,15 @@
6612
6716
  url = jsonUrl;
6613
6717
  newIndex = index;
6614
6718
  }
6615
- return await Loader.loadRemoteOptions({
6719
+ return this.loadRemoteOptions({
6616
6720
  tagId: newId,
6617
6721
  url: url,
6618
6722
  index: newIndex,
6619
6723
  element: element
6620
6724
  });
6621
6725
  }
6622
- static setOnClickHandler(callback) {
6623
- const dom = Loader.dom();
6726
+ setOnClickHandler(callback) {
6727
+ const dom = this.dom();
6624
6728
  if (dom.length === 0) {
6625
6729
  throw new Error("Can only set click handlers after calling tsParticles.load() or tsParticles.loadJSON()");
6626
6730
  }
@@ -6629,7 +6733,8 @@
6629
6733
  }
6630
6734
  }
6631
6735
  }
6632
- var __classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
6736
+ _Loader_engine = new WeakMap;
6737
+ var engine_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
6633
6738
  if (kind === "m") throw new TypeError("Private method is not writable");
6634
6739
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
6635
6740
  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");
@@ -6641,40 +6746,44 @@
6641
6746
  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");
6642
6747
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6643
6748
  };
6644
- var _Engine_initialized;
6749
+ var _Engine_initialized, _Engine_loader;
6645
6750
  class Engine {
6646
6751
  constructor() {
6647
6752
  _Engine_initialized.set(this, void 0);
6648
- __classPrivateFieldSet(this, _Engine_initialized, false, "f");
6753
+ _Engine_loader.set(this, void 0);
6754
+ engine_classPrivateFieldSet(this, _Engine_initialized, false, "f");
6755
+ this.domArray = [];
6756
+ engine_classPrivateFieldSet(this, _Engine_loader, new Loader(this), "f");
6757
+ this.plugins = new Plugins(this);
6649
6758
  }
6650
6759
  init() {
6651
6760
  if (!engine_classPrivateFieldGet(this, _Engine_initialized, "f")) {
6652
- __classPrivateFieldSet(this, _Engine_initialized, true, "f");
6761
+ engine_classPrivateFieldSet(this, _Engine_initialized, true, "f");
6653
6762
  }
6654
6763
  }
6655
6764
  async loadFromArray(tagId, options, index) {
6656
- return Loader.load(tagId, options, index);
6765
+ return engine_classPrivateFieldGet(this, _Engine_loader, "f").load(tagId, options, index);
6657
6766
  }
6658
6767
  async load(tagId, options) {
6659
- return Loader.load(tagId, options);
6768
+ return engine_classPrivateFieldGet(this, _Engine_loader, "f").load(tagId, options);
6660
6769
  }
6661
6770
  async set(id, element, options) {
6662
- return Loader.set(id, element, options);
6771
+ return engine_classPrivateFieldGet(this, _Engine_loader, "f").set(id, element, options);
6663
6772
  }
6664
6773
  async loadJSON(tagId, pathConfigJson, index) {
6665
- return Loader.loadJSON(tagId, pathConfigJson, index);
6774
+ return engine_classPrivateFieldGet(this, _Engine_loader, "f").loadJSON(tagId, pathConfigJson, index);
6666
6775
  }
6667
6776
  async setJSON(id, element, pathConfigJson, index) {
6668
- return Loader.setJSON(id, element, pathConfigJson, index);
6777
+ return engine_classPrivateFieldGet(this, _Engine_loader, "f").setJSON(id, element, pathConfigJson, index);
6669
6778
  }
6670
6779
  setOnClickHandler(callback) {
6671
- Loader.setOnClickHandler(callback);
6780
+ engine_classPrivateFieldGet(this, _Engine_loader, "f").setOnClickHandler(callback);
6672
6781
  }
6673
6782
  dom() {
6674
- return Loader.dom();
6783
+ return engine_classPrivateFieldGet(this, _Engine_loader, "f").dom();
6675
6784
  }
6676
6785
  domItem(index) {
6677
- return Loader.domItem(index);
6786
+ return engine_classPrivateFieldGet(this, _Engine_loader, "f").domItem(index);
6678
6787
  }
6679
6788
  async refresh() {
6680
6789
  for (const instance of this.dom()) {
@@ -6693,31 +6802,31 @@
6693
6802
  } else {
6694
6803
  customDrawer = drawer;
6695
6804
  }
6696
- Plugins.addShapeDrawer(shape, customDrawer);
6805
+ this.plugins.addShapeDrawer(shape, customDrawer);
6697
6806
  await this.refresh();
6698
6807
  }
6699
6808
  async addPreset(preset, options, override = false) {
6700
- Plugins.addPreset(preset, options, override);
6809
+ this.plugins.addPreset(preset, options, override);
6701
6810
  await this.refresh();
6702
6811
  }
6703
6812
  async addPlugin(plugin) {
6704
- Plugins.addPlugin(plugin);
6813
+ this.plugins.addPlugin(plugin);
6705
6814
  await this.refresh();
6706
6815
  }
6707
6816
  async addPathGenerator(name, generator) {
6708
- Plugins.addPathGenerator(name, generator);
6817
+ this.plugins.addPathGenerator(name, generator);
6709
6818
  await this.refresh();
6710
6819
  }
6711
6820
  async addInteractor(name, interactorInitializer) {
6712
- Plugins.addInteractor(name, interactorInitializer);
6821
+ this.plugins.addInteractor(name, interactorInitializer);
6713
6822
  await this.refresh();
6714
6823
  }
6715
6824
  async addParticleUpdater(name, updaterInitializer) {
6716
- Plugins.addParticleUpdater(name, updaterInitializer);
6825
+ this.plugins.addParticleUpdater(name, updaterInitializer);
6717
6826
  await this.refresh();
6718
6827
  }
6719
6828
  }
6720
- _Engine_initialized = new WeakMap;
6829
+ _Engine_initialized = new WeakMap, _Engine_loader = new WeakMap;
6721
6830
  const initPjs = engine => {
6722
6831
  const particlesJS = (tagId, options) => engine.load(tagId, options);
6723
6832
  particlesJS.load = (tagId, pathConfigJson, callback) => {