@tsparticles/plugin-blend 4.0.0-alpha.8 → 4.0.0-beta.1

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.
package/517.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_plugin_blend=this.webpackChunk_tsparticles_plugin_blend||[]).push([[517],{517(e,o,t){t.d(o,{BlendPluginInstance:()=>a});var l=t(303);class a{_container;_defaultCompositeValue;constructor(e){this._container=e}drawParticleCleanup(e,o){o.options.blend?.enable&&(e.globalCompositeOperation=o.originalBlendMode??l.defaultCompositeValue,o.originalBlendMode=void 0)}drawParticleSetup(e,o){o.options.blend?.enable&&(o.originalBlendMode=e.globalCompositeOperation,e.globalCompositeOperation=o.options.blend.mode)}drawSettingsCleanup(e){this._defaultCompositeValue&&(e.globalCompositeOperation=this._defaultCompositeValue)}drawSettingsSetup(e){let o=e.globalCompositeOperation,t=this._container.actualOptions.blend;this._defaultCompositeValue=o,e.globalCompositeOperation=t?.enable?t.mode:o}}}}]);
package/978.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_plugin_blend=this.webpackChunk_tsparticles_plugin_blend||[]).push([[978],{978(e,n,l){l.d(n,{BlendPlugin:()=>t});var d=l(303);class i{enable;mode;constructor(){this.mode="destination-out",this.enable=!1}load(e){(0,d.isNull)(e)||(void 0!==e.mode&&(this.mode=e.mode),void 0!==e.enable&&(this.enable=e.enable))}}class t{id="blend";async getPlugin(e){let{BlendPluginInstance:n}=await l.e(517).then(l.bind(l,517));return new n(e)}loadOptions(e,n,l){if(!this.needsPlugin(n)&&!this.needsPlugin(l))return;let d=n.blend;d?.load||(n.blend=d=new i),d.load(l?.blend)}loadParticlesOptions(e,n,l){n.blend??=new i,n.blend.load(l?.blend)}needsPlugin(e){return!!e?.blend?.enable||!!e?.particles?.blend?.enable}}}}]);
@@ -1,8 +1,6 @@
1
1
  import { Blend } from "./Options/Classes/Blend.js";
