@tsparticles/preset-firefly 4.0.2 → 4.0.4

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,5 +1,5 @@
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);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
2
- /* Preset v4.0.2 */
2
+ /* Preset v4.0.4 */
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
5
5
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -1002,7 +1002,7 @@
1002
1002
  return this._domArray;
1003
1003
  }
1004
1004
  get version() {
1005
- return "4.0.2";
1005
+ return "4.0.4";
1006
1006
  }
1007
1007
  addEventListener(type, listener) {
1008
1008
  this._eventDispatcher.addEventListener(type, listener);
@@ -2829,6 +2829,58 @@
2829
2829
 
2830
2830
  const tsParticles = initEngine();
2831
2831
 
2832
+ class Blend {
2833
+ enable;
2834
+ mode;
2835
+ constructor() {
2836
+ this.mode = "destination-out";
2837
+ this.enable = false;
2838
+ }
2839
+ load(data) {
2840
+ if (isNull(data)) {
2841
+ return;
2842
+ }
2843
+ if (data.mode !== undefined) {
2844
+ this.mode = data.mode;
2845
+ }
2846
+ if (data.enable !== undefined) {
2847
+ this.enable = data.enable;
2848
+ }
2849
+ }
2850
+ }
2851
+
2852
+ class BlendPlugin {
2853
+ id = "blend";
2854
+ async getPlugin(container) {
2855
+ const { BlendPluginInstance } = await Promise.resolve().then(function () { return BlendPluginInstance$1; });
2856
+ return new BlendPluginInstance(container);
2857
+ }
2858
+ loadOptions(_container, options, source) {
2859
+ if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
2860
+ return;
2861
+ }
2862
+ let blendOptions = options.blend;
2863
+ if (!blendOptions?.load) {
2864
+ options.blend = blendOptions = new Blend();
2865
+ }
2866
+ blendOptions.load(source?.blend);
2867
+ }
2868
+ loadParticlesOptions(_container, options, source) {
2869
+ options.blend ??= new Blend();
2870
+ options.blend.load(source?.blend);
2871
+ }
2872
+ needsPlugin(options) {
2873
+ return !!options?.blend?.enable || !!options?.particles?.blend?.enable;
2874
+ }
2875
+ }
2876
+
2877
+ async function loadBlendPlugin(engine) {
2878
+ engine.checkVersion("4.0.4");
2879
+ await engine.pluginManager.register(e => {
2880
+ e.pluginManager.addPlugin(new BlendPlugin());
2881
+ });
2882
+ }
2883
+
2832
2884
  const minAngle$1 = 0;
2833
2885
  function drawCircle(data) {
2834
2886
  const { context, particle, radius } = data;
@@ -2860,7 +2912,7 @@
2860
2912
  }
2861
2913
 
