tsparticles 1.37.0 → 1.37.4

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 (66) hide show
  1. package/Core/Container.d.ts +1 -0
  2. package/Core/Container.js +2 -0
  3. package/Core/InteractionManager.d.ts +1 -0
  4. package/Core/InteractionManager.js +4 -1
  5. package/Core/Particles.d.ts +1 -1
  6. package/Core/Particles.js +3 -1
  7. package/Plugins/Absorbers/AbsorberInstance.d.ts +2 -1
  8. package/Plugins/Absorbers/AbsorberInstance.js +21 -9
  9. package/Plugins/Absorbers/Options/Classes/AbsorberSize.d.ts +2 -1
  10. package/Plugins/Absorbers/Options/Classes/AbsorberSize.js +6 -4
  11. package/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.d.ts +9 -0
  12. package/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.js +21 -0
  13. package/Plugins/Absorbers/Options/Interfaces/IAbsorberSize.d.ts +3 -2
  14. package/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.d.ts +4 -0
  15. package/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.js +2 -0
  16. package/Utils/EventListeners.d.ts +1 -0
  17. package/Utils/EventListeners.js +13 -2
  18. package/Utils/Plugins.d.ts +2 -2
  19. package/Utils/Plugins.js +4 -4
  20. package/browser/Core/Container.d.ts +1 -0
  21. package/browser/Core/Container.js +2 -0
  22. package/browser/Core/InteractionManager.d.ts +1 -0
  23. package/browser/Core/InteractionManager.js +4 -1
  24. package/browser/Core/Particles.d.ts +1 -1
  25. package/browser/Core/Particles.js +3 -1
  26. package/browser/Plugins/Absorbers/AbsorberInstance.d.ts +2 -1
  27. package/browser/Plugins/Absorbers/AbsorberInstance.js +21 -9
  28. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSize.d.ts +2 -1
  29. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSize.js +6 -4
  30. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.d.ts +9 -0
  31. package/browser/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.js +17 -0
  32. package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorberSize.d.ts +3 -2
  33. package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.d.ts +4 -0
  34. package/browser/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.js +1 -0
  35. package/browser/Plugins/PolygonMask/plugin.js +3 -1
  36. package/browser/Utils/EventListeners.d.ts +1 -0
  37. package/browser/Utils/EventListeners.js +14 -3
  38. package/browser/Utils/Plugins.d.ts +2 -2
  39. package/browser/Utils/Plugins.js +4 -4
  40. package/esm/Core/Container.d.ts +1 -0
  41. package/esm/Core/Container.js +2 -0
  42. package/esm/Core/InteractionManager.d.ts +1 -0
  43. package/esm/Core/InteractionManager.js +4 -1
  44. package/esm/Core/Particles.d.ts +1 -1
  45. package/esm/Core/Particles.js +3 -1
  46. package/esm/Plugins/Absorbers/AbsorberInstance.d.ts +2 -1
  47. package/esm/Plugins/Absorbers/AbsorberInstance.js +21 -9
  48. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSize.d.ts +2 -1
  49. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSize.js +6 -4
  50. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.d.ts +9 -0
  51. package/esm/Plugins/Absorbers/Options/Classes/AbsorberSizeLimit.js +17 -0
  52. package/esm/Plugins/Absorbers/Options/Interfaces/IAbsorberSize.d.ts +3 -2
  53. package/esm/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.d.ts +4 -0
  54. package/esm/Plugins/Absorbers/Options/Interfaces/IAbsorberSizeLimit.js +1 -0
  55. package/esm/Utils/EventListeners.d.ts +1 -0
  56. package/esm/Utils/EventListeners.js +14 -3
  57. package/esm/Utils/Plugins.d.ts +2 -2
  58. package/esm/Utils/Plugins.js +4 -4
  59. package/package.json +1 -1
  60. package/report.html +2 -2
  61. package/report.slim.html +2 -2
  62. package/tsparticles.js +601 -240
  63. package/tsparticles.min.js +2 -2
  64. package/tsparticles.pathseg.js +2 -2
  65. package/tsparticles.slim.js +419 -183
  66. package/tsparticles.slim.min.js +2 -2
@@ -3,12 +3,12 @@
3
3
  var a = factory();
4
4
  for (var i in a) (typeof exports === "object" ? exports : root)[i] = a[i];
5
5
  }
