@tsparticles/preset-confetti 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) :
@@ -1018,7 +1018,7 @@
1018
1018
  return this._domArray;
1019
1019
  }
1020
1020
  get version() {
1021
- return "4.0.2";
1021
+ return "4.0.4";
1022
1022
  }
1023
1023
  addEventListener(type, listener) {
1024
1024
  this._eventDispatcher.addEventListener(type, listener);
@@ -2845,6 +2845,58 @@
2845
2845
 
2846
2846
  const tsParticles = initEngine();
2847
2847
 
2848
+ class Blend {
2849
+ enable;
2850
+ mode;
2851
+ constructor() {
2852
+ this.mode = "destination-out";
2853
+ this.enable = false;
2854
+ }
2855
+ load(data) {
2856
+ if (isNull(data)) {
2857
+ return;
2858
+ }
2859
+ if (data.mode !== undefined) {
2860
+ this.mode = data.mode;
2861
+ }
2862
+ if (data.enable !== undefined) {
2863
+ this.enable = data.enable;
2864
+ }
2865
+ }
2866
+ }
2867
+
2868
+ class BlendPlugin {
2869
+ id = "blend";
2870
+ async getPlugin(container) {
2871
+ const { BlendPluginInstance } = await Promise.resolve().then(function () { return BlendPluginInstance$1; });
2872
+ return new BlendPluginInstance(container);
2873
+ }
2874
+ loadOptions(_container, options, source) {
2875
+ if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
2876
+ return;
2877
+ }
2878
+ let blendOptions = options.blend;
2879
+ if (!blendOptions?.load) {
2880
+ options.blend = blendOptions = new Blend();
2881
+ }
2882
+ blendOptions.load(source?.blend);
2883
+ }
2884
+ loadParticlesOptions(_container, options, source) {
2885
+ options.blend ??= new Blend();
2886
+ options.blend.load(source?.blend);
2887
+ }
2888
+ needsPlugin(options) {
2889
+ return !!options?.blend?.enable || !!options?.particles?.blend?.enable;
2890
+ }
2891
+ }
2892
+
2893
+ async function loadBlendPlugin(engine) {
2894
+ engine.checkVersion("4.0.4");
2895
+ await engine.pluginManager.register(e => {
2896
+ e.pluginManager.addPlugin(new BlendPlugin());
2897
+ });
2898
+ }
2899
+
2848
2900
  const minAngle$1 = 0;
2849
2901
  function drawCircle(data) {
2850
2902
  const { context, particle, radius } = data;
@@ -2876,7 +2928,7 @@
2876
2928
  }
2877
2929
 