2862
2914
  async function loadCircleShape(engine) {
2863
- engine.checkVersion("4.0.2");
2915
+ engine.checkVersion("4.0.4");
2864
2916
  await engine.pluginManager.register(e => {
2865
2917
  e.pluginManager.addShape(["circle"], () => {
2866
2918
  return Promise.resolve(new CircleDrawer());
@@ -2908,7 +2960,7 @@
2908
2960
  }
2909
2961
 
2910
2962
  async function loadHexColorPlugin(engine) {
2911
- engine.checkVersion("4.0.2");
2963
+ engine.checkVersion("4.0.4");
2912
2964
  await engine.pluginManager.register(e => {
2913
2965
  e.pluginManager.addColorManager("hex", new HexColorManager());
2914
2966
  });
@@ -2961,7 +3013,7 @@
2961
3013
  }
2962
3014
 
2963
3015
  async function loadHslColorPlugin(engine) {
2964
- engine.checkVersion("4.0.2");
3016
+ engine.checkVersion("4.0.4");
2965
3017
  await engine.pluginManager.register(e => {
2966
3018
  e.pluginManager.addColorManager("hsl", new HslColorManager());
2967
3019
  });
@@ -2985,7 +3037,7 @@
2985
3037
  }
2986
3038
 
2987
3039
  async function loadMovePlugin(engine) {
2988
- engine.checkVersion("4.0.2");
3040
+ engine.checkVersion("4.0.4");
2989
3041
  await engine.pluginManager.register(e => {
2990
3042
  const moveEngine = e, movePluginManager = moveEngine.pluginManager;
2991
3043
  movePluginManager.initializers.pathGenerators ??= new Map();
@@ -3046,7 +3098,7 @@
3046
3098
  }
3047
3099
 
3048
3100
  async function loadOpacityUpdater(engine) {
3049
- engine.checkVersion("4.0.2");
3101
+ engine.checkVersion("4.0.4");
3050
3102
  await engine.pluginManager.register(e => {
3051
3103
  e.pluginManager.addParticleUpdater("opacity", container => {
3052
3104
  return Promise.resolve(new OpacityUpdater(container));
@@ -3398,7 +3450,7 @@
3398
3450
  }
3399
3451
 
3400
3452
  async function loadOutModesUpdater(engine) {
3401
- engine.checkVersion("4.0.2");
3453
+ engine.checkVersion("4.0.4");
3402
3454
  await engine.pluginManager.register(e => {
3403
3455
  e.pluginManager.addParticleUpdater("outModes", container => {
3404
3456
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3469,7 +3521,7 @@
3469
3521
  }
3470
3522
 
3471
3523
  async function loadPaintUpdater(engine) {
3472
- engine.checkVersion("4.0.2");
3524
+ engine.checkVersion("4.0.4");
3473
3525
  await engine.pluginManager.register(e => {
3474
3526
  e.pluginManager.addParticleUpdater("paint", container => {
3475
3527
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3524,7 +3576,7 @@
3524
3576
  }
3525
3577
 
3526
3578
  async function loadRgbColorPlugin(engine) {
3527
- engine.checkVersion("4.0.2");
3579
+ engine.checkVersion("4.0.4");
3528
3580
  await engine.pluginManager.register(e => {
3529
3581
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3530
3582
  });
@@ -3567,7 +3619,7 @@
3567
3619
  }
3568
3620
 
3569
3621
  async function loadSizeUpdater(engine) {
3570
- engine.checkVersion("4.0.2");
3622
+ engine.checkVersion("4.0.4");
3571
3623
  await engine.pluginManager.register(e => {
3572
3624
  e.pluginManager.addParticleUpdater("size", container => {
3573
3625
  return Promise.resolve(new SizeUpdater(container));
@@ -3576,9 +3628,10 @@
3576
3628
  }
3577
3629
 
3578
3630
  async function loadBasic(engine) {
3579
- engine.checkVersion("4.0.2");
3631
+ engine.checkVersion("4.0.4");
3580
3632
  await engine.pluginManager.register(async (e) => {
3581
3633
  await Promise.all([
3634
+ loadBlendPlugin(e),
3582
3635
  loadHexColorPlugin(e),
3583
3636
  loadHslColorPlugin(e),
3584
3637
  loadRgbColorPlugin(e),
@@ -3813,7 +3866,7 @@
3813
3866
  const clickEvent = "click", mouseDownEvent = "pointerdown", mouseUpEvent = "pointerup", mouseLeaveEvent = "pointerleave", mouseMoveEvent = "pointermove", touchStartEvent = "touchstart", touchEndEvent = "touchend", touchMoveEvent = "touchmove", touchCancelEvent = "touchcancel";
3814
3867
 
3815
3868
  async function loadInteractivityPlugin(engine) {
3816
- engine.checkVersion("4.0.2");
3869
+ engine.checkVersion("4.0.4");
3817
3870
  await engine.pluginManager.register(e => {
3818
3871
  const interactivityEngine = e, interactivityPluginManager = interactivityEngine.pluginManager;
3819
3872
  interactivityPluginManager.addPlugin(new InteractivityPlugin(interactivityPluginManager));
@@ -4041,7 +4094,7 @@
4041
4094
  }
4042
4095
 
4043
4096
  async function loadExternalTrailInteraction(engine) {
4044
- engine.checkVersion("4.0.2");
4097
+ engine.checkVersion("4.0.4");
4045
4098
  await engine.pluginManager.register((e) => {
4046
4099
  ensureInteractivityPluginLoaded(e);
4047
4100
  e.pluginManager.addInteractor?.("externalTrail", container => {
@@ -4209,7 +4262,7 @@
4209
4262
  }
4210
4263
 
4211
4264
  async function loadLifeUpdater(engine) {
4212
- engine.checkVersion("4.0.2");
4265
+ engine.checkVersion("4.0.4");
4213
4266
  await engine.pluginManager.register(e => {
4214
4267
  e.pluginManager.addParticleUpdater("life", container => {
4215
4268
  return Promise.resolve(new LifeUpdater(container));
@@ -6365,6 +6418,44 @@
6365
6418
  Container: Container
6366
6419
  });
6367
6420
 
6421
+ class BlendPluginInstance {
6422
+ _container;
6423
+ _defaultCompositeValue;
6424
+ constructor(container) {
6425
+ this._container = container;
6426
+ }
6427
+ drawParticleCleanup(context, particle) {
6428
+ if (!particle.options.blend?.enable) {
6429
+ return;
6430
+ }
6431
+ context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
6432
+ particle.originalBlendMode = undefined;
6433
+ }
6434
+ drawParticleSetup(context, particle) {
6435
+ if (!particle.options.blend?.enable) {
6436
+ return;
6437
+ }
6438
+ particle.originalBlendMode = context.globalCompositeOperation;
6439
+ context.globalCompositeOperation = particle.options.blend.mode;
6440
+ }
6441
+ drawSettingsCleanup(context) {
6442
+ if (!this._defaultCompositeValue) {
6443
+ return;
6444
+ }
6445
+ context.globalCompositeOperation = this._defaultCompositeValue;
6446
+ }
6447
+ drawSettingsSetup(context) {
6448
+ const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
6449
+ this._defaultCompositeValue = previousComposite;
6450
+ context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
6451
+ }
6452
+ }
6453
+
6454
+ var BlendPluginInstance$1 = /*#__PURE__*/Object.freeze({
6455
+ __proto__: null,
6456
+ BlendPluginInstance: BlendPluginInstance
6457
+ });
6458
+
6368
6459
  const minVelocity = 0, identity = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
6369
6460
  function applyDistance(particle) {
6370
6461
  const initialPosition = particle.initialPosition, { dx, dy } = getDistances(initialPosition, particle.position), dxFixed = Math.abs(dx), dyFixed = Math.abs(dy), { maxDistance } = particle.retina, hDistance = maxDistance.horizontal, vDistance = maxDistance.vertical;