@tsparticles/preset-bubbles 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;
@@ -3458,7 +3454,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3458
3454
  })(EmitterClickMode || (EmitterClickMode = {}));
3459
3455
 
3460
3456
  async function loadEmittersPluginSimple(engine) {
3461
- engine.checkVersion("4.5.0");
3457
+ engine.checkVersion("4.5.1");
3462
3458
  if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
3463
3459
  addErrorMessages(ErrorMessages);
3464
3460
  }
@@ -4458,6 +4454,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
4458
4454
  this.#manageListeners(true);
4459
4455
  }
4460
4456
  removeListeners() {
4457
+ if (this.#resizeTimeout !== undefined) {
4458
+ clearTimeout(this.#resizeTimeout);
4459
+ this.#resizeTimeout = undefined;
4460
+ }
4461
4461
  this.#manageListeners(false);
4462
4462
  }
4463
4463
  #handleVisibilityChange() {
@@ -5112,14 +5112,22 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5112
5112
  return out;
5113
5113
  }
5114
5114
  queryCircle(position, radius, check, out = []) {
5115
- const circle = this.#acquireCircle(position.x, position.y, radius), result = this.query(circle, check, out);
5116
- this.#releaseShapes();
5117
- return result;
5115
+ const circle = this.#acquireCircle(position.x, position.y, radius);
5116
+ try {
5117
+ return this.query(circle, check, out);
5118
+ }
5119
+ finally {
5120
+ this.#circlePoolIdx--;
5121
+ }
5118
5122
  }
5119
5123
  queryRectangle(position, size, check, out = []) {
5120
- const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height), result = this.query(rect, check, out);
5121
- this.#releaseShapes();
5122
- return result;
5124
+ const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height);
5125
+ try {
5126
+ return this.query(rect, check, out);
5127
+ }
5128
+ finally {
5129
+ this.#rectanglePoolIdx--;
5130
+ }
5123
5131
  }
5124
5132
  #acquireCircle(x, y, r) {
5125
5133
  const idx = this.#circlePoolIdx++;
@@ -5178,10 +5186,6 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5178
5186
  }
5179
5187
  }
5180
5188
  }
5181
- #releaseShapes() {
5182
- this.#circlePoolIdx = 0;
5183
- this.#rectanglePoolIdx = 0;
5184
- }
5185
5189
  }
5186
5190
 
5187
5191
  class ParticlesManager {
@@ -5729,6 +5733,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5729
5733
  started;
5730
5734
  zLayers;
5731
5735
  #delay;
5736
+ #delayResolve;
5732
5737
  #delayTimeout;
5733
5738
  #delta = { value: 0, factor: 0 };
5734
5739
  #dispatchCallback;
@@ -5967,7 +5972,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5967
5972
  await this.init();
5968
5973
  this.started = true;
5969
5974
  await new Promise(resolve => {
5975
+ this.#delayResolve = resolve;
5970
5976
  const start = async () => {
5977
+ this.#delayTimeout = undefined;
5978
+ this.#delayResolve = undefined;
5971
5979
  this.#eventListeners.addListeners();
5972
5980
  for (const plugin of this.plugins) {
5973
5981
  await plugin.start?.();
@@ -5983,9 +5991,11 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5983
5991
  if (!guardCheck(this) || !this.started) {
5984
5992
  return;
5985
5993
  }
5986
- if (this.#delayTimeout) {
5994
+ if (this.#delayTimeout !== undefined) {
5987
5995
  clearTimeout(this.#delayTimeout);
5988
5996
  this.#delayTimeout = undefined;
5997
+ this.#delayResolve?.();
5998
+ this.#delayResolve = undefined;
5989
5999
  }
5990
6000
  this.#firstStart = true;
5991
6001
  this.started = false;
@@ -6712,8 +6722,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6712
6722
  this.#lifeCount--;
6713
6723
  }
6714
6724
  if (this.#lifeCount > minLifeCount || this.#immortal) {
6715
- this.position = this.#calcPosition();
6716
- this.#shape?.resize(this.position, this.size);
6725
+ if (!this.#positionOverride) {
6726
+ this.position = this.#calcPosition();
6727
+ this.#shape?.resize(this.position, this.size);
6728
+ }
6717
6729
  this.#spawnDelay = container.retina.reduceFactor
6718
6730
  ? (getRangeValue(this.options.life.delay ?? defaultLifeDelay) * millisecondsToSeconds) /
6719
6731
  container.retina.reduceFactor