@tsparticles/preset-confetti-falling 4.0.1 → 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.1 */
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) :
@@ -1002,7 +1002,7 @@
1002
1002
  return this._domArray;
1003
1003
  }
1004
1004
  get version() {
1005
- return "4.0.1";
1005
+ return "4.0.3";
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.3");
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.1");
2915
+ engine.checkVersion("4.0.3");
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.1");
2963
+ engine.checkVersion("4.0.3");
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.1");
3016
+ engine.checkVersion("4.0.3");
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.1");
3040
+ engine.checkVersion("4.0.3");
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.1");
3101
+ engine.checkVersion("4.0.3");
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.1");
3453
+ engine.checkVersion("4.0.3");
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.1");
3524
+ engine.checkVersion("4.0.3");
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.1");
3579
+ engine.checkVersion("4.0.3");
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.1");
3622
+ engine.checkVersion("4.0.3");
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.1");
3631
+ engine.checkVersion("4.0.3");
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),
@@ -3682,7 +3735,7 @@
3682
3735
  }
3683
3736
 
3684
3737
  async function loadMotionPlugin(engine) {
3685
- engine.checkVersion("4.0.1");
3738
+ engine.checkVersion("4.0.3");
3686
3739
  await engine.pluginManager.register(e => {
3687
3740
  e.pluginManager.addPlugin(new MotionPlugin());
3688
3741
  });
@@ -3839,7 +3892,7 @@
3839
3892
  }
3840
3893
 
3841
3894
  async function loadRollUpdater(engine) {
3842
- engine.checkVersion("4.0.1");
3895
+ engine.checkVersion("4.0.3");
3843
3896
  await engine.pluginManager.register(e => {
3844
3897
  e.pluginManager.addParticleUpdater("roll", () => {
3845
3898
  return Promise.resolve(new RollUpdater(e.pluginManager));
@@ -3973,7 +4026,7 @@
3973
4026
  }
3974
4027
 
3975
4028
  async function loadRotateUpdater(engine) {
3976
- engine.checkVersion("4.0.1");
4029
+ engine.checkVersion("4.0.3");
3977
4030
  await engine.pluginManager.register(e => {
3978
4031
  e.pluginManager.addParticleUpdater("rotate", container => {
3979
4032
  return Promise.resolve(new RotateUpdater(container));
@@ -3997,7 +4050,7 @@
3997
4050
  }
3998
4051
 
3999
4052
  async function loadSquareShape(engine) {
4000
- engine.checkVersion("4.0.1");
4053
+ engine.checkVersion("4.0.3");
4001
4054
  await engine.pluginManager.register(e => {
4002
4055
  e.pluginManager.addShape(["edge", "square"], () => Promise.resolve(new SquareDrawer()));
4003
4056
  });
@@ -4134,7 +4187,7 @@
4134
4187
  }
4135
4188
 
4136
4189
  async function loadTiltUpdater(engine) {
4137
- engine.checkVersion("4.0.1");
4190
+ engine.checkVersion("4.0.3");
4138
4191
  await engine.pluginManager.register(e => {
4139
4192
  e.pluginManager.addParticleUpdater("tilt", container => {
4140
4193
  return Promise.resolve(new TiltUpdater(container));
@@ -4256,7 +4309,7 @@
4256
4309
  }
4257
4310
 
4258
4311
  async function loadWobbleUpdater(engine) {
4259
- engine.checkVersion("4.0.1");
4312
+ engine.checkVersion("4.0.3");
4260
4313
  await engine.pluginManager.register(e => {
4261
4314
  e.pluginManager.addParticleUpdater("wobble", container => {
4262
4315
  return Promise.resolve(new WobbleUpdater(container));
@@ -6440,6 +6493,44 @@
6440
6493
  Container: Container
6441
6494
  });
6442
6495
 
6496
+ class BlendPluginInstance {
6497
+ _container;
6498
+ _defaultCompositeValue;
6499
+ constructor(container) {
6500
+ this._container = container;
6501
+ }
6502
+ drawParticleCleanup(context, particle) {
6503
+ if (!particle.options.blend?.enable) {
6504
+ return;
6505
+ }
6506
+ context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
6507
+ particle.originalBlendMode = undefined;
6508
+ }
6509
+ drawParticleSetup(context, particle) {
6510
+ if (!particle.options.blend?.enable) {
6511
+ return;
6512
+ }
6513
+ particle.originalBlendMode = context.globalCompositeOperation;
6514
+ context.globalCompositeOperation = particle.options.blend.mode;
6515
+ }
6516
+ drawSettingsCleanup(context) {
6517
+ if (!this._defaultCompositeValue) {
6518
+ return;
6519
+ }
6520
+ context.globalCompositeOperation = this._defaultCompositeValue;
6521
+ }
6522
+ drawSettingsSetup(context) {
6523
+ const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
6524
+ this._defaultCompositeValue = previousComposite;
6525
+ context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
6526
+ }
6527
+ }
6528
+
6529
+ var BlendPluginInstance$1 = /*#__PURE__*/Object.freeze({
6530
+ __proto__: null,
6531
+ BlendPluginInstance: BlendPluginInstance
6532
+ });
6533
+
6443
6534
  const minVelocity = 0, identity$1 = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
6444
6535
  function applyDistance(particle) {
6445
6536
  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;