@tsparticles/preset-confetti-explosions 4.0.2 → 4.0.3

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.3 */
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.3";
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.3");
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.3");
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.3");
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.3");
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.3");
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.3");
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.3");
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.3");
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.3");
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.3");
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.3");
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.3");
3910
3963
  await engine.pluginManager.register(async (e) => {
3911
3964
  const instancesManager = await getEmittersInstancesManager(e);
3912
3965
  await addEmittersShapesManager(e);
@@ -3974,7 +4027,7 @@
3974
4027
  }
3975
4028
 
3976
4029
  async function loadMotionPlugin(engine) {
3977
- engine.checkVersion("4.0.2");
4030
+ engine.checkVersion("4.0.3");
3978
4031
  await engine.pluginManager.register(e => {
3979
4032
  e.pluginManager.addPlugin(new MotionPlugin());
3980
4033
  });
@@ -4131,7 +4184,7 @@
4131
4184
  }
4132
4185
 
4133
4186
  async function loadRollUpdater(engine) {
4134
- engine.checkVersion("4.0.2");
4187
+ engine.checkVersion("4.0.3");
4135
4188
  await engine.pluginManager.register(e => {
4136
4189
  e.pluginManager.addParticleUpdater("roll", () => {
4137
4190
  return Promise.resolve(new RollUpdater(e.pluginManager));
@@ -4265,7 +4318,7 @@
4265
4318
  }
4266
4319
 
4267
4320
  async function loadRotateUpdater(engine) {
4268
- engine.checkVersion("4.0.2");
4321
+ engine.checkVersion("4.0.3");
4269
4322
  await engine.pluginManager.register(e => {
4270
4323
  e.pluginManager.addParticleUpdater("rotate", container => {
4271
4324
  return Promise.resolve(new RotateUpdater(container));
@@ -4289,7 +4342,7 @@
4289
4342
  }
4290
4343
 
4291
4344
  async function loadSquareShape(engine) {
4292
- engine.checkVersion("4.0.2");
4345
+ engine.checkVersion("4.0.3");
4293
4346
  await engine.pluginManager.register(e => {
4294
4347
  e.pluginManager.addShape(["edge", "square"], () => Promise.resolve(new SquareDrawer()));
4295
4348
  });
@@ -4426,7 +4479,7 @@
4426
4479
  }
4427
4480
 
4428
4481
  async function loadTiltUpdater(engine) {
4429
- engine.checkVersion("4.0.2");
4482
+ engine.checkVersion("4.0.3");
4430
4483
  await engine.pluginManager.register(e => {
4431
4484
  e.pluginManager.addParticleUpdater("tilt", container => {
4432
4485
  return Promise.resolve(new TiltUpdater(container));
@@ -4548,7 +4601,7 @@
4548
4601
  }
4549
4602
 
4550
4603
  async function loadWobbleUpdater(engine) {
4551
- engine.checkVersion("4.0.2");
4604
+ engine.checkVersion("4.0.3");
4552
4605
  await engine.pluginManager.register(e => {
4553
4606
  e.pluginManager.addParticleUpdater("wobble", container => {
4554
4607
  return Promise.resolve(new WobbleUpdater(container));
@@ -6775,6 +6828,44 @@
6775
6828
  Container: Container
6776
6829
  });
6777
6830
 
6831
+ class BlendPluginInstance {
6832
+ _container;
6833
+ _defaultCompositeValue;
6834
+ constructor(container) {
6835
+ this._container = container;
6836
+ }
6837
+ drawParticleCleanup(context, particle) {
6838
+ if (!particle.options.blend?.enable) {
6839
+ return;
6840
+ }
6841
+ context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
6842
+ particle.originalBlendMode = undefined;
6843
+ }
6844
+ drawParticleSetup(context, particle) {
6845
+ if (!particle.options.blend?.enable) {
6846
+ return;
6847
+ }
6848
+ particle.originalBlendMode = context.globalCompositeOperation;
6849
+ context.globalCompositeOperation = particle.options.blend.mode;
6850
+ }
6851
+ drawSettingsCleanup(context) {
6852
+ if (!this._defaultCompositeValue) {
6853
+ return;
6854
+ }
6855
+ context.globalCompositeOperation = this._defaultCompositeValue;
6856
+ }
6857
+ drawSettingsSetup(context) {
6858
+ const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
6859
+ this._defaultCompositeValue = previousComposite;
6860
+ context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
6861
+ }
6862
+ }
6863
+
6864
+ var BlendPluginInstance$1 = /*#__PURE__*/Object.freeze({
6865
+ __proto__: null,
6866
+ BlendPluginInstance: BlendPluginInstance
6867
+ });
6868
+
6778
6869
  const minVelocity = 0, identity$1 = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
6779
6870
  function applyDistance(particle) {
6780
6871
  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;