@tsparticles/preset-hyperspace 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
  }
@@ -2666,7 +2662,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2666
2662
  }
2667
2663
 
2668
2664
  async function loadOpacityUpdater(engine) {
2669
- engine.checkVersion("4.5.0");
2665
+ engine.checkVersion("4.5.1");
2670
2666
  await engine.pluginManager.register(e => {
2671
2667
  e.pluginManager.addParticleUpdater("opacity", container => {
2672
2668
  return Promise.resolve(new OpacityUpdater(container));
@@ -2995,7 +2991,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
2995
2991
  }
2996
2992
 
2997
2993
  async function loadOutModesUpdater(engine) {
2998
- engine.checkVersion("4.5.0");
2994
+ engine.checkVersion("4.5.1");
2999
2995
  await engine.pluginManager.register(e => {
3000
2996
  e.pluginManager.addParticleUpdater("outModes", container => {
3001
2997
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3074,7 +3070,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3074
3070
  }
3075
3071
 
3076
3072
  async function loadPaintUpdater(engine) {
3077
- engine.checkVersion("4.5.0");
3073
+ engine.checkVersion("4.5.1");
3078
3074
  await engine.pluginManager.register(e => {
3079
3075
  e.pluginManager.addParticleUpdater("paint", container => {
3080
3076
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3129,7 +3125,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3129
3125
  }
3130
3126
 
3131
3127
  async function loadRgbColorPlugin(engine) {
3132
- engine.checkVersion("4.5.0");
3128
+ engine.checkVersion("4.5.1");
3133
3129
  await engine.pluginManager.register(e => {
3134
3130
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3135
3131
  });
@@ -3214,7 +3210,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3214
3210
  }
3215
3211
 
3216
3212
  async function loadSizeUpdater(engine) {
3217
- engine.checkVersion("4.5.0");
3213
+ engine.checkVersion("4.5.1");
3218
3214
  await engine.pluginManager.register(e => {
3219
3215
  e.pluginManager.addParticleUpdater("size", container => {
3220
3216
  return Promise.resolve(new SizeUpdater(container));
@@ -3223,7 +3219,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3223
3219
  }
3224
3220
 
3225
3221
  async function loadBasic(engine) {
3226
- engine.checkVersion("4.5.0");
3222
+ engine.checkVersion("4.5.1");
3227
3223
  await engine.pluginManager.register(async (e) => {
3228
3224
  await Promise.all([
3229
3225
  loadBlendPlugin(e),
@@ -3333,7 +3329,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3333
3329
  direction;
3334
3330
  domId;
3335
3331
  draggable = false;
3336
- draw = true;
3332
+ draw = false;
3337
3333
  fill = true;
3338
3334
  life = new EmitterLife();
3339
3335
  name;
@@ -3477,7 +3473,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3477
3473
  })(EmitterClickMode || (EmitterClickMode = {}));
3478
3474
 
3479
3475
  async function loadEmittersPluginSimple(engine) {
3480
- engine.checkVersion("4.5.0");
3476
+ engine.checkVersion("4.5.1");
3481
3477
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
3482
3478
  addErrorMessages(ErrorMessages);
3483
3479
  }
@@ -3626,7 +3622,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3626
3622
  }
3627
3623
 
3628
3624
  async function loadEmittersShapeSquare(engine) {
3629
- engine.checkVersion("4.5.0");
3625
+ engine.checkVersion("4.5.1");
3630
3626
  await engine.pluginManager.register((e) => {
3631
3627
  ensureEmittersPluginLoaded(e);
3632
3628
  e.pluginManager.addEmitterShapeGenerator?.("square", new EmittersSquareShapeGenerator());
@@ -3708,7 +3704,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3708
3704
  particle.destroy();
3709
3705
  return;
3710
3706
  }
3711
- const widthRange = setRangeValue(minCanvasSize, canvasSize.width), heightRange = setRangeValue(minCanvasSize, canvasSize.width);
3707
+ const widthRange = setRangeValue(minCanvasSize, canvasSize.width), heightRange = setRangeValue(minCanvasSize, canvasSize.height);
3712
3708
  particle.position.x = randomInRangeValue(widthRange);
3713
3709
  particle.position.y = randomInRangeValue(heightRange);
3714
3710
  particle.spawning = true;
@@ -3770,7 +3766,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3770
3766
  }
3771
3767
 
3772
3768
  async function loadLifeUpdater(engine) {
3773
- engine.checkVersion("4.5.0");
3769
+ engine.checkVersion("4.5.1");
3774
3770
  await engine.pluginManager.register(e => {
3775
3771
  e.pluginManager.addParticleUpdater("life", container => {
3776
3772
  return Promise.resolve(new LifeUpdater(container));
@@ -3834,7 +3830,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3834
3830
  }
3835
3831
 
3836
3832
  async function loadTrailPlugin(engine) {
3837
- engine.checkVersion("4.5.0");
3833
+ engine.checkVersion("4.5.1");
3838
3834
  await engine.pluginManager.register(e => {
3839
3835
  e.pluginManager.addPlugin(new TrailPlugin(e.pluginManager));
3840
3836
  });
@@ -4843,6 +4839,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
4843
4839
  this.#manageListeners(true);
4844
4840
  }
4845
4841
  removeListeners() {
4842
+ if (this.#resizeTimeout !== undefined) {
4843
+ clearTimeout(this.#resizeTimeout);
4844
+ this.#resizeTimeout = undefined;
4845
+ }
4846
4846
  this.#manageListeners(false);
4847
4847
  }
4848
4848
  #handleVisibilityChange() {
@@ -5497,14 +5497,22 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5497
5497
  return out;
5498
5498
  }
5499
5499
  queryCircle(position, radius, check, out = []) {
5500
- const circle = this.#acquireCircle(position.x, position.y, radius), result = this.query(circle, check, out);
5501
- this.#releaseShapes();
5502
- return result;
5500
+ const circle = this.#acquireCircle(position.x, position.y, radius);
5501
+ try {
5502
+ return this.query(circle, check, out);
5503
+ }
5504
+ finally {
5505
+ this.#circlePoolIdx--;
5506
+ }
5503
5507
  }
5504
5508
  queryRectangle(position, size, check, out = []) {
5505
- const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height), result = this.query(rect, check, out);
5506
- this.#releaseShapes();
5507
- return result;
5509
+ const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height);
5510
+ try {
5511
+ return this.query(rect, check, out);
5512
+ }
5513
+ finally {
5514
+ this.#rectanglePoolIdx--;
5515
+ }
5508
5516
  }
5509
5517
  #acquireCircle(x, y, r) {
5510
5518
  const idx = this.#circlePoolIdx++;
@@ -5563,10 +5571,6 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5563
5571
  }
5564
5572
  }
5565
5573
  }
5566
- #releaseShapes() {
5567
- this.#circlePoolIdx = 0;
5568
- this.#rectanglePoolIdx = 0;
5569
- }
5570
5574
  }
5571
5575
 
5572
5576
  class ParticlesManager {
@@ -6114,6 +6118,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6114
6118
  started;
6115
6119
  zLayers;
6116
6120
  #delay;
6121
+ #delayResolve;
6117
6122
  #delayTimeout;
6118
6123
  #delta = { value: 0, factor: 0 };
6119
6124
  #dispatchCallback;
@@ -6352,7 +6357,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6352
6357
  await this.init();
6353
6358
  this.started = true;
6354
6359
  await new Promise(resolve => {
6360
+ this.#delayResolve = resolve;
6355
6361
  const start = async () => {
6362
+ this.#delayTimeout = undefined;
6363
+ this.#delayResolve = undefined;
6356
6364
  this.#eventListeners.addListeners();
6357
6365
  for (const plugin of this.plugins) {
6358
6366
  await plugin.start?.();
@@ -6368,9 +6376,11 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6368
6376
  if (!guardCheck(this) || !this.started) {
6369
6377
  return;
6370
6378
  }
6371
- if (this.#delayTimeout) {
6379
+ if (this.#delayTimeout !== undefined) {
6372
6380
  clearTimeout(this.#delayTimeout);
6373
6381
  this.#delayTimeout = undefined;
6382
+ this.#delayResolve?.();
6383
+ this.#delayResolve = undefined;
6374
6384
  }
6375
6385
  this.#firstStart = true;
6376
6386
  this.started = false;
@@ -7124,8 +7134,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
7124
7134
  this.#lifeCount--;
7125
7135
  }
7126
7136
  if (this.#lifeCount > minLifeCount || this.#immortal) {
7127
- this.position = this.#calcPosition();
7128
- this.#shape?.resize(this.position, this.size);
7137
+ if (!this.#positionOverride) {
7138
+ this.position = this.#calcPosition();
7139
+ this.#shape?.resize(this.position, this.size);
7140
+ }
7129
7141
  this.#spawnDelay = container.retina.reduceFactor
7130
7142
  ? (getRangeValue(this.options.life.delay ?? defaultLifeDelay) * millisecondsToSeconds) /
7131
7143
  container.retina.reduceFactor