@tsparticles/preset-confetti-explosions 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) {
@@ -667,12 +667,8 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
667
667
  }
668
668
  addEventListener(type, listener) {
669
669
  this.removeEventListener(type, listener);
670
- let arr = this.#listeners.get(type);
671
- if (!arr) {
672
- arr = [];
673
- this.#listeners.set(type, arr);
674
- }
675
- arr.push(listener);
670
+ const arr = this.#listeners.get(type);
671
+ this.#listeners.set(type, arr ? [...arr, listener] : [listener]);
676
672
  }
677
673
  dispatchEvent(type, args) {
678
674
  const listeners = this.#listeners.get(type);
@@ -704,7 +700,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
704
700
  this.#listeners.delete(type);
705
701
  }
706
702
  else {
707
- arr.splice(idx, deleteCount);
703
+ this.#listeners.set(type, [...arr.slice(minIndex, idx), ...arr.slice(idx + deleteCount)]);
708
704
  }
709
705
  }
710
706
  }
@@ -885,7 +881,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
885
881
  return this.#domArray;
886
882
  }
887
883
  get version() {
888
- return "4.5.0";
884
+ return "4.5.1";
889
885
  }
890
886
  addEventListener(type, listener) {
891
887
  this.#eventDispatcher.addEventListener(type, listener);
@@ -2286,7 +2282,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2286
2282
  }
2287
2283
 
2288
2284
  async function loadBlendPlugin(engine) {
2289
- engine.checkVersion("4.5.0");
2285
+ engine.checkVersion("4.5.1");
2290
2286
  await engine.pluginManager.register(e => {
2291
2287
  e.pluginManager.addPlugin(new BlendPlugin());
2292
2288
  });
@@ -2323,7 +2319,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2323
2319
  }
2324
2320
 
