@tsparticles/engine 4.0.0-alpha.3 → 4.0.0-alpha.5

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 (266) 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 +3 -3
  5. package/browser/Core/Container.js +35 -155
  6. package/browser/Core/Engine.js +32 -78
  7. package/browser/Core/Particle.js +5 -10
  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/ColorUtils.js +7 -5
  15. package/browser/Utils/Utils.js +33 -36
  16. package/browser/exports.js +1 -21
  17. package/cjs/Core/Canvas.js +3 -3
  18. package/cjs/Core/Container.js +35 -155
  19. package/cjs/Core/Engine.js +32 -78
  20. package/cjs/Core/Particle.js +5 -10
  21. package/cjs/Core/Particles.js +36 -25
  22. package/cjs/Core/Utils/Constants.js +2 -2
  23. package/cjs/Core/Utils/EventListeners.js +5 -250
  24. package/cjs/Options/Classes/Options.js +7 -75
  25. package/cjs/Options/Classes/Particles/ParticlesOptions.js +5 -11
  26. package/cjs/Options/Classes/{Interactivity/Events/ResizeEvent.js → ResizeEvent.js} +1 -1
  27. package/cjs/Utils/ColorUtils.js +7 -5
  28. package/cjs/Utils/Utils.js +33 -36
  29. package/cjs/exports.js +1 -21
  30. package/dist_browser_Core_Container_js.js +6 -16
  31. package/esm/Core/Canvas.js +3 -3
  32. package/esm/Core/Container.js +35 -155
  33. package/esm/Core/Engine.js +32 -78
  34. package/esm/Core/Particle.js +5 -10
  35. package/esm/Core/Particles.js +36 -25
  36. package/esm/Core/Utils/Constants.js +2 -2
  37. package/esm/Core/Utils/EventListeners.js +5 -250
  38. package/esm/Options/Classes/Options.js +7 -75
  39. package/esm/Options/Classes/Particles/ParticlesOptions.js +5 -11
  40. package/{browser/Options/Classes/Interactivity/Events → esm/Options/Classes}/ResizeEvent.js +1 -1
  41. package/esm/Utils/ColorUtils.js +7 -5
  42. package/esm/Utils/Utils.js +33 -36
  43. package/esm/exports.js +1 -21
  44. package/package.json +1 -1
  45. package/report.html +1 -1
  46. package/tsparticles.engine.js +14 -206
  47. package/tsparticles.engine.min.js +1 -1
  48. package/tsparticles.engine.min.js.LICENSE.txt +1 -1
  49. package/types/Core/Container.d.ts +3 -15
  50. package/types/Core/Engine.d.ts +8 -19
  51. package/types/Core/Interfaces/IContainerPlugin.d.ts +8 -1
  52. package/types/Core/Interfaces/IPlugin.d.ts +5 -1
  53. package/types/Core/Particle.d.ts +0 -2
  54. package/types/Core/Particles.d.ts +1 -5
  55. package/types/Core/Utils/Constants.d.ts +2 -2
  56. package/types/Core/Utils/EventListeners.d.ts +0 -14
  57. package/types/Options/Classes/Options.d.ts +2 -11
  58. package/types/Options/Classes/Particles/ParticlesOptions.d.ts +0 -2
  59. package/types/Options/Classes/ResizeEvent.d.ts +9 -0
  60. package/types/Options/Interfaces/IOptions.d.ts +2 -8
  61. package/types/Options/Interfaces/Particles/IParticlesOptions.d.ts +0 -3
  62. package/types/Types/EngineInitializers.d.ts +10 -0
  63. package/types/Utils/Utils.d.ts +4 -6
  64. package/types/export-types.d.ts +3 -19
  65. package/types/exports.d.ts +1 -21
  66. package/umd/Core/Canvas.js +3 -3
  67. package/umd/Core/Container.js +35 -155
  68. package/umd/Core/Engine.js +33 -79
  69. package/umd/Core/Particle.js +6 -11
  70. package/umd/Core/Particles.js +37 -26
  71. package/umd/Core/Utils/Constants.js +3 -3
  72. package/umd/Core/Utils/EventListeners.js +7 -252
  73. package/umd/Options/Classes/Options.js +7 -75
  74. package/umd/Options/Classes/Particles/ParticlesOptions.js +5 -11
  75. package/umd/Options/Classes/{Interactivity/Events/ResizeEvent.js → ResizeEvent.js} +2 -2
  76. package/umd/Utils/ColorUtils.js +7 -5
  77. package/umd/Utils/Utils.js +34 -39
  78. package/umd/exports.js +2 -22
  79. package/638.min.js +0 -2
  80. package/638.min.js.LICENSE.txt +0 -1
  81. package/browser/Core/Interfaces/IMouseData.js +0 -1
  82. package/browser/Core/Interfaces/IParticlesInteractor.js +0 -1
  83. package/browser/Core/Utils/ExternalInteractorBase.js +0 -7
  84. package/browser/Core/Utils/InteractionManager.js +0 -60
  85. package/browser/Core/Utils/ParticlesInteractorBase.js +0 -7
  86. package/browser/Enums/InteractivityDetect.js +0 -6
  87. package/browser/Enums/Modes/ResponsiveMode.js +0 -5
  88. package/browser/Enums/Modes/ThemeMode.js +0 -6
  89. package/browser/Enums/Types/DivType.js +0 -5
  90. package/browser/Enums/Types/InteractorType.js +0 -5
  91. package/browser/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
  92. package/browser/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
  93. package/browser/Options/Classes/Interactivity/Events/Events.js +0 -30
  94. package/browser/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
  95. package/browser/Options/Classes/Interactivity/Events/Parallax.js +0 -22
  96. package/browser/Options/Classes/Interactivity/Interactivity.js +0 -22
  97. package/browser/Options/Classes/Interactivity/Modes/Modes.js +0 -25
  98. package/browser/Options/Classes/ManualParticle.js +0 -21
  99. package/browser/Options/Classes/Responsive.js +0 -29
  100. package/browser/Options/Classes/Theme/Theme.js +0 -21
  101. package/browser/Options/Classes/Theme/ThemeDefault.js +0 -23
  102. package/browser/Options/Interfaces/IManualParticle.js +0 -1
  103. package/browser/Options/Interfaces/IResponsive.js +0 -1
  104. package/browser/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -1
  105. package/browser/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -1
  106. package/browser/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
  107. package/browser/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
  108. package/browser/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
  109. package/browser/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
  110. package/browser/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
  111. package/browser/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
  112. package/browser/Options/Interfaces/Theme/ITheme.js +0 -1
  113. package/browser/Options/Interfaces/Theme/IThemeDefault.js +0 -1
  114. package/cjs/Core/Interfaces/IContainerInteractivity.js +0 -1
  115. package/cjs/Core/Interfaces/IExternalInteractor.js +0 -1
  116. package/cjs/Core/Interfaces/IInteractor.js +0 -1
  117. package/cjs/Core/Interfaces/IMouseData.js +0 -1
  118. package/cjs/Core/Interfaces/IParticlesInteractor.js +0 -1
  119. package/cjs/Core/Utils/ExternalInteractorBase.js +0 -7
  120. package/cjs/Core/Utils/InteractionManager.js +0 -60
  121. package/cjs/Core/Utils/ParticlesInteractorBase.js +0 -7
  122. package/cjs/Enums/InteractivityDetect.js +0 -6
  123. package/cjs/Enums/Modes/ResponsiveMode.js +0 -5
  124. package/cjs/Enums/Modes/ThemeMode.js +0 -6
  125. package/cjs/Enums/Types/DivType.js +0 -5
  126. package/cjs/Enums/Types/InteractorType.js +0 -5
  127. package/cjs/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
  128. package/cjs/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
  129. package/cjs/Options/Classes/Interactivity/Events/Events.js +0 -30
  130. package/cjs/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
  131. package/cjs/Options/Classes/Interactivity/Events/Parallax.js +0 -22
  132. package/cjs/Options/Classes/Interactivity/Interactivity.js +0 -22
  133. package/cjs/Options/Classes/Interactivity/Modes/Modes.js +0 -25
  134. package/cjs/Options/Classes/ManualParticle.js +0 -21
  135. package/cjs/Options/Classes/Responsive.js +0 -29
  136. package/cjs/Options/Classes/Theme/Theme.js +0 -21
  137. package/cjs/Options/Classes/Theme/ThemeDefault.js +0 -23
  138. package/cjs/Options/Interfaces/IManualParticle.js +0 -1
  139. package/cjs/Options/Interfaces/IResponsive.js +0 -1
  140. package/cjs/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -1
  141. package/cjs/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -1
  142. package/cjs/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
  143. package/cjs/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
  144. package/cjs/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
  145. package/cjs/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
  146. package/cjs/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
  147. package/cjs/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
  148. package/cjs/Options/Interfaces/Theme/ITheme.js +0 -1
  149. package/cjs/Options/Interfaces/Theme/IThemeDefault.js +0 -1
  150. package/esm/Core/Interfaces/IContainerInteractivity.js +0 -1
  151. package/esm/Core/Interfaces/IExternalInteractor.js +0 -1
  152. package/esm/Core/Interfaces/IInteractor.js +0 -1
  153. package/esm/Core/Interfaces/IMouseData.js +0 -1
  154. package/esm/Core/Interfaces/IParticlesInteractor.js +0 -1
  155. package/esm/Core/Utils/ExternalInteractorBase.js +0 -7
  156. package/esm/Core/Utils/InteractionManager.js +0 -60
  157. package/esm/Core/Utils/ParticlesInteractorBase.js +0 -7
  158. package/esm/Enums/InteractivityDetect.js +0 -6
  159. package/esm/Enums/Modes/ResponsiveMode.js +0 -5
  160. package/esm/Enums/Modes/ThemeMode.js +0 -6
  161. package/esm/Enums/Types/DivType.js +0 -5
  162. package/esm/Enums/Types/InteractorType.js +0 -5
  163. package/esm/Options/Classes/Interactivity/Events/ClickEvent.js +0 -18
  164. package/esm/Options/Classes/Interactivity/Events/DivEvent.js +0 -27
  165. package/esm/Options/Classes/Interactivity/Events/Events.js +0 -30
  166. package/esm/Options/Classes/Interactivity/Events/HoverEvent.js +0 -21
  167. package/esm/Options/Classes/Interactivity/Events/Parallax.js +0 -22
  168. package/esm/Options/Classes/Interactivity/Interactivity.js +0 -22
  169. package/esm/Options/Classes/Interactivity/Modes/Modes.js +0 -25
  170. package/esm/Options/Classes/ManualParticle.js +0 -21
  171. package/esm/Options/Classes/Responsive.js +0 -29
  172. package/esm/Options/Classes/Theme/Theme.js +0 -21
  173. package/esm/Options/Classes/Theme/ThemeDefault.js +0 -23
  174. package/esm/Options/Interfaces/IManualParticle.js +0 -1
  175. package/esm/Options/Interfaces/IResponsive.js +0 -1
  176. package/esm/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -1
  177. package/esm/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -1
  178. package/esm/Options/Interfaces/Interactivity/Events/IEvents.js +0 -1
  179. package/esm/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -1
  180. package/esm/Options/Interfaces/Interactivity/Events/IParallax.js +0 -1
  181. package/esm/Options/Interfaces/Interactivity/IInteractivity.js +0 -1
  182. package/esm/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -1
  183. package/esm/Options/Interfaces/Interactivity/Modes/IModes.js +0 -1
  184. package/esm/Options/Interfaces/Theme/ITheme.js +0 -1
  185. package/esm/Options/Interfaces/Theme/IThemeDefault.js +0 -1
  186. package/types/Core/Interfaces/IContainerInteractivity.d.ts +0 -6
  187. package/types/Core/Interfaces/IExternalInteractor.d.ts +0 -12
  188. package/types/Core/Interfaces/IInteractor.d.ts +0 -16
  189. package/types/Core/Interfaces/IMouseData.d.ts +0 -9
  190. package/types/Core/Interfaces/IParticlesInteractor.d.ts +0 -7
  191. package/types/Core/Utils/ExternalInteractorBase.d.ts +0 -15
  192. package/types/Core/Utils/InteractionManager.d.ts +0 -17
  193. package/types/Core/Utils/ParticlesInteractorBase.d.ts +0 -15
  194. package/types/Enums/InteractivityDetect.d.ts +0 -5
  195. package/types/Enums/Modes/ResponsiveMode.d.ts +0 -4
  196. package/types/Enums/Modes/ThemeMode.d.ts +0 -5
  197. package/types/Enums/Types/DivType.d.ts +0 -4
  198. package/types/Enums/Types/InteractorType.d.ts +0 -4
  199. package/types/Options/Classes/Interactivity/Events/ClickEvent.d.ts +0 -10
  200. package/types/Options/Classes/Interactivity/Events/DivEvent.d.ts +0 -13
  201. package/types/Options/Classes/Interactivity/Events/Events.d.ts +0 -16
  202. package/types/Options/Classes/Interactivity/Events/HoverEvent.d.ts +0 -12
  203. package/types/Options/Classes/Interactivity/Events/Parallax.d.ts +0 -10
  204. package/types/Options/Classes/Interactivity/Events/ResizeEvent.d.ts +0 -9
  205. package/types/Options/Classes/Interactivity/Interactivity.d.ts +0 -16
  206. package/types/Options/Classes/Interactivity/Modes/Modes.d.ts +0 -12
  207. package/types/Options/Classes/ManualParticle.d.ts +0 -10
  208. package/types/Options/Classes/Responsive.d.ts +0 -12
  209. package/types/Options/Classes/Theme/Theme.d.ts +0 -12
  210. package/types/Options/Classes/Theme/ThemeDefault.d.ts +0 -11
  211. package/types/Options/Interfaces/IManualParticle.d.ts +0 -7
  212. package/types/Options/Interfaces/IResponsive.d.ts +0 -7
  213. package/types/Options/Interfaces/Interactivity/Events/IClickEvent.d.ts +0 -5
  214. package/types/Options/Interfaces/Interactivity/Events/IDivEvent.d.ts +0 -8
  215. package/types/Options/Interfaces/Interactivity/Events/IEvents.d.ts +0 -11
  216. package/types/Options/Interfaces/Interactivity/Events/IHoverEvent.d.ts +0 -7
  217. package/types/Options/Interfaces/Interactivity/Events/IParallax.d.ts +0 -5
  218. package/types/Options/Interfaces/Interactivity/IInteractivity.d.ts +0 -9
  219. package/types/Options/Interfaces/Interactivity/Modes/IModeDiv.d.ts +0 -4
  220. package/types/Options/Interfaces/Interactivity/Modes/IModes.d.ts +0 -1
  221. package/types/Options/Interfaces/Theme/ITheme.d.ts +0 -7
  222. package/types/Options/Interfaces/Theme/IThemeDefault.d.ts +0 -6
  223. package/umd/Core/Interfaces/IExternalInteractor.js +0 -12
  224. package/umd/Core/Interfaces/IInteractor.js +0 -12
  225. package/umd/Core/Interfaces/IMouseData.js +0 -12
  226. package/umd/Core/Interfaces/IParticlesInteractor.js +0 -12
  227. package/umd/Core/Utils/ExternalInteractorBase.js +0 -21
  228. package/umd/Core/Utils/InteractionManager.js +0 -74
  229. package/umd/Core/Utils/ParticlesInteractorBase.js +0 -21
  230. package/umd/Enums/InteractivityDetect.js +0 -19
  231. package/umd/Enums/Modes/ResponsiveMode.js +0 -18
  232. package/umd/Enums/Modes/ThemeMode.js +0 -19
  233. package/umd/Enums/Types/DivType.js +0 -18
  234. package/umd/Enums/Types/InteractorType.js +0 -18
  235. package/umd/Options/Classes/Interactivity/Events/ClickEvent.js +0 -32
  236. package/umd/Options/Classes/Interactivity/Events/DivEvent.js +0 -41
  237. package/umd/Options/Classes/Interactivity/Events/Events.js +0 -44
  238. package/umd/Options/Classes/Interactivity/Events/HoverEvent.js +0 -35
  239. package/umd/Options/Classes/Interactivity/Events/Parallax.js +0 -36
  240. package/umd/Options/Classes/Interactivity/Interactivity.js +0 -36
  241. package/umd/Options/Classes/Interactivity/Modes/Modes.js +0 -39
  242. package/umd/Options/Classes/ManualParticle.js +0 -35
  243. package/umd/Options/Classes/Responsive.js +0 -43
  244. package/umd/Options/Classes/Theme/Theme.js +0 -35
  245. package/umd/Options/Classes/Theme/ThemeDefault.js +0 -37
  246. package/umd/Options/Interfaces/IManualParticle.js +0 -12
  247. package/umd/Options/Interfaces/IResponsive.js +0 -12
  248. package/umd/Options/Interfaces/Interactivity/Events/IClickEvent.js +0 -12
  249. package/umd/Options/Interfaces/Interactivity/Events/IDivEvent.js +0 -12
  250. package/umd/Options/Interfaces/Interactivity/Events/IEvents.js +0 -12
  251. package/umd/Options/Interfaces/Interactivity/Events/IHoverEvent.js +0 -12
  252. package/umd/Options/Interfaces/Interactivity/Events/IParallax.js +0 -12
  253. package/umd/Options/Interfaces/Interactivity/IInteractivity.js +0 -12
  254. package/umd/Options/Interfaces/Interactivity/Modes/IModeDiv.js +0 -12
  255. package/umd/Options/Interfaces/Interactivity/Modes/IModes.js +0 -12
  256. package/umd/Options/Interfaces/Theme/ITheme.js +0 -12
  257. package/umd/Options/Interfaces/Theme/IThemeDefault.js +0 -12
  258. /package/browser/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
  259. /package/browser/{Core/Interfaces/IContainerInteractivity.js → Types/EngineInitializers.js} +0 -0
  260. /package/cjs/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
  261. /package/{browser/Core/Interfaces/IExternalInteractor.js → cjs/Types/EngineInitializers.js} +0 -0
  262. /package/esm/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
  263. /package/{browser/Core/Interfaces/IInteractor.js → esm/Types/EngineInitializers.js} +0 -0
  264. /package/types/Options/Interfaces/{Interactivity/Events/IResizeEvent.d.ts → IResizeEvent.d.ts} +0 -0
  265. /package/umd/Options/Interfaces/{Interactivity/Events/IResizeEvent.js → IResizeEvent.js} +0 -0
  266. /package/umd/{Core/Interfaces/IContainerInteractivity.js → Types/EngineInitializers.js} +0 -0
