@tsparticles/preset-matrix 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);
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),
@@ -3442,7 +3438,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3442
3438
  }
3443
3439
 
3444
3440
  async function loadMatrixShape(engine) {
3445
- engine.checkVersion("4.5.0");
3441
+ engine.checkVersion("4.5.1");
3446
3442
  await engine.pluginManager.register(e => {
3447
3443
  e.pluginManager.addShape(["matrix"], () => Promise.resolve(new MatrixDrawer()));
3448
3444
  });
@@ -3487,7 +3483,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3487
3483
  }
3488
3484
 
3489
3485
  async function loadPoissonDiscPlugin(engine) {
3490
- engine.checkVersion("4.5.0");
3486
+ engine.checkVersion("4.5.1");
3491
3487
  await engine.pluginManager.register(e => {
3492
3488
  e.pluginManager.addPlugin(new PoissonDiscPlugin());
3493
3489
  });
@@ -3529,7 +3525,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3529
3525
  }
3530
3526
 
3531
3527
  async function loadShadowEffect(engine) {
3532
- engine.checkVersion("4.5.0");
3528
+ engine.checkVersion("4.5.1");
3533
3529
  await engine.pluginManager.register(e => {
3534
3530
  e.pluginManager.addEffect("shadow", container => {
3535
3531
  return Promise.resolve(new ShadowDrawer(e.pluginManager, container));
@@ -3593,7 +3589,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
3593
3589
  }
3594
3590
 
3595
3591
  async function loadTrailPlugin(engine) {
3596
- engine.checkVersion("4.5.0");
3592
+ engine.checkVersion("4.5.1");
3597
3593
  await engine.pluginManager.register(e => {
3598
3594
  e.pluginManager.addPlugin(new TrailPlugin(e.pluginManager));
3599
3595
  });
@@ -4615,6 +4611,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
4615
4611
  this.#manageListeners(true);
4616
4612
  }
4617
4613
  removeListeners() {
4614
+ if (this.#resizeTimeout !== undefined) {
4615
+ clearTimeout(this.#resizeTimeout);
4616
+ this.#resizeTimeout = undefined;
4617
+ }
4618
4618
  this.#manageListeners(false);
4619
4619
  }
4620
4620
  #handleVisibilityChange() {
@@ -5269,14 +5269,22 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5269
5269
  return out;
5270
5270
  }
5271
5271
  queryCircle(position, radius, check, out = []) {
5272
- const circle = this.#acquireCircle(position.x, position.y, radius), result = this.query(circle, check, out);
5273
- this.#releaseShapes();
5274
- return result;
5272
+ const circle = this.#acquireCircle(position.x, position.y, radius);
5273
+ try {
5274
+ return this.query(circle, check, out);
5275
+ }
5276
+ finally {
5277
+ this.#circlePoolIdx--;
5278
+ }
5275
5279
  }
5276
5280
  queryRectangle(position, size, check, out = []) {
5277
- const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height), result = this.query(rect, check, out);
5278
- this.#releaseShapes();
5279
- return result;
5281
+ const rect = this.#acquireRectangle(position.x, position.y, size.width, size.height);
5282
+ try {
5283
+ return this.query(rect, check, out);
5284
+ }
5285
+ finally {
5286
+ this.#rectanglePoolIdx--;
5287
+ }
5280
5288
  }
5281
5289
  #acquireCircle(x, y, r) {
5282
5290
  const idx = this.#circlePoolIdx++;
@@ -5335,10 +5343,6 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5335
5343
  }
5336
5344
  }
5337
5345
  }
5338
- #releaseShapes() {
5339
- this.#circlePoolIdx = 0;
5340
- this.#rectanglePoolIdx = 0;
5341
- }
5342
5346
  }
5343
5347
 
5344
5348
  class ParticlesManager {
@@ -5886,6 +5890,7 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
5886
5890
  started;
5887
5891
  zLayers;
5888
5892
  #delay;
5893
+ #delayResolve;
5889
5894
  #delayTimeout;
5890
5895
  #delta = { value: 0, factor: 0 };
5891
5896
  #dispatchCallback;
@@ -6124,7 +6129,10 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6124
6129
  await this.init();
6125
6130
  this.started = true;
6126
6131
  await new Promise(resolve => {
6132
+ this.#delayResolve = resolve;
6127
6133
  const start = async () => {
6134
+ this.#delayTimeout = undefined;
6135
+ this.#delayResolve = undefined;
6128
6136
  this.#eventListeners.addListeners();
6129
6137
  for (const plugin of this.plugins) {
6130
6138
  await plugin.start?.();
@@ -6140,9 +6148,11 @@ g.__tsParticlesInternals.presets = g.__tsParticlesInternals.presets || {};
6140
6148
  if (!guardCheck(this) || !this.started) {
6141
6149
  return;
6142
6150
  }
6143
- if (this.#delayTimeout) {
6151
+ if (this.#delayTimeout !== undefined) {
6144
6152
  clearTimeout(this.#delayTimeout);
6145
6153
  this.#delayTimeout = undefined;
6154
+ this.#delayResolve?.();
6155
+ this.#delayResolve = undefined;
6146
6156
  }
6147
6157
  this.#firstStart = true;
6148
6158
  this.started = false;