2
2
  export class BlendPlugin {
3
- constructor() {
4
- this.id = "blend";
5
- }
3
+ id = "blend";
6
4
  async getPlugin(container) {
7
5
  const { BlendPluginInstance } = await import("./BlendPluginInstance.js");
8
6
  return new BlendPluginInstance(container);
@@ -1,9 +1,15 @@
1
+ import { defaultCompositeValue } from "@tsparticles/engine";
1
2
  export class BlendPluginInstance {
3
+ _container;
4
+ _defaultCompositeValue;
2
5
  constructor(container) {
3
6
  this._container = container;
4
7
  }
5
8
  drawParticleCleanup(context, particle) {
6
- context.globalCompositeOperation = particle.originalBlendMode ?? "source-over";
9
+ if (!particle.options.blend?.enable) {
10
+ return;
11
+ }
12
+ context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
7
13
  particle.originalBlendMode = undefined;
8
14
  }
9
15
  drawParticleSetup(context, particle) {
@@ -1,5 +1,7 @@
1
1
  import { isNull } from "@tsparticles/engine";
2
2
  export class Blend {
3
+ enable;
4
+ mode;
3
5
  constructor() {
4
6
  this.mode = "destination-out";
5
7
  this.enable = false;
package/browser/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export async function loadBlendPlugin(engine) {
2
- engine.checkVersion("4.0.0-alpha.8");
3
- await engine.register(async (e) => {
2
+ engine.checkVersion("4.0.0-beta.1");
3
+ await engine.pluginManager.register(async (e) => {
4
4
  const { BlendPlugin } = await import("./BlendPlugin.js");
5
- e.addPlugin(new BlendPlugin());
5
+ e.pluginManager.addPlugin(new BlendPlugin());
6
6
  });
7
7
  }
@@ -1,8 +1,6 @@
1
1
  import { Blend } from "./Options/Classes/Blend.js";
2
2
  export class BlendPlugin {
3
- constructor() {
4
- this.id = "blend";
5
- }
3
+ id = "blend";
6
4
  async getPlugin(container) {
7
5
  const { BlendPluginInstance } = await import("./BlendPluginInstance.js");
8
6
  return new BlendPluginInstance(container);
@@ -1,9 +1,15 @@
1
+ import { defaultCompositeValue } from "@tsparticles/engine";
1
2
  export class BlendPluginInstance {
3
+ _container;
4
+ _defaultCompositeValue;
2
5
  constructor(container) {
3
6
  this._container = container;
4
7
  }
5
8
  drawParticleCleanup(context, particle) {
6
- context.globalCompositeOperation = particle.originalBlendMode ?? "source-over";
9
+ if (!particle.options.blend?.enable) {
10
+ return;
11
+ }
12
+ context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
7
13
  particle.originalBlendMode = undefined;
8
14
  }
9
15
  drawParticleSetup(context, particle) {
@@ -1,5 +1,7 @@
1
1
  import { isNull } from "@tsparticles/engine";
2
2
  export class Blend {
3
+ enable;
4
+ mode;
3
5
  constructor() {
4
6
  this.mode = "destination-out";
5
7
  this.enable = false;
package/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export async function loadBlendPlugin(engine) {
2
- engine.checkVersion("4.0.0-alpha.8");
3
- await engine.register(async (e) => {
2
+ engine.checkVersion("4.0.0-beta.1");
3
+ await engine.pluginManager.register(async (e) => {
4
4
  const { BlendPlugin } = await import("./BlendPlugin.js");
5
- e.addPlugin(new BlendPlugin());
5
+ e.pluginManager.addPlugin(new BlendPlugin());
6
6
  });
7
7
  }
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v4.0.0-alpha.8
7
+ * v4.0.0-beta.1
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -23,7 +23,7 @@
23
23
  \*********************************************/
24
24
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
25
 
26
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BlendPluginInstance: () => (/* binding */ BlendPluginInstance)\n/* harmony export */ });\nclass BlendPluginInstance {\n constructor(container) {\n this._container = container;\n }\n drawParticleCleanup(context, particle) {\n context.globalCompositeOperation = particle.originalBlendMode ?? \"source-over\";\n particle.originalBlendMode = undefined;\n }\n drawParticleSetup(context, particle) {\n if (!particle.options.blend?.enable) {\n return;\n }\n particle.originalBlendMode = context.globalCompositeOperation;\n context.globalCompositeOperation = particle.options.blend.mode;\n }\n drawSettingsCleanup(context) {\n if (!this._defaultCompositeValue) {\n return;\n }\n context.globalCompositeOperation = this._defaultCompositeValue;\n }\n drawSettingsSetup(context) {\n const previousComposite = context.globalCompositeOperation,\n blend = this._container.actualOptions.blend;\n this._defaultCompositeValue = previousComposite;\n context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-blend/./dist/browser/BlendPluginInstance.js?\n}");
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BlendPluginInstance: () => (/* binding */ BlendPluginInstance)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass BlendPluginInstance {\n _container;\n _defaultCompositeValue;\n constructor(container){\n this._container = container;\n }\n drawParticleCleanup(context, particle) {\n if (!particle.options.blend?.enable) {\n return;\n }\n context.globalCompositeOperation = particle.originalBlendMode ?? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.defaultCompositeValue;\n particle.originalBlendMode = undefined;\n }\n drawParticleSetup(context, particle) {\n if (!particle.options.blend?.enable) {\n return;\n }\n particle.originalBlendMode = context.globalCompositeOperation;\n context.globalCompositeOperation = particle.options.blend.mode;\n }\n drawSettingsCleanup(context) {\n if (!this._defaultCompositeValue) {\n return;\n }\n context.globalCompositeOperation = this._defaultCompositeValue;\n }\n drawSettingsSetup(context) {\n const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;\n this._defaultCompositeValue = previousComposite;\n context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-blend/./dist/browser/BlendPluginInstance.js?\n}");
27
27
 
28
28
  /***/ }
29
29
 
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v4.0.0-alpha.8
7
+ * v4.0.0-beta.1
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -23,7 +23,7 @@
23
23
  \*************************************/
24
24
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
25
 
26
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BlendPlugin: () => (/* binding */ BlendPlugin)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Blend_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Blend.js */ \"./dist/browser/Options/Classes/Blend.js\");\n\nclass BlendPlugin {\n constructor() {\n this.id = \"blend\";\n }\n async getPlugin(container) {\n const {\n BlendPluginInstance\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_BlendPluginInstance_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./BlendPluginInstance.js */ \"./dist/browser/BlendPluginInstance.js\"));\n return new BlendPluginInstance(container);\n }\n loadOptions(_container, options, source) {\n if (!this.needsPlugin(options) && !this.needsPlugin(source)) {\n return;\n }\n let blendOptions = options.blend;\n if (!blendOptions?.load) {\n options.blend = blendOptions = new _Options_Classes_Blend_js__WEBPACK_IMPORTED_MODULE_0__.Blend();\n }\n blendOptions.load(source?.blend);\n }\n loadParticlesOptions(_container, options, source) {\n options.blend ??= new _Options_Classes_Blend_js__WEBPACK_IMPORTED_MODULE_0__.Blend();\n options.blend.load(source?.blend);\n }\n needsPlugin(options) {\n return !!options?.blend?.enable || !!options?.particles?.blend?.enable;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-blend/./dist/browser/BlendPlugin.js?\n}");
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BlendPlugin: () => (/* binding */ BlendPlugin)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_Blend_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/Blend.js */ \"./dist/browser/Options/Classes/Blend.js\");\n\nclass BlendPlugin {\n id = \"blend\";\n async getPlugin(container) {\n const { BlendPluginInstance } = await __webpack_require__.e(/*! import() */ \"dist_browser_BlendPluginInstance_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./BlendPluginInstance.js */ \"./dist/browser/BlendPluginInstance.js\"));\n return new BlendPluginInstance(container);\n }\n loadOptions(_container, options, source) {\n if (!this.needsPlugin(options) && !this.needsPlugin(source)) {\n return;\n }\n let blendOptions = options.blend;\n if (!blendOptions?.load) {\n options.blend = blendOptions = new _Options_Classes_Blend_js__WEBPACK_IMPORTED_MODULE_0__.Blend();\n }\n blendOptions.load(source?.blend);\n }\n loadParticlesOptions(_container, options, source) {\n options.blend ??= new _Options_Classes_Blend_js__WEBPACK_IMPORTED_MODULE_0__.Blend();\n options.blend.load(source?.blend);\n }\n needsPlugin(options) {\n return !!options?.blend?.enable || !!options?.particles?.blend?.enable;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-blend/./dist/browser/BlendPlugin.js?\n}");
27
27
 
28
28
  /***/ },
29
29
 
@@ -33,7 +33,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
33
33
  \***********************************************/
34
34
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
35
 
36
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Blend: () => (/* binding */ Blend)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass Blend {\n constructor() {\n this.mode = \"destination-out\";\n this.enable = false;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.mode !== undefined) {\n this.mode = data.mode;\n }\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-blend/./dist/browser/Options/Classes/Blend.js?\n}");
36
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Blend: () => (/* binding */ Blend)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass Blend {\n enable;\n mode;\n constructor(){\n this.mode = \"destination-out\";\n this.enable = false;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.mode !== undefined) {\n this.mode = data.mode;\n }\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-blend/./dist/browser/Options/Classes/Blend.js?\n}");
37
37
 
38
38
  /***/ }
39
39
 
@@ -1,8 +1,6 @@
1
1
  import { Blend } from "./Options/Classes/Blend.js";
2
2
  export class BlendPlugin {
3
- constructor() {
4
- this.id = "blend";
5
- }
3
+ id = "blend";
6
4
  async getPlugin(container) {
7
5
  const { BlendPluginInstance } = await import("./BlendPluginInstance.js");
8
6
  return new BlendPluginInstance(container);
@@ -1,9 +1,15 @@
1
+ import { defaultCompositeValue } from "@tsparticles/engine";
1
2
  export class BlendPluginInstance {
3
+ _container;
4
+ _defaultCompositeValue;
2
5
  constructor(container) {
3
6
  this._container = container;
4
7
  }
5
8
  drawParticleCleanup(context, particle) {
6
- context.globalCompositeOperation = particle.originalBlendMode ?? "source-over";
9
+ if (!particle.options.blend?.enable) {
10
+ return;
11
+ }
12
+ context.globalCompositeOperation = particle.originalBlendMode ?? defaultCompositeValue;
7
13
  particle.originalBlendMode = undefined;
8
14
  }
9
15
  drawParticleSetup(context, particle) {
@@ -1,5 +1,7 @@
1
1
  import { isNull } from "@tsparticles/engine";
2
2
  export class Blend {
3
+ enable;
4
+ mode;
3
5
  constructor() {
4
6
  this.mode = "destination-out";
5
7
  this.enable = false;
package/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export async function loadBlendPlugin(engine) {
2
- engine.checkVersion("4.0.0-alpha.8");
3
- await engine.register(async (e) => {
2
+ engine.checkVersion("4.0.0-beta.1");
3
+ await engine.pluginManager.register(async (e) => {
4
4
  const { BlendPlugin } = await import("./BlendPlugin.js");
5
- e.addPlugin(new BlendPlugin());
5
+ e.pluginManager.addPlugin(new BlendPlugin());
6
6
  });
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/plugin-blend",
3
- "version": "4.0.0-alpha.8",
3
+ "version": "4.0.0-beta.1",
4
4
  "description": "tsParticles blend plugin",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -86,7 +86,7 @@
86
86
  "./package.json": "./package.json"
87
87
  },
88
88
  "dependencies": {
89
- "@tsparticles/engine": "4.0.0-alpha.8"
89
+ "@tsparticles/engine": "4.0.0-beta.1"
90
90
  },
91
91
  "publishConfig": {
92
92
  "access": "public"