@tsparticles/fireworks 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
- /* tsParticles v4.0.2 */
2
+ /* tsParticles 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) :
@@ -1118,7 +1118,7 @@
1118
1118
  return this._domArray;
1119
1119
  }
1120
1120
  get version() {
1121
- return "4.0.2";
1121
+ return "4.0.4";
1122
1122
  }
1123
1123
  addEventListener(type, listener) {
1124
1124
  this._eventDispatcher.addEventListener(type, listener);
@@ -3314,6 +3314,58 @@
3314
3314
  return createPromise;
3315
3315
  }
3316
3316
 
3317
+ class Blend {
3318
+ enable;
3319
+ mode;
3320
+ constructor() {
3321
+ this.mode = "destination-out";
3322
+ this.enable = false;
3323
+ }
3324
+ load(data) {
3325
+ if (isNull(data)) {
3326
+ return;
3327
+ }
3328
+ if (data.mode !== undefined) {
3329
+ this.mode = data.mode;
3330
+ }
3331
+ if (data.enable !== undefined) {
3332
+ this.enable = data.enable;
3333
+ }
3334
+ }
3335
+ }
3336
+
3337
+ class BlendPlugin {
3338
+ id = "blend";
3339
+ async getPlugin(container) {
3340
+ const { BlendPluginInstance } = await Promise.resolve().then(function () { return BlendPluginInstance$1; });
3341
+ return new BlendPluginInstance(container);
3342
+ }
3343
+ loadOptions(_container, options, source) {
3344
+ if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
3345
+ return;
3346
+ }
3347
+ let blendOptions = options.blend;
3348
+ if (!blendOptions?.load) {
3349
+ options.blend = blendOptions = new Blend();
3350
+ }
3351
+ blendOptions.load(source?.blend);
3352
+ }
3353
+ loadParticlesOptions(_container, options, source) {
3354
+ options.blend ??= new Blend();
3355
+ options.blend.load(source?.blend);
3356
+ }
3357
+ needsPlugin(options) {
3358
+ return !!options?.blend?.enable || !!options?.particles?.blend?.enable;
3359
+ }
3360
+ }
3361
+
3362
+ async function loadBlendPlugin(engine) {
3363
+ engine.checkVersion("4.0.4");
3364
+ await engine.pluginManager.register(e => {
3365
+ e.pluginManager.addPlugin(new BlendPlugin());
3366
+ });
3367
+ }
3368
+
3317
3369
  const minAngle$1 = 0;
3318
3370
  function drawCircle(data) {
3319
3371
  const { context, particle, radius } = data;
@@ -3345,7 +3397,7 @@
3345
3397
  }
3346
3398
 
3347
3399
  async function loadCircleShape(engine) {
3348
- engine.checkVersion("4.0.2");
3400
+ engine.checkVersion("4.0.4");
3349
3401
  await engine.pluginManager.register(e => {
3350
3402
  e.pluginManager.addShape(["circle"], () => {
3351
3403
  return Promise.resolve(new CircleDrawer());
@@ -3393,7 +3445,7 @@
3393
3445
  }
3394
3446
 
3395
3447
  async function loadHexColorPlugin(engine) {
3396
- engine.checkVersion("4.0.2");
3448
+ engine.checkVersion("4.0.4");
3397
3449
  await engine.pluginManager.register(e => {
3398
3450
  e.pluginManager.addColorManager("hex", new HexColorManager());
3399
3451
  });
@@ -3446,7 +3498,7 @@
3446
3498
  }
3447
3499
 
3448
3500
  async function loadHslColorPlugin(engine) {
3449
- engine.checkVersion("4.0.2");
3501
+ engine.checkVersion("4.0.4");
3450
3502
  await engine.pluginManager.register(e => {
3451
3503
  e.pluginManager.addColorManager("hsl", new HslColorManager());
3452
3504
  });
@@ -3470,7 +3522,7 @@
3470
3522
  }
3471
3523
 
3472
3524
  async function loadMovePlugin(engine) {
3473
- engine.checkVersion("4.0.2");
3525
+ engine.checkVersion("4.0.4");
3474
3526
  await engine.pluginManager.register(e => {
3475
3527
  const moveEngine = e, movePluginManager = moveEngine.pluginManager;
3476
3528
  movePluginManager.initializers.pathGenerators ??= new Map();
@@ -3531,7 +3583,7 @@
3531
3583
  }
3532
3584
 
3533
3585
  async function loadOpacityUpdater(engine) {
3534
- engine.checkVersion("4.0.2");
3586
+ engine.checkVersion("4.0.4");
3535
3587
  await engine.pluginManager.register(e => {
3536
3588
  e.pluginManager.addParticleUpdater("opacity", container => {
3537
3589
  return Promise.resolve(new OpacityUpdater(container));
@@ -3883,7 +3935,7 @@
3883
3935
  }
3884
3936
 
3885
3937
  async function loadOutModesUpdater(engine) {
3886
- engine.checkVersion("4.0.2");
3938
+ engine.checkVersion("4.0.4");
3887
3939
  await engine.pluginManager.register(e => {
3888
3940
  e.pluginManager.addParticleUpdater("outModes", container => {
3889
3941
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3954,7 +4006,7 @@
3954
4006
  }
3955
4007
 
3956
4008
  async function loadPaintUpdater(engine) {
3957
- engine.checkVersion("4.0.2");
4009
+ engine.checkVersion("4.0.4");
3958
4010
  await engine.pluginManager.register(e => {
3959
4011
  e.pluginManager.addParticleUpdater("paint", container => {
3960
4012
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -4009,7 +4061,7 @@
4009
4061
  }
4010
4062
 
4011
4063
  async function loadRgbColorPlugin(engine) {
4012
- engine.checkVersion("4.0.2");
4064
+ engine.checkVersion("4.0.4");
4013
4065
  await engine.pluginManager.register(e => {
4014
4066
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
4015
4067
  });
@@ -4052,7 +4104,7 @@
4052
4104
  }
4053
4105
 
4054
4106
  async function loadSizeUpdater(engine) {
4055
- engine.checkVersion("4.0.2");
4107
+ engine.checkVersion("4.0.4");
4056
4108
  await engine.pluginManager.register(e => {
4057
4109
  e.pluginManager.addParticleUpdater("size", container => {
4058
4110
  return Promise.resolve(new SizeUpdater(container));
@@ -4061,9 +4113,10 @@
4061
4113
  }
4062
4114
 
4063
4115
  async function loadBasic(engine) {
4064
- engine.checkVersion("4.0.2");
4116
+ engine.checkVersion("4.0.4");
4065
4117
  await engine.pluginManager.register(async (e) => {
4066
4118
  await Promise.all([
4119
+ loadBlendPlugin(e),
4067
4120
  loadHexColorPlugin(e),
4068
4121
  loadHslColorPlugin(e),
4069
4122
  loadRgbColorPlugin(e),
@@ -4077,58 +4130,6 @@
4077
4130
  });
4078
4131
  }
4079
4132
 
4080
- class Blend {
4081
- enable;
4082
- mode;
4083
- constructor() {
4084
- this.mode = "destination-out";
4085
- this.enable = false;
4086
- }
4087
- load(data) {
4088
- if (isNull(data)) {
4089
- return;
4090
- }
4091
- if (data.mode !== undefined) {
4092
- this.mode = data.mode;
4093
- }
4094
- if (data.enable !== undefined) {
4095
- this.enable = data.enable;
4096
- }
4097
- }
4098
- }
4099
-
4100
- class BlendPlugin {
4101
- id = "blend";
4102
- async getPlugin(container) {
4103
- const { BlendPluginInstance } = await Promise.resolve().then(function () { return BlendPluginInstance$1; });
4104
- return new BlendPluginInstance(container);
4105
- }
4106
- loadOptions(_container, options, source) {
4107
- if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
4108
- return;
4109
- }
4110
- let blendOptions = options.blend;
4111
- if (!blendOptions?.load) {
4112
- options.blend = blendOptions = new Blend();
4113
- }
4114
- blendOptions.load(source?.blend);
4115
- }
4116
- loadParticlesOptions(_container, options, source) {
4117
- options.blend ??= new Blend();
4118
- options.blend.load(source?.blend);
4119
- }
4120
- needsPlugin(options) {
4121
- return !!options?.blend?.enable || !!options?.particles?.blend?.enable;
4122
- }
4123
- }
4124
-
4125
- async function loadBlendPlugin(engine) {
4126
- engine.checkVersion("4.0.2");
4127
- await engine.pluginManager.register(e => {
4128
- e.pluginManager.addPlugin(new BlendPlugin());
4129
- });
4130
- }
4131
-
4132
4133
  class DestroyBounds {
4133
4134
  bottom;
4134
4135
  left;
@@ -4482,7 +4483,7 @@
4482
4483
  }
4483
4484
 
4484
4485
  async function loadDestroyUpdater(engine) {
4485
- engine.checkVersion("4.0.2");
4486
+ engine.checkVersion("4.0.4");
4486
4487
  await engine.pluginManager.register(e => {
4487
4488
  e.pluginManager.addParticleUpdater("destroy", container => {
4488
4489
  return Promise.resolve(new DestroyUpdater(e.pluginManager, container));
@@ -4775,7 +4776,7 @@
4775
4776
  })(EmitterClickMode || (EmitterClickMode = {}));
4776
4777
 
4777
4778
  async function loadEmittersPluginSimple(engine) {
4778
- engine.checkVersion("4.0.2");
4779
+ engine.checkVersion("4.0.4");
4779
4780
  await engine.pluginManager.register(async (e) => {
4780
4781
  const instancesManager = await getEmittersInstancesManager(e);
4781
4782
  await addEmittersShapesManager(e);
@@ -4863,7 +4864,7 @@
4863
4864
  }
4864
4865
 
4865
4866
  async function loadEmittersShapeSquare(engine) {
4866
- engine.checkVersion("4.0.2");
4867
+ engine.checkVersion("4.0.4");
4867
4868
  await engine.pluginManager.register((e) => {
4868
4869
  ensureEmittersPluginLoaded(e);
4869
4870
  e.pluginManager.addEmitterShapeGenerator?.("square", new EmittersSquareShapeGenerator());
@@ -5029,7 +5030,7 @@
5029
5030
  }
5030
5031
 
5031
5032
  async function loadLifeUpdater(engine) {
5032
- engine.checkVersion("4.0.2");
5033
+ engine.checkVersion("4.0.4");
5033
5034
  await engine.pluginManager.register(e => {
5034
5035
  e.pluginManager.addParticleUpdater("life", container => {
5035
5036
  return Promise.resolve(new LifeUpdater(container));
@@ -5055,7 +5056,7 @@
5055
5056
  }
5056
5057
 
5057
5058
  async function loadLineShape(engine) {
5058
- engine.checkVersion("4.0.2");
5059
+ engine.checkVersion("4.0.4");
5059
5060
  await engine.pluginManager.register(e => {
5060
5061
  e.pluginManager.addShape(["line"], () => Promise.resolve(new LineDrawer()));
5061
5062
  });
@@ -5187,7 +5188,7 @@
5187
5188
  }
5188
5189
 
5189
5190
  async function loadRotateUpdater(engine) {
5190
- engine.checkVersion("4.0.2");
5191
+ engine.checkVersion("4.0.4");
5191
5192
  await engine.pluginManager.register(e => {
5192
5193
  e.pluginManager.addParticleUpdater("rotate", container => {
5193
5194
  return Promise.resolve(new RotateUpdater(container));
@@ -5568,7 +5569,7 @@
5568
5569
  }
5569
5570
 
5570
5571
  async function loadSoundsPlugin(engine) {
5571
- engine.checkVersion("4.0.2");
5572
+ engine.checkVersion("4.0.4");
5572
5573
  await engine.pluginManager.register(e => {
5573
5574
  e.pluginManager.addPlugin(new SoundsPlugin(e));
5574
5575
  });
@@ -5576,7 +5577,7 @@
5576
5577
 
5577
5578
  let initPromise = null;
5578
5579
  async function doInitPlugins(engine) {
5579
- engine.checkVersion("4.0.2");
5580
+ engine.checkVersion("4.0.4");
5580
5581
  await engine.pluginManager.register(async (e) => {
5581
5582
  const loadEmittersForFireworks = async (e) => {
5582
5583
  await loadEmittersPluginSimple(e);
@@ -5623,7 +5624,7 @@
5623
5624
  fireworks.init = async () => {
5624
5625
  await initPlugins(tsParticles);
5625
5626
  };
5626
- fireworks.version = "4.0.2";
5627
+ fireworks.version = "4.0.4";
5627
5628
  globalThis.fireworks = fireworks;
5628
5629
 
5629
5630
  const globalObject = globalThis;
@@ -7716,6 +7717,44 @@
7716
7717
  FireworksInstance: FireworksInstance
7717
7718
  });
7718
7719
 
7720
+ class BlendPluginInstance {
7721
+ _container;
7722
+ _defaultCompositeValue;
7723
+ constructor(container) {
7724
+ this._container = container;
7725
+ }
7726
+ drawParticleCleanup(context, particle) {
7727
+ if (!particle.options.blend?.enable) {
7728
+ return;
7729
+ }
7730
+ context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
7731
+ particle.originalBlendMode = undefined;
7732
+ }
7733
+ drawParticleSetup(context, particle) {
7734
+ if (!particle.options.blend?.enable) {
7735
+ return;
7736
+ }
7737
+ particle.originalBlendMode = context.globalCompositeOperation;
7738
+ context.globalCompositeOperation = particle.options.blend.mode;
7739
+ }
7740
+ drawSettingsCleanup(context) {
7741
+ if (!this._defaultCompositeValue) {
7742
+ return;
7743
+ }
7744
+ context.globalCompositeOperation = this._defaultCompositeValue;
7745
+ }
7746
+ drawSettingsSetup(context) {
7747
+ const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
7748
+ this._defaultCompositeValue = previousComposite;
7749
+ context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
7750
+ }
7751
+ }
7752
+
7753
+ var BlendPluginInstance$1 = /*#__PURE__*/Object.freeze({
7754
+ __proto__: null,
7755
+ BlendPluginInstance: BlendPluginInstance
7756
+ });
7757
+
7719
7758
  const minVelocity = 0, identity = 1, moveSpeedFactor = 60, minSpinRadius = 0, spinFactor = 0.01, defaultPathDelay = 0, noDecay = 1;
