@tsparticles/preset-confetti-cannon 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) :
@@ -1008,7 +1008,7 @@
1008
1008
  return this._domArray;
1009
1009
  }
1010
1010
  get version() {
1011
- return "4.0.2";
1011
+ return "4.0.4";
1012
1012
  }
1013
1013
  addEventListener(type, listener) {
1014
1014
  this._eventDispatcher.addEventListener(type, listener);
@@ -2835,6 +2835,58 @@
2835
2835
 
2836
2836
  const tsParticles = initEngine();
2837
2837
 
2838
+ class Blend {
2839
+ enable;
2840
+ mode;
2841
+ constructor() {
2842
+ this.mode = "destination-out";
2843
+ this.enable = false;
2844
+ }
2845
+ load(data) {
2846
+ if (isNull(data)) {
2847
+ return;
2848
+ }
2849
+ if (data.mode !== undefined) {
2850
+ this.mode = data.mode;
2851
+ }
2852
+ if (data.enable !== undefined) {
2853
+ this.enable = data.enable;
2854
+ }
2855
+ }
2856
+ }
2857
+
2858
+ class BlendPlugin {
2859
+ id = "blend";
2860
+ async getPlugin(container) {
2861
+ const { BlendPluginInstance } = await Promise.resolve().then(function () { return BlendPluginInstance$1; });
2862
+ return new BlendPluginInstance(container);
2863
+ }
2864
+ loadOptions(_container, options, source) {
2865
+ if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
2866
+ return;
2867
+ }
2868
+ let blendOptions = options.blend;
2869
+ if (!blendOptions?.load) {
2870
+ options.blend = blendOptions = new Blend();
2871
+ }
2872
+ blendOptions.load(source?.blend);
2873
+ }
2874
+ loadParticlesOptions(_container, options, source) {
2875
+ options.blend ??= new Blend();
2876
+ options.blend.load(source?.blend);
2877
+ }
2878
+ needsPlugin(options) {
2879
+ return !!options?.blend?.enable || !!options?.particles?.blend?.enable;
2880
+ }
2881
+ }
2882
+
2883
+ async function loadBlendPlugin(engine) {
2884
+ engine.checkVersion("4.0.4");
2885
+ await engine.pluginManager.register(e => {
2886
+ e.pluginManager.addPlugin(new BlendPlugin());
2887
+ });
2888
+ }
2889
+
2838
2890
  const minAngle$2 = 0;
2839
2891
  function drawCircle(data) {
2840
2892
  const { context, particle, radius } = data;
@@ -2866,7 +2918,7 @@
2866
2918
  }
2867
2919
 