@@ -1,7 +0,0 @@
1
- import { InteractorType } from "../../Enums/Types/InteractorType.js";
2
- export class ExternalInteractorBase {
3
- constructor(container) {
4
- this.type = InteractorType.external;
5
- this.container = container;
6
- }
7
- }
@@ -1,60 +0,0 @@
1
- import { InteractorType } from "../../Enums/Types/InteractorType.js";
2
- export class InteractionManager {
3
- constructor(engine, container) {
4
- this.container = container;
5
- this._engine = engine;
6
- this._interactors = [];
7
- this._externalInteractors = [];
8
- this._particleInteractors = [];
9
- }
10
- externalInteract(delta) {
11
- for (const interactor of this._externalInteractors) {
12
- if (interactor.isEnabled()) {
13
- interactor.interact(delta);
14
- }
15
- }
16
- }
17
- handleClickMode(mode) {
18
- for (const interactor of this._externalInteractors) {
19
- interactor.handleClickMode?.(mode);
20
- }
21
- }
22
- async init() {
23
- this._interactors = await this._engine.getInteractors(this.container, true);
24
- this._externalInteractors = [];
25
- this._particleInteractors = [];
26
- for (const interactor of this._interactors) {
27
- switch (interactor.type) {
28
- case InteractorType.external:
29
- this._externalInteractors.push(interactor);
30
- break;
31
- case InteractorType.particles:
32
- this._particleInteractors.push(interactor);
33
- break;
34
- }
35
- interactor.init();
36
- }
37
- }
38
- particlesInteract(particle, delta) {
39
- for (const interactor of this._externalInteractors) {
40
- interactor.clear(particle, delta);
41
- }
42
- for (const interactor of this._particleInteractors) {
43
- if (interactor.isEnabled(particle)) {
44
- interactor.interact(particle, delta);
45
- }
46
- }
47
- }
48
- reset(particle) {
49
- for (const interactor of this._externalInteractors) {
50
- if (interactor.isEnabled()) {
51
- interactor.reset(particle);
52
- }
53
- }
54
- for (const interactor of this._particleInteractors) {
55
- if (interactor.isEnabled(particle)) {
56
- interactor.reset(particle);
57
- }
58
- }
59
- }
60
- }
@@ -1,7 +0,0 @@
1
- import { InteractorType } from "../../Enums/Types/InteractorType.js";
2
- export class ParticlesInteractorBase {
3
- constructor(container) {
4
- this.type = InteractorType.particles;
5
- this.container = container;
6
- }
7
- }
@@ -1,6 +0,0 @@
1
- export var InteractivityDetect;
2
- (function (InteractivityDetect) {
3
- InteractivityDetect["canvas"] = "canvas";
4
- InteractivityDetect["parent"] = "parent";
5
- InteractivityDetect["window"] = "window";
6
- })(InteractivityDetect || (InteractivityDetect = {}));
@@ -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 +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,7 +0,0 @@
1
- import { InteractorType } from "../../Enums/Types/InteractorType.js";
2
- export class ExternalInteractorBase {
3
- constructor(container) {
4
- this.type = InteractorType.external;
5
- this.container = container;
6
- }
7
- }
@@ -1,60 +0,0 @@
1
- import { InteractorType } from "../../Enums/Types/InteractorType.js";
2
- export class InteractionManager {
3
- constructor(engine, container) {
4
- this.container = container;
5
- this._engine = engine;
6
- this._interactors = [];
7
- this._externalInteractors = [];
8
- this._particleInteractors = [];
9
- }
10
- externalInteract(delta) {
11
- for (const interactor of this._externalInteractors) {
12
- if (interactor.isEnabled()) {
13
- interactor.interact(delta);
14
- }
15
- }
16
- }
17
- handleClickMode(mode) {
18
- for (const interactor of this._externalInteractors) {
19
- interactor.handleClickMode?.(mode);
20
- }
21
- }
22
- async init() {
23
- this._interactors = await this._engine.getInteractors(this.container, true);
24
- this._externalInteractors = [];
25
- this._particleInteractors = [];
26
- for (const interactor of this._interactors) {
27
- switch (interactor.type) {
28
- case InteractorType.external:
29
- this._externalInteractors.push(interactor);
30
- break;
31
- case InteractorType.particles:
32
- this._particleInteractors.push(interactor);
33
- break;
34
- }
35
- interactor.init();
36
- }
37
- }
38
- particlesInteract(particle, delta) {
39
- for (const interactor of this._externalInteractors) {
40
- interactor.clear(particle, delta);
41
- }
42
- for (const interactor of this._particleInteractors) {
43
- if (interactor.isEnabled(particle)) {
44
- interactor.interact(particle, delta);
45
- }
46
- }
47
- }
48
- reset(particle) {
49
- for (const interactor of this._externalInteractors) {
50
- if (interactor.isEnabled()) {
51
- interactor.reset(particle);
52
- }
53
- }
54
- for (const interactor of this._particleInteractors) {
55
- if (interactor.isEnabled(particle)) {
56
- interactor.reset(particle);
57
- }
58
- }
59
- }
60
- }
@@ -1,7 +0,0 @@
1
- import { InteractorType } from "../../Enums/Types/InteractorType.js";
2
- export class ParticlesInteractorBase {
3
- constructor(container) {
4
- this.type = InteractorType.particles;
5
- this.container = container;
6
- }
7
- }
@@ -1,6 +0,0 @@
1
- export var InteractivityDetect;
2
- (function (InteractivityDetect) {
3
- InteractivityDetect["canvas"] = "canvas";
4
- InteractivityDetect["parent"] = "parent";
5
- InteractivityDetect["window"] = "window";
6
- })(InteractivityDetect || (InteractivityDetect = {}));
@@ -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
- }