@tsparticles/preset-fireworks 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) :
@@ -1021,7 +1021,7 @@
1021
1021
  return this._domArray;
1022
1022
  }
1023
1023
  get version() {
1024
- return "4.0.2";
1024
+ return "4.0.3";
1025
1025
  }
1026
1026
  addEventListener(type, listener) {
1027
1027
  this._eventDispatcher.addEventListener(type, listener);
@@ -3104,6 +3104,58 @@
3104
3104
  };
3105
3105
  }
3106
3106
 
3107
+ class Blend {
3108
+ enable;
3109
+ mode;
3110
+ constructor() {
3111
+ this.mode = "destination-out";
3112
+ this.enable = false;
3113
+ }
3114
+ load(data) {
3115
+ if (isNull(data)) {
3116
+ return;
3117
+ }
3118
+ if (data.mode !== undefined) {
3119
+ this.mode = data.mode;
3120
+ }
3121
+ if (data.enable !== undefined) {
3122
+ this.enable = data.enable;
3123
+ }
3124
+ }
3125
+ }
3126
+
3127
+ class BlendPlugin {
3128
+ id = "blend";
3129
+ async getPlugin(container) {
3130
+ const { BlendPluginInstance } = await Promise.resolve().then(function () { return BlendPluginInstance$1; });
3131
+ return new BlendPluginInstance(container);
3132
+ }
3133
+ loadOptions(_container, options, source) {
3134
+ if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
3135
+ return;
3136
+ }
3137
+ let blendOptions = options.blend;
3138
+ if (!blendOptions?.load) {
3139
+ options.blend = blendOptions = new Blend();
3140
+ }
3141
+ blendOptions.load(source?.blend);
3142
+ }
3143
+ loadParticlesOptions(_container, options, source) {
3144
+ options.blend ??= new Blend();
3145
+ options.blend.load(source?.blend);
3146
+ }
3147
+ needsPlugin(options) {
3148
+ return !!options?.blend?.enable || !!options?.particles?.blend?.enable;
3149
+ }
3150
+ }
3151
+
3152
+ async function loadBlendPlugin(engine) {
3153
+ engine.checkVersion("4.0.3");
3154
+ await engine.pluginManager.register(e => {
3155
+ e.pluginManager.addPlugin(new BlendPlugin());
3156
+ });
3157
+ }
3158
+
3107
3159
  const minAngle$1 = 0;
3108
3160
  function drawCircle(data) {
3109
3161
  const { context, particle, radius } = data;
@@ -3135,7 +3187,7 @@
3135
3187
  }
3136
3188
 