6
- })(this, (function() {
7
- return (() => {
6
+ })(window, (function() {
7
+ return function() {
8
8
  "use strict";
9
9
  var __webpack_require__ = {};
10
- (() => {
11
- __webpack_require__.d = (exports, definition) => {
10
+ !function() {
11
+ __webpack_require__.d = function(exports, definition) {
12
12
  for (var key in definition) {
13
13
  if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
14
14
  Object.defineProperty(exports, key, {
@@ -18,12 +18,14 @@
18
18
  }
19
19
  }
20
20
  };
21
- })();
22
- (() => {
23
- __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
24
- })();
25
- (() => {
26
- __webpack_require__.r = exports => {
21
+ }();
22
+ !function() {
23
+ __webpack_require__.o = function(obj, prop) {
24
+ return Object.prototype.hasOwnProperty.call(obj, prop);
25
+ };
26
+ }();
27
+ !function() {
28
+ __webpack_require__.r = function(exports) {
27
29
  if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
28
30
  Object.defineProperty(exports, Symbol.toStringTag, {
29
31
  value: "Module"
@@ -33,119 +35,337 @@
33
35
  value: true
34
36
  });
35
37
  };
36
- })();
38
+ }();
37
39
  var __webpack_exports__ = {};
38
40
  __webpack_require__.r(__webpack_exports__);
39
41
  __webpack_require__.d(__webpack_exports__, {
40
- AlterType: () => AlterType,
41
- AnimationStatus: () => AnimationStatus,
42
- Circle: () => Circle,
43
- CircleWarp: () => CircleWarp,
44
- ClickMode: () => ClickMode,
45
- CollisionMode: () => CollisionMode,
46
- Constants: () => Constants,
47
- Container: () => Container,
48
- DestroyMode: () => DestroyMode,
49
- DestroyType: () => DestroyType,
50
- DivMode: () => DivMode,
51
- DivType: () => DivType,
52
- EasingType: () => EasingType,
53
- ExternalInteractorBase: () => ExternalInteractorBase,
54
- GradientType: () => GradientType,
55
- HoverMode: () => HoverMode,
56
- InteractivityDetect: () => InteractivityDetect,
57
- InteractorType: () => InteractorType,
58
- Main: () => Main,
59
- MoveDirection: () => MoveDirection,
60
- OrbitType: () => OrbitType,
61
- OutMode: () => OutMode,
62
- OutModeDirection: () => OutModeDirection,
63
- Particle: () => Particle,
64
- ParticlesInteractorBase: () => ParticlesInteractorBase,
65
- Point: () => Point,
66
- Rectangle: () => Rectangle,
67
- ResponsiveMode: () => ResponsiveMode,
68
- RollMode: () => RollMode,
69
- RotateDirection: () => RotateDirection,
70
- ShapeType: () => ShapeType,
71
- SizeMode: () => SizeMode,
72
- StartValueType: () => StartValueType,
73
- ThemeMode: () => ThemeMode,
74
- TiltDirection: () => TiltDirection,
75
- Vector: () => Vector,
76
- alterHsl: () => alterHsl,
77
- animate: () => animate,
78
- areBoundsInside: () => areBoundsInside,
79
- arrayRandomIndex: () => arrayRandomIndex,
80
- calcEasing: () => calcEasing,
81
- calculateBounds: () => calculateBounds,
82
- cancelAnimation: () => cancelAnimation,
83
- circleBounce: () => circleBounce,
84
- circleBounceDataFromParticle: () => circleBounceDataFromParticle,
85
- clamp: () => clamp,
86
- clear: () => clear,
87
- collisionVelocity: () => collisionVelocity,
88
- colorMix: () => colorMix,
89
- colorToHsl: () => colorToHsl,
90
- colorToRgb: () => colorToRgb,
91
- deepExtend: () => deepExtend,
92
- divMode: () => divMode,
93
- divModeExecute: () => divModeExecute,
94
- drawConnectLine: () => drawConnectLine,
95
- drawEllipse: () => drawEllipse,
96
- drawGrabLine: () => drawGrabLine,
97
- drawLinkLine: () => drawLinkLine,
98
- drawLinkTriangle: () => drawLinkTriangle,
99
- drawParticle: () => drawParticle,
100
- drawParticlePlugin: () => drawParticlePlugin,
101
- drawPlugin: () => drawPlugin,
102
- drawShape: () => drawShape,
103
- drawShapeAfterEffect: () => drawShapeAfterEffect,
104
- getDistance: () => getDistance,
105
- getDistances: () => getDistances,
106
- getHslAnimationFromHsl: () => getHslAnimationFromHsl,
107
- getHslFromAnimation: () => getHslFromAnimation,
108
- getLinkColor: () => getLinkColor,
109
- getLinkRandomColor: () => getLinkRandomColor,
110
- getParticleBaseVelocity: () => getParticleBaseVelocity,
111
- getParticleDirectionAngle: () => getParticleDirectionAngle,
112
- getRandomRgbColor: () => getRandomRgbColor,
113
- getRangeMax: () => getRangeMax,
114
- getRangeMin: () => getRangeMin,
115
- getRangeValue: () => getRangeValue,
116
- getStyleFromHsl: () => getStyleFromHsl,
117
- getStyleFromHsv: () => getStyleFromHsv,
118
- getStyleFromRgb: () => getStyleFromRgb,
119
- getValue: () => getValue,
120
- gradient: () => gradient,
121
- hslToHsv: () => hslToHsv,
122
- hslToRgb: () => hslToRgb,
123
- hslaToHsva: () => hslaToHsva,
124
- hslaToRgba: () => hslaToRgba,
125
- hsvToHsl: () => hsvToHsl,
126
- hsvToRgb: () => hsvToRgb,
127
- hsvaToHsla: () => hsvaToHsla,
128
- hsvaToRgba: () => hsvaToRgba,
129
- isDivModeEnabled: () => isDivModeEnabled,
130
- isInArray: () => isInArray,
131
- isPointInside: () => isPointInside,
132
- isSsr: () => isSsr,
133
- itemFromArray: () => itemFromArray,
134
- loadFont: () => loadFont,
135
- mix: () => mix,
136
- pJSDom: () => pJSDom,
137
- paintBase: () => paintBase,
138
- particlesJS: () => particlesJS,
139
- randomInRange: () => randomInRange,
140
- rectBounce: () => rectBounce,
141
- rgbToHsl: () => rgbToHsl,
142
- rgbToHsv: () => rgbToHsv,
143
- rgbaToHsva: () => rgbaToHsva,
144
- setRangeValue: () => setRangeValue,
145
- singleDivModeExecute: () => singleDivModeExecute,
146
- stringToAlpha: () => stringToAlpha,
147
- stringToRgb: () => stringToRgb,
148
- tsParticles: () => tsParticles
42
+ AlterType: function() {
43
+ return AlterType;
44
+ },
45
+ AnimationStatus: function() {
46
+ return AnimationStatus;
47
+ },
48
+ Circle: function() {
49
+ return Circle;
50
+ },
51
+ CircleWarp: function() {
52
+ return CircleWarp;
53
+ },
54
+ ClickMode: function() {
55
+ return ClickMode;
56
+ },
57
+ CollisionMode: function() {
58
+ return CollisionMode;
59
+ },
60
+ Constants: function() {
61
+ return Constants;
62
+ },
63
+ Container: function() {
64
+ return Container;
65
+ },
66
+ DestroyMode: function() {
67
+ return DestroyMode;
68
+ },
69
+ DestroyType: function() {
70
+ return DestroyType;
71
+ },
72
+ DivMode: function() {
73
+ return DivMode;
74
+ },
75
+ DivType: function() {
76
+ return DivType;
77
+ },
78
+ EasingType: function() {
79
+ return EasingType;
80
+ },
81
+ ExternalInteractorBase: function() {
82
+ return ExternalInteractorBase;
83
+ },
84
+ GradientType: function() {
85
+ return GradientType;
86
+ },
87
+ HoverMode: function() {
88
+ return HoverMode;
89
+ },
90
+ InteractivityDetect: function() {
91
+ return InteractivityDetect;
92
+ },
93
+ InteractorType: function() {
94
+ return InteractorType;
95
+ },
96
+ Main: function() {
97
+ return Main;
98
+ },
99
+ MoveDirection: function() {
100
+ return MoveDirection;
101
+ },
102
+ OrbitType: function() {
103
+ return OrbitType;
104
+ },
105
+ OutMode: function() {
106
+ return OutMode;
107
+ },
108
+ OutModeDirection: function() {
109
+ return OutModeDirection;
110
+ },
111
+ Particle: function() {
112
+ return Particle;
113
+ },
114
+ ParticlesInteractorBase: function() {
115
+ return ParticlesInteractorBase;
116
+ },
117
+ Point: function() {
118
+ return Point;
119
+ },
120
+ Rectangle: function() {
121
+ return Rectangle;
122
+ },
123
+ ResponsiveMode: function() {
124
+ return ResponsiveMode;
125
+ },
126
+ RollMode: function() {
127
+ return RollMode;
128
+ },
129
+ RotateDirection: function() {
130
+ return RotateDirection;
131
+ },
132
+ ShapeType: function() {
133
+ return ShapeType;
134
+ },
135
+ SizeMode: function() {
136
+ return SizeMode;
137
+ },
138
+ StartValueType: function() {
139
+ return StartValueType;
140
+ },
141
+ ThemeMode: function() {
142
+ return ThemeMode;
143
+ },
144
+ TiltDirection: function() {
145
+ return TiltDirection;
146
+ },
147
+ Vector: function() {
148
+ return Vector;
149
+ },
150
+ alterHsl: function() {
151
+ return alterHsl;
152
+ },
153
+ animate: function() {
154
+ return animate;
155
+ },
156
+ areBoundsInside: function() {
157
+ return areBoundsInside;
158
+ },
159
+ arrayRandomIndex: function() {
160
+ return arrayRandomIndex;
161
+ },
162
+ calcEasing: function() {
163
+ return calcEasing;
164
+ },
165
+ calculateBounds: function() {
166
+ return calculateBounds;
167
+ },
168
+ cancelAnimation: function() {
169
+ return cancelAnimation;
170
+ },
171
+ circleBounce: function() {
172
+ return circleBounce;
173
+ },
174
+ circleBounceDataFromParticle: function() {
175
+ return circleBounceDataFromParticle;
176
+ },
177
+ clamp: function() {
178
+ return clamp;
179
+ },
180
+ clear: function() {
181
+ return clear;
182
+ },
183
+ collisionVelocity: function() {
184
+ return collisionVelocity;
185
+ },
186
+ colorMix: function() {
187
+ return colorMix;
188
+ },
189
+ colorToHsl: function() {
190
+ return colorToHsl;
191
+ },
192
+ colorToRgb: function() {
193
+ return colorToRgb;
194
+ },
195
+ deepExtend: function() {
196
+ return deepExtend;
197
+ },
198
+ divMode: function() {
199
+ return divMode;
200
+ },
201
+ divModeExecute: function() {
202
+ return divModeExecute;
203
+ },
204
+ drawConnectLine: function() {
205
+ return drawConnectLine;
206
+ },
207
+ drawEllipse: function() {
208
+ return drawEllipse;
209
+ },
210
+ drawGrabLine: function() {
211
+ return drawGrabLine;
212
+ },
213
+ drawLinkLine: function() {
214
+ return drawLinkLine;
215
+ },
216
+ drawLinkTriangle: function() {
217
+ return drawLinkTriangle;
218
+ },
219
+ drawParticle: function() {
220
+ return drawParticle;
221
+ },
222
+ drawParticlePlugin: function() {
223
+ return drawParticlePlugin;
224
+ },
225
+ drawPlugin: function() {
226
+ return drawPlugin;
227
+ },
228
+ drawShape: function() {
229
+ return drawShape;
230
+ },
231
+ drawShapeAfterEffect: function() {
232
+ return drawShapeAfterEffect;
233
+ },
234
+ getDistance: function() {
235
+ return getDistance;
236
+ },
237
+ getDistances: function() {
238
+ return getDistances;
239
+ },
240
+ getHslAnimationFromHsl: function() {
241
+ return getHslAnimationFromHsl;
242
+ },
243
+ getHslFromAnimation: function() {
244
+ return getHslFromAnimation;
245
+ },
246
+ getLinkColor: function() {
247
+ return getLinkColor;
248
+ },
249
+ getLinkRandomColor: function() {
250
+ return getLinkRandomColor;
251
+ },
252
+ getParticleBaseVelocity: function() {
253
+ return getParticleBaseVelocity;
254
+ },
255
+ getParticleDirectionAngle: function() {
256
+ return getParticleDirectionAngle;
257
+ },
258
+ getRandomRgbColor: function() {
259
+ return getRandomRgbColor;
260
+ },
261
+ getRangeMax: function() {
262
+ return getRangeMax;
263
+ },
264
+ getRangeMin: function() {
265
+ return getRangeMin;
266
+ },
267
+ getRangeValue: function() {
268
+ return getRangeValue;
269
+ },
270
+ getStyleFromHsl: function() {
271
+ return getStyleFromHsl;
272
+ },
273
+ getStyleFromHsv: function() {
274
+ return getStyleFromHsv;
275
+ },
276
+ getStyleFromRgb: function() {
277
+ return getStyleFromRgb;
278
+ },
279
+ getValue: function() {
280
+ return getValue;
281
+ },
282
+ gradient: function() {
283
+ return gradient;
284
+ },
285
+ hslToHsv: function() {
286
+ return hslToHsv;
287
+ },
288
+ hslToRgb: function() {
289
+ return hslToRgb;
290
+ },
291
+ hslaToHsva: function() {
292
+ return hslaToHsva;
293
+ },
294
+ hslaToRgba: function() {
295
+ return hslaToRgba;
296
+ },
297
+ hsvToHsl: function() {
298
+ return hsvToHsl;
299
+ },
300
+ hsvToRgb: function() {
301
+ return hsvToRgb;
302
+ },
303
+ hsvaToHsla: function() {
304
+ return hsvaToHsla;
305
+ },
306
+ hsvaToRgba: function() {
307
+ return hsvaToRgba;
308
+ },
309
+ isDivModeEnabled: function() {
310
+ return isDivModeEnabled;
311
+ },
312
+ isInArray: function() {
313
+ return isInArray;
314
+ },
315
+ isPointInside: function() {
316
+ return isPointInside;
317
+ },
318
+ isSsr: function() {
319
+ return isSsr;
320
+ },
321
+ itemFromArray: function() {
322
+ return itemFromArray;
323
+ },
324
+ loadFont: function() {
325
+ return loadFont;
326
+ },
327
+ mix: function() {
328
+ return mix;
329
+ },
330
+ pJSDom: function() {
331
+ return pJSDom;
332
+ },
333
+ paintBase: function() {
334
+ return paintBase;
335
+ },
336
+ particlesJS: function() {
337
+ return particlesJS;
338
+ },
339
+ randomInRange: function() {
340
+ return randomInRange;
341
+ },
342
+ rectBounce: function() {
343
+ return rectBounce;
344
+ },
345
+ rgbToHsl: function() {
346
+ return rgbToHsl;
347
+ },
348
+ rgbToHsv: function() {
349
+ return rgbToHsv;
350
+ },
351
+ rgbaToHsva: function() {
352
+ return rgbaToHsva;
353
+ },
354
+ setRangeValue: function() {
355
+ return setRangeValue;
356
+ },
357
+ singleDivModeExecute: function() {
358
+ return singleDivModeExecute;
359
+ },
360
+ stringToAlpha: function() {
361
+ return stringToAlpha;
362
+ },
363
+ stringToRgb: function() {
364
+ return stringToRgb;
365
+ },
366
+ tsParticles: function() {
367
+ return tsParticles;
368
+ }
149
369
  });
150
370
  const initPjs = main => {
151
371
  const particlesJS = (tagId, options) => main.load(tagId, options);
@@ -163,8 +383,8 @@
163
383
  };
164
384
  const pJSDom = main.dom();
165
385
  return {
166
- particlesJS,
167
- pJSDom
386
+ particlesJS: particlesJS,
387
+ pJSDom: pJSDom
168
388
  };
169
389
  };
170
390
  var MoveDirection;
@@ -469,7 +689,7 @@
469
689
  }
470
690
  function getValue(options) {
471
691
  const random = options.random;
472
- const {enable, minimumValue} = typeof random === "boolean" ? {
692
+ const {enable: enable, minimumValue: minimumValue} = typeof random === "boolean" ? {
473
693
  enable: random,
474
694
  minimumValue: 0
475
695
  } : random;
@@ -479,8 +699,8 @@
479
699
  const dx = pointA.x - pointB.x;
480
700
  const dy = pointA.y - pointB.y;
481
701
  return {
482
- dx,
483
- dy,
702
+ dx: dx,
703
+ dy: dy,
484
704
  distance: Math.sqrt(dx * dx + dy * dy)
485
705
  };
486
706
  }
@@ -1095,7 +1315,7 @@
1095
1315
  }
1096
1316
  const s = !v ? 0 : c / v;
1097
1317
  return {
1098
- h,
1318
+ h: h,
1099
1319
  s: s * 100,
1100
1320
  v: v * 100
1101
1321
  };
@@ -1504,8 +1724,8 @@
1504
1724
  class Range {
1505
1725
  constructor(x, y) {
1506
1726
  this.position = {
1507
- x,
1508
- y
1727
+ x: x,
1728
+ y: y
1509
1729
  };
1510
1730
  }
1511
1731
  }
@@ -1548,8 +1768,8 @@
1548
1768
  constructor(x, y, width, height) {
1549
1769
  super(x, y);
1550
1770
  this.size = {
1551
- height,
1552
- width
1771
+ height: height,
1772
+ width: width
1553
1773
  };
1554
1774
  }
1555
1775
  contains(point) {
@@ -1660,6 +1880,7 @@
1660
1880
  this.mouseDownHandler = () => this.mouseDown();
1661
1881
  this.visibilityChangeHandler = () => this.handleVisibilityChange();
1662
1882
  this.themeChangeHandler = e => this.handleThemeChange(e);
1883
+ this.oldThemeChangeHandler = e => this.handleThemeChange(e);
1663
1884
  this.resizeHandler = () => this.handleWindowResize();
1664
1885
  }
1665
1886
  addListeners() {
@@ -1683,9 +1904,17 @@
1683
1904
  } else {
1684
1905
  container.interactivity.element = container.canvas.element;
1685
1906
  }
1686
- const mediaMatch = typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)");
1907
+ const mediaMatch = !isSsr() && typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)");
1687
1908
  if (mediaMatch) {
1688
- manageListener(mediaMatch, "change", this.themeChangeHandler, add);
1909
+ if (mediaMatch.addEventListener !== undefined) {
1910
+ manageListener(mediaMatch, "change", this.themeChangeHandler, add);
1911
+ } else if (mediaMatch.addListener !== undefined) {
1912
+ if (add) {
1913
+ mediaMatch.addListener(this.oldThemeChangeHandler);
1914
+ } else {
1915
+ mediaMatch.removeListener(this.oldThemeChangeHandler);
1916
+ }
1917
+ }
1689
1918
  }
1690
1919
  const interactivityEl = container.interactivity.element;
1691
1920
  if (!interactivityEl) {
@@ -2037,9 +2266,9 @@
2037
2266
  pathGenerators.set(type, pathGenerator);
2038
2267
  }
2039
2268
  }
2040
- static getInteractors(container) {
2269
+ static getInteractors(container, force = false) {
2041
2270
  let res = interactors.get(container);
2042
- if (!res) {
2271
+ if (!res || force) {
2043
2272
  res = [ ...interactorsInitializers.values() ].map((t => t(container)));
2044
2273
  interactors.set(container, res);
2045
2274
  }
@@ -2048,9 +2277,9 @@
2048
2277
  static addInteractor(name, initInteractor) {
2049
2278
  interactorsInitializers.set(name, initInteractor);
2050
2279
  }
2051
- static getUpdaters(container) {
2280
+ static getUpdaters(container, force = false) {
2052
2281
  let res = updaters.get(container);
2053
- if (!res) {
2282
+ if (!res || force) {
2054
2283
  res = [ ...updatersInitializers.values() ].map((t => t(container)));
2055
2284
  updaters.set(container, res);
2056
2285
  }
@@ -4307,21 +4536,21 @@
4307
4536
  const radius = this.getRadius();
4308
4537
  const outModes = this.options.move.outModes, fixHorizontal = outMode => {
4309
4538
  fixOutMode({
4310
- outMode,
4539
+ outMode: outMode,
4311
4540
  checkModes: [ OutMode.bounce, OutMode.bounceHorizontal ],
4312
4541
  coord: pos.x,
4313
4542
  maxCoord: container.canvas.size.width,
4314
4543
  setCb: value => pos.x += value,
4315
- radius
4544
+ radius: radius
4316
4545
  });
4317
4546
  }, fixVertical = outMode => {
4318
4547
  fixOutMode({
4319
- outMode,
4548
+ outMode: outMode,
4320
4549
  checkModes: [ OutMode.bounce, OutMode.bounceVertical ],
4321
4550
  coord: pos.y,
4322
4551
  maxCoord: container.canvas.size.height,
4323
4552
  setCb: value => pos.y += value,
4324
- radius
4553
+ radius: radius
4325
4554
  });
4326
4555
  };
4327
4556
  fixHorizontal((_c = outModes.left) !== null && _c !== void 0 ? _c : outModes.default);
@@ -4403,9 +4632,12 @@
4403
4632
  class InteractionManager {
4404
4633
  constructor(container) {
4405
4634
  this.container = container;
4406
- const interactors = Plugins.getInteractors(container);
4407
4635
  this.externalInteractors = [];
4408
4636
  this.particleInteractors = [];
4637
+ this.init();
4638
+ }
4639
+ init() {
4640
+ const interactors = Plugins.getInteractors(this.container, true);
4409
4641
  for (const interactor of interactors) {
4410
4642
  switch (interactor.type) {
4411
4643
  case InteractorType.External:
@@ -4438,7 +4670,7 @@
4438
4670
  }
4439
4671
  function applyDistance(particle) {
4440
4672
  const initialPosition = particle.initialPosition;
4441
- const {dx, dy} = getDistances(initialPosition, particle.position);
4673
+ const {dx: dx, dy: dy} = getDistances(initialPosition, particle.position);
4442
4674
  const dxFixed = Math.abs(dx), dyFixed = Math.abs(dy);
4443
4675
  const hDistance = particle.retina.maxDistance.horizontal;
4444
4676
  const vDistance = particle.retina.maxDistance.vertical;
@@ -4627,7 +4859,7 @@
4627
4859
  const canvasSize = this.container.canvas.size;
4628
4860
  this.linksColors = new Map;
4629
4861
  this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
4630
- this.updaters = Plugins.getUpdaters(container);
4862
+ this.updaters = Plugins.getUpdaters(container, true);
4631
4863
  }
4632
4864
  get count() {
4633
4865
  return this.array.length;
@@ -4641,6 +4873,8 @@
4641
4873
  this.freqs.links = new Map;
4642
4874
  this.freqs.triangles = new Map;
4643
4875
  let handled = false;
4876
+ this.updaters = Plugins.getUpdaters(container, true);
4877
+ this.interactionManager.init();
4644
4878
  for (const [, plugin] of container.plugins) {
4645
4879
  if (plugin.particlesInitialization !== undefined) {
4646
4880
  handled = plugin.particlesInitialization();
@@ -5752,7 +5986,7 @@
5752
5986
  color: data.cover
5753
5987
  } : data.cover;
5754
5988
  this.cover.load(cover.color !== undefined ? cover : {
5755
- color
5989
+ color: color
5756
5990
  });
5757
5991
  }
5758
5992
  if (data.enable !== undefined) {
@@ -6083,6 +6317,7 @@
6083
6317
  this.zLayers = 100;
6084
6318
  this.pageHidden = false;
6085
6319
  this._sourceOptions = sourceOptions;
6320
+ this._initialSourceOptions = sourceOptions;
6086
6321
  this.retina = new Retina(this);
6087
6322
  this.canvas = new Canvas(this);
6088
6323
  this.particles = new Particles(this);
@@ -6382,6 +6617,7 @@
6382
6617
  this.drawers.set(type, drawer);
6383
6618
  }
6384
6619
  }
6620
+ this._options.load(this._initialSourceOptions);
6385
6621
  this._options.load(this._sourceOptions);
6386
6622
  this.actualOptions = new Options;
6387
6623
  this.actualOptions.load(this._options);
@@ -6469,7 +6705,7 @@
6469
6705
  static async loadOptions(params) {
6470
6706
  var _a, _b, _c;
6471
6707
  const tagId = (_a = params.tagId) !== null && _a !== void 0 ? _a : `tsparticles${Math.floor(Math.random() * 1e4)}`;
6472
- const {options, index} = params;
6708
+ const {options: options, index: index} = params;
6473
6709
  let domContainer = (_b = params.element) !== null && _b !== void 0 ? _b : document.getElementById(tagId);
6474
6710
  if (!domContainer) {
6475
6711
  domContainer = document.createElement("div");
@@ -6519,7 +6755,7 @@
6519
6755
  return newItem;
6520
6756
  }
6521
6757
  static async loadRemoteOptions(params) {
6522
- const {url: jsonUrl, index} = params;
6758
+ const {url: jsonUrl, index: index} = params;
6523
6759
  const url = jsonUrl instanceof Array ? itemFromArray(jsonUrl, index) : jsonUrl;
6524
6760
  if (!url) {
6525
6761
  return;
@@ -6533,13 +6769,13 @@
6533
6769
  return await Loader.loadOptions({
6534
6770
  tagId: params.tagId,
6535
6771
  element: params.element,
6536
- index,
6772
+ index: index,
6537
6773
  options: data
6538
6774
  });
6539
6775
  }
6540
6776
  static load(tagId, options, index) {
6541
6777
  const params = {
6542
- index
6778
+ index: index
6543
6779
  };
6544
6780
  if (typeof tagId === "string") {
6545
6781
  params.tagId = tagId;
@@ -6555,7 +6791,7 @@
6555
6791
  }
6556
6792
  static async set(id, domContainer, options, index) {
6557
6793
  const params = {
6558
- index
6794
+ index: index
6559
6795
  };
6560
6796
  if (typeof id === "string") {
6561
6797
  params.tagId = id;
@@ -6584,8 +6820,8 @@
6584
6820
  }
6585
6821
  return await Loader.loadRemoteOptions({
6586
6822
  tagId: id,
6587
- url,
6588
- index
6823
+ url: url,
6824
+ index: index
6589
6825
  });
6590
6826
  }
6591
6827
  static async setJSON(id, domContainer, jsonUrl, index) {
@@ -6602,9 +6838,9 @@
6602
6838
  }
6603
6839
  return await Loader.loadRemoteOptions({
6604
6840
  tagId: newId,
6605
- url,
6841
+ url: url,
6606
6842
  index: newIndex,
6607
- element
6843
+ element: element
6608
6844
  });
6609
6845
  }
6610
6846
  static setOnClickHandler(callback) {
@@ -6673,10 +6909,10 @@
6673
6909
  let customDrawer;
6674
6910
  if (typeof drawer === "function") {
6675
6911
  customDrawer = {
6676
- afterEffect,
6677
- destroy,
6912
+ afterEffect: afterEffect,
6913
+ destroy: destroy,
6678
6914
  draw: drawer,
6679
- init
6915
+ init: init
6680
6916
  };
6681
6917
  } else {
6682
6918
  customDrawer = drawer;
@@ -6941,7 +7177,7 @@
6941
7177
  return;
6942
7178
  }
6943
7179
  const image = {
6944
- source,
7180
+ source: source,
6945
7181
  type: source.substr(source.length - 3)
6946
7182
  };
6947
7183
  const img = new Image;
@@ -6960,7 +7196,7 @@
6960
7196
  throw new Error("Error tsParticles - No image.src");
6961
7197
  }
6962
7198
  const image = {
6963
- source,
7199
+ source: source,
6964
7200
  type: source.substr(source.length - 3)
6965
7201
  };
6966
7202
  if (image.type !== "svg") {
@@ -6974,7 +7210,7 @@
6974
7210
  return image;
6975
7211
  }
6976
7212
  function replaceColorSvg(imageShape, color, opacity) {
6977
- const {svgData} = imageShape;
7213
+ const {svgData: svgData} = imageShape;
6978
7214
  if (!svgData) {
6979
7215
  return "";
6980
7216
  }
@@ -7178,8 +7414,8 @@
7178
7414
  const close = (_g = imageData.close) !== null && _g !== void 0 ? _g : particle.close;
7179
7415
  const imageShape = {
7180
7416
  image: imageRes,
7181
- fill,
7182
- close
7417
+ fill: fill,
7418
+ close: close
7183
7419
  };
7184
7420
  particle.image = imageShape.image;
7185
7421
  particle.fill = imageShape.fill;
@@ -7545,7 +7781,7 @@
7545
7781
  const attractOptions = container.actualOptions.interactivity.modes.attract;
7546
7782
  const query = container.particles.quadTree.query(area);
7547
7783
  for (const particle of query) {
7548
- const {dx, dy, distance} = getDistances(particle.position, position);
7784
+ const {dx: dx, dy: dy, distance: distance} = getDistances(particle.position, position);
7549
7785
  const velocity = attractOptions.speed * attractOptions.factor;
7550
7786
  const attractFactor = clamp(calcEasing(1 - distance / attractRadius, attractOptions.easing) * velocity, 0, attractOptions.maxSpeed);
7551
7787
  const normVec = Vector.create(distance === 0 ? velocity : dx / distance * attractFactor, distance === 0 ? velocity : dy / distance * attractFactor);
@@ -7662,7 +7898,7 @@
7662
7898
  if (p1 === p2 || !p2.options.move.attract.enable || p2.destroyed || p2.spawning) {
7663
7899
  continue;
7664
7900
  }
7665
- const pos2 = p2.getPosition(), {dx, dy} = getDistances(pos1, pos2), rotate = p1.options.move.attract.rotate, ax = dx / (rotate.x * 1e3), ay = dy / (rotate.y * 1e3), p1Factor = p2.size.value / p1.size.value, p2Factor = 1 / p1Factor;
7901
+ const pos2 = p2.getPosition(), {dx: dx, dy: dy} = getDistances(pos1, pos2), rotate = p1.options.move.attract.rotate, ax = dx / (rotate.x * 1e3), ay = dy / (rotate.y * 1e3), p1Factor = p2.size.value / p1.size.value, p2Factor = 1 / p1Factor;
7666
7902
  p1.velocity.x -= ax * p1Factor;
7667
7903
  p1.velocity.y -= ay * p1Factor;
7668
7904
  p2.velocity.x += ax * p2Factor;
@@ -8155,22 +8391,22 @@
8155
8391
  }
8156
8392
  const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = calculateBounds(pos, size), canvasSize = container.canvas.size;
8157
8393
  bounceHorizontal({
8158
- particle,
8159
- outMode,
8160
- direction,
8161
- bounds,
8162
- canvasSize,
8163
- offset,
8164
- size
8394
+ particle: particle,
8395
+ outMode: outMode,
8396
+ direction: direction,
8397
+ bounds: bounds,
8398
+ canvasSize: canvasSize,
8399
+ offset: offset,
8400
+ size: size
8165
8401
  });
8166
8402
  bounceVertical({
8167
- particle,
8168
- outMode,
8169
- direction,
8170
- bounds,
8171
- canvasSize,
8172
- offset,
8173
- size
8403
+ particle: particle,
8404
+ outMode: outMode,
8405
+ direction: direction,
8406
+ bounds: bounds,
8407
+ canvasSize: canvasSize,
8408
+ offset: offset,
8409
+ size: size
8174
8410
  });
8175
8411
  }
8176
8412
  none(particle, direction) {
@@ -8246,7 +8482,7 @@
8246
8482
  var _a;
8247
8483
  const container = this.container, query = container.particles.quadTree.query(area), repulseOptions = container.actualOptions.interactivity.modes.repulse;
8248
8484
  for (const particle of query) {
8249
- const {dx, dy, distance} = getDistances(particle.position, position), velocity = ((_a = divRepulse === null || divRepulse === void 0 ? void 0 : divRepulse.speed) !== null && _a !== void 0 ? _a : repulseOptions.speed) * repulseOptions.factor, repulseFactor = clamp(calcEasing(1 - distance / repulseRadius, repulseOptions.easing) * velocity, 0, repulseOptions.maxSpeed), normVec = Vector.create(distance === 0 ? velocity : dx / distance * repulseFactor, distance === 0 ? velocity : dy / distance * repulseFactor);
8485
+ const {dx: dx, dy: dy, distance: distance} = getDistances(particle.position, position), velocity = ((_a = divRepulse === null || divRepulse === void 0 ? void 0 : divRepulse.speed) !== null && _a !== void 0 ? _a : repulseOptions.speed) * repulseOptions.factor, repulseFactor = clamp(calcEasing(1 - distance / repulseRadius, repulseOptions.easing) * velocity, 0, repulseOptions.maxSpeed), normVec = Vector.create(distance === 0 ? velocity : dx / distance * repulseFactor, distance === 0 ? velocity : dy / distance * repulseFactor);
8250
8486
  particle.position.addTo(normVec);
8251
8487
  }
8252
8488
  }
@@ -8268,7 +8504,7 @@
8268
8504
  }
8269
8505
  const range = new Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius), query = container.particles.quadTree.query(range);
8270
8506
  for (const particle of query) {
8271
- const {dx, dy, distance} = getDistances(mouseClickPos, particle.position), d = distance ** 2, velocity = container.actualOptions.interactivity.modes.repulse.speed, force = -repulseRadius * velocity / d;
8507
+ const {dx: dx, dy: dy, distance: distance} = getDistances(mouseClickPos, particle.position), d = distance ** 2, velocity = container.actualOptions.interactivity.modes.repulse.speed, force = -repulseRadius * velocity / d;
8272
8508
  if (d <= repulseRadius) {
8273
8509
  container.repulse.particles.push(particle);
8274
8510
  const vect = Vector.create(dx, dy);
@@ -8342,8 +8578,8 @@
8342
8578
  for (const particle of query) {
8343
8579
  if (area instanceof Circle) {
8344
8580
  circleBounce(circleBounceDataFromParticle(particle), {
8345
- position,
8346
- radius,
8581
+ position: position,
8582
+ radius: radius,
8347
8583
  mass: radius ** 2 * Math.PI / 2,
8348
8584
  velocity: Vector.origin,
8349
8585
  factor: Vector.origin
@@ -8738,8 +8974,8 @@
8738
8974
  }
8739
8975
  const tsParticles = new Main;
8740
8976
  tsParticles.init();
8741
- const {particlesJS, pJSDom} = initPjs(tsParticles);
8977
+ const {particlesJS: particlesJS, pJSDom: pJSDom} = initPjs(tsParticles);
8742
8978
  loadSlim(tsParticles);
8743
8979
  return __webpack_exports__;
8744
- })();
8980
+ }();
8745
8981
  }));