2878
2930
  async function loadCircleShape(engine) {
2879
- engine.checkVersion("4.0.2");
2931
+ engine.checkVersion("4.0.4");
2880
2932
  await engine.pluginManager.register(e => {
2881
2933
  e.pluginManager.addShape(["circle"], () => {
2882
2934
  return Promise.resolve(new CircleDrawer());
@@ -2924,7 +2976,7 @@
2924
2976
  }
2925
2977
 
2926
2978
  async function loadHexColorPlugin(engine) {
2927
- engine.checkVersion("4.0.2");
2979
+ engine.checkVersion("4.0.4");
2928
2980
  await engine.pluginManager.register(e => {
2929
2981
  e.pluginManager.addColorManager("hex", new HexColorManager());
2930
2982
  });
@@ -2977,7 +3029,7 @@
2977
3029
  }
2978
3030
 
2979
3031
  async function loadHslColorPlugin(engine) {
2980
- engine.checkVersion("4.0.2");
3032
+ engine.checkVersion("4.0.4");
2981
3033
  await engine.pluginManager.register(e => {
2982
3034
  e.pluginManager.addColorManager("hsl", new HslColorManager());
2983
3035
  });
@@ -3001,7 +3053,7 @@
3001
3053
  }
3002
3054
 
3003
3055
  async function loadMovePlugin(engine) {
3004
- engine.checkVersion("4.0.2");
3056
+ engine.checkVersion("4.0.4");
3005
3057
  await engine.pluginManager.register(e => {
3006
3058
  const moveEngine = e, movePluginManager = moveEngine.pluginManager;
3007
3059
  movePluginManager.initializers.pathGenerators ??= new Map();
@@ -3062,7 +3114,7 @@
3062
3114
  }
3063
3115
 
3064
3116
  async function loadOpacityUpdater(engine) {
3065
- engine.checkVersion("4.0.2");
3117
+ engine.checkVersion("4.0.4");
3066
3118
  await engine.pluginManager.register(e => {
3067
3119
  e.pluginManager.addParticleUpdater("opacity", container => {
3068
3120
  return Promise.resolve(new OpacityUpdater(container));
@@ -3414,7 +3466,7 @@
3414
3466
  }
3415
3467
 
3416
3468
  async function loadOutModesUpdater(engine) {
3417
- engine.checkVersion("4.0.2");
3469
+ engine.checkVersion("4.0.4");
3418
3470
  await engine.pluginManager.register(e => {
3419
3471
  e.pluginManager.addParticleUpdater("outModes", container => {
3420
3472
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3485,7 +3537,7 @@
3485
3537
  }
3486
3538
 
3487
3539
  async function loadPaintUpdater(engine) {
3488
- engine.checkVersion("4.0.2");
3540
+ engine.checkVersion("4.0.4");
3489
3541
  await engine.pluginManager.register(e => {
3490
3542
  e.pluginManager.addParticleUpdater("paint", container => {
3491
3543
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3540,7 +3592,7 @@
3540
3592
  }
3541
3593
 
3542
3594
  async function loadRgbColorPlugin(engine) {
3543
- engine.checkVersion("4.0.2");
3595
+ engine.checkVersion("4.0.4");
3544
3596
  await engine.pluginManager.register(e => {
3545
3597
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3546
3598
  });
@@ -3583,7 +3635,7 @@
3583
3635
  }
3584
3636
 
3585
3637
  async function loadSizeUpdater(engine) {
3586
- engine.checkVersion("4.0.2");
3638
+ engine.checkVersion("4.0.4");
3587
3639
  await engine.pluginManager.register(e => {
3588
3640
  e.pluginManager.addParticleUpdater("size", container => {
3589
3641
  return Promise.resolve(new SizeUpdater(container));
@@ -3592,9 +3644,10 @@
3592
3644
  }
3593
3645
 
3594
3646
  async function loadBasic(engine) {
3595
- engine.checkVersion("4.0.2");
3647
+ engine.checkVersion("4.0.4");
3596
3648
  await engine.pluginManager.register(async (e) => {
3597
3649
  await Promise.all([
3650
+ loadBlendPlugin(e),
3598
3651
  loadHexColorPlugin(e),
3599
3652
  loadHslColorPlugin(e),
3600
3653
  loadRgbColorPlugin(e),
@@ -3906,7 +3959,7 @@
3906
3959
  })(EmitterClickMode || (EmitterClickMode = {}));
3907
3960
 
3908
3961
  async function loadEmittersPluginSimple(engine) {
3909
- engine.checkVersion("4.0.2");
3962
+ engine.checkVersion("4.0.4");
3910
3963
  await engine.pluginManager.register(async (e) => {
3911
3964
  const instancesManager = await getEmittersInstancesManager(e);
3912
3965
  await addEmittersShapesManager(e);
@@ -4073,7 +4126,7 @@
4073
4126
  }
4074
4127
 
4075
4128
  async function loadLifeUpdater(engine) {
4076
- engine.checkVersion("4.0.2");
4129
+ engine.checkVersion("4.0.4");
4077
4130
  await engine.pluginManager.register(e => {
4078
4131
  e.pluginManager.addParticleUpdater("life", container => {
4079
4132
  return Promise.resolve(new LifeUpdater(container));
@@ -4141,7 +4194,7 @@
4141
4194
  }
4142
4195
 
4143
4196
  async function loadMotionPlugin(engine) {
4144
- engine.checkVersion("4.0.2");
4197
+ engine.checkVersion("4.0.4");
4145
4198
  await engine.pluginManager.register(e => {
4146
4199
  e.pluginManager.addPlugin(new MotionPlugin());
4147
4200
  });
@@ -4298,7 +4351,7 @@
4298
4351
  }
4299
4352
 
4300
4353
  async function loadRollUpdater(engine) {
4301
- engine.checkVersion("4.0.2");
4354
+ engine.checkVersion("4.0.4");
4302
4355
  await engine.pluginManager.register(e => {
4303
4356
  e.pluginManager.addParticleUpdater("roll", () => {
4304
4357
  return Promise.resolve(new RollUpdater(e.pluginManager));
@@ -4432,7 +4485,7 @@
4432
4485
  }
4433
4486
 
4434
4487
  async function loadRotateUpdater(engine) {
4435
- engine.checkVersion("4.0.2");
4488
+ engine.checkVersion("4.0.4");
4436
4489
  await engine.pluginManager.register(e => {
4437
4490
  e.pluginManager.addParticleUpdater("rotate", container => {
4438
4491
  return Promise.resolve(new RotateUpdater(container));
@@ -4456,7 +4509,7 @@
4456
4509
  }
4457
4510
 
4458
4511
  async function loadSquareShape(engine) {
4459
- engine.checkVersion("4.0.2");
4512
+ engine.checkVersion("4.0.4");
4460
4513
  await engine.pluginManager.register(e => {
4461
4514
  e.pluginManager.addShape(["edge", "square"], () => Promise.resolve(new SquareDrawer()));
4462
4515
  });
@@ -4593,7 +4646,7 @@
4593
4646
  }
4594
4647
 
4595
4648
  async function loadTiltUpdater(engine) {
4596
- engine.checkVersion("4.0.2");
4649
+ engine.checkVersion("4.0.4");
4597
4650
  await engine.pluginManager.register(e => {
4598
4651
  e.pluginManager.addParticleUpdater("tilt", container => {
4599
4652
  return Promise.resolve(new TiltUpdater(container));
@@ -4715,7 +4768,7 @@
4715
4768
  }
4716
4769
 
4717
4770
  async function loadWobbleUpdater(engine) {
4718
- engine.checkVersion("4.0.2");
4771
+ engine.checkVersion("4.0.4");
4719
4772
  await engine.pluginManager.register(e => {
4720
4773
  e.pluginManager.addParticleUpdater("wobble", container => {
4721
4774
  return Promise.resolve(new WobbleUpdater(container));
@@ -6941,6 +6994,44 @@
6941
6994
  Container: Container
6942
6995
  });
6943
6996
 
6997
+ class BlendPluginInstance {
6998
+ _container;
6999
+ _defaultCompositeValue;
7000
+ constructor(container) {
7001
+ this._container = container;
7002
+ }
7003
+ drawParticleCleanup(context, particle) {
7004
+ if (!particle.options.blend?.enable) {
7005
+ return;
7006
+ }
7007
+ context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
7008
+ particle.originalBlendMode = undefined;
7009
+ }
7010
+ drawParticleSetup(context, particle) {
7011
+ if (!particle.options.blend?.enable) {
7012
+ return;
7013
+ }
7014
+ particle.originalBlendMode = context.globalCompositeOperation;
7015
+ context.globalCompositeOperation = particle.options.blend.mode;
7016
+ }
7017
+ drawSettingsCleanup(context) {
7018
+ if (!this._defaultCompositeValue) {
7019
+ return;
7020
+ }
7021
+ context.globalCompositeOperation = this._defaultCompositeValue;
7022
+ }
7023
+ drawSettingsSetup(context) {
7024
+ const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
7025
+ this._defaultCompositeValue = previousComposite;
7026
+ context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
7027
+ }
7028
+ }
7029
+
7030
+ var BlendPluginInstance$1 = /*#__PURE__*/Object.freeze({
7031
+ __proto__: null,
7032
+ BlendPluginInstance: BlendPluginInstance
7033
+ });
7034
+
6944
7035
  const minVelocity = 0, identity$1 = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
6945
7036
  function applyDistance(particle) {
6946
7037
  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;