@tsparticles/engine 4.0.0-alpha.2 → 4.0.0-alpha.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 (283) hide show
  1. package/794.min.js +2 -0
  2. package/794.min.js.LICENSE.txt +1 -0
  3. package/README.md +2 -5
  4. package/browser/Core/Canvas.js +18 -22
  5. package/browser/Core/Container.js +44 -169
  6. package/browser/Core/Engine.js +40 -61
  7. package/browser/Core/Particle.js +99 -58
  8. package/browser/Core/Particles.js +36 -25
  9. package/browser/Core/Utils/Constants.js +2 -2
  10. package/browser/Core/Utils/EventListeners.js +5 -250
  11. package/browser/Options/Classes/Options.js +7 -75
  12. package/browser/Options/Classes/Particles/ParticlesOptions.js +5 -11
  13. package/{esm/Options/Classes/Interactivity/Events → browser/Options/Classes}/ResizeEvent.js +1 -1
  14. package/browser/Utils/CanvasUtils.js +26 -83
  15. package/browser/Utils/ColorUtils.js +17 -2
  16. package/browser/Utils/MathUtils.js +3 -2
  17. package/browser/Utils/Utils.js +26 -33
  18. package/browser/exports.js +1 -21
  19. package/cjs/Core/Canvas.js +18 -22
  20. package/cjs/Core/Container.js +44 -169
  21. package/cjs/Core/Engine.js +40 -61
  22. package/cjs/Core/Particle.js +99 -58
  23. package/cjs/Core/Particles.js +36 -25
  24. package/cjs/Core/Utils/Constants.js +2 -2
  25. package/cjs/Core/Utils/EventListeners.js +5 -250
  26. package/cjs/Options/Classes/Options.js +7 -75
  27. package/cjs/Options/Classes/Particles/ParticlesOptions.js +5 -11
  28. package/cjs/Options/Classes/{Interactivity/Events/ResizeEvent.js → ResizeEvent.js} +1 -1
  29. package/cjs/Utils/CanvasUtils.js +26 -83
  30. package/cjs/Utils/ColorUtils.js +17 -2
  31. package/cjs/Utils/MathUtils.js +3 -2
  32. package/cjs/Utils/Utils.js +26 -33
  33. package/cjs/exports.js +1 -21
  34. package/dist_browser_Core_Container_js.js +6 -16
  35. package/esm/Core/Canvas.js +18 -22
  36. package/esm/Core/Container.js +44 -169
  37. package/esm/Core/Engine.js +40 -61
  38. package/esm/Core/Particle.js +99 -58
  39. package/esm/Core/Particles.js +36 -25
  40. package/esm/Core/Utils/Constants.js +2 -2
  41. package/esm/Core/Utils/EventListeners.js +5 -250
  42. package/esm/Options/Classes/Options.js +7 -75
  43. package/esm/Options/Classes/Particles/ParticlesOptions.js +5 -11
  44. package/{browser/Options/Classes/Interactivity/Events → esm/Options/Classes}/ResizeEvent.js +1 -1
  45. package/esm/Utils/CanvasUtils.js +26 -83
  46. package/esm/Utils/ColorUtils.js +17 -2
  47. package/esm/Utils/MathUtils.js +3 -2
  48. package/esm/Utils/Utils.js +26 -33
  49. package/esm/exports.js +1 -21
  50. package/package.json +1 -1
  51. package/report.html +1 -1
  52. package/tsparticles.engine.js +16 -208
  53. package/tsparticles.engine.min.js +1 -1
  54. package/tsparticles.engine.min.js.LICENSE.txt +1 -1
  55. package/types/Core/Canvas.d.ts +3 -0
  56. package/types/Core/Container.d.ts +4 -15
  57. package/types/Core/Engine.d.ts +4 -19
  58. package/types/Core/Interfaces/IContainerPlugin.d.ts +8 -1
  59. package/types/Core/Interfaces/IDrawParticleParams.d.ts +1 -1
  60. package/types/Core/Interfaces/IParticleOpacityData.d.ts +4 -0
  61. package/types/Core/Interfaces/IParticleRotateData.d.ts +4 -0
  62. package/types/Core/Interfaces/IParticleTransformValues.d.ts +4 -4
  63. package/types/Core/Interfaces/IParticleUpdater.d.ts +1 -1
  64. package/types/Core/Interfaces/IPlugin.d.ts +5 -1
  65. package/types/Core/Particle.d.ts +12 -2
  66. package/types/Core/Particles.d.ts +1 -5
  67. package/types/Core/Utils/Constants.d.ts +2 -2
  68. package/types/Core/Utils/EventListeners.d.ts +0 -14
  69. package/types/Options/Classes/Options.d.ts +2 -11
  70. package/types/Options/Classes/Particles/ParticlesOptions.d.ts +0 -2
  71. package/types/Options/Classes/ResizeEvent.d.ts +9 -0
  72. package/types/Options/Interfaces/IOptions.d.ts +2 -8
  73. package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +0 -3
  74. package/types/Types/CustomEventListener.d.ts +1 -1
  75. package/types/Types/EngineInitializers.d.ts +10 -0
  76. package/types/Utils/CanvasUtils.d.ts +6 -21
  77. package/types/Utils/EventDispatcher.d.ts +1 -1
  78. package/types/Utils/Utils.d.ts +4 -6
  79. package/types/export-types.d.ts +3 -19
  80. package/types/exports.d.ts +1 -21
  81. package/umd/Core/Canvas.js +17 -21
  82. package/umd/Core/Container.js +44 -169
  83. package/umd/Core/Engine.js +41 -62
  84. package/umd/Core/Particle.js +99 -58
  85. package/umd/Core/Particles.js +37 -26
  86. package/umd/Core/Utils/Constants.js +3 -3
  87. package/umd/Core/Utils/EventListeners.js +7 -252
  88. package/umd/Options/Classes/Options.js +7 -75
  89. package/umd/Options/Classes/Particles/ParticlesOptions.js +5 -11
  90. package/umd/Options/Classes/{Interactivity/Events/ResizeEvent.js → ResizeEvent.js} +2 -2
  91. package/umd/Utils/CanvasUtils.js +25 -82
  92. package/umd/Utils/ColorUtils.js +17 -2
  93. package/umd/Utils/MathUtils.js +3 -2
  94. package/umd/Utils/Utils.js +27 -36
  95. package/umd/exports.js +2 -22
  96. package/638.min.js +0 -2
  97. package/638.min.js.LICENSE.txt +0 -1
  98. package/browser/Core/Utils/ExternalInteractorBase.js +0 -7
  99. package/browser/Core/Utils/InteractionManager.js +0 -60
  100. package/browser/Core/Utils/ParticlesInteractorBase.js +0 -7
  101. package/browser/Enums/InteractivityDetect.js +0 -6
  102. package/browser/Enums/Modes/ResponsiveMode.js +0 -5
  103. package/browser/Enums/Modes/ThemeMode.js +0 -6
  104. package/browser/Enums/Types/DivType.js +0 -5
  105. package/browser/Enums/Types/InteractorType.js +0 -5
  106. package/browser/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
  107. package/browser/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
  108. package/browser/Options/Classes/Interactivity/Events/Events.js +0 -30
  109. package/browser/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
  110. package/browser/Options/Classes/Interactivity/Events/Parallax.js +0 -22
  111. package/browser/Options/Classes/Interactivity/Interactivity.js +0 -22
  112. package/browser/Options/Classes/Interactivity/Modes/Modes.js +0 -25
  113. package/browser/Options/Classes/ManualParticle.js +0 -21
  114. package/browser/Options/Classes/Responsive.js +0 -29
  115. package/browser/Options/Classes/Theme/Theme.js +0 -21
  116. package/browser/Options/Classes/Theme/ThemeDefault.js +0 -23
  117. package/browser/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
  118. package/browser/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
  119. package/browser/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
  120. package/browser/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
  121. package/browser/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
  122. package/browser/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
  123. package/browser/Options/Interfaces/Theme/ITheme.js +0 -1
  124. package/browser/Options/Interfaces/Theme/IThemeDefault.js +0 -1
  125. package/cjs/Core/Interfaces/IContainerInteractivity.js +0 -1
  126. package/cjs/Core/Interfaces/IExternalInteractor.js +0 -1
  127. package/cjs/Core/Interfaces/IInteractor.js +0 -1
  128. package/cjs/Core/Interfaces/IMouseData.js +0 -1
  129. package/cjs/Core/Interfaces/IParticlesInteractor.js +0 -1
  130. package/cjs/Core/Utils/ExternalInteractorBase.js +0 -7
  131. package/cjs/Core/Utils/InteractionManager.js +0 -60
  132. package/cjs/Core/Utils/ParticlesInteractorBase.js +0 -7
  133. package/cjs/Enums/InteractivityDetect.js +0 -6
  134. package/cjs/Enums/Modes/ResponsiveMode.js +0 -5
  135. package/cjs/Enums/Modes/ThemeMode.js +0 -6
  136. package/cjs/Enums/Types/DivType.js +0 -5
  137. package/cjs/Enums/Types/InteractorType.js +0 -5
  138. package/cjs/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
  139. package/cjs/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
  140. package/cjs/Options/Classes/Interactivity/Events/Events.js +0 -30
  141. package/cjs/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
  142. package/cjs/Options/Classes/Interactivity/Events/Parallax.js +0 -22
  143. package/cjs/Options/Classes/Interactivity/Interactivity.js +0 -22
  144. package/cjs/Options/Classes/Interactivity/Modes/Modes.js +0 -25
  145. package/cjs/Options/Classes/ManualParticle.js +0 -21
  146. package/cjs/Options/Classes/Responsive.js +0 -29
  147. package/cjs/Options/Classes/Theme/Theme.js +0 -21
  148. package/cjs/Options/Classes/Theme/ThemeDefault.js +0 -23
  149. package/cjs/Options/Interfaces/IManualParticle.js +0 -1
  150. package/cjs/Options/Interfaces/IResponsive.js +0 -1
  151. package/cjs/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -1
  152. package/cjs/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -1
  153. package/cjs/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
  154. package/cjs/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
  155. package/cjs/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
  156. package/cjs/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
  157. package/cjs/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
  158. package/cjs/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
  159. package/cjs/Options/Interfaces/Theme/ITheme.js +0 -1
  160. package/cjs/Options/Interfaces/Theme/IThemeDefault.js +0 -1
  161. package/esm/Core/Interfaces/IContainerInteractivity.js +0 -1
  162. package/esm/Core/Interfaces/IExternalInteractor.js +0 -1
  163. package/esm/Core/Interfaces/IInteractor.js +0 -1
  164. package/esm/Core/Interfaces/IMouseData.js +0 -1
  165. package/esm/Core/Interfaces/IParticlesInteractor.js +0 -1
  166. package/esm/Core/Utils/ExternalInteractorBase.js +0 -7
  167. package/esm/Core/Utils/InteractionManager.js +0 -60
  168. package/esm/Core/Utils/ParticlesInteractorBase.js +0 -7
  169. package/esm/Enums/InteractivityDetect.js +0 -6
  170. package/esm/Enums/Modes/ResponsiveMode.js +0 -5
  171. package/esm/Enums/Modes/ThemeMode.js +0 -6
  172. package/esm/Enums/Types/DivType.js +0 -5
  173. package/esm/Enums/Types/InteractorType.js +0 -5
  174. package/esm/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
  175. package/esm/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
  176. package/esm/Options/Classes/Interactivity/Events/Events.js +0 -30
  177. package/esm/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
  178. package/esm/Options/Classes/Interactivity/Events/Parallax.js +0 -22
  179. package/esm/Options/Classes/Interactivity/Interactivity.js +0 -22
  180. package/esm/Options/Classes/Interactivity/Modes/Modes.js +0 -25
  181. package/esm/Options/Classes/ManualParticle.js +0 -21
  182. package/esm/Options/Classes/Responsive.js +0 -29
  183. package/esm/Options/Classes/Theme/Theme.js +0 -21
  184. package/esm/Options/Classes/Theme/ThemeDefault.js +0 -23
  185. package/esm/Options/Interfaces/IManualParticle.js +0 -1
  186. package/esm/Options/Interfaces/IResponsive.js +0 -1
  187. package/esm/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -1
  188. package/esm/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -1
  189. package/esm/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
  190. package/esm/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
  191. package/esm/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
  192. package/esm/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
  193. package/esm/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
  194. package/esm/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
  195. package/esm/Options/Interfaces/Theme/ITheme.js +0 -1
  196. package/esm/Options/Interfaces/Theme/IThemeDefault.js +0 -1
  197. package/types/Core/Interfaces/IContainerInteractivity.d.ts +0 -6
  198. package/types/Core/Interfaces/IExternalInteractor.d.ts +0 -12
  199. package/types/Core/Interfaces/IInteractor.d.ts +0 -16
  200. package/types/Core/Interfaces/IMouseData.d.ts +0 -9
  201. package/types/Core/Interfaces/IParticlesInteractor.d.ts +0 -7
  202. package/types/Core/Utils/ExternalInteractorBase.d.ts +0 -15
  203. package/types/Core/Utils/InteractionManager.d.ts +0 -17
  204. package/types/Core/Utils/ParticlesInteractorBase.d.ts +0 -15
  205. package/types/Enums/InteractivityDetect.d.ts +0 -5
  206. package/types/Enums/Modes/ResponsiveMode.d.ts +0 -4
  207. package/types/Enums/Modes/ThemeMode.d.ts +0 -5
  208. package/types/Enums/Types/DivType.d.ts +0 -4
  209. package/types/Enums/Types/InteractorType.d.ts +0 -4
  210. package/types/Options/Classes/Interactivity/Events/ClickEvent.d.ts +0 -10
  211. package/types/Options/Classes/Interactivity/Events/DivEvent.d.ts +0 -13
  212. package/types/Options/Classes/Interactivity/Events/Events.d.ts +0 -16
  213. package/types/Options/Classes/Interactivity/Events/HoverEvent.d.ts +0 -12
  214. package/types/Options/Classes/Interactivity/Events/Parallax.d.ts +0 -10
  215. package/types/Options/Classes/Interactivity/Events/ResizeEvent.d.ts +0 -9
  216. package/types/Options/Classes/Interactivity/Interactivity.d.ts +0 -16
  217. package/types/Options/Classes/Interactivity/Modes/Modes.d.ts +0 -12
  218. package/types/Options/Classes/ManualParticle.d.ts +0 -10
  219. package/types/Options/Classes/Responsive.d.ts +0 -12
  220. package/types/Options/Classes/Theme/Theme.d.ts +0 -12
  221. package/types/Options/Classes/Theme/ThemeDefault.d.ts +0 -11
  222. package/types/Options/Interfaces/IManualParticle.d.ts +0 -7
  223. package/types/Options/Interfaces/IResponsive.d.ts +0 -7
  224. package/types/Options/Interfaces/Interactivity/Events/IClickEvent.d.ts +0 -5
  225. package/types/Options/Interfaces/Interactivity/Events/IDivEvent.d.ts +0 -8
  226. package/types/Options/Interfaces/Interactivity/Events/IEvents.d.ts +0 -11
  227. package/types/Options/Interfaces/Interactivity/Events/IHoverEvent.d.ts +0 -7
  228. package/types/Options/Interfaces/Interactivity/Events/IParallax.d.ts +0 -5
  229. package/types/Options/Interfaces/Interactivity/IInteractivity.d.ts +0 -9
  230. package/types/Options/Interfaces/Interactivity/Modes/IModeDiv.d.ts +0 -4
  231. package/types/Options/Interfaces/Interactivity/Modes/IModes.d.ts +0 -1
  232. package/types/Options/Interfaces/Theme/ITheme.d.ts +0 -7
  233. package/types/Options/Interfaces/Theme/IThemeDefault.d.ts +0 -6
  234. package/umd/Core/Interfaces/IMouseData.js +0 -12
  235. package/umd/Core/Interfaces/IParticlesInteractor.js +0 -12
  236. package/umd/Core/Utils/ExternalInteractorBase.js +0 -21
  237. package/umd/Core/Utils/InteractionManager.js +0 -74
  238. package/umd/Core/Utils/ParticlesInteractorBase.js +0 -21
  239. package/umd/Enums/InteractivityDetect.js +0 -19
  240. package/umd/Enums/Modes/ResponsiveMode.js +0 -18
  241. package/umd/Enums/Modes/ThemeMode.js +0 -19
  242. package/umd/Enums/Types/DivType.js +0 -18
  243. package/umd/Enums/Types/InteractorType.js +0 -18
  244. package/umd/Options/Classes/Interactivity/Events/ClickEvent.js +0 -32
  245. package/umd/Options/Classes/Interactivity/Events/DivEvent.js +0 -41
  246. package/umd/Options/Classes/Interactivity/Events/Events.js +0 -44
  247. package/umd/Options/Classes/Interactivity/Events/HoverEvent.js +0 -35
  248. package/umd/Options/Classes/Interactivity/Events/Parallax.js +0 -36
  249. package/umd/Options/Classes/Interactivity/Interactivity.js +0 -36
  250. package/umd/Options/Classes/Interactivity/Modes/Modes.js +0 -39
  251. package/umd/Options/Classes/ManualParticle.js +0 -35
  252. package/umd/Options/Classes/Responsive.js +0 -43
  253. package/umd/Options/Classes/Theme/Theme.js +0 -35
  254. package/umd/Options/Classes/Theme/ThemeDefault.js +0 -37
  255. package/umd/Options/Interfaces/IManualParticle.js +0 -12
  256. package/umd/Options/Interfaces/IResponsive.js +0 -12
  257. package/umd/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -12
  258. package/umd/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -12
  259. package/umd/Options/Interfaces/Interactivity/Events/IEvents.js +0 -12
  260. package/umd/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -12
  261. package/umd/Options/Interfaces/Interactivity/Events/IParallax.js +0 -12
  262. package/umd/Options/Interfaces/Interactivity/IInteractivity.js +0 -12
  263. package/umd/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -12
  264. package/umd/Options/Interfaces/Interactivity/Modes/IModes.js +0 -12
  265. package/umd/Options/Interfaces/Theme/ITheme.js +0 -12
  266. package/umd/Options/Interfaces/Theme/IThemeDefault.js +0 -12
  267. /package/browser/Core/Interfaces/{IContainerInteractivity.js → IParticleOpacityData.js} +0 -0
  268. /package/browser/Core/Interfaces/{IExternalInteractor.js → IParticleRotateData.js} +0 -0
  269. /package/browser/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
  270. /package/browser/{Core/Interfaces/IInteractor.js → Types/EngineInitializers.js} +0 -0
  271. /package/{browser/Core/Interfaces/IMouseData.js → cjs/Core/Interfaces/IParticleOpacityData.js} +0 -0
  272. /package/{browser/Core/Interfaces/IParticlesInteractor.js → cjs/Core/Interfaces/IParticleRotateData.js} +0 -0
  273. /package/cjs/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
  274. /package/{browser/Options/Interfaces/IManualParticle.js → cjs/Types/EngineInitializers.js} +0 -0
  275. /package/{browser/Options/Interfaces/IResponsive.js → esm/Core/Interfaces/IParticleOpacityData.js} +0 -0
  276. /package/{browser/Options/Interfaces/Interactivity/Events/IClickEvent.js → esm/Core/Interfaces/IParticleRotateData.js} +0 -0
  277. /package/esm/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
  278. /package/{browser/Options/Interfaces/Interactivity/Events/IDivEvent.js → esm/Types/EngineInitializers.js} +0 -0
  279. /package/types/Options/Interfaces/{Interactivity/Events/IResizeEvent.d.ts → IResizeEvent.d.ts} +0 -0
  280. /package/umd/Core/Interfaces/{IContainerInteractivity.js → IParticleOpacityData.js} +0 -0
  281. /package/umd/Core/Interfaces/{IExternalInteractor.js → IParticleRotateData.js} +0 -0
  282. /package/umd/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
  283. /package/umd/{Core/Interfaces/IInteractor.js → Types/EngineInitializers.js} +0 -0
