tsparticles 1.36.0 → 1.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/Core/Container.d.ts +2 -1
  2. package/Core/Container.js +14 -11
  3. package/Enums/Modes/ResponsiveMode.d.ts +4 -0
  4. package/Enums/Modes/ResponsiveMode.js +8 -0
  5. package/Enums/Modes/index.d.ts +1 -0
  6. package/Enums/Modes/index.js +1 -0
  7. package/Interactions/External/Attract/index.d.ts +1 -1
  8. package/Interactions/External/Attract/index.js +2 -2
  9. package/Interactions/External/Bounce/index.d.ts +1 -1
  10. package/Interactions/External/Bounce/index.js +2 -2
  11. package/Interactions/External/Bubble/index.d.ts +1 -1
  12. package/Interactions/External/Bubble/index.js +2 -2
  13. package/Interactions/External/Connect/index.d.ts +1 -1
  14. package/Interactions/External/Connect/index.js +2 -2
  15. package/Interactions/External/Grab/index.d.ts +1 -1
  16. package/Interactions/External/Grab/index.js +2 -2
  17. package/Interactions/External/Repulse/index.d.ts +1 -1
  18. package/Interactions/External/Repulse/index.js +2 -2
  19. package/Interactions/External/Trail/index.d.ts +1 -1
  20. package/Interactions/External/Trail/index.js +2 -2
  21. package/Interactions/Particles/Attract/index.d.ts +1 -1
  22. package/Interactions/Particles/Attract/index.js +2 -2
  23. package/Interactions/Particles/Collisions/index.d.ts +1 -1
  24. package/Interactions/Particles/Collisions/index.js +2 -2
  25. package/Interactions/Particles/Links/index.d.ts +2 -2
  26. package/Interactions/Particles/Links/index.js +5 -5
  27. package/Interactions/Particles/Links/plugin.d.ts +1 -1
  28. package/Interactions/Particles/Links/plugin.js +2 -2
  29. package/Options/Classes/FullScreen/FullScreen.js +2 -2
  30. package/Options/Classes/Interactivity/Interactivity.js +1 -1
  31. package/Options/Classes/Options.js +3 -1
  32. package/Options/Classes/Responsive.d.ts +2 -0
  33. package/Options/Classes/Responsive.js +10 -0
  34. package/Options/Interfaces/IResponsive.d.ts +2 -0
  35. package/Plugins/Absorbers/plugin.d.ts +1 -1
  36. package/Plugins/Absorbers/plugin.js +2 -2
  37. package/Plugins/Emitters/plugin.d.ts +1 -1
  38. package/Plugins/Emitters/plugin.js +2 -2
  39. package/Plugins/PolygonMask/plugin.js +1 -1
  40. package/Shapes/Circle/index.d.ts +1 -1
  41. package/Shapes/Circle/index.js +2 -2
  42. package/Shapes/Image/index.d.ts +1 -1
  43. package/Shapes/Image/index.js +3 -3
  44. package/Shapes/Line/index.d.ts +1 -1
  45. package/Shapes/Line/index.js +2 -2
  46. package/Shapes/Polygon/index.d.ts +3 -3
  47. package/Shapes/Polygon/index.js +7 -7
  48. package/Shapes/Square/index.d.ts +1 -1
  49. package/Shapes/Square/index.js +3 -3
  50. package/Shapes/Star/index.d.ts +1 -1
  51. package/Shapes/Star/index.js +2 -2
  52. package/Shapes/Text/index.d.ts +1 -1
  53. package/Shapes/Text/index.js +2 -2
  54. package/Updaters/Angle/index.d.ts +1 -1
  55. package/Updaters/Angle/index.js +2 -2
  56. package/Updaters/Color/index.d.ts +1 -1
  57. package/Updaters/Color/index.js +2 -2
  58. package/Updaters/Life/index.d.ts +1 -1
  59. package/Updaters/Life/index.js +2 -2
  60. package/Updaters/Opacity/index.d.ts +1 -1
  61. package/Updaters/Opacity/index.js +2 -2
  62. package/Updaters/OutModes/index.d.ts +1 -1
  63. package/Updaters/OutModes/index.js +2 -2
  64. package/Updaters/Roll/index.d.ts +1 -1
  65. package/Updaters/Roll/index.js +2 -2
  66. package/Updaters/Size/index.d.ts +1 -1
  67. package/Updaters/Size/index.js +2 -2
  68. package/Updaters/StrokeColor/index.d.ts +1 -1
  69. package/Updaters/StrokeColor/index.js +2 -2
  70. package/Updaters/Tilt/index.d.ts +1 -1
  71. package/Updaters/Tilt/index.js +2 -2
  72. package/Updaters/Wobble/index.d.ts +1 -1
  73. package/Updaters/Wobble/index.js +2 -2
  74. package/Utils/Utils.d.ts +1 -2
  75. package/browser/Core/Container.d.ts +2 -1
  76. package/browser/Core/Container.js +15 -12
  77. package/browser/Enums/Modes/ResponsiveMode.d.ts +4 -0
  78. package/browser/Enums/Modes/ResponsiveMode.js +5 -0
  79. package/browser/Enums/Modes/index.d.ts +1 -0
  80. package/browser/Enums/Modes/index.js +1 -0
  81. package/browser/Interactions/External/Attract/index.d.ts +1 -1
  82. package/browser/Interactions/External/Attract/index.js +2 -2
  83. package/browser/Interactions/External/Bounce/index.d.ts +1 -1
  84. package/browser/Interactions/External/Bounce/index.js +2 -2
  85. package/browser/Interactions/External/Bubble/index.d.ts +1 -1
  86. package/browser/Interactions/External/Bubble/index.js +2 -2
  87. package/browser/Interactions/External/Connect/index.d.ts +1 -1
  88. package/browser/Interactions/External/Connect/index.js +2 -2
  89. package/browser/Interactions/External/Grab/index.d.ts +1 -1
  90. package/browser/Interactions/External/Grab/index.js +2 -2
  91. package/browser/Interactions/External/Repulse/index.d.ts +1 -1
  92. package/browser/Interactions/External/Repulse/index.js +2 -2
  93. package/browser/Interactions/External/Trail/index.d.ts +1 -1
  94. package/browser/Interactions/External/Trail/index.js +2 -2
  95. package/browser/Interactions/Particles/Attract/index.d.ts +1 -1
  96. package/browser/Interactions/Particles/Attract/index.js +2 -2
  97. package/browser/Interactions/Particles/Collisions/index.d.ts +1 -1
  98. package/browser/Interactions/Particles/Collisions/index.js +2 -2
  99. package/browser/Interactions/Particles/Links/index.d.ts +2 -2
  100. package/browser/Interactions/Particles/Links/index.js +5 -5
  101. package/browser/Interactions/Particles/Links/plugin.d.ts +1 -1
  102. package/browser/Interactions/Particles/Links/plugin.js +2 -2
  103. package/browser/Options/Classes/FullScreen/FullScreen.js +2 -2
  104. package/browser/Options/Classes/Interactivity/Interactivity.js +1 -1
  105. package/browser/Options/Classes/Options.js +4 -2
  106. package/browser/Options/Classes/Responsive.d.ts +2 -0
  107. package/browser/Options/Classes/Responsive.js +11 -0
  108. package/browser/Options/Interfaces/IResponsive.d.ts +2 -0
  109. package/browser/Plugins/Absorbers/plugin.d.ts +1 -1
  110. package/browser/Plugins/Absorbers/plugin.js +2 -2
  111. package/browser/Plugins/Emitters/plugin.d.ts +1 -1
  112. package/browser/Plugins/Emitters/plugin.js +2 -2
  113. package/browser/Plugins/PolygonMask/plugin.js +1 -1
  114. package/browser/Shapes/Circle/index.d.ts +1 -1
  115. package/browser/Shapes/Circle/index.js +2 -2
  116. package/browser/Shapes/Image/index.d.ts +1 -1
  117. package/browser/Shapes/Image/index.js +3 -3
  118. package/browser/Shapes/Line/index.d.ts +1 -1
  119. package/browser/Shapes/Line/index.js +2 -2
  120. package/browser/Shapes/Polygon/index.d.ts +3 -3
  121. package/browser/Shapes/Polygon/index.js +7 -7
  122. package/browser/Shapes/Square/index.d.ts +1 -1
  123. package/browser/Shapes/Square/index.js +3 -3
  124. package/browser/Shapes/Star/index.d.ts +1 -1
  125. package/browser/Shapes/Star/index.js +2 -2
  126. package/browser/Shapes/Text/index.d.ts +1 -1
  127. package/browser/Shapes/Text/index.js +2 -2
  128. package/browser/Updaters/Angle/index.d.ts +1 -1
  129. package/browser/Updaters/Angle/index.js +2 -2
  130. package/browser/Updaters/Color/index.d.ts +1 -1
  131. package/browser/Updaters/Color/index.js +2 -2
  132. package/browser/Updaters/Life/index.d.ts +1 -1
  133. package/browser/Updaters/Life/index.js +2 -2
  134. package/browser/Updaters/Opacity/index.d.ts +1 -1
  135. package/browser/Updaters/Opacity/index.js +2 -2
  136. package/browser/Updaters/OutModes/index.d.ts +1 -1
  137. package/browser/Updaters/OutModes/index.js +2 -2
  138. package/browser/Updaters/Roll/index.d.ts +1 -1
  139. package/browser/Updaters/Roll/index.js +2 -2
  140. package/browser/Updaters/Size/index.d.ts +1 -1
  141. package/browser/Updaters/Size/index.js +2 -2
  142. package/browser/Updaters/StrokeColor/index.d.ts +1 -1
  143. package/browser/Updaters/StrokeColor/index.js +2 -2
  144. package/browser/Updaters/Tilt/index.d.ts +1 -1
  145. package/browser/Updaters/Tilt/index.js +2 -2
  146. package/browser/Updaters/Wobble/index.d.ts +1 -1
  147. package/browser/Updaters/Wobble/index.js +2 -2
  148. package/browser/Utils/Utils.d.ts +1 -2
  149. package/browser/full.d.ts +1 -1
  150. package/browser/full.js +9 -9
  151. package/browser/index.js +1 -1
  152. package/browser/index.slim.js +1 -1
  153. package/browser/main.d.ts +10 -6
  154. package/browser/main.js +20 -6
  155. package/browser/slim.d.ts +1 -1
  156. package/browser/slim.js +24 -24
  157. package/esm/Core/Container.d.ts +2 -1
  158. package/esm/Core/Container.js +14 -11
  159. package/esm/Enums/Modes/ResponsiveMode.d.ts +4 -0
  160. package/esm/Enums/Modes/ResponsiveMode.js +5 -0
  161. package/esm/Enums/Modes/index.d.ts +1 -0
  162. package/esm/Enums/Modes/index.js +1 -0
  163. package/esm/Interactions/External/Attract/index.d.ts +1 -1
  164. package/esm/Interactions/External/Attract/index.js +2 -2
  165. package/esm/Interactions/External/Bounce/index.d.ts +1 -1
  166. package/esm/Interactions/External/Bounce/index.js +2 -2
  167. package/esm/Interactions/External/Bubble/index.d.ts +1 -1
  168. package/esm/Interactions/External/Bubble/index.js +2 -2
  169. package/esm/Interactions/External/Connect/index.d.ts +1 -1
  170. package/esm/Interactions/External/Connect/index.js +2 -2
  171. package/esm/Interactions/External/Grab/index.d.ts +1 -1
  172. package/esm/Interactions/External/Grab/index.js +2 -2
  173. package/esm/Interactions/External/Repulse/index.d.ts +1 -1
  174. package/esm/Interactions/External/Repulse/index.js +2 -2
  175. package/esm/Interactions/External/Trail/index.d.ts +1 -1
  176. package/esm/Interactions/External/Trail/index.js +2 -2
  177. package/esm/Interactions/Particles/Attract/index.d.ts +1 -1
  178. package/esm/Interactions/Particles/Attract/index.js +2 -2
  179. package/esm/Interactions/Particles/Collisions/index.d.ts +1 -1
  180. package/esm/Interactions/Particles/Collisions/index.js +2 -2
  181. package/esm/Interactions/Particles/Links/index.d.ts +2 -2
  182. package/esm/Interactions/Particles/Links/index.js +5 -5
  183. package/esm/Interactions/Particles/Links/plugin.d.ts +1 -1
  184. package/esm/Interactions/Particles/Links/plugin.js +2 -2
  185. package/esm/Options/Classes/FullScreen/FullScreen.js +2 -2
  186. package/esm/Options/Classes/Interactivity/Interactivity.js +1 -1
  187. package/esm/Options/Classes/Options.js +4 -2
  188. package/esm/Options/Classes/Responsive.d.ts +2 -0
  189. package/esm/Options/Classes/Responsive.js +10 -0
  190. package/esm/Options/Interfaces/IResponsive.d.ts +2 -0
  191. package/esm/Plugins/Absorbers/plugin.d.ts +1 -1
  192. package/esm/Plugins/Absorbers/plugin.js +2 -2
  193. package/esm/Plugins/Emitters/plugin.d.ts +1 -1
  194. package/esm/Plugins/Emitters/plugin.js +2 -2
  195. package/esm/Plugins/PolygonMask/plugin.js +1 -1
  196. package/esm/Shapes/Circle/index.d.ts +1 -1
  197. package/esm/Shapes/Circle/index.js +2 -2
  198. package/esm/Shapes/Image/index.d.ts +1 -1
  199. package/esm/Shapes/Image/index.js +3 -3
  200. package/esm/Shapes/Line/index.d.ts +1 -1
  201. package/esm/Shapes/Line/index.js +2 -2
  202. package/esm/Shapes/Polygon/index.d.ts +3 -3
  203. package/esm/Shapes/Polygon/index.js +7 -7
  204. package/esm/Shapes/Square/index.d.ts +1 -1
  205. package/esm/Shapes/Square/index.js +3 -3
  206. package/esm/Shapes/Star/index.d.ts +1 -1
  207. package/esm/Shapes/Star/index.js +2 -2
  208. package/esm/Shapes/Text/index.d.ts +1 -1
  209. package/esm/Shapes/Text/index.js +2 -2
  210. package/esm/Updaters/Angle/index.d.ts +1 -1
  211. package/esm/Updaters/Angle/index.js +2 -2
  212. package/esm/Updaters/Color/index.d.ts +1 -1
  213. package/esm/Updaters/Color/index.js +2 -2
  214. package/esm/Updaters/Life/index.d.ts +1 -1
  215. package/esm/Updaters/Life/index.js +2 -2
  216. package/esm/Updaters/Opacity/index.d.ts +1 -1
  217. package/esm/Updaters/Opacity/index.js +2 -2
  218. package/esm/Updaters/OutModes/index.d.ts +1 -1
  219. package/esm/Updaters/OutModes/index.js +2 -2
  220. package/esm/Updaters/Roll/index.d.ts +1 -1
  221. package/esm/Updaters/Roll/index.js +2 -2
  222. package/esm/Updaters/Size/index.d.ts +1 -1
  223. package/esm/Updaters/Size/index.js +2 -2
  224. package/esm/Updaters/StrokeColor/index.d.ts +1 -1
  225. package/esm/Updaters/StrokeColor/index.js +2 -2
  226. package/esm/Updaters/Tilt/index.d.ts +1 -1
  227. package/esm/Updaters/Tilt/index.js +2 -2
  228. package/esm/Updaters/Wobble/index.d.ts +1 -1
  229. package/esm/Updaters/Wobble/index.js +2 -2
  230. package/esm/Utils/Utils.d.ts +1 -2
  231. package/esm/full.d.ts +1 -1
  232. package/esm/full.js +9 -9
  233. package/esm/index.js +1 -1
  234. package/esm/index.slim.js +1 -1
  235. package/esm/main.d.ts +7 -6
  236. package/esm/main.js +17 -6
  237. package/esm/slim.d.ts +1 -1
  238. package/esm/slim.js +24 -24
  239. package/full.d.ts +1 -1
  240. package/full.js +9 -9
  241. package/index.js +1 -1
  242. package/index.slim.js +1 -1
  243. package/main.d.ts +7 -6
  244. package/main.js +17 -6
  245. package/package.json +1 -1
  246. package/report.html +2 -2
  247. package/report.slim.html +2 -2
  248. package/slim.d.ts +1 -1
  249. package/slim.js +24 -24
  250. package/tsparticles.js +155 -127
  251. package/tsparticles.min.js +2 -2
  252. package/tsparticles.slim.js +133 -105
  253. package/tsparticles.slim.min.js +2 -2
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadOpacityUpdater(tsParticles: Main): void;
2
+ export declare function loadOpacityUpdater(tsParticles: Main): Promise<void>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadOpacityUpdater = void 0;
4
4
  const OpacityUpdater_1 = require("./OpacityUpdater");