2325
2321
  async function loadCircleShape(engine) {
2326
- engine.checkVersion("4.5.0");
2322
+ engine.checkVersion("4.5.1");
2327
2323
  await engine.pluginManager.register(e => {
2328
2324
  e.pluginManager.addShape(["circle"], () => {
2329
2325
  return Promise.resolve(new CircleDrawer());
@@ -2371,7 +2367,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2371
2367
  }
2372
2368
 
2373
2369
  async function loadHexColorPlugin(engine) {
2374
- engine.checkVersion("4.5.0");
2370
+ engine.checkVersion("4.5.1");
2375
2371
  await engine.pluginManager.register(e => {
2376
2372
  e.pluginManager.addColorManager("hex", new HexColorManager());
2377
2373
  });
@@ -2424,7 +2420,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2424
2420
  }
2425
2421
 
2426
2422
  async function loadHslColorPlugin(engine) {
2427
- engine.checkVersion("4.5.0");
2423
+ engine.checkVersion("4.5.1");
2428
2424
  await engine.pluginManager.register(e => {
2429
2425
  e.pluginManager.addColorManager("hsl", new HslColorManager());
2430
2426
  });
@@ -2456,7 +2452,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2456
2452
  }
2457
2453
 
2458
2454
  async function loadMovePlugin(engine) {
2459
- engine.checkVersion("4.5.0");
2455
+ engine.checkVersion("4.5.1");
2460
2456
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
2461
2457
  addErrorMessages(ErrorMessages$1);
2462
2458
  }
@@ -2672,7 +2668,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2672
2668
  }
2673
2669
 
2674
2670
  async function loadOpacityUpdater(engine) {
2675
- engine.checkVersion("4.5.0");
2671
+ engine.checkVersion("4.5.1");
2676
2672
  await engine.pluginManager.register(e => {
2677
2673
  e.pluginManager.addParticleUpdater("opacity", container => {
2678
2674
  return Promise.resolve(new OpacityUpdater(container));
@@ -3001,7 +2997,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3001
2997
  }
3002
2998
 
3003
2999
  async function loadOutModesUpdater(engine) {
3004
- engine.checkVersion("4.5.0");
3000
+ engine.checkVersion("4.5.1");
3005
3001
  await engine.pluginManager.register(e => {
3006
3002
  e.pluginManager.addParticleUpdater("outModes", container => {
3007
3003
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3080,7 +3076,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3080
3076
  }
3081
3077
 
3082
3078
  async function loadPaintUpdater(engine) {
3083
- engine.checkVersion("4.5.0");
3079
+ engine.checkVersion("4.5.1");
3084
3080
  await engine.pluginManager.register(e => {
3085
3081
  e.pluginManager.addParticleUpdater("paint", container => {
3086
3082
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3135,7 +3131,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3135
3131
  }
3136
3132
 
3137
3133
  async function loadRgbColorPlugin(engine) {
3138
- engine.checkVersion("4.5.0");
3134
+ engine.checkVersion("4.5.1");
3139
3135
  await engine.pluginManager.register(e => {
3140
3136
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3141
3137
  });
@@ -3220,7 +3216,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3220
3216
  }
3221
3217
 
3222
3218
  async function loadSizeUpdater(engine) {
3223
- engine.checkVersion("4.5.0");
3219
+ engine.checkVersion("4.5.1");
3224
3220
  await engine.pluginManager.register(e => {
3225
3221
  e.pluginManager.addParticleUpdater("size", container => {
3226
3222
  return Promise.resolve(new SizeUpdater(container));
@@ -3229,7 +3225,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3229
3225
  }
3230
3226
 
3231
3227
  async function loadBasic(engine) {
3232
- engine.checkVersion("4.5.0");
3228
+ engine.checkVersion("4.5.1");
3233
3229
  await engine.pluginManager.register(async (e) => {
3234
3230
  await Promise.all([
3235
3231
  loadBlendPlugin(e),
@@ -3369,7 +3365,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3369
3365
  direction;
3370
3366
  domId;
3371
3367
  draggable = false;
3372
- draw = true;
3368
+ draw = false;
3373
3369
  fill = true;
3374
3370
  life = new EmitterLife();
3375
3371
  name;
@@ -3494,7 +3490,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3494
3490
  })(EmitterClickMode || (EmitterClickMode = {}));
3495
3491
 
3496
3492
  async function loadEmittersPluginSimple(engine) {
3497
- engine.checkVersion("4.5.0");
3493
+ engine.checkVersion("4.5.1");
3498
3494
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
3499
3495
  addErrorMessages(ErrorMessages);
3500
3496
  }
@@ -3551,7 +3547,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3551
3547
  }
3552
3548
 
3553
3549
  async function loadMotionPlugin(engine) {
3554
- engine.checkVersion("4.5.0");
3550
+ engine.checkVersion("4.5.1");
3555
3551
  await engine.pluginManager.register(e => {
3556
3552
  e.pluginManager.addPlugin(new MotionPlugin());
3557
3553
  });
@@ -3684,7 +3680,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3684
3680
  }
3685
3681
 
3686
3682
  async function loadRollUpdater(engine) {
3687
- engine.checkVersion("4.5.0");
3683
+ engine.checkVersion("4.5.1");
3688
3684
  await engine.pluginManager.register(e => {
3689
3685
  e.pluginManager.addParticleUpdater("roll", () => {
3690
3686
  return Promise.resolve(new RollUpdater(e.pluginManager));
@@ -3790,7 +3786,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3790
3786
  }
3791
3787
 
3792
3788
  async function loadRotateUpdater(engine) {
3793
- engine.checkVersion("4.5.0");
3789
+ engine.checkVersion("4.5.1");
3794
3790
  await engine.pluginManager.register(e => {
3795
3791
  e.pluginManager.addParticleUpdater("rotate", container => {
3796
3792
  return Promise.resolve(new RotateUpdater(container));
@@ -3814,7 +3810,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3814
3810
  }
3815
3811
 
3816
3812
  async function loadSquareShape(engine) {
3817
- engine.checkVersion("4.5.0");
3813
+ engine.checkVersion("4.5.1");
3818
3814
  await engine.pluginManager.register(e => {
3819
3815
  e.pluginManager.addShape(["edge", "square"], () => Promise.resolve(new SquareDrawer()));
3820
3816
  });
@@ -3923,7 +3919,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3923
3919
  }
3924
3920
 
3925
3921
  async function loadTiltUpdater(engine) {
3926
- engine.checkVersion("4.5.0");
3922
+ engine.checkVersion("4.5.1");
3927
3923
  await engine.pluginManager.register(e => {
3928
3924
  e.pluginManager.addParticleUpdater("tilt", container => {
3929
3925
  return Promise.resolve(new TiltUpdater(container));
@@ -4025,7 +4021,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
4025
4021
  }
4026
4022
 
4027
4023
  async function loadWobbleUpdater(engine) {
4028
- engine.checkVersion("4.5.0");
4024
+ engine.checkVersion("4.5.1");
4029
4025
  await engine.pluginManager.register(e => {
4030
4026
  e.pluginManager.addParticleUpdater("wobble", container => {
4031
4027
  return Promise.resolve(new WobbleUpdater(container));
@@ -5107,6 +5103,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5107
5103
  this.#manageListeners(true);
5108
5104
  }
5109
5105
  removeListeners() {
5106
+ if (this.#resizeTimeout !== undefined) {
5107
+ clearTimeout(this.#resizeTimeout);
5108
+ this.#resizeTimeout = undefined;
5109
+ }
5110
5110
  this.#manageListeners(false);
5111
5111
  }
5112
5112
  #handleVisibilityChange() {
@@ -5761,14 +5761,22 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5761
5761
  return out;
5762
5762
  }
5763
5763
  queryCircle(position, radius, check, out = []) {
5764
- const circle = this.#acquireCircle(position.x, position.y, radius), result = this.query(circle, check, out);
5765
- this.#releaseShapes();
5766
- return result;
5764
+ const circle = this.#acquireCircle(position.x, position.y, radius);
5765
+ try {
5766
+ return this.query(circle, check, out);
5767
+ }
5768
+ finally {
5769
+ this.#circlePoolIdx--;
5770
+ }
5767
5771
  }
5768
5772
  queryRectangle(position, size, check, out = []) {
5769
- const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height), result = this.query(rect, check, out);
5770
- this.#releaseShapes();
5771
- return result;
5773
+ const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height);
5774
+ try {
5775
+ return this.query(rect, check, out);
5776
+ }
5777
+ finally {
5778
+ this.#rectanglePoolIdx--;
5779
+ }
5772
5780
  }
5773
5781
  #acquireCircle(x, y, r) {
5774
5782
  const idx = this.#circlePoolIdx++;
@@ -5827,10 +5835,6 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5827
5835
  }
5828
5836
  }
5829
5837
  }
5830
- #releaseShapes() {
5831
- this.#circlePoolIdx = 0;
5832
- this.#rectanglePoolIdx = 0;
5833
- }
5834
5838
  }
5835
5839
 
5836
5840
  class ParticlesManager {
@@ -6378,6 +6382,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6378
6382
  started;
6379
6383
  zLayers;
6380
6384
  #delay;
6385
+ #delayResolve;
6381
6386
  #delayTimeout;
6382
6387
  #delta = { value: 0, factor: 0 };
6383
6388
  #dispatchCallback;
@@ -6616,7 +6621,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6616
6621
  await this.init();
6617
6622
  this.started = true;
6618
6623
  await new Promise(resolve => {
6624
+ this.#delayResolve = resolve;
6619
6625
  const start = async () => {
6626
+ this.#delayTimeout = undefined;
6627
+ this.#delayResolve = undefined;
6620
6628
  this.#eventListeners.addListeners();
6621
6629
  for (const plugin of this.plugins) {
6622
6630
  await plugin.start?.();
@@ -6632,9 +6640,11 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6632
6640
  if (!guardCheck(this) || !this.started) {
6633
6641
  return;
6634
6642
  }
6635
- if (this.#delayTimeout) {
6643
+ if (this.#delayTimeout !== undefined) {
6636
6644
  clearTimeout(this.#delayTimeout);
6637
6645
  this.#delayTimeout = undefined;
6646
+ this.#delayResolve?.();
6647
+ this.#delayResolve = undefined;
6638
6648
  }
6639
6649
  this.#firstStart = true;
6640
6650
  this.started = false;
@@ -7416,8 +7426,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
7416
7426
  this.#lifeCount--;
7417
7427
  }
7418
7428
  if (this.#lifeCount > minLifeCount || this.#immortal) {
7419
- this.position = this.#calcPosition();
7420
- this.#shape?.resize(this.position, this.size);
7429
+ if (!this.#positionOverride) {
7430
+ this.position = this.#calcPosition();
7431
+ this.#shape?.resize(this.position, this.size);
7432
+ }
7421
7433
  this.#spawnDelay = container.retina.reduceFactor
7422
7434
  ? (getRangeValue(this.options.life.delay ?? defaultLifeDelay) * millisecondsToSeconds) /
7423
7435
  container.retina.reduceFactor