@tsparticles/fireworks 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
- /* tsParticles v4.5.0 */
3
+ /* tsParticles v4.5.1 */
4
4
  g.__tsParticlesInternals = g.__tsParticlesInternals || {};
5
5
  g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
6
6
  (function (exports) {
@@ -737,12 +737,8 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
737
737
  }
738
738
  addEventListener(type, listener) {
739
739
  this.removeEventListener(type, listener);
740
- let arr = this.#listeners.get(type);
741
- if (!arr) {
742
- arr = [];
743
- this.#listeners.set(type, arr);
744
- }
745
- arr.push(listener);
740
+ const arr = this.#listeners.get(type);
741
+ this.#listeners.set(type, arr ? [...arr, listener] : [listener]);
746
742
  }
747
743
  dispatchEvent(type, args) {
748
744
  const listeners = this.#listeners.get(type);
@@ -774,7 +770,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
774
770
  this.#listeners.delete(type);
775
771
  }
776
772
  else {
777
- arr.splice(idx, deleteCount);
773
+ this.#listeners.set(type, [...arr.slice(minIndex, idx), ...arr.slice(idx + deleteCount)]);
778
774
  }
779
775
  }
780
776
  }
@@ -955,7 +951,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
955
951
  return this.#domArray;
956
952
  }
957
953
  get version() {
958
- return "4.5.0";
954
+ return "4.5.1";
959
955
  }
960
956
  addEventListener(type, listener) {
961
957
  this.#eventDispatcher.addEventListener(type, listener);
@@ -2748,7 +2744,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
2748
2744
  }
2749
2745
 
2750
2746
  async function loadBlendPlugin(engine) {
2751
- engine.checkVersion("4.5.0");
2747
+ engine.checkVersion("4.5.1");
2752
2748
  await engine.pluginManager.register(e => {
2753
2749
  e.pluginManager.addPlugin(new BlendPlugin());
2754
2750
  });
@@ -2785,7 +2781,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
2785
2781
  }
2786
2782
 