5
- function loadOpacityUpdater(tsParticles) {
6
- tsParticles.addParticleUpdater("opacity", (container) => new OpacityUpdater_1.OpacityUpdater(container));
5
+ async function loadOpacityUpdater(tsParticles) {
6
+ await tsParticles.addParticleUpdater("opacity", (container) => new OpacityUpdater_1.OpacityUpdater(container));
7
7
  }
8
8
  exports.loadOpacityUpdater = loadOpacityUpdater;
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadOutModesUpdater(tsParticles: Main): void;
2
+ export declare function loadOutModesUpdater(tsParticles: Main): Promise<void>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadOutModesUpdater = void 0;
4
4
  const OutOfCanvasUpdater_1 = require("./OutOfCanvasUpdater");
5
- function loadOutModesUpdater(tsParticles) {
6
- tsParticles.addParticleUpdater("outModes", (container) => new OutOfCanvasUpdater_1.OutOfCanvasUpdater(container));
5
+ async function loadOutModesUpdater(tsParticles) {
6
+ await tsParticles.addParticleUpdater("outModes", (container) => new OutOfCanvasUpdater_1.OutOfCanvasUpdater(container));
7
7
  }
8
8
  exports.loadOutModesUpdater = loadOutModesUpdater;
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadRollUpdater(tsParticles: Main): void;
2
+ export declare function loadRollUpdater(tsParticles: Main): Promise<void>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadRollUpdater = void 0;
4
4
  const RollUpdater_1 = require("./RollUpdater");
5
- function loadRollUpdater(tsParticles) {
6
- tsParticles.addParticleUpdater("roll", () => new RollUpdater_1.RollUpdater());
5
+ async function loadRollUpdater(tsParticles) {
6
+ await tsParticles.addParticleUpdater("roll", () => new RollUpdater_1.RollUpdater());
7
7
  }
8
8
  exports.loadRollUpdater = loadRollUpdater;
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadSizeUpdater(tsParticles: Main): void;
2
+ export declare function loadSizeUpdater(tsParticles: Main): Promise<void>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadSizeUpdater = void 0;
4
4
  const SizeUpdater_1 = require("./SizeUpdater");
5
- function loadSizeUpdater(tsParticles) {
6
- tsParticles.addParticleUpdater("size", () => new SizeUpdater_1.SizeUpdater());
5
+ async function loadSizeUpdater(tsParticles) {
6
+ await tsParticles.addParticleUpdater("size", () => new SizeUpdater_1.SizeUpdater());
7
7
  }
8
8
  exports.loadSizeUpdater = loadSizeUpdater;
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadStrokeColorUpdater(tsParticles: Main): void;
2
+ export declare function loadStrokeColorUpdater(tsParticles: Main): Promise<void>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadStrokeColorUpdater = void 0;
4
4
  const StrokeColorUpdater_1 = require("./StrokeColorUpdater");
5
- function loadStrokeColorUpdater(tsParticles) {
6
- tsParticles.addParticleUpdater("strokeColor", (container) => new StrokeColorUpdater_1.StrokeColorUpdater(container));
5
+ async function loadStrokeColorUpdater(tsParticles) {
6
+ await tsParticles.addParticleUpdater("strokeColor", (container) => new StrokeColorUpdater_1.StrokeColorUpdater(container));
7
7
  }
8
8
  exports.loadStrokeColorUpdater = loadStrokeColorUpdater;
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadTiltUpdater(tsParticles: Main): void;
2
+ export declare function loadTiltUpdater(tsParticles: Main): Promise<void>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadTiltUpdater = void 0;
4
4
  const TiltUpdater_1 = require("./TiltUpdater");
5
- function loadTiltUpdater(tsParticles) {
6
- tsParticles.addParticleUpdater("tilt", (container) => new TiltUpdater_1.TiltUpdater(container));
5
+ async function loadTiltUpdater(tsParticles) {
6
+ await tsParticles.addParticleUpdater("tilt", (container) => new TiltUpdater_1.TiltUpdater(container));
7
7
  }
8
8
  exports.loadTiltUpdater = loadTiltUpdater;
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadWobbleUpdater(tsParticles: Main): void;
2
+ export declare function loadWobbleUpdater(tsParticles: Main): Promise<void>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadWobbleUpdater = void 0;
4
4
  const WobbleUpdater_1 = require("./WobbleUpdater");
5
- function loadWobbleUpdater(tsParticles) {
6
- tsParticles.addParticleUpdater("wobble", (container) => new WobbleUpdater_1.WobbleUpdater(container));
5
+ async function loadWobbleUpdater(tsParticles) {
6
+ await tsParticles.addParticleUpdater("wobble", (container) => new WobbleUpdater_1.WobbleUpdater(container));
7
7
  }
8
8
  exports.loadWobbleUpdater = loadWobbleUpdater;
package/Utils/Utils.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import type { IBounds, ICircleBouncer, ICoordinates, IDimension, IParticle } from "../Core/Interfaces";
2
- import { DivMode } from "../Enums";
2
+ import { DivMode, OutModeDirection } from "../Enums";
3
3
  import type { ICharacterShape } from "../Options/Interfaces/Particles/Shape/ICharacterShape";
4
4
  import type { SingleOrMultiple } from "../Types";
5
5
  import { DivEvent } from "../Options/Classes/Interactivity/Events/DivEvent";
6
6
  import type { IModeDiv } from "../Options/Interfaces/Interactivity/Modes/IModeDiv";
7
- import { OutModeDirection } from "../Enums";
8
7
  declare global {
9
8
  interface Window {
10
9
  customRequestAnimationFrame: (callback: FrameRequestCallback) => number;
@@ -70,6 +70,7 @@ export declare class Container {
70
70
  private firstStart;
71
71
  private currentTheme?;
72
72
  private drawAnimationFrame?;
73
+ private readonly presets;
73
74
  private readonly eventListeners;
74
75
  private readonly intersectionObserver?;
75
76
  /**
@@ -154,6 +155,6 @@ export declare class Container {
154
155
  start(): Promise<void>;
155
156
  addClickHandler(callback: (evt: Event, particles?: Particle[]) => void): void;
156
157
  updateActualOptions(): boolean;
157
- private init;
158
+ init(): Promise<void>;
158
159
  private intersectionManager;
159
160
  }
@@ -39,6 +39,7 @@ export class Container {
39
39
  this.canvas = new Canvas(this);
40
40
  this.particles = new Particles(this);
41
41
  this.drawer = new FrameManager(this);
42
+ this.presets = presets;
42
43
  this.pathGenerator = {
43
44
  generate: () => {
44
45
  const v = Vector.create(0, 0);
@@ -68,18 +69,6 @@ export class Container {
68
69
  /* tsParticles variables with default values */
69
70
  this._options = new Options();
70
71
  this.actualOptions = new Options();
71
- for (const preset of presets) {
72
- this._options.load(Plugins.getPreset(preset));
73
- }
74
- const shapes = Plugins.getSupportedShapes();
75
- for (const type of shapes) {
76
- const drawer = Plugins.getShapeDrawer(type);
77
- if (drawer) {
78
- this.drawers.set(type, drawer);
79
- }
80
- }
81
- /* options settings */
82
- this._options.load(this._sourceOptions);
83
72
  /* ---------- tsParticles - start ------------ */
84
73
  this.eventListeners = new EventListeners(this);
85
74
  if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
@@ -277,6 +266,7 @@ export class Container {
277
266
  this.particles.linksColors = new Map();
278
267
  delete this.particles.grabLineColor;
279
268
  delete this.particles.linksColor;
269
+ this._sourceOptions = this._options;
280
270
  }
281
271
  /**
282
272
  * Loads the given theme, overriding the options
@@ -398,6 +388,19 @@ export class Container {
398
388
  return false;
399
389
  }
400
390
  async init() {
391
+ this._options = new Options();
392
+ for (const preset of this.presets) {
393
+ this._options.load(Plugins.getPreset(preset));
394
+ }
395
+ const shapes = Plugins.getSupportedShapes();
396
+ for (const type of shapes) {
397
+ const drawer = Plugins.getShapeDrawer(type);
398
+ if (drawer) {
399
+ this.drawers.set(type, drawer);
400
+ }
401
+ }
402
+ /* options settings */
403
+ this._options.load(this._sourceOptions);
401
404
  this.actualOptions = new Options();
402
405
  this.actualOptions.load(this._options);
403
406
  /* init canvas + particles */
@@ -0,0 +1,4 @@
1
+ export declare enum ResponsiveMode {
2
+ screen = "screen",
3
+ canvas = "canvas"
4
+ }
@@ -0,0 +1,5 @@
1
+ export var ResponsiveMode;
2
+ (function (ResponsiveMode) {
3
+ ResponsiveMode["screen"] = "screen";
4
+ ResponsiveMode["canvas"] = "canvas";
5
+ })(ResponsiveMode || (ResponsiveMode = {}));
@@ -7,3 +7,4 @@ export * from "./OutMode";
7
7
  export * from "./RollMode";
8
8
  export * from "./SizeMode";
9
9
  export * from "./ThemeMode";
10
+ export * from "./ResponsiveMode";
@@ -7,3 +7,4 @@ export * from "./OutMode";
7
7
  export * from "./RollMode";
8
8
  export * from "./SizeMode";
9
9
  export * from "./ThemeMode";
10
+ export * from "./ResponsiveMode";
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../../main";
2
- export declare function loadExternalAttractInteraction(tsParticles: Main): void;
2
+ export declare function loadExternalAttractInteraction(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { Attractor } from "./Attractor";
2
- export function loadExternalAttractInteraction(tsParticles) {
3
- tsParticles.addInteractor("externalAttract", (container) => new Attractor(container));
2
+ export async function loadExternalAttractInteraction(tsParticles) {
3
+ await tsParticles.addInteractor("externalAttract", (container) => new Attractor(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../../main";
2
- export declare function loadExternalBounceInteraction(tsParticles: Main): void;
2
+ export declare function loadExternalBounceInteraction(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { Bouncer } from "./Bouncer";
2
- export function loadExternalBounceInteraction(tsParticles) {
3
- tsParticles.addInteractor("externalBounce", (container) => new Bouncer(container));
2
+ export async function loadExternalBounceInteraction(tsParticles) {
3
+ await tsParticles.addInteractor("externalBounce", (container) => new Bouncer(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../../main";
2
- export declare function loadExternalBubbleInteraction(tsParticles: Main): void;
2
+ export declare function loadExternalBubbleInteraction(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { Bubbler } from "./Bubbler";
2
- export function loadExternalBubbleInteraction(tsParticles) {
3
- tsParticles.addInteractor("externalBubble", (container) => new Bubbler(container));
2
+ export async function loadExternalBubbleInteraction(tsParticles) {
3
+ await tsParticles.addInteractor("externalBubble", (container) => new Bubbler(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../../main";
2
- export declare function loadExternalConnectInteraction(tsParticles: Main): void;
2
+ export declare function loadExternalConnectInteraction(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { Connector } from "./Connector";
2
- export function loadExternalConnectInteraction(tsParticles) {
3
- tsParticles.addInteractor("externalConnect", (container) => new Connector(container));
2
+ export async function loadExternalConnectInteraction(tsParticles) {
3
+ await tsParticles.addInteractor("externalConnect", (container) => new Connector(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../../main";
2
- export declare function loadExternalGrabInteraction(tsParticles: Main): void;
2
+ export declare function loadExternalGrabInteraction(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { Grabber } from "./Grabber";
2
- export function loadExternalGrabInteraction(tsParticles) {
3
- tsParticles.addInteractor("externalGrab", (container) => new Grabber(container));
2
+ export async function loadExternalGrabInteraction(tsParticles) {
3
+ await tsParticles.addInteractor("externalGrab", (container) => new Grabber(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../../main";
2
- export declare function loadExternalRepulseInteraction(tsParticles: Main): void;
2
+ export declare function loadExternalRepulseInteraction(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { Repulser } from "./Repulser";
2
- export function loadExternalRepulseInteraction(tsParticles) {
3
- tsParticles.addInteractor("externalRepulse", (container) => new Repulser(container));
2
+ export async function loadExternalRepulseInteraction(tsParticles) {
3
+ await tsParticles.addInteractor("externalRepulse", (container) => new Repulser(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../../main";
2
- export declare function loadExternalTrailInteraction(tsParticles: Main): void;
2
+ export declare function loadExternalTrailInteraction(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { TrailMaker } from "./TrailMaker";
2
- export function loadExternalTrailInteraction(tsParticles) {
3
- tsParticles.addInteractor("externalTrail", (container) => new TrailMaker(container));
2
+ export async function loadExternalTrailInteraction(tsParticles) {
3
+ await tsParticles.addInteractor("externalTrail", (container) => new TrailMaker(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../../main";
2
- export declare function loadParticlesAttractInteraction(tsParticles: Main): void;
2
+ export declare function loadParticlesAttractInteraction(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { Attractor } from "./Attractor";
2
- export function loadParticlesAttractInteraction(tsParticles) {
3
- tsParticles.addInteractor("particlesAttract", (container) => new Attractor(container));
2
+ export async function loadParticlesAttractInteraction(tsParticles) {
3
+ await tsParticles.addInteractor("particlesAttract", (container) => new Attractor(container));
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../../main";
2
- export declare function loadParticlesCollisionsInteraction(tsParticles: Main): void;
2
+ export declare function loadParticlesCollisionsInteraction(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { Collider } from "./Collider";
2
- export function loadParticlesCollisionsInteraction(tsParticles) {
3
- tsParticles.addInteractor("particlesCollisions", (container) => new Collider(container));
2
+ export async function loadParticlesCollisionsInteraction(tsParticles) {
3
+ await tsParticles.addInteractor("particlesCollisions", (container) => new Collider(container));
4
4
  }
@@ -1,3 +1,3 @@
1
1
  import type { Main } from "../../../main";
2
- export declare function loadInteraction(tsParticles: Main): void;
3
- export declare function loadParticlesLinksInteraction(tsParticles: Main): void;
2
+ export declare function loadInteraction(tsParticles: Main): Promise<void>;
3
+ export declare function loadParticlesLinksInteraction(tsParticles: Main): Promise<void>;
@@ -1,9 +1,9 @@
1
1
  import { Linker } from "./Linker";
2
2
  import { loadPlugin } from "./plugin";
3
- export function loadInteraction(tsParticles) {
4
- tsParticles.addInteractor("particlesLinks", (container) => new Linker(container));
3
+ export async function loadInteraction(tsParticles) {
4
+ await tsParticles.addInteractor("particlesLinks", (container) => new Linker(container));
5
5
  }
6
- export function loadParticlesLinksInteraction(tsParticles) {
7
- loadInteraction(tsParticles);
8
- loadPlugin(tsParticles);
6
+ export async function loadParticlesLinksInteraction(tsParticles) {
7
+ await loadInteraction(tsParticles);
8
+ await loadPlugin(tsParticles);
9
9
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../../main";
2
- export declare function loadPlugin(tsParticles: Main): void;
2
+ export declare function loadPlugin(tsParticles: Main): Promise<void>;
@@ -13,7 +13,7 @@ class Plugin {
13
13
  // do nothing
14
14
  }
15
15
  }
16
- export function loadPlugin(tsParticles) {
16
+ export async function loadPlugin(tsParticles) {
17
17
  const plugin = new Plugin();
18
- tsParticles.addPlugin(plugin);
18
+ await tsParticles.addPlugin(plugin);
19
19
  }
@@ -6,8 +6,8 @@
6
6
  */
7
7
  export class FullScreen {
8
8
  constructor() {
9
- this.enable = false;
10
- this.zIndex = -1;
9
+ this.enable = true;
10
+ this.zIndex = 0;
11
11
  }
12
12
  load(data) {
13
13
  if (!data) {
@@ -7,7 +7,7 @@ import { Modes } from "./Modes/Modes";
7
7
  */
8
8
  export class Interactivity {
9
9
  constructor() {
10
- this.detectsOn = InteractivityDetect.canvas;
10
+ this.detectsOn = InteractivityDetect.window;
11
11
  this.events = new Events();
12
12
  this.modes = new Modes();
13
13
  }
@@ -10,7 +10,7 @@ import { BackgroundMask } from "./BackgroundMask/BackgroundMask";
10
10
  import { Background } from "./Background/Background";
11
11
  import { Plugins } from "../../Utils";
12
12
  import { Theme } from "./Theme/Theme";
13
- import { ThemeMode } from "../../Enums";
13
+ import { ResponsiveMode, ThemeMode } from "../../Enums";
14
14
  import { FullScreen } from "./FullScreen/FullScreen";
15
15
  import { Motion } from "./Motion/Motion";
16
16
  import { ManualParticle } from "./ManualParticle";
@@ -175,7 +175,9 @@ export class Options {
175
175
  }
176
176
  setResponsive(width, pxRatio, defaultOptions) {
177
177
  this.load(defaultOptions);
178
- const responsiveOptions = this.responsive.find((t) => t.maxWidth * pxRatio > width);
178
+ const responsiveOptions = this.responsive.find((t) => t.mode === ResponsiveMode.screen && screen
179
+ ? t.maxWidth * pxRatio > screen.availWidth
180
+ : t.maxWidth * pxRatio > width);
179
181
  this.load(responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.options);
180
182
  return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
181
183
  }
@@ -2,9 +2,11 @@ import type { IResponsive } from "../Interfaces/IResponsive";
2
2
  import type { IOptionLoader } from "../Interfaces/IOptionLoader";
3
3
  import type { RecursivePartial } from "../../Types";
4
4
  import type { IOptions } from "../Interfaces/IOptions";
5
+ import { ResponsiveMode } from "../../Enums";
5
6
  export declare class Responsive implements IResponsive, IOptionLoader<IResponsive> {
6
7
  maxWidth: number;
7
8
  options: RecursivePartial<IOptions>;
9
+ mode: ResponsiveMode;
8
10
  constructor();
9
11
  load(data?: RecursivePartial<IResponsive>): void;
10
12
  }
@@ -1,8 +1,10 @@
1
1
  import { deepExtend } from "../../Utils";
2
+ import { ResponsiveMode } from "../../Enums";
2
3
  export class Responsive {
3
4
  constructor() {
4
5
  this.maxWidth = Infinity;
5
6
  this.options = {};
7
+ this.mode = ResponsiveMode.canvas;
6
8
  }
7
9
  load(data) {
8
10
  if (!data) {
@@ -11,6 +13,15 @@ export class Responsive {
11
13
  if (data.maxWidth !== undefined) {
12
14
  this.maxWidth = data.maxWidth;
13
15
  }
16
+ if (data.mode !== undefined) {
17
+ // not enforcing an error here as this should largely be an opt-in setting
18
+ if (data.mode === ResponsiveMode.screen) {
19
+ this.mode = ResponsiveMode.screen;
20
+ }
21
+ else {
22
+ this.mode = ResponsiveMode.canvas;
23
+ }
24
+ }
14
25
  if (data.options !== undefined) {
15
26
  this.options = deepExtend({}, data.options);
16
27
  }
@@ -1,6 +1,8 @@
1
+ import { ResponsiveMode } from "../../Enums";
1
2
  import type { RecursivePartial } from "../../Types";
2
3
  import type { IOptions } from "./IOptions";
3
4
  export interface IResponsive {
4
5
  maxWidth: number;
5
6
  options: RecursivePartial<IOptions>;
7
+ mode: ResponsiveMode;
6
8
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadAbsorbersPlugin(tsParticles: Main): void;
2
+ export declare function loadAbsorbersPlugin(tsParticles: Main): Promise<void>;
@@ -74,7 +74,7 @@ class Plugin {
74
74
  }
75
75
  }
76
76
  }
77
- export function loadAbsorbersPlugin(tsParticles) {
77
+ export async function loadAbsorbersPlugin(tsParticles) {
78
78
  const plugin = new Plugin();
79
- tsParticles.addPlugin(plugin);
79
+ await tsParticles.addPlugin(plugin);
80
80
  }
@@ -1,3 +1,3 @@
1
1
  import { EmittersMain } from "./EmittersMain";
2
- export declare function loadEmittersPlugin(tsParticles: EmittersMain): void;
2
+ export declare function loadEmittersPlugin(tsParticles: EmittersMain): Promise<void>;
3
3
  export * from "./EmittersMain";
@@ -67,9 +67,9 @@ class EmittersPlugin {
67
67
  }
68
68
  }
69
69
  }
70
- export function loadEmittersPlugin(tsParticles) {
70
+ export async function loadEmittersPlugin(tsParticles) {
71
71
  const plugin = new EmittersPlugin();
72
- tsParticles.addPlugin(plugin);
72
+ await tsParticles.addPlugin(plugin);
73
73
  if (!tsParticles.addEmitterShape) {
74
74
  tsParticles.addEmitterShape = (name, shape) => {
75
75
  ShapeManager.addShape(name, shape);
@@ -36,5 +36,5 @@ export async function loadPolygonMaskPlugin(tsParticles) {
36
36
  "./pathseg");
37
37
  }
38
38
  const plugin = new Plugin();
39
- tsParticles.addPlugin(plugin);
39
+ await tsParticles.addPlugin(plugin);
40
40
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadCircleShape(tsParticles: Main): void;
2
+ export declare function loadCircleShape(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { CircleDrawer } from "./CircleDrawer";
2
- export function loadCircleShape(tsParticles) {
3
- tsParticles.addShape("circle", new CircleDrawer());
2
+ export async function loadCircleShape(tsParticles) {
3
+ await tsParticles.addShape("circle", new CircleDrawer());
4
4
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadImageShape(tsParticles: Main): void;
2
+ export declare function loadImageShape(tsParticles: Main): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { ImageDrawer } from "./ImageDrawer";
2
- export function loadImageShape(tsParticles) {
2
+ export async function loadImageShape(tsParticles) {
3
3
  const imageDrawer = new ImageDrawer();
4
- tsParticles.addShape("image", imageDrawer);
5
- tsParticles.addShape("images", imageDrawer);
4
+ await tsParticles.addShape("image", imageDrawer);
5
+ await tsParticles.addShape("images", imageDrawer);
6
6
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadLineShape(tsParticles: Main): void;
2
+ export declare function loadLineShape(tsParticles: Main): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { LineDrawer } from "./LineDrawer";
2
- export function loadLineShape(tsParticles) {
3
- tsParticles.addShape("line", new LineDrawer());
2
+ export async function loadLineShape(tsParticles) {
3
+ await tsParticles.addShape("line", new LineDrawer());
4
4
  }
@@ -1,4 +1,4 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadGenericPolygonShape(tsParticles: Main): void;
3
- export declare function loadTriangleShape(tsParticles: Main): void;
4
- export declare function loadPolygonShape(tsParticles: Main): void;
2
+ export declare function loadGenericPolygonShape(tsParticles: Main): Promise<void>;
3
+ export declare function loadTriangleShape(tsParticles: Main): Promise<void>;
4
+ export declare function loadPolygonShape(tsParticles: Main): Promise<void>;
@@ -1,12 +1,12 @@
1
1
  import { PolygonDrawer } from "./PolygonDrawer";
2
2
  import { TriangleDrawer } from "./TriangleDrawer";
3
- export function loadGenericPolygonShape(tsParticles) {
4
- tsParticles.addShape("polygon", new PolygonDrawer());
3
+ export async function loadGenericPolygonShape(tsParticles) {
4
+ await tsParticles.addShape("polygon", new PolygonDrawer());
5
5
  }
6
- export function loadTriangleShape(tsParticles) {
7
- tsParticles.addShape("triangle", new TriangleDrawer());
6
+ export async function loadTriangleShape(tsParticles) {
7
+ await tsParticles.addShape("triangle", new TriangleDrawer());
8
8
  }
9
- export function loadPolygonShape(tsParticles) {
10
- loadGenericPolygonShape(tsParticles);
11
- loadTriangleShape(tsParticles);
9
+ export async function loadPolygonShape(tsParticles) {
10
+ await loadGenericPolygonShape(tsParticles);
11
+ await loadTriangleShape(tsParticles);
12
12
  }
@@ -1,2 +1,2 @@
1
1
  import type { Main } from "../../main";
2
- export declare function loadSquareShape(tsParticles: Main): void;
2
+ export declare function loadSquareShape(tsParticles: Main): Promise<void>;