@tsparticles/confetti 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
- /* tsParticles v4.0.1 */
2
+ /* tsParticles 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) :
@@ -1118,7 +1118,7 @@
1118
1118
  return this._domArray;
1119
1119
  }
1120
1120
  get version() {
1121
- return "4.0.1";
1121
+ return "4.0.3";
1122
1122
  }
1123
1123
  addEventListener(type, listener) {
1124
1124
  this._eventDispatcher.addEventListener(type, listener);
@@ -3009,6 +3009,58 @@
3009
3009
 
3010
3010
  const tsParticles = initEngine();
3011
3011
 
3012
+ class Blend {
3013
+ enable;
3014
+ mode;
3015
+ constructor() {
3016
+ this.mode = "destination-out";
3017
+ this.enable = false;
3018
+ }
3019
+ load(data) {
3020
+ if (isNull(data)) {
3021
+ return;
3022
+ }
3023
+ if (data.mode !== undefined) {
3024
+ this.mode = data.mode;
3025
+ }
3026
+ if (data.enable !== undefined) {
3027
+ this.enable = data.enable;
3028
+ }
3029
+ }
3030
+ }
3031
+
3032
+ class BlendPlugin {
3033
+ id = "blend";
3034
+ async getPlugin(container) {
3035
+ const { BlendPluginInstance } = await Promise.resolve().then(function () { return BlendPluginInstance$1; });
3036
+ return new BlendPluginInstance(container);
3037
+ }
3038
+ loadOptions(_container, options, source) {
3039
+ if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
3040
+ return;
3041
+ }
3042
+ let blendOptions = options.blend;
3043
+ if (!blendOptions?.load) {
3044
+ options.blend = blendOptions = new Blend();
3045
+ }
3046
+ blendOptions.load(source?.blend);
3047
+ }
3048
+ loadParticlesOptions(_container, options, source) {
3049
+ options.blend ??= new Blend();
3050
+ options.blend.load(source?.blend);
3051
+ }
3052
+ needsPlugin(options) {
3053
+ return !!options?.blend?.enable || !!options?.particles?.blend?.enable;
3054
+ }
3055
+ }
3056
+
3057
+ async function loadBlendPlugin(engine) {
3058
+ engine.checkVersion("4.0.3");
3059
+ await engine.pluginManager.register(e => {
3060
+ e.pluginManager.addPlugin(new BlendPlugin());
3061
+ });
3062
+ }
3063
+
3012
3064
  const minAngle$1 = 0;
3013
3065
  function drawCircle(data) {
3014
3066
  const { context, particle, radius } = data;
@@ -3040,7 +3092,7 @@
3040
3092
  }
3041
3093
 
3042
3094
  async function loadCircleShape(engine) {
3043
- engine.checkVersion("4.0.1");
3095
+ engine.checkVersion("4.0.3");
3044
3096
  await engine.pluginManager.register(e => {
3045
3097
  e.pluginManager.addShape(["circle"], () => {
3046
3098
  return Promise.resolve(new CircleDrawer());
@@ -3088,7 +3140,7 @@
3088
3140
  }
3089
3141
 
3090
3142
  async function loadHexColorPlugin(engine) {
3091
- engine.checkVersion("4.0.1");
3143
+ engine.checkVersion("4.0.3");
3092
3144
  await engine.pluginManager.register(e => {
3093
3145
  e.pluginManager.addColorManager("hex", new HexColorManager());
3094
3146
  });
@@ -3141,7 +3193,7 @@
3141
3193
  }
3142
3194
 
3143
3195
  async function loadHslColorPlugin(engine) {
3144
- engine.checkVersion("4.0.1");
3196
+ engine.checkVersion("4.0.3");
3145
3197
  await engine.pluginManager.register(e => {
3146
3198
  e.pluginManager.addColorManager("hsl", new HslColorManager());
3147
3199
  });
@@ -3165,7 +3217,7 @@
3165
3217
  }
3166
3218
 
3167
3219
  async function loadMovePlugin(engine) {
3168
- engine.checkVersion("4.0.1");
3220
+ engine.checkVersion("4.0.3");
3169
3221
  await engine.pluginManager.register(e => {
3170
3222
  const moveEngine = e, movePluginManager = moveEngine.pluginManager;
3171
3223
  movePluginManager.initializers.pathGenerators ??= new Map();
@@ -3226,7 +3278,7 @@
3226
3278
  }
3227
3279
 
3228
3280
  async function loadOpacityUpdater(engine) {
3229
- engine.checkVersion("4.0.1");
3281
+ engine.checkVersion("4.0.3");
3230
3282
  await engine.pluginManager.register(e => {
3231
3283
  e.pluginManager.addParticleUpdater("opacity", container => {
3232
3284
  return Promise.resolve(new OpacityUpdater(container));
@@ -3578,7 +3630,7 @@
3578
3630
  }
3579
3631
 
3580
3632
  async function loadOutModesUpdater(engine) {
3581
- engine.checkVersion("4.0.1");
3633
+ engine.checkVersion("4.0.3");
3582
3634
  await engine.pluginManager.register(e => {
3583
3635
  e.pluginManager.addParticleUpdater("outModes", container => {
3584
3636
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3649,7 +3701,7 @@
3649
3701
  }
3650
3702
 
3651
3703
  async function loadPaintUpdater(engine) {
3652
- engine.checkVersion("4.0.1");
3704
+ engine.checkVersion("4.0.3");
3653
3705
  await engine.pluginManager.register(e => {
3654
3706
  e.pluginManager.addParticleUpdater("paint", container => {
3655
3707
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3704,7 +3756,7 @@
3704
3756
  }
3705
3757
 
3706
3758
  async function loadRgbColorPlugin(engine) {
3707
- engine.checkVersion("4.0.1");
3759
+ engine.checkVersion("4.0.3");
3708
3760
  await engine.pluginManager.register(e => {
3709
3761
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3710
3762
  });
@@ -3747,7 +3799,7 @@
3747
3799
  }
3748
3800
 
3749
3801
  async function loadSizeUpdater(engine) {
3750
- engine.checkVersion("4.0.1");
3802
+ engine.checkVersion("4.0.3");
3751
3803
  await engine.pluginManager.register(e => {
3752
3804
  e.pluginManager.addParticleUpdater("size", container => {
3753
3805
  return Promise.resolve(new SizeUpdater(container));
@@ -3756,9 +3808,10 @@
3756
3808
  }
3757
3809
 
3758
3810
  async function loadBasic(engine) {
3759
- engine.checkVersion("4.0.1");
3811
+ engine.checkVersion("4.0.3");
3760
3812
  await engine.pluginManager.register(async (e) => {
3761
3813
  await Promise.all([
3814
+ loadBlendPlugin(e),
3762
3815
  loadHexColorPlugin(e),
3763
3816
  loadHslColorPlugin(e),
3764
3817
  loadRgbColorPlugin(e),
@@ -4055,7 +4108,7 @@
4055
4108
  }
4056
4109
 
4057
4110
  async function loadClubsSuitShape(engine) {
4058
- engine.checkVersion("4.0.1");
4111
+ engine.checkVersion("4.0.3");
4059
4112
  await engine.pluginManager.register(e => {
4060
4113
  e.pluginManager.addShape(["club", "clubs"], () => Promise.resolve(new ClubDrawer()));
4061
4114
  });
@@ -4069,7 +4122,7 @@
4069
4122
  }
4070
4123
 
4071
4124
  async function loadDiamondsSuitShape(engine) {
4072
- engine.checkVersion("4.0.1");
4125
+ engine.checkVersion("4.0.3");
4073
4126
  await engine.pluginManager.register(e => {
4074
4127
  e.pluginManager.addShape(["diamond", "diamonds"], () => Promise.resolve(new DiamondDrawer()));
4075
4128
  });
@@ -4083,7 +4136,7 @@
4083
4136
  };
4084
4137
 
4085
4138
  async function loadHeartsSuitShape(engine) {
4086
- engine.checkVersion("4.0.1");
4139
+ engine.checkVersion("4.0.3");
4087
4140
  await engine.pluginManager.register(e => {
4088
4141
  e.pluginManager.addShape(["heart", "hearts"], () => Promise.resolve(new HeartDrawer$1()));
4089
4142
  });
@@ -4097,14 +4150,14 @@
4097
4150
  }
4098
4151
 
4099
4152
  async function loadSpadesSuitShape(engine) {
4100
- engine.checkVersion("4.0.1");
4153
+ engine.checkVersion("4.0.3");
4101
4154
  await engine.pluginManager.register(e => {
4102
4155
  e.pluginManager.addShape(["spade", "spades"], () => Promise.resolve(new SpadeDrawer()));
4103
4156
  });
4104
4157
  }
4105
4158
 
4106
4159
  async function loadCardSuitsShape(engine) {
4107
- engine.checkVersion("4.0.1");
4160
+ engine.checkVersion("4.0.3");
4108
4161
  await Promise.all([
4109
4162
  loadClubsSuitShape(engine),
4110
4163
  loadDiamondsSuitShape(engine),
@@ -4381,7 +4434,7 @@
4381
4434
  })(EmitterClickMode || (EmitterClickMode = {}));
4382
4435
 
4383
4436
  async function loadEmittersPluginSimple(engine) {
4384
- engine.checkVersion("4.0.1");
4437
+ engine.checkVersion("4.0.3");
4385
4438
  await engine.pluginManager.register(async (e) => {
4386
4439
  const instancesManager = await getEmittersInstancesManager(e);
4387
4440
  await addEmittersShapesManager(e);
@@ -4483,7 +4536,7 @@
4483
4536
  }
4484
4537
 
4485
4538
  async function loadEmojiShape(engine) {
4486
- engine.checkVersion("4.0.1");
4539
+ engine.checkVersion("4.0.3");
4487
4540
  await engine.pluginManager.register(e => {
4488
4541
  e.pluginManager.addShape(validTypes, () => Promise.resolve(new EmojiDrawer()));
4489
4542
  });
@@ -4509,7 +4562,7 @@
4509
4562
  }
4510
4563
 
4511
4564
  async function loadHeartShape(engine) {
4512
- engine.checkVersion("4.0.1");
4565
+ engine.checkVersion("4.0.3");
4513
4566
  await engine.pluginManager.register(e => {
4514
4567
  e.pluginManager.addShape(["heart"], () => Promise.resolve(new HeartDrawer()));
4515
4568
  });
@@ -5334,7 +5387,7 @@
5334
5387
  };
5335
5388
  }
5336
5389
  async function loadImageShape(engine) {
5337
- engine.checkVersion("4.0.1");
5390
+ engine.checkVersion("4.0.3");
5338
5391
  await engine.pluginManager.register(e => {
5339
5392
  addLoadImageToEngine(e);
5340
5393
  e.pluginManager.addPlugin(new ImagePreloaderPlugin(e));
@@ -5501,7 +5554,7 @@
5501
5554
  }
5502
5555
 
5503
5556
  async function loadLifeUpdater(engine) {
5504
- engine.checkVersion("4.0.1");
5557
+ engine.checkVersion("4.0.3");
5505
5558
  await engine.pluginManager.register(e => {
5506
5559
  e.pluginManager.addParticleUpdater("life", container => {
5507
5560
  return Promise.resolve(new LifeUpdater(container));
@@ -5569,7 +5622,7 @@
5569
5622
  }
5570
5623
 
5571
5624
  async function loadMotionPlugin(engine) {
5572
- engine.checkVersion("4.0.1");
5625
+ engine.checkVersion("4.0.3");
5573
5626
  await engine.pluginManager.register(e => {
5574
5627
  e.pluginManager.addPlugin(new MotionPlugin());
5575
5628
  });
@@ -5654,19 +5707,19 @@
5654
5707
  }
5655
5708
 
5656
5709
  async function loadGenericPolygonShape(engine) {
5657
- engine.checkVersion("4.0.1");
5710
+ engine.checkVersion("4.0.3");
5658
5711
  await engine.pluginManager.register(e => {
5659
5712
  e.pluginManager.addShape(["polygon"], () => Promise.resolve(new PolygonDrawer()));
5660
5713
  });
5661
5714
  }
5662
5715
  async function loadTriangleShape(engine) {
5663
- engine.checkVersion("4.0.1");
5716
+ engine.checkVersion("4.0.3");
5664
5717
  await engine.pluginManager.register(e => {
5665
5718
  e.pluginManager.addShape(["triangle"], () => Promise.resolve(new TriangleDrawer()));
5666
5719
  });
5667
5720
  }
5668
5721
  async function loadPolygonShape(engine) {
5669
- engine.checkVersion("4.0.1");
5722
+ engine.checkVersion("4.0.3");
5670
5723
  await Promise.all([
5671
5724
  loadGenericPolygonShape(engine),
5672
5725
  loadTriangleShape(engine),
@@ -5824,7 +5877,7 @@
5824
5877
  }
5825
5878
 
5826
5879
  async function loadRollUpdater(engine) {
5827
- engine.checkVersion("4.0.1");
5880
+ engine.checkVersion("4.0.3");
5828
5881
  await engine.pluginManager.register(e => {
5829
5882
  e.pluginManager.addParticleUpdater("roll", () => {
5830
5883
  return Promise.resolve(new RollUpdater(e.pluginManager));
@@ -5958,7 +6011,7 @@
5958
6011
  }
5959
6012
 
5960
6013
  async function loadRotateUpdater(engine) {
5961
- engine.checkVersion("4.0.1");
6014
+ engine.checkVersion("4.0.3");
5962
6015
  await engine.pluginManager.register(e => {
5963
6016
  e.pluginManager.addParticleUpdater("rotate", container => {
5964
6017
  return Promise.resolve(new RotateUpdater(container));
@@ -5982,7 +6035,7 @@
5982
6035
  }
5983
6036
 
5984
6037
  async function loadSquareShape(engine) {
5985
- engine.checkVersion("4.0.1");
6038
+ engine.checkVersion("4.0.3");
5986
6039
  await engine.pluginManager.register(e => {
5987
6040
  e.pluginManager.addShape(["edge", "square"], () => Promise.resolve(new SquareDrawer()));
5988
6041
  });
@@ -6016,7 +6069,7 @@
6016
6069
  }
6017
6070
 
6018
6071
  async function loadStarShape(engine) {
6019
- engine.checkVersion("4.0.1");
6072
+ engine.checkVersion("4.0.3");
6020
6073
  await engine.pluginManager.register(e => {
6021
6074
  e.pluginManager.addShape(["star"], () => Promise.resolve(new StarDrawer()));
6022
6075
  });
@@ -6153,7 +6206,7 @@
6153
6206
  }
6154
6207
 
6155
6208
  async function loadTiltUpdater(engine) {
6156
- engine.checkVersion("4.0.1");
6209
+ engine.checkVersion("4.0.3");
6157
6210
  await engine.pluginManager.register(e => {
6158
6211
  e.pluginManager.addParticleUpdater("tilt", container => {
6159
6212
  return Promise.resolve(new TiltUpdater(container));
@@ -6275,7 +6328,7 @@
6275
6328
  }
6276
6329
 
6277
6330
  async function loadWobbleUpdater(engine) {
6278
- engine.checkVersion("4.0.1");
6331
+ engine.checkVersion("4.0.3");
6279
6332
  await engine.pluginManager.register(e => {
6280
6333
  e.pluginManager.addParticleUpdater("wobble", container => {
6281
6334
  return Promise.resolve(new WobbleUpdater(container));
@@ -6702,7 +6755,7 @@
6702
6755
 
6703
6756
  let initPromise = null;
6704
6757
  async function doInitPlugins(engine) {
6705
- engine.checkVersion("4.0.1");
6758
+ engine.checkVersion("4.0.3");
6706
6759
  await engine.pluginManager.register(async (e) => {
6707
6760
  await Promise.all([
6708
6761
  loadBasic(e),
@@ -6775,7 +6828,7 @@
6775
6828
  confetti.init = async () => {
6776
6829
  await initPlugins(tsParticles);
6777
6830
  };
6778
- confetti.version = "4.0.1";
6831
+ confetti.version = "4.0.3";
6779
6832
  globalThis.confetti = confetti;
6780
6833
 
6781
6834
  const globalObject = globalThis;
@@ -8847,6 +8900,44 @@
8847
8900
  Container: Container
8848
8901
  });
8849
8902
 
8903
+ class BlendPluginInstance {
8904
+ _container;
8905
+ _defaultCompositeValue;
8906
+ constructor(container) {
8907
+ this._container = container;
8908
+ }
8909
+ drawParticleCleanup(context, particle) {
8910
+ if (!particle.options.blend?.enable) {
8911
+ return;
8912
+ }
8913
+ context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
8914
+ particle.originalBlendMode = undefined;
8915
+ }
8916
+ drawParticleSetup(context, particle) {
8917
+ if (!particle.options.blend?.enable) {
8918
+ return;
8919
+ }
8920
+ particle.originalBlendMode = context.globalCompositeOperation;
8921
+ context.globalCompositeOperation = particle.options.blend.mode;
8922
+ }
8923
+ drawSettingsCleanup(context) {
8924
+ if (!this._defaultCompositeValue) {
8925
+ return;
8926
+ }
8927
+ context.globalCompositeOperation = this._defaultCompositeValue;
8928
+ }
8929
+ drawSettingsSetup(context) {
8930
+ const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
8931
+ this._defaultCompositeValue = previousComposite;
8932
+ context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
8933
+ }
8934
+ }
8935
+
8936
+ var BlendPluginInstance$1 = /*#__PURE__*/Object.freeze({
8937
+ __proto__: null,
8938
+ BlendPluginInstance: BlendPluginInstance
8939
+ });
8940
+
8850
8941
  const minVelocity = 0, identity$1 = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
8851
8942
  function applyDistance(particle) {
8852
8943
  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;