3137
3189
  async function loadCircleShape(engine) {
3138
- engine.checkVersion("4.0.2");
3190
+ engine.checkVersion("4.0.3");
3139
3191
  await engine.pluginManager.register(e => {
3140
3192
  e.pluginManager.addShape(["circle"], () => {
3141
3193
  return Promise.resolve(new CircleDrawer());
@@ -3183,7 +3235,7 @@
3183
3235
  }
3184
3236
 
3185
3237
  async function loadHexColorPlugin(engine) {
3186
- engine.checkVersion("4.0.2");
3238
+ engine.checkVersion("4.0.3");
3187
3239
  await engine.pluginManager.register(e => {
3188
3240
  e.pluginManager.addColorManager("hex", new HexColorManager());
3189
3241
  });
@@ -3236,7 +3288,7 @@
3236
3288
  }
3237
3289
 
3238
3290
  async function loadHslColorPlugin(engine) {
3239
- engine.checkVersion("4.0.2");
3291
+ engine.checkVersion("4.0.3");
3240
3292
  await engine.pluginManager.register(e => {
3241
3293
  e.pluginManager.addColorManager("hsl", new HslColorManager());
3242
3294
  });
@@ -3260,7 +3312,7 @@
3260
3312
  }
3261
3313
 
3262
3314
  async function loadMovePlugin(engine) {
3263
- engine.checkVersion("4.0.2");
3315
+ engine.checkVersion("4.0.3");
3264
3316
  await engine.pluginManager.register(e => {
3265
3317
  const moveEngine = e, movePluginManager = moveEngine.pluginManager;
3266
3318
  movePluginManager.initializers.pathGenerators ??= new Map();
@@ -3321,7 +3373,7 @@
3321
3373
  }
3322
3374
 
3323
3375
  async function loadOpacityUpdater(engine) {
3324
- engine.checkVersion("4.0.2");
3376
+ engine.checkVersion("4.0.3");
3325
3377
  await engine.pluginManager.register(e => {
3326
3378
  e.pluginManager.addParticleUpdater("opacity", container => {
3327
3379
  return Promise.resolve(new OpacityUpdater(container));
@@ -3673,7 +3725,7 @@
3673
3725
  }
3674
3726
 
3675
3727
  async function loadOutModesUpdater(engine) {
3676
- engine.checkVersion("4.0.2");
3728
+ engine.checkVersion("4.0.3");
3677
3729
  await engine.pluginManager.register(e => {
3678
3730
  e.pluginManager.addParticleUpdater("outModes", container => {
3679
3731
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3744,7 +3796,7 @@
3744
3796
  }
3745
3797
 
3746
3798
  async function loadPaintUpdater(engine) {
3747
- engine.checkVersion("4.0.2");
3799
+ engine.checkVersion("4.0.3");
3748
3800
  await engine.pluginManager.register(e => {
3749
3801
  e.pluginManager.addParticleUpdater("paint", container => {
3750
3802
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3799,7 +3851,7 @@
3799
3851
  }
3800
3852
 
3801
3853
  async function loadRgbColorPlugin(engine) {
3802
- engine.checkVersion("4.0.2");
3854
+ engine.checkVersion("4.0.3");
3803
3855
  await engine.pluginManager.register(e => {
3804
3856
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3805
3857
  });
@@ -3842,7 +3894,7 @@
3842
3894
  }
3843
3895
 
3844
3896
  async function loadSizeUpdater(engine) {
3845
- engine.checkVersion("4.0.2");
3897
+ engine.checkVersion("4.0.3");
3846
3898
  await engine.pluginManager.register(e => {
3847
3899
  e.pluginManager.addParticleUpdater("size", container => {
3848
3900
  return Promise.resolve(new SizeUpdater(container));
@@ -3851,9 +3903,10 @@
3851
3903
  }
3852
3904
 
3853
3905
  async function loadBasic(engine) {
3854
- engine.checkVersion("4.0.2");
3906
+ engine.checkVersion("4.0.3");
3855
3907
  await engine.pluginManager.register(async (e) => {
3856
3908
  await Promise.all([
3909
+ loadBlendPlugin(e),
3857
3910
  loadHexColorPlugin(e),
3858
3911
  loadHslColorPlugin(e),
3859
3912
  loadRgbColorPlugin(e),
@@ -4220,7 +4273,7 @@
4220
4273
  }
4221
4274
 
4222
4275
  async function loadDestroyUpdater(engine) {
4223
- engine.checkVersion("4.0.2");
4276
+ engine.checkVersion("4.0.3");
4224
4277
  await engine.pluginManager.register(e => {
4225
4278
  e.pluginManager.addParticleUpdater("destroy", container => {
4226
4279
  return Promise.resolve(new DestroyUpdater(e.pluginManager, container));
@@ -4513,7 +4566,7 @@
4513
4566
  })(EmitterClickMode || (EmitterClickMode = {}));
4514
4567
 
4515
4568
  async function loadEmittersPluginSimple(engine) {
4516
- engine.checkVersion("4.0.2");
4569
+ engine.checkVersion("4.0.3");
4517
4570
  await engine.pluginManager.register(async (e) => {
4518
4571
  const instancesManager = await getEmittersInstancesManager(e);
4519
4572
  await addEmittersShapesManager(e);
@@ -4601,7 +4654,7 @@
4601
4654
  }
4602
4655
 
4603
4656
  async function loadEmittersShapeSquare(engine) {
4604
- engine.checkVersion("4.0.2");
4657
+ engine.checkVersion("4.0.3");
4605
4658
  await engine.pluginManager.register((e) => {
4606
4659
  ensureEmittersPluginLoaded(e);
4607
4660
  e.pluginManager.addEmitterShapeGenerator?.("square", new EmittersSquareShapeGenerator());
@@ -4767,7 +4820,7 @@
4767
4820
  }
4768
4821
 
4769
4822
  async function loadLifeUpdater(engine) {
4770
- engine.checkVersion("4.0.2");
4823
+ engine.checkVersion("4.0.3");
4771
4824
  await engine.pluginManager.register(e => {
4772
4825
  e.pluginManager.addParticleUpdater("life", container => {
4773
4826
  return Promise.resolve(new LifeUpdater(container));
@@ -4793,7 +4846,7 @@
4793
4846
  }
4794
4847
 
4795
4848
  async function loadLineShape(engine) {
4796
- engine.checkVersion("4.0.2");
4849
+ engine.checkVersion("4.0.3");
4797
4850
  await engine.pluginManager.register(e => {
4798
4851
  e.pluginManager.addShape(["line"], () => Promise.resolve(new LineDrawer()));
4799
4852
  });
@@ -4925,7 +4978,7 @@
4925
4978
  }
4926
4979
 
4927
4980
  async function loadRotateUpdater(engine) {
4928
- engine.checkVersion("4.0.2");
4981
+ engine.checkVersion("4.0.3");
4929
4982
  await engine.pluginManager.register(e => {
4930
4983
  e.pluginManager.addParticleUpdater("rotate", container => {
4931
4984
  return Promise.resolve(new RotateUpdater(container));
@@ -5306,7 +5359,7 @@
5306
5359
  }
5307
5360
 
5308
5361
  async function loadSoundsPlugin(engine) {
5309
- engine.checkVersion("4.0.2");
5362
+ engine.checkVersion("4.0.3");
5310
5363
  await engine.pluginManager.register(e => {
5311
5364
  e.pluginManager.addPlugin(new SoundsPlugin(e));
5312
5365
  });
@@ -5389,7 +5442,7 @@
5389
5442
  }
5390
5443
 
5391
5444
  async function loadTrailEffect(engine) {
5392
- engine.checkVersion("4.0.2");
5445
+ engine.checkVersion("4.0.3");
5393
5446
  await engine.pluginManager.register(e => {
5394
5447
  e.pluginManager.addEffect("trail", container => {
5395
5448
  return Promise.resolve(new TrailDrawer(container));
@@ -7487,6 +7540,44 @@
7487
7540
  Container: Container
7488
7541
  });
7489
7542
 
7543
+ class BlendPluginInstance {
7544
+ _container;
7545
+ _defaultCompositeValue;
7546
+ constructor(container) {
7547
+ this._container = container;
7548
+ }
7549
+ drawParticleCleanup(context, particle) {
7550
+ if (!particle.options.blend?.enable) {
7551
+ return;
7552
+ }
7553
+ context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
7554
+ particle.originalBlendMode = undefined;
7555
+ }
7556
+ drawParticleSetup(context, particle) {
7557
+ if (!particle.options.blend?.enable) {
7558
+ return;
7559
+ }
7560
+ particle.originalBlendMode = context.globalCompositeOperation;
7561
+ context.globalCompositeOperation = particle.options.blend.mode;
7562
+ }
7563
+ drawSettingsCleanup(context) {
7564
+ if (!this._defaultCompositeValue) {
7565
+ return;
7566
+ }
7567
+ context.globalCompositeOperation = this._defaultCompositeValue;
7568
+ }
7569
+ drawSettingsSetup(context) {
7570
+ const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
7571
+ this._defaultCompositeValue = previousComposite;
7572
+ context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
7573
+ }
7574
+ }
7575
+
7576
+ var BlendPluginInstance$1 = /*#__PURE__*/Object.freeze({
7577
+ __proto__: null,
7578
+ BlendPluginInstance: BlendPluginInstance
7579
+ });
7580
+
7490
7581
  const minVelocity = 0, identity = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
7491
7582
  function applyDistance(particle) {
7492
7583
  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;