@@ -1,5 +0,0 @@
1
- export var ResponsiveMode;
2
- (function (ResponsiveMode) {
3
- ResponsiveMode["screen"] = "screen";
4
- ResponsiveMode["canvas"] = "canvas";
5
- })(ResponsiveMode || (ResponsiveMode = {}));
@@ -1,6 +0,0 @@
1
- export var ThemeMode;
2
- (function (ThemeMode) {
3
- ThemeMode["any"] = "any";
4
- ThemeMode["dark"] = "dark";
5
- ThemeMode["light"] = "light";
6
- })(ThemeMode || (ThemeMode = {}));
@@ -1,5 +0,0 @@
1
- export var DivType;
2
- (function (DivType) {
3
- DivType["circle"] = "circle";
4
- DivType["rectangle"] = "rectangle";
5
- })(DivType || (DivType = {}));
@@ -1,5 +0,0 @@
1
- export var InteractorType;
2
- (function (InteractorType) {
3
- InteractorType["external"] = "external";
4
- InteractorType["particles"] = "particles";
5
- })(InteractorType || (InteractorType = {}));
@@ -1,18 +0,0 @@
1
- import { isNull } from "../../../../Utils/TypeUtils.js";
2
- export class ClickEvent {
3
- constructor() {
4
- this.enable = false;
5
- this.mode = [];
6
- }
7
- load(data) {
8
- if (isNull(data)) {
9
- return;
10
- }
11
- if (data.enable !== undefined) {
12
- this.enable = data.enable;
13
- }
14
- if (data.mode !== undefined) {
15
- this.mode = data.mode;
16
- }
17
- }
18
- }
@@ -1,27 +0,0 @@
1
- import { DivType } from "../../../../Enums/Types/DivType.js";
2
- import { isNull } from "../../../../Utils/TypeUtils.js";
3
- export class DivEvent {
4
- constructor() {
5
- this.selectors = [];
6
- this.enable = false;
7
- this.mode = [];
8
- this.type = DivType.circle;
9
- }
10
- load(data) {
11
- if (isNull(data)) {
12
- return;
13
- }
14
- if (data.selectors !== undefined) {
15
- this.selectors = data.selectors;
16
- }
17
- if (data.enable !== undefined) {
18
- this.enable = data.enable;
19
- }
20
- if (data.mode !== undefined) {
21
- this.mode = data.mode;
22
- }
23
- if (data.type !== undefined) {
24
- this.type = data.type;
25
- }
26
- }
27
- }
@@ -1,30 +0,0 @@
1
- import { ClickEvent } from "./ClickEvent.js";
2
- import { DivEvent } from "./DivEvent.js";
3
- import { HoverEvent } from "./HoverEvent.js";
4
- import { ResizeEvent } from "./ResizeEvent.js";
5
- import { executeOnSingleOrMultiple } from "../../../../Utils/Utils.js";
6
- import { isNull } from "../../../../Utils/TypeUtils.js";
7
- export class Events {
8
- constructor() {
9
- this.onClick = new ClickEvent();
10
- this.onDiv = new DivEvent();
11
- this.onHover = new HoverEvent();
12
- this.resize = new ResizeEvent();
13
- }
14
- load(data) {
15
- if (isNull(data)) {
16
- return;
17
- }
18
- this.onClick.load(data.onClick);
19
- const onDiv = data.onDiv;
20
- if (onDiv !== undefined) {
21
- this.onDiv = executeOnSingleOrMultiple(onDiv, t => {
22
- const tmp = new DivEvent();
23
- tmp.load(t);
24
- return tmp;
25
- });
26
- }
27
- this.onHover.load(data.onHover);
28
- this.resize.load(data.resize);
29
- }
30
- }
@@ -1,21 +0,0 @@
1
- import { Parallax } from "./Parallax.js";
2
- import { isNull } from "../../../../Utils/TypeUtils.js";
3
- export class HoverEvent {
4
- constructor() {
5
- this.enable = false;
6
- this.mode = [];
7
- this.parallax = new Parallax();
8
- }
9
- load(data) {
10
- if (isNull(data)) {
11
- return;
12
- }
13
- if (data.enable !== undefined) {
14
- this.enable = data.enable;
15
- }
16
- if (data.mode !== undefined) {
17
- this.mode = data.mode;
18
- }
19
- this.parallax.load(data.parallax);
20
- }
21
- }
@@ -1,22 +0,0 @@
1
- import { isNull } from "../../../../Utils/TypeUtils.js";
2
- export class Parallax {
3
- constructor() {
4
- this.enable = false;
5
- this.force = 2;
6
- this.smooth = 10;
7
- }
8
- load(data) {
9
- if (isNull(data)) {
10
- return;
11
- }
12
- if (data.enable !== undefined) {
13
- this.enable = data.enable;
14
- }
15
- if (data.force !== undefined) {
16
- this.force = data.force;
17
- }
18
- if (data.smooth !== undefined) {
19
- this.smooth = data.smooth;
20
- }
21
- }
22
- }
@@ -1,22 +0,0 @@
1
- import { Events } from "./Events/Events.js";
2
- import { InteractivityDetect } from "../../../Enums/InteractivityDetect.js";
3
- import { Modes } from "./Modes/Modes.js";
4
- import { isNull } from "../../../Utils/TypeUtils.js";
5
- export class Interactivity {
6
- constructor(engine, container) {
7
- this.detectsOn = InteractivityDetect.window;
8
- this.events = new Events();
9
- this.modes = new Modes(engine, container);
10
- }
11
- load(data) {
12
- if (isNull(data)) {
13
- return;
14
- }
15
- const detectsOn = data.detectsOn;
16
- if (detectsOn !== undefined) {
17
- this.detectsOn = detectsOn;
18
- }
19
- this.events.load(data.events);
20
- this.modes.load(data.modes);
21
- }
22
- }
@@ -1,25 +0,0 @@
1
- import { isNull } from "../../../../Utils/TypeUtils.js";
2
- export class Modes {
3
- constructor(engine, container) {
4
- this._engine = engine;
5
- this._container = container;
6
- }
7
- load(data) {
8
- if (isNull(data)) {
9
- return;
10
- }
11
- if (!this._container) {
12
- return;
13
- }
14
- const interactors = this._engine.interactors.get(this._container);
15
- if (!interactors) {
16
- return;
17
- }
18
- for (const interactor of interactors) {
19
- if (!interactor.loadModeOptions) {
20
- continue;
21
- }
22
- interactor.loadModeOptions(this, data);
23
- }
24
- }
25
- }
@@ -1,21 +0,0 @@
1
- import { PixelMode } from "../../Enums/Modes/PixelMode.js";
2
- import { deepExtend } from "../../Utils/Utils.js";
3
- import { isNull } from "../../Utils/TypeUtils.js";
4
- import { manualDefaultPosition } from "../../Core/Utils/Constants.js";
5
- export class ManualParticle {
6
- load(data) {
7
- if (isNull(data)) {
8
- return;
9
- }
10
- if (data.position) {
11
- this.position = {
12
- x: data.position.x ?? manualDefaultPosition,
13
- y: data.position.y ?? manualDefaultPosition,
14
- mode: data.position.mode ?? PixelMode.percent,
15
- };
16
- }
17
- if (data.options) {
18
- this.options = deepExtend({}, data.options);
19
- }
20
- }
21
- }
@@ -1,29 +0,0 @@
1
- import { ResponsiveMode } from "../../Enums/Modes/ResponsiveMode.js";
2
- import { deepExtend } from "../../Utils/Utils.js";
3
- import { isNull } from "../../Utils/TypeUtils.js";
4
- export class Responsive {
5
- constructor() {
6
- this.maxWidth = Infinity;
7
- this.options = {};
8
- this.mode = ResponsiveMode.canvas;
9
- }
10
- load(data) {
11
- if (isNull(data)) {
12
- return;
13
- }
14
- if (!isNull(data.maxWidth)) {
15
- this.maxWidth = data.maxWidth;
16
- }
17
- if (!isNull(data.mode)) {
18
- if (data.mode === ResponsiveMode.screen) {
19
- this.mode = ResponsiveMode.screen;
20
- }
21
- else {
22
- this.mode = ResponsiveMode.canvas;
23
- }
24
- }
25
- if (!isNull(data.options)) {
26
- this.options = deepExtend({}, data.options);
27
- }
28
- }
29
- }
@@ -1,21 +0,0 @@
1
- import { ThemeDefault } from "./ThemeDefault.js";
2
- import { deepExtend } from "../../../Utils/Utils.js";
3
- import { isNull } from "../../../Utils/TypeUtils.js";
4
- export class Theme {
5
- constructor() {
6
- this.name = "";
7
- this.default = new ThemeDefault();
8
- }
9
- load(data) {
10
- if (isNull(data)) {
11
- return;
12
- }
13
- if (data.name !== undefined) {
14
- this.name = data.name;
15
- }
16
- this.default.load(data.default);
17
- if (data.options !== undefined) {
18
- this.options = deepExtend({}, data.options);
19
- }
20
- }
21
- }
@@ -1,23 +0,0 @@
1
- import { ThemeMode } from "../../../Enums/Modes/ThemeMode.js";
2
- import { isNull } from "../../../Utils/TypeUtils.js";
3
- export class ThemeDefault {
4
- constructor() {
5
- this.auto = false;
6
- this.mode = ThemeMode.any;
7
- this.value = false;
8
- }
9
- load(data) {
10
- if (isNull(data)) {
11
- return;
12
- }
13
- if (data.auto !== undefined) {
14
- this.auto = data.auto;
15
- }
16
- if (data.mode !== undefined) {
17
- this.mode = data.mode;
18
- }
19
- if (data.value !== undefined) {
20
- this.value = data.value;
21
- }
22
- }
23
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import type { IMouseData } from "./IMouseData.js";
2
- export interface IContainerInteractivity {
3
- element?: HTMLElement | Window | Node | null;
4
- mouse: IMouseData;
5
- status?: string;
6
- }
@@ -1,12 +0,0 @@
1
- import type { IDelta } from "./IDelta.js";
2
- import type { IInteractor } from "./IInteractor.js";
3
- import type { IModes } from "../../Options/Interfaces/Interactivity/Modes/IModes.js";
4
- import type { Modes } from "../../Options/Classes/Interactivity/Modes/Modes.js";
5
- import type { Particle } from "../Particle.js";
6
- import type { RecursivePartial } from "../../Types/RecursivePartial.js";
7
- export interface IExternalInteractor<TParticle extends Particle = Particle> extends IInteractor<TParticle> {
8
- handleClickMode?: (mode: string) => void;
9
- loadModeOptions?: (options: Modes, ...sources: RecursivePartial<IModes | undefined>[]) => void;
10
- interact(delta: IDelta): void;
11
- isEnabled(particle?: TParticle): boolean;
12
- }
@@ -1,16 +0,0 @@
1
- import type { IDelta } from "./IDelta.js";
2
- import type { IParticlesOptions } from "../../Options/Interfaces/Particles/IParticlesOptions.js";
3
- import type { ISourceOptions } from "../../Types/ISourceOptions.js";
4
- import type { InteractorType } from "../../Enums/Types/InteractorType.js";
5
- import type { Options } from "../../Options/Classes/Options.js";
6
- import type { Particle } from "../Particle.js";
7
- import type { ParticlesOptions } from "../../Options/Classes/Particles/ParticlesOptions.js";
8
- import type { RecursivePartial } from "../../Types/RecursivePartial.js";
9
- export interface IInteractor<TParticle extends Particle = Particle> {
10
- loadOptions?: (options: Options, ...sources: (ISourceOptions | undefined)[]) => void;
11
- loadParticlesOptions?: (options: ParticlesOptions, ...sources: (RecursivePartial<IParticlesOptions> | undefined)[]) => void;
12
- type: InteractorType;
13
- clear(particle: TParticle, delta: IDelta): void;
14
- init(): void;
15
- reset(particle: TParticle): void;
16
- }
@@ -1,9 +0,0 @@
1
- import type { ICoordinates } from "./ICoordinates.js";
2
- export interface IMouseData {
3
- clickPosition?: ICoordinates;
4
- clickTime?: number;
5
- clicking: boolean;
6
- downPosition?: ICoordinates;
7
- inside: boolean;
8
- position?: ICoordinates;
9
- }
@@ -1,7 +0,0 @@
1
- import type { IDelta } from "./IDelta.js";
2
- import type { IInteractor } from "./IInteractor.js";
3
- import type { Particle } from "../Particle.js";
4
- export interface IParticlesInteractor<TParticle extends Particle = Particle> extends IInteractor<TParticle> {
5
- interact(particle: TParticle, delta: IDelta): void;
6
- isEnabled(particle: TParticle): boolean;
7
- }
@@ -1,15 +0,0 @@
1
- import type { Container } from "../Container.js";
2
- import type { IDelta } from "../Interfaces/IDelta.js";
3
- import type { IExternalInteractor } from "../Interfaces/IExternalInteractor.js";
4
- import { InteractorType } from "../../Enums/Types/InteractorType.js";
5
- import type { Particle } from "../Particle.js";
6
- export declare abstract class ExternalInteractorBase<TContainer extends Container = Container, TParticle extends Particle = Particle> implements IExternalInteractor<TParticle> {
7
- type: InteractorType;
8
- protected readonly container: TContainer;
9
- protected constructor(container: TContainer);
10
- abstract clear(particle: TParticle, delta: IDelta): void;
11
- abstract init(): void;
12
- abstract interact(delta: IDelta): void;
13
- abstract isEnabled(particle?: TParticle): boolean;
14
- abstract reset(particle: TParticle): void;
15
- }
@@ -1,17 +0,0 @@
1
- import type { Container } from "../Container.js";
2
- import type { Engine } from "../Engine.js";
3
- import type { IDelta } from "../Interfaces/IDelta.js";
4
- import type { Particle } from "../Particle.js";
5
- export declare class InteractionManager {
6
- private readonly container;
7
- private readonly _engine;
8
- private _externalInteractors;
9
- private _interactors;
10
- private _particleInteractors;
11
- constructor(engine: Engine, container: Container);
12
- externalInteract(delta: IDelta): void;
13
- handleClickMode(mode: string): void;
14
- init(): Promise<void>;
15
- particlesInteract(particle: Particle, delta: IDelta): void;
16
- reset(particle: Particle): void;
17
- }
@@ -1,15 +0,0 @@
1
- import type { Container } from "../Container.js";
2
- import type { IDelta } from "../Interfaces/IDelta.js";
3
- import type { IParticlesInteractor } from "../Interfaces/IParticlesInteractor.js";
4
- import { InteractorType } from "../../Enums/Types/InteractorType.js";
5
- import type { Particle } from "../Particle.js";
6
- export declare abstract class ParticlesInteractorBase<TContainer extends Container = Container, TParticle extends Particle = Particle> implements IParticlesInteractor<TParticle> {
7
- type: InteractorType;
8
- protected readonly container: TContainer;
9
- protected constructor(container: TContainer);
10
- abstract clear(particle: TParticle, delta: IDelta): void;
11
- abstract init(): void;
12
- abstract interact(particle: TParticle, delta: IDelta): void;
13
- abstract isEnabled(particle: TParticle): boolean;
14
- abstract reset(particle: TParticle): void;
15
- }
@@ -1,5 +0,0 @@
1
- export declare enum InteractivityDetect {
2
- canvas = "canvas",
3
- parent = "parent",
4
- window = "window"
5
- }
@@ -1,4 +0,0 @@
1
- export declare enum ResponsiveMode {
2
- screen = "screen",
3
- canvas = "canvas"
4
- }
@@ -1,5 +0,0 @@
1
- export declare enum ThemeMode {
2
- any = "any",
3
- dark = "dark",
4
- light = "light"
5
- }
@@ -1,4 +0,0 @@
1
- export declare enum DivType {
2
- circle = "circle",
3
- rectangle = "rectangle"
4
- }
@@ -1,4 +0,0 @@
1
- export declare enum InteractorType {
2
- external = "external",
3
- particles = "particles"
4
- }
@@ -1,10 +0,0 @@
1
- import type { IClickEvent } from "../../../Interfaces/Interactivity/Events/IClickEvent.js";
2
- import type { IOptionLoader } from "../../../Interfaces/IOptionLoader.js";
3
- import type { RecursivePartial } from "../../../../Types/RecursivePartial.js";
4
- import type { SingleOrMultiple } from "../../../../Types/SingleOrMultiple.js";
5
- export declare class ClickEvent implements IClickEvent, IOptionLoader<IClickEvent> {
6
- enable: boolean;
7
- mode: SingleOrMultiple<string>;
8
- constructor();
9
- load(data?: RecursivePartial<IClickEvent>): void;
10
- }
@@ -1,13 +0,0 @@
1
- import { DivType } from "../../../../Enums/Types/DivType.js";
2
- import type { IDivEvent } from "../../../Interfaces/Interactivity/Events/IDivEvent.js";
3
- import type { IOptionLoader } from "../../../Interfaces/IOptionLoader.js";
4
- import type { RecursivePartial } from "../../../../Types/RecursivePartial.js";
5
- import type { SingleOrMultiple } from "../../../../Types/SingleOrMultiple.js";
6
- export declare class DivEvent implements IDivEvent, IOptionLoader<IDivEvent> {
7
- enable: boolean;
8
- mode: SingleOrMultiple<string>;
9
- selectors: SingleOrMultiple<string>;
10
- type: DivType | keyof typeof DivType;
11
- constructor();
12
- load(data?: RecursivePartial<IDivEvent>): void;
13
- }
@@ -1,16 +0,0 @@
1
- import { ClickEvent } from "./ClickEvent.js";
2
- import { DivEvent } from "./DivEvent.js";
3
- import { HoverEvent } from "./HoverEvent.js";
4
- import type { IEvents } from "../../../Interfaces/Interactivity/Events/IEvents.js";
5
- import type { IOptionLoader } from "../../../Interfaces/IOptionLoader.js";
6
- import type { RecursivePartial } from "../../../../Types/RecursivePartial.js";
7
- import { ResizeEvent } from "./ResizeEvent.js";
8
- import type { SingleOrMultiple } from "../../../../Types/SingleOrMultiple.js";
9
- export declare class Events implements IEvents, IOptionLoader<IEvents> {
10
- readonly onClick: ClickEvent;
11
- onDiv: SingleOrMultiple<DivEvent>;
12
- readonly onHover: HoverEvent;
13
- readonly resize: ResizeEvent;
14
- constructor();
15
- load(data?: RecursivePartial<IEvents>): void;
16
- }
@@ -1,12 +0,0 @@
1
- import type { IHoverEvent } from "../../../Interfaces/Interactivity/Events/IHoverEvent.js";
2
- import type { IOptionLoader } from "../../../Interfaces/IOptionLoader.js";
3
- import { Parallax } from "./Parallax.js";
4
- import type { RecursivePartial } from "../../../../Types/RecursivePartial.js";
5
- import type { SingleOrMultiple } from "../../../../Types/SingleOrMultiple.js";
6
- export declare class HoverEvent implements IHoverEvent, IOptionLoader<IHoverEvent> {
7
- enable: boolean;
8
- mode: SingleOrMultiple<string>;
9
- readonly parallax: Parallax;
10
- constructor();
11
- load(data?: RecursivePartial<IHoverEvent>): void;
12
- }
@@ -1,10 +0,0 @@
1
- import type { IOptionLoader } from "../../../Interfaces/IOptionLoader.js";
2
- import type { IParallax } from "../../../Interfaces/Interactivity/Events/IParallax.js";
3
- import type { RecursivePartial } from "../../../../Types/RecursivePartial.js";
4
- export declare class Parallax implements IParallax, IOptionLoader<IParallax> {
5
- enable: boolean;
6
- force: number;
7
- smooth: number;
8
- constructor();
9
- load(data?: RecursivePartial<IParallax>): void;
10
- }
@@ -1,9 +0,0 @@
1
- import type { IOptionLoader } from "../../../Interfaces/IOptionLoader.js";
2
- import type { IResizeEvent } from "../../../Interfaces/Interactivity/Events/IResizeEvent.js";
3
- import type { RecursivePartial } from "../../../../Types/RecursivePartial.js";
4
- export declare class ResizeEvent implements IResizeEvent, IOptionLoader<IResizeEvent> {
5
- delay: number;
6
- enable: boolean;
7
- constructor();
8
- load(data?: RecursivePartial<IResizeEvent>): void;
9
- }
@@ -1,16 +0,0 @@
1
- import type { Container } from "../../../Core/Container.js";
2
- import type { Engine } from "../../../Core/Engine.js";
3
- import { Events } from "./Events/Events.js";
4
- import type { IInteractivity } from "../../Interfaces/Interactivity/IInteractivity.js";
5
- import type { IOptionLoader } from "../../Interfaces/IOptionLoader.js";
6
- import { InteractivityDetect } from "../../../Enums/InteractivityDetect.js";
7
- import { Modes } from "./Modes/Modes.js";
8
- import type { RecursivePartial } from "../../../Types/RecursivePartial.js";
9
- export declare class Interactivity implements IInteractivity, IOptionLoader<IInteractivity> {
10
- [name: string]: unknown;
11
- detectsOn: InteractivityDetect | keyof typeof InteractivityDetect;
12
- readonly events: Events;
13
- readonly modes: Modes;
14
- constructor(engine: Engine, container?: Container);
15
- load(data?: RecursivePartial<IInteractivity>): void;
16
- }
@@ -1,12 +0,0 @@
1
- import type { Container } from "../../../../Core/Container.js";
2
- import type { Engine } from "../../../../Core/Engine.js";
3
- import type { IModes } from "../../../Interfaces/Interactivity/Modes/IModes.js";
4
- import type { IOptionLoader } from "../../../Interfaces/IOptionLoader.js";
5
- import type { RecursivePartial } from "../../../../Types/RecursivePartial.js";
6
- export declare class Modes implements IModes, IOptionLoader<IModes> {
7
- [name: string]: unknown;
8
- private readonly _container;
9
- private readonly _engine;
10
- constructor(engine: Engine, container?: Container);
11
- load(data?: RecursivePartial<IModes>): void;
12
- }
@@ -1,10 +0,0 @@
1
- import type { ICoordinatesWithMode } from "../../Core/Interfaces/ICoordinates.js";
2
- import type { IManualParticle } from "../Interfaces/IManualParticle.js";
3
- import type { IOptionLoader } from "../Interfaces/IOptionLoader.js";
4
- import type { IParticlesOptions } from "../Interfaces/Particles/IParticlesOptions.js";
5
- import type { RecursivePartial } from "../../Types/RecursivePartial.js";
6
- export declare class ManualParticle implements IManualParticle, IOptionLoader<IManualParticle> {
7
- options?: RecursivePartial<IParticlesOptions>;
8
- position?: ICoordinatesWithMode;
9
- load(data?: RecursivePartial<IManualParticle>): void;
10
- }
@@ -1,12 +0,0 @@
1
- import type { IOptionLoader } from "../Interfaces/IOptionLoader.js";
2
- import type { IResponsive } from "../Interfaces/IResponsive.js";
3
- import type { ISourceOptions } from "../../Types/ISourceOptions.js";
4
- import type { RecursivePartial } from "../../Types/RecursivePartial.js";
5
- import { ResponsiveMode } from "../../Enums/Modes/ResponsiveMode.js";
6
- export declare class Responsive implements IResponsive, IOptionLoader<IResponsive> {
7
- maxWidth: number;
8
- mode: ResponsiveMode | keyof typeof ResponsiveMode;
9
- options: ISourceOptions;
10
- constructor();
11
- load(data?: RecursivePartial<IResponsive>): void;
12
- }
@@ -1,12 +0,0 @@
1
- import type { IOptionLoader } from "../../Interfaces/IOptionLoader.js";
2
- import type { ISourceOptions } from "../../../Types/ISourceOptions.js";
3
- import type { ITheme } from "../../Interfaces/Theme/ITheme.js";
4
- import type { RecursivePartial } from "../../../Types/RecursivePartial.js";
5
- import { ThemeDefault } from "./ThemeDefault.js";
6
- export declare class Theme implements ITheme, IOptionLoader<ITheme> {
7
- readonly default: ThemeDefault;
8
- name: string;
9
- options?: ISourceOptions;
10
- constructor();
11
- load(data?: RecursivePartial<ITheme>): void;
12
- }