@tsparticles/preset-firefly 4.5.0 → 4.5.1

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.
@@ -1,6 +1,6 @@
1
1
  (function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
2
2
  (function (g) {
3
- /* Preset v4.5.0 */
3
+ /* Preset v4.5.1 */
4
4
  g.__tsParticlesInternals = g.__tsParticlesInternals || {};
5
5
  g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6
6
  (function (exports) {
@@ -654,12 +654,8 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
654
654
  }
655
655
  addEventListener(type, listener) {
656
656
  this.removeEventListener(type, listener);
657
- let arr = this.#listeners.get(type);
658
- if (!arr) {
659
- arr = [];
660
- this.#listeners.set(type, arr);
661
- }
662
- arr.push(listener);
657
+ const arr = this.#listeners.get(type);
658
+ this.#listeners.set(type, arr ? [...arr, listener] : [listener]);
663
659
  }
664
660
  dispatchEvent(type, args) {
665
661
  const listeners = this.#listeners.get(type);
@@ -691,7 +687,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
691
687
  this.#listeners.delete(type);
692
688
  }
693
689
  else {
694
- arr.splice(idx, deleteCount);
690
+ this.#listeners.set(type, [...arr.slice(minIndex, idx), ...arr.slice(idx + deleteCount)]);
695
691
  }
696
692
  }
697
693
  }
@@ -872,7 +868,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
872
868
  return this.#domArray;
873
869
  }
874
870
  get version() {
875
- return "4.5.0";
871
+ return "4.5.1";
876
872
  }
877
873
  addEventListener(type, listener) {
878
874
  this.#eventDispatcher.addEventListener(type, listener);
@@ -2273,7 +2269,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2273
2269
  }
2274
2270
 
2275
2271
  async function loadBlendPlugin(engine) {
2276
- engine.checkVersion("4.5.0");
2272
+ engine.checkVersion("4.5.1");
2277
2273
  await engine.pluginManager.register(e => {
2278
2274
  e.pluginManager.addPlugin(new BlendPlugin());
2279
2275
  });
@@ -2310,7 +2306,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2310
2306
  }
2311
2307
 
2312
2308
  async function loadCircleShape(engine) {
2313
- engine.checkVersion("4.5.0");
2309
+ engine.checkVersion("4.5.1");
2314
2310
  await engine.pluginManager.register(e => {
2315
2311
  e.pluginManager.addShape(["circle"], () => {
2316
2312
  return Promise.resolve(new CircleDrawer());
@@ -2358,7 +2354,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2358
2354
  }
2359
2355
 
2360
2356
  async function loadHexColorPlugin(engine) {
2361
- engine.checkVersion("4.5.0");
2357
+ engine.checkVersion("4.5.1");
2362
2358
  await engine.pluginManager.register(e => {
2363
2359
  e.pluginManager.addColorManager("hex", new HexColorManager());
2364
2360
  });
@@ -2411,7 +2407,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2411
2407
  }
2412
2408
 
2413
2409
  async function loadHslColorPlugin(engine) {
2414
- engine.checkVersion("4.5.0");
2410
+ engine.checkVersion("4.5.1");
2415
2411
  await engine.pluginManager.register(e => {
2416
2412
  e.pluginManager.addColorManager("hsl", new HslColorManager());
2417
2413
  });
@@ -2443,7 +2439,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2443
2439
  }
2444
2440
 
2445
2441
  async function loadMovePlugin(engine) {
2446
- engine.checkVersion("4.5.0");
2442
+ engine.checkVersion("4.5.1");
2447
2443
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
2448
2444
  addErrorMessages(ErrorMessages$1);
2449
2445
  }
@@ -2653,7 +2649,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2653
2649
  }
2654
2650
 
2655
2651
  async function loadOpacityUpdater(engine) {
2656
- engine.checkVersion("4.5.0");
2652
+ engine.checkVersion("4.5.1");
2657
2653
  await engine.pluginManager.register(e => {
2658
2654
  e.pluginManager.addParticleUpdater("opacity", container => {
2659
2655
  return Promise.resolve(new OpacityUpdater(container));
@@ -2982,7 +2978,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2982
2978
  }
2983
2979
 
2984
2980
  async function loadOutModesUpdater(engine) {
2985
- engine.checkVersion("4.5.0");
2981
+ engine.checkVersion("4.5.1");
2986
2982
  await engine.pluginManager.register(e => {
2987
2983
  e.pluginManager.addParticleUpdater("outModes", container => {
2988
2984
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3061,7 +3057,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3061
3057
  }
3062
3058
 
3063
3059
  async function loadPaintUpdater(engine) {
3064
- engine.checkVersion("4.5.0");
3060
+ engine.checkVersion("4.5.1");
3065
3061
  await engine.pluginManager.register(e => {
3066
3062
  e.pluginManager.addParticleUpdater("paint", container => {
3067
3063
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3116,7 +3112,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3116
3112
  }
3117
3113
 
3118
3114
  async function loadRgbColorPlugin(engine) {
3119
- engine.checkVersion("4.5.0");
3115
+ engine.checkVersion("4.5.1");
3120
3116
  await engine.pluginManager.register(e => {
3121
3117
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3122
3118
  });
@@ -3201,7 +3197,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3201
3197
  }
3202
3198
 
3203
3199
  async function loadSizeUpdater(engine) {
3204
- engine.checkVersion("4.5.0");
3200
+ engine.checkVersion("4.5.1");
3205
3201
  await engine.pluginManager.register(e => {
3206
3202
  e.pluginManager.addParticleUpdater("size", container => {
3207
3203
  return Promise.resolve(new SizeUpdater(container));
@@ -3210,7 +3206,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3210
3206
  }
3211
3207
 
3212
3208
  async function loadBasic(engine) {
3213
- engine.checkVersion("4.5.0");
3209
+ engine.checkVersion("4.5.1");
3214
3210
  await engine.pluginManager.register(async (e) => {
3215
3211
  await Promise.all([
3216
3212
  loadBlendPlugin(e),
@@ -3416,7 +3412,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3416
3412
  const clickEvent = "click", mouseDownEvent = "pointerdown", mouseUpEvent = "pointerup", mouseLeaveEvent = "pointerleave", mouseMoveEvent = "pointermove", touchStartEvent = "touchstart", touchEndEvent = "touchend", touchMoveEvent = "touchmove", touchCancelEvent = "touchcancel";
3417
3413
 
3418
3414
  async function loadInteractivityPlugin(engine) {
3419
- engine.checkVersion("4.5.0");
3415
+ engine.checkVersion("4.5.1");
3420
3416
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
3421
3417
  addErrorMessages(ErrorMessages);
3422
3418
  }
@@ -3613,7 +3609,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3613
3609
  }
3614
3610
 
3615
3611
  async function loadExternalTrailInteraction(engine) {
3616
- engine.checkVersion("4.5.0");
3612
+ engine.checkVersion("4.5.1");
3617
3613
  await engine.pluginManager.register((e) => {
3618
3614
  ensureInteractivityPluginLoaded(e);
3619
3615
  e.pluginManager.addInteractor?.("externalTrail", container => {
@@ -3697,7 +3693,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3697
3693
  particle.destroy();
3698
3694
  return;
3699
3695
  }
3700
- const widthRange = setRangeValue(minCanvasSize, canvasSize.width), heightRange = setRangeValue(minCanvasSize, canvasSize.width);
3696
+ const widthRange = setRangeValue(minCanvasSize, canvasSize.width), heightRange = setRangeValue(minCanvasSize, canvasSize.height);
3701
3697
  particle.position.x = randomInRangeValue(widthRange);
3702
3698
  particle.position.y = randomInRangeValue(heightRange);
3703
3699
  particle.spawning = true;
@@ -3759,7 +3755,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3759
3755
  }
3760
3756
 
3761
3757
  async function loadLifeUpdater(engine) {
3762
- engine.checkVersion("4.5.0");
3758
+ engine.checkVersion("4.5.1");
3763
3759
  await engine.pluginManager.register(e => {
3764
3760
  e.pluginManager.addParticleUpdater("life", container => {
3765
3761
  return Promise.resolve(new LifeUpdater(container));
@@ -4770,6 +4766,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
4770
4766
  this.#manageListeners(true);
4771
4767
  }
4772
4768
  removeListeners() {
4769
+ if (this.#resizeTimeout !== undefined) {
4770
+ clearTimeout(this.#resizeTimeout);
4771
+ this.#resizeTimeout = undefined;
4772
+ }
4773
4773
  this.#manageListeners(false);
4774
4774
  }
4775
4775
  #handleVisibilityChange() {
@@ -5424,14 +5424,22 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5424
5424
  return out;
5425
5425
  }
5426
5426
  queryCircle(position, radius, check, out = []) {
5427
- const circle = this.#acquireCircle(position.x, position.y, radius), result = this.query(circle, check, out);
5428
- this.#releaseShapes();
5429
- return result;
5427
+ const circle = this.#acquireCircle(position.x, position.y, radius);
5428
+ try {
5429
+ return this.query(circle, check, out);
5430
+ }
5431
+ finally {
5432
+ this.#circlePoolIdx--;
5433
+ }
5430
5434
  }
5431
5435
  queryRectangle(position, size, check, out = []) {
5432
- const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height), result = this.query(rect, check, out);
5433
- this.#releaseShapes();
5434
- return result;
5436
+ const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height);
5437
+ try {
5438
+ return this.query(rect, check, out);
5439
+ }
5440
+ finally {
5441
+ this.#rectanglePoolIdx--;
5442
+ }
5435
5443
  }
5436
5444
  #acquireCircle(x, y, r) {
5437
5445
  const idx = this.#circlePoolIdx++;
@@ -5490,10 +5498,6 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5490
5498
  }
5491
5499
  }
5492
5500
  }
5493
- #releaseShapes() {
5494
- this.#circlePoolIdx = 0;
5495
- this.#rectanglePoolIdx = 0;
5496
- }
5497
5501
  }
5498
5502
 
5499
5503
  class ParticlesManager {
@@ -6041,6 +6045,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6041
6045
  started;
6042
6046
  zLayers;
6043
6047
  #delay;
6048
+ #delayResolve;
6044
6049
  #delayTimeout;
6045
6050
  #delta = { value: 0, factor: 0 };
6046
6051
  #dispatchCallback;
@@ -6279,7 +6284,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6279
6284
  await this.init();
6280
6285
  this.started = true;
6281
6286
  await new Promise(resolve => {
6287
+ this.#delayResolve = resolve;
6282
6288
  const start = async () => {
6289
+ this.#delayTimeout = undefined;
6290
+ this.#delayResolve = undefined;
6283
6291
  this.#eventListeners.addListeners();
6284
6292
  for (const plugin of this.plugins) {
6285
6293
  await plugin.start?.();
@@ -6295,9 +6303,11 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6295
6303
  if (!guardCheck(this) || !this.started) {
6296
6304
  return;
6297
6305
  }
6298
- if (this.#delayTimeout) {
6306
+ if (this.#delayTimeout !== undefined) {
6299
6307
  clearTimeout(this.#delayTimeout);
6300
6308
  this.#delayTimeout = undefined;
6309
+ this.#delayResolve?.();
6310
+ this.#delayResolve = undefined;
6301
6311
  }
6302
6312
  this.#firstStart = true;
6303
6313
  this.started = false;
@@ -6731,7 +6741,9 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6731
6741
  manageListener(interactivityEl, mouseMoveEvent, handlers.mouseMove, add);
6732
6742
  manageListener(interactivityEl, touchStartEvent, handlers.touchStart, add);
6733
6743
  manageListener(interactivityEl, touchMoveEvent, handlers.touchMove, add);
6734
- manageListener(interactivityEl, touchEndEvent, options.interactivity?.events.onClick.enable ? handlers.touchEndClick : handlers.touchEnd, add);
6744
+ const onClickEnabled = !!options.interactivity?.events.onClick.enable;
6745
+ manageListener(interactivityEl, touchEndEvent, handlers.touchEndClick, add && onClickEnabled);
6746
+ manageListener(interactivityEl, touchEndEvent, handlers.touchEnd, add && !onClickEnabled);
6735
6747
  manageListener(interactivityEl, mouseUpEvent, handlers.mouseUp, add);
6736
6748
  manageListener(interactivityEl, mouseDownEvent, handlers.mouseDown, add);
6737
6749
  manageListener(interactivityEl, mouseLeaveEvent, handlers.mouseLeave, add);