2868
2920
  async function loadCircleShape(engine) {
2869
- engine.checkVersion("4.0.2");
2921
+ engine.checkVersion("4.0.4");
2870
2922
  await engine.pluginManager.register(e => {
2871
2923
  e.pluginManager.addShape(["circle"], () => {
2872
2924
  return Promise.resolve(new CircleDrawer());
@@ -2914,7 +2966,7 @@
2914
2966
  }
2915
2967
 
2916
2968
  async function loadHexColorPlugin(engine) {
2917
- engine.checkVersion("4.0.2");
2969
+ engine.checkVersion("4.0.4");
2918
2970
  await engine.pluginManager.register(e => {
2919
2971
  e.pluginManager.addColorManager("hex", new HexColorManager());
2920
2972
  });
@@ -2967,7 +3019,7 @@
2967
3019
  }
2968
3020
 
2969
3021
  async function loadHslColorPlugin(engine) {
2970
- engine.checkVersion("4.0.2");
3022
+ engine.checkVersion("4.0.4");
2971
3023
  await engine.pluginManager.register(e => {
2972
3024
  e.pluginManager.addColorManager("hsl", new HslColorManager());
2973
3025
  });
@@ -2991,7 +3043,7 @@
2991
3043
  }
2992
3044
 
2993
3045
  async function loadMovePlugin(engine) {
2994
- engine.checkVersion("4.0.2");
3046
+ engine.checkVersion("4.0.4");
2995
3047
  await engine.pluginManager.register(e => {
2996
3048
  const moveEngine = e, movePluginManager = moveEngine.pluginManager;
2997
3049
  movePluginManager.initializers.pathGenerators ??= new Map();
@@ -3052,7 +3104,7 @@
3052
3104
  }
3053
3105
 
3054
3106
  async function loadOpacityUpdater(engine) {
3055
- engine.checkVersion("4.0.2");
3107
+ engine.checkVersion("4.0.4");
3056
3108
  await engine.pluginManager.register(e => {
3057
3109
  e.pluginManager.addParticleUpdater("opacity", container => {
3058
3110
  return Promise.resolve(new OpacityUpdater(container));
@@ -3404,7 +3456,7 @@
3404
3456
  }
3405
3457
 
3406
3458
  async function loadOutModesUpdater(engine) {
3407
- engine.checkVersion("4.0.2");
3459
+ engine.checkVersion("4.0.4");
3408
3460
  await engine.pluginManager.register(e => {
3409
3461
  e.pluginManager.addParticleUpdater("outModes", container => {
3410
3462
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3475,7 +3527,7 @@
3475
3527
  }
3476
3528
 
3477
3529
  async function loadPaintUpdater(engine) {
3478
- engine.checkVersion("4.0.2");
3530
+ engine.checkVersion("4.0.4");
3479
3531
  await engine.pluginManager.register(e => {
3480
3532
  e.pluginManager.addParticleUpdater("paint", container => {
3481
3533
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3530,7 +3582,7 @@
3530
3582
  }
3531
3583
 
3532
3584
  async function loadRgbColorPlugin(engine) {
3533
- engine.checkVersion("4.0.2");
3585
+ engine.checkVersion("4.0.4");
3534
3586
  await engine.pluginManager.register(e => {
3535
3587
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3536
3588
  });
@@ -3573,7 +3625,7 @@
3573
3625
  }
3574
3626
 
3575
3627
  async function loadSizeUpdater(engine) {
3576
- engine.checkVersion("4.0.2");
3628
+ engine.checkVersion("4.0.4");
3577
3629
  await engine.pluginManager.register(e => {
3578
3630
  e.pluginManager.addParticleUpdater("size", container => {
3579
3631
  return Promise.resolve(new SizeUpdater(container));
@@ -3582,9 +3634,10 @@
3582
3634
  }
3583
3635
 
3584
3636
  async function loadBasic(engine) {
3585
- engine.checkVersion("4.0.2");
3637
+ engine.checkVersion("4.0.4");
3586
3638
  await engine.pluginManager.register(async (e) => {
3587
3639
  await Promise.all([
3640
+ loadBlendPlugin(e),
3588
3641
  loadHexColorPlugin(e),
3589
3642
  loadHslColorPlugin(e),
3590
3643
  loadRgbColorPlugin(e),
@@ -3849,7 +3902,7 @@
3849
3902
  const clickEvent = "click", mouseDownEvent = "pointerdown", mouseUpEvent = "pointerup", mouseLeaveEvent = "pointerleave", mouseMoveEvent = "pointermove", touchStartEvent = "touchstart", touchEndEvent = "touchend", touchMoveEvent = "touchmove", touchCancelEvent = "touchcancel";
3850
3903
 
3851
3904
  async function loadInteractivityPlugin(engine) {
3852
- engine.checkVersion("4.0.2");
3905
+ engine.checkVersion("4.0.4");
3853
3906
  await engine.pluginManager.register(e => {
3854
3907
  const interactivityEngine = e, interactivityPluginManager = interactivityEngine.pluginManager;
3855
3908
  interactivityPluginManager.addPlugin(new InteractivityPlugin(interactivityPluginManager));
@@ -4054,7 +4107,7 @@
4054
4107
  }
4055
4108
 
4056
4109
  async function loadExternalCannonInteraction(engine) {
4057
- engine.checkVersion("4.0.2");
4110
+ engine.checkVersion("4.0.4");
4058
4111
  await engine.pluginManager.register((e) => {
4059
4112
  ensureInteractivityPluginLoaded(e);
4060
4113
  e.pluginManager.addInteractor?.("externalCannon", container => {
@@ -4222,7 +4275,7 @@
4222
4275
  }
4223
4276
 
4224
4277
  async function loadLifeUpdater(engine) {
4225
- engine.checkVersion("4.0.2");
4278
+ engine.checkVersion("4.0.4");
4226
4279
  await engine.pluginManager.register(e => {
4227
4280
  e.pluginManager.addParticleUpdater("life", container => {
4228
4281
  return Promise.resolve(new LifeUpdater(container));
@@ -4290,7 +4343,7 @@
4290
4343
  }
4291
4344
 
4292
4345
  async function loadMotionPlugin(engine) {
4293
- engine.checkVersion("4.0.2");
4346
+ engine.checkVersion("4.0.4");
4294
4347
  await engine.pluginManager.register(e => {
4295
4348
  e.pluginManager.addPlugin(new MotionPlugin());
4296
4349
  });
@@ -4447,7 +4500,7 @@
4447
4500
  }
4448
4501
 
4449
4502
  async function loadRollUpdater(engine) {
4450
- engine.checkVersion("4.0.2");
4503
+ engine.checkVersion("4.0.4");
4451
4504
  await engine.pluginManager.register(e => {
4452
4505
  e.pluginManager.addParticleUpdater("roll", () => {
4453
4506
  return Promise.resolve(new RollUpdater(e.pluginManager));
@@ -4581,7 +4634,7 @@
4581
4634
  }
4582
4635
 
4583
4636
  async function loadRotateUpdater(engine) {
4584
- engine.checkVersion("4.0.2");
4637
+ engine.checkVersion("4.0.4");
4585
4638
  await engine.pluginManager.register(e => {
4586
4639
  e.pluginManager.addParticleUpdater("rotate", container => {
4587
4640
  return Promise.resolve(new RotateUpdater(container));
@@ -4605,7 +4658,7 @@
4605
4658
  }
4606
4659
 
4607
4660
  async function loadSquareShape(engine) {
4608
- engine.checkVersion("4.0.2");
4661
+ engine.checkVersion("4.0.4");
4609
4662
  await engine.pluginManager.register(e => {
4610
4663
  e.pluginManager.addShape(["edge", "square"], () => Promise.resolve(new SquareDrawer()));
4611
4664
  });
@@ -4742,7 +4795,7 @@
4742
4795
  }
4743
4796
 
4744
4797
  async function loadTiltUpdater(engine) {
4745
- engine.checkVersion("4.0.2");
4798
+ engine.checkVersion("4.0.4");
4746
4799
  await engine.pluginManager.register(e => {
4747
4800
  e.pluginManager.addParticleUpdater("tilt", container => {
4748
4801
  return Promise.resolve(new TiltUpdater(container));
@@ -4864,7 +4917,7 @@
4864
4917
  }
4865
4918
 
4866
4919
  async function loadWobbleUpdater(engine) {
4867
- engine.checkVersion("4.0.2");
4920
+ engine.checkVersion("4.0.4");
4868
4921
  await engine.pluginManager.register(e => {
4869
4922
  e.pluginManager.addParticleUpdater("wobble", container => {
4870
4923
  return Promise.resolve(new WobbleUpdater(container));
@@ -7076,6 +7129,44 @@
7076
7129
  Container: Container
7077
7130
  });
7078
7131
 
7132
+ class BlendPluginInstance {
7133
+ _container;
7134
+ _defaultCompositeValue;
7135
+ constructor(container) {
7136
+ this._container = container;
7137
+ }
7138
+ drawParticleCleanup(context, particle) {
7139
+ if (!particle.options.blend?.enable) {
7140
+ return;
7141
+ }
7142
+ context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
7143
+ particle.originalBlendMode = undefined;
7144
+ }
7145
+ drawParticleSetup(context, particle) {
7146
+ if (!particle.options.blend?.enable) {
7147
+ return;
7148
+ }
7149
+ particle.originalBlendMode = context.globalCompositeOperation;
7150
+ context.globalCompositeOperation = particle.options.blend.mode;
7151
+ }
7152
+ drawSettingsCleanup(context) {
7153
+ if (!this._defaultCompositeValue) {
7154
+ return;
7155
+ }
7156
+ context.globalCompositeOperation = this._defaultCompositeValue;
7157
+ }
7158
+ drawSettingsSetup(context) {
7159
+ const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
7160
+ this._defaultCompositeValue = previousComposite;
7161
+ context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
7162
+ }
7163
+ }
7164
+
7165
+ var BlendPluginInstance$1 = /*#__PURE__*/Object.freeze({
7166
+ __proto__: null,
7167
+ BlendPluginInstance: BlendPluginInstance
7168
+ });
7169
+
7079
7170
  const minVelocity = 0, identity$1 = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
7080
7171
  function applyDistance(particle) {
7081
7172
  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;