2787
2783
  async function loadCircleShape(engine) {
2788
- engine.checkVersion("4.5.0");
2784
+ engine.checkVersion("4.5.1");
2789
2785
  await engine.pluginManager.register(e => {
2790
2786
  e.pluginManager.addShape(["circle"], () => {
2791
2787
  return Promise.resolve(new CircleDrawer());
@@ -2833,7 +2829,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
2833
2829
  }
2834
2830
 
2835
2831
  async function loadHexColorPlugin(engine) {
2836
- engine.checkVersion("4.5.0");
2832
+ engine.checkVersion("4.5.1");
2837
2833
  await engine.pluginManager.register(e => {
2838
2834
  e.pluginManager.addColorManager("hex", new HexColorManager());
2839
2835
  });
@@ -2886,7 +2882,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
2886
2882
  }
2887
2883
 
2888
2884
  async function loadHslColorPlugin(engine) {
2889
- engine.checkVersion("4.5.0");
2885
+ engine.checkVersion("4.5.1");
2890
2886
  await engine.pluginManager.register(e => {
2891
2887
  e.pluginManager.addColorManager("hsl", new HslColorManager());
2892
2888
  });
@@ -2918,7 +2914,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
2918
2914
  }
2919
2915
 
2920
2916
  async function loadMovePlugin(engine) {
2921
- engine.checkVersion("4.5.0");
2917
+ engine.checkVersion("4.5.1");
2922
2918
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
2923
2919
  addErrorMessages(ErrorMessages$1);
2924
2920
  }
@@ -3134,7 +3130,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
3134
3130
  }
3135
3131
 
3136
3132
  async function loadOpacityUpdater(engine) {
3137
- engine.checkVersion("4.5.0");
3133
+ engine.checkVersion("4.5.1");
3138
3134
  await engine.pluginManager.register(e => {
3139
3135
  e.pluginManager.addParticleUpdater("opacity", container => {
3140
3136
  return Promise.resolve(new OpacityUpdater(container));
@@ -3463,7 +3459,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
3463
3459
  }
3464
3460
 
3465
3461
  async function loadOutModesUpdater(engine) {
3466
- engine.checkVersion("4.5.0");
3462
+ engine.checkVersion("4.5.1");
3467
3463
  await engine.pluginManager.register(e => {
3468
3464
  e.pluginManager.addParticleUpdater("outModes", container => {
3469
3465
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3542,7 +3538,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
3542
3538
  }
3543
3539
 
3544
3540
  async function loadPaintUpdater(engine) {
3545
- engine.checkVersion("4.5.0");
3541
+ engine.checkVersion("4.5.1");
3546
3542
  await engine.pluginManager.register(e => {
3547
3543
  e.pluginManager.addParticleUpdater("paint", container => {
3548
3544
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3597,7 +3593,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
3597
3593
  }
3598
3594
 
3599
3595
  async function loadRgbColorPlugin(engine) {
3600
- engine.checkVersion("4.5.0");
3596
+ engine.checkVersion("4.5.1");
3601
3597
  await engine.pluginManager.register(e => {
3602
3598
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3603
3599
  });
@@ -3682,7 +3678,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
3682
3678
  }
3683
3679
 
3684
3680
  async function loadSizeUpdater(engine) {
3685
- engine.checkVersion("4.5.0");
3681
+ engine.checkVersion("4.5.1");
3686
3682
  await engine.pluginManager.register(e => {
3687
3683
  e.pluginManager.addParticleUpdater("size", container => {
3688
3684
  return Promise.resolve(new SizeUpdater(container));
@@ -3691,7 +3687,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
3691
3687
  }
3692
3688
 
3693
3689
  async function loadBasic(engine) {
3694
- engine.checkVersion("4.5.0");
3690
+ engine.checkVersion("4.5.1");
3695
3691
  await engine.pluginManager.register(async (e) => {
3696
3692
  await Promise.all([
3697
3693
  loadBlendPlugin(e),
@@ -4022,7 +4018,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4022
4018
  }
4023
4019
 
4024
4020
  async function loadDestroyUpdater(engine) {
4025
- engine.checkVersion("4.5.0");
4021
+ engine.checkVersion("4.5.1");
4026
4022
  await engine.pluginManager.register(e => {
4027
4023
  e.pluginManager.addParticleUpdater("destroy", container => {
4028
4024
  return Promise.resolve(new DestroyUpdater(e.pluginManager, container));
@@ -4123,7 +4119,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4123
4119
  direction;
4124
4120
  domId;
4125
4121
  draggable = false;
4126
- draw = true;
4122
+ draw = false;
4127
4123
  fill = true;
4128
4124
  life = new EmitterLife();
4129
4125
  name;
@@ -4267,7 +4263,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4267
4263
  })(EmitterClickMode || (EmitterClickMode = {}));
4268
4264
 
4269
4265
  async function loadEmittersPluginSimple(engine) {
4270
- engine.checkVersion("4.5.0");
4266
+ engine.checkVersion("4.5.1");
4271
4267
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
4272
4268
  addErrorMessages(ErrorMessages);
4273
4269
  }
@@ -4416,7 +4412,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4416
4412
  }
4417
4413
 
4418
4414
  async function loadEmittersShapeSquare(engine) {
4419
- engine.checkVersion("4.5.0");
4415
+ engine.checkVersion("4.5.1");
4420
4416
  await engine.pluginManager.register((e) => {
4421
4417
  ensureEmittersPluginLoaded(e);
4422
4418
  e.pluginManager.addEmitterShapeGenerator?.("square", new EmittersSquareShapeGenerator());
@@ -4498,7 +4494,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4498
4494
  particle.destroy();
4499
4495
  return;
4500
4496
  }
4501
- const widthRange = setRangeValue(minCanvasSize, canvasSize.width), heightRange = setRangeValue(minCanvasSize, canvasSize.width);
4497
+ const widthRange = setRangeValue(minCanvasSize, canvasSize.width), heightRange = setRangeValue(minCanvasSize, canvasSize.height);
4502
4498
  particle.position.x = randomInRangeValue(widthRange);
4503
4499
  particle.position.y = randomInRangeValue(heightRange);
4504
4500
  particle.spawning = true;
@@ -4560,7 +4556,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4560
4556
  }
4561
4557
 
4562
4558
  async function loadLifeUpdater(engine) {
4563
- engine.checkVersion("4.5.0");
4559
+ engine.checkVersion("4.5.1");
4564
4560
  await engine.pluginManager.register(e => {
4565
4561
  e.pluginManager.addParticleUpdater("life", container => {
4566
4562
  return Promise.resolve(new LifeUpdater(container));
@@ -4586,7 +4582,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4586
4582
  }
4587
4583
 
4588
4584
  async function loadLineShape(engine) {
4589
- engine.checkVersion("4.5.0");
4585
+ engine.checkVersion("4.5.1");
4590
4586
  await engine.pluginManager.register(e => {
4591
4587
  e.pluginManager.addShape(["line"], () => Promise.resolve(new LineDrawer()));
4592
4588
  });
@@ -4690,7 +4686,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
4690
4686
  }
4691
4687
 
4692
4688
  async function loadRotateUpdater(engine) {
4693
- engine.checkVersion("4.5.0");
4689
+ engine.checkVersion("4.5.1");
4694
4690
  await engine.pluginManager.register(e => {
4695
4691
  e.pluginManager.addParticleUpdater("rotate", container => {
4696
4692
  return Promise.resolve(new RotateUpdater(container));
@@ -5006,7 +5002,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
5006
5002
  }
5007
5003
 
5008
5004
  async function loadSoundsPlugin(engine) {
5009
- engine.checkVersion("4.5.0");
5005
+ engine.checkVersion("4.5.1");
5010
5006
  await engine.pluginManager.register(e => {
5011
5007
  e.pluginManager.addPlugin(new SoundsPlugin(e));
5012
5008
  });
@@ -5014,7 +5010,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
5014
5010
 
5015
5011
  let initPromise = null;
5016
5012
  async function doInitPlugins(engine) {
5017
- engine.checkVersion("4.5.0");
5013
+ engine.checkVersion("4.5.1");
5018
5014
  await engine.pluginManager.register(async (e) => {
5019
5015
  const loadEmittersForFireworks = async (e) => {
5020
5016
  await loadEmittersPluginSimple(e);
@@ -5061,7 +5057,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
5061
5057
  fireworks.init = async () => {
5062
5058
  await initPlugins(tsParticles);
5063
5059
  };
5064
- fireworks.version = "4.5.0";
5060
+ fireworks.version = "4.5.1";
5065
5061
  globalThis.fireworks = fireworks;
5066
5062
 
5067
5063
  const globalObject = globalThis;
@@ -5988,6 +5984,10 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
5988
5984
  this.#manageListeners(true);
5989
5985
  }
5990
5986
  removeListeners() {
5987
+ if (this.#resizeTimeout !== undefined) {
5988
+ clearTimeout(this.#resizeTimeout);
5989
+ this.#resizeTimeout = undefined;
5990
+ }
5991
5991
  this.#manageListeners(false);
5992
5992
  }
5993
5993
  #handleVisibilityChange() {
@@ -6642,14 +6642,22 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
6642
6642
  return out;
6643
6643
  }
6644
6644
  queryCircle(position, radius, check, out = []) {
6645
- const circle = this.#acquireCircle(position.x, position.y, radius), result = this.query(circle, check, out);
6646
- this.#releaseShapes();
6647
- return result;
6645
+ const circle = this.#acquireCircle(position.x, position.y, radius);
6646
+ try {
6647
+ return this.query(circle, check, out);
6648
+ }
6649
+ finally {
6650
+ this.#circlePoolIdx--;
6651
+ }
6648
6652
  }
6649
6653
  queryRectangle(position, size, check, out = []) {
6650
- const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height), result = this.query(rect, check, out);
6651
- this.#releaseShapes();
6652
- return result;
6654
+ const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height);
6655
+ try {
6656
+ return this.query(rect, check, out);
6657
+ }
6658
+ finally {
6659
+ this.#rectanglePoolIdx--;
6660
+ }
6653
6661
  }
6654
6662
  #acquireCircle(x, y, r) {
6655
6663
  const idx = this.#circlePoolIdx++;
@@ -6708,10 +6716,6 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
6708
6716
  }
6709
6717
  }
6710
6718
  }
6711
- #releaseShapes() {
6712
- this.#circlePoolIdx = 0;
6713
- this.#rectanglePoolIdx = 0;
6714
- }
6715
6719
  }
6716
6720
 
6717
6721
  class ParticlesManager {
@@ -7259,6 +7263,7 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
7259
7263
  started;
7260
7264
  zLayers;
7261
7265
  #delay;
7266
+ #delayResolve;
7262
7267
  #delayTimeout;
7263
7268
  #delta = { value: 0, factor: 0 };
7264
7269
  #dispatchCallback;
@@ -7497,7 +7502,10 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
7497
7502
  await this.init();
7498
7503
  this.started = true;
7499
7504
  await new Promise(resolve => {
7505
+ this.#delayResolve = resolve;
7500
7506
  const start = async () => {
7507
+ this.#delayTimeout = undefined;
7508
+ this.#delayResolve = undefined;
7501
7509
  this.#eventListeners.addListeners();
7502
7510
  for (const plugin of this.plugins) {
7503
7511
  await plugin.start?.();
@@ -7513,9 +7521,11 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
7513
7521
  if (!guardCheck(this) || !this.started) {
7514
7522
  return;
7515
7523
  }
7516
- if (this.#delayTimeout) {
7524
+ if (this.#delayTimeout !== undefined) {
7517
7525
  clearTimeout(this.#delayTimeout);
7518
7526
  this.#delayTimeout = undefined;
7527
+ this.#delayResolve?.();
7528
+ this.#delayResolve = undefined;
7519
7529
  }
7520
7530
  this.#firstStart = true;
7521
7531
  this.started = false;
@@ -8668,8 +8678,10 @@ g.__tsParticlesInternals.bundles = g.__tsParticlesInternals.bundles || {};
8668
8678
  this.#lifeCount--;
8669
8679
  }
8670
8680
  if (this.#lifeCount > minLifeCount || this.#immortal) {
8671
- this.position = this.#calcPosition();
8672
- this.#shape?.resize(this.position, this.size);
8681
+ if (!this.#positionOverride) {
8682
+ this.position = this.#calcPosition();
8683
+ this.#shape?.resize(this.position, this.size);
8684
+ }
8673
8685
  this.#spawnDelay = container.retina.reduceFactor
8674
8686
  ? (getRangeValue(this.options.life.delay ?? defaultLifeDelay) * millisecondsToSeconds) /
8675
8687
  container.retina.reduceFactor