7720
7759
  function applyDistance(particle) {
7721
7760
  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;
@@ -7933,44 +7972,6 @@
7933
7972
  MovePluginInstance: MovePluginInstance
7934
7973
  });
7935
7974
 
7936
- class BlendPluginInstance {
7937
- _container;
7938
- _defaultCompositeValue;
7939
- constructor(container) {
7940
- this._container = container;
7941
- }
7942
- drawParticleCleanup(context, particle) {
7943
- if (!particle.options.blend?.enable) {
7944
- return;
7945
- }
7946
- context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
7947
- particle.originalBlendMode = undefined;
7948
- }
7949
- drawParticleSetup(context, particle) {
7950
- if (!particle.options.blend?.enable) {
7951
- return;
7952
- }
7953
- particle.originalBlendMode = context.globalCompositeOperation;
7954
- context.globalCompositeOperation = particle.options.blend.mode;
7955
- }
7956
- drawSettingsCleanup(context) {
7957
- if (!this._defaultCompositeValue) {
7958
- return;
7959
- }
7960
- context.globalCompositeOperation = this._defaultCompositeValue;
7961
- }
7962
- drawSettingsSetup(context) {
7963
- const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
7964
- this._defaultCompositeValue = previousComposite;
7965
- context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
7966
- }
7967
- }
7968
-
7969
- var BlendPluginInstance$1 = /*#__PURE__*/Object.freeze({
7970
- __proto__: null,
7971
- BlendPluginInstance: BlendPluginInstance
7972
- });
7973
-
7974
7975
  class EmittersPluginInstance {
7975
7976
  container;
7976
7977
  _instancesManager;