@tsparticles/plugin-blend 4.0.0-beta.0 → 4.0.0-beta.2

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.
@@ -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-beta.0
7
+ * v4.0.0-beta.2
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -44,7 +44,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
44
44
  \*******************************/
45
45
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
46
46
 
47
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadBlendPlugin: () => (/* binding */ loadBlendPlugin)\n/* harmony export */ });\nasync function loadBlendPlugin(engine) {\n engine.checkVersion(\"4.0.0-beta.0\");\n await engine.register(async (e)=>{\n const { BlendPlugin } = await __webpack_require__.e(/*! import() */ \"dist_browser_BlendPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./BlendPlugin.js */ \"./dist/browser/BlendPlugin.js\"));\n e.addPlugin(new BlendPlugin());\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-blend/./dist/browser/index.js?\n}");
47
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadBlendPlugin: () => (/* binding */ loadBlendPlugin)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nasync function loadBlendPlugin(engine) {\n engine.checkVersion(\"4.0.0-beta.2\");\n await engine.pluginManager.register(async (e)=>{\n const { BlendPlugin } = await __webpack_require__.e(/*! import() */ \"dist_browser_BlendPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./BlendPlugin.js */ \"./dist/browser/BlendPlugin.js\"));\n e.pluginManager.addPlugin(new BlendPlugin());\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-blend/./dist/browser/index.js?\n}");
48
48
 
49
49
  /***/ }
50
50
 
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,e=>(()=>{"use strict";var t,r,o,n={303(t){t.exports=e}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e](r,r.exports,a),r.exports}a.m=n,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,r)=>(a.f[r](e,t),t),[])),a.u=e=>""+e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s={},a.l=(e,t,r,o)=>{if(s[e])return void s[e].push(t);if(void 0!==r)for(var n,i,l=document.getElementsByTagName("script"),c=0;c<l.length;c++){var p=l[c];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")=="@tsparticles/plugin-blend:"+r){n=p;break}}n||(i=!0,(n=document.createElement("script")).charset="utf-8",a.nc&&n.setAttribute("nonce",a.nc),n.setAttribute("data-webpack","@tsparticles/plugin-blend:"+r),n.src=e),s[e]=[t];var u=(t,r)=>{n.onerror=n.onload=null,clearTimeout(d);var o=s[e];if(delete s[e],n.parentNode&&n.parentNode.removeChild(n),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=u.bind(null,n.onerror),n.onload=u.bind(null,n.onload),i&&document.head.appendChild(n)},a.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(l=a.g.location+"");var s,l,c=a.g.document;if(!l&&c&&(c.currentScript&&"SCRIPT"===c.currentScript.tagName.toUpperCase()&&(l=c.currentScript.src),!l)){var p=c.getElementsByTagName("script");if(p.length)for(var u=p.length-1;u>-1&&(!l||!/^http(s?):/.test(l));)l=p[u--].src}if(!l)throw Error("Automatic publicPath is not supported in this browser");a.p=l=l.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={313:0},a.f.j=(e,r)=>{var o=a.o(t,e)?t[e]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=t[e]=[r,n]);r.push(o[2]=n);var i=a.p+a.u(e),s=Error();a.l(i,r=>{if(a.o(t,e)&&(0!==(o=t[e])&&(t[e]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+e+` failed.
2
- (`+n+": "+i+")",s.name="ChunkLoadError",s.type=n,s.request=i,o[1](s)}},"chunk-"+e,e)}},r=(e,r)=>{var o,n,[i,s,l]=r,c=0;if(i.some(e=>0!==t[e])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);l&&l(a)}for(e&&e(r);c<i.length;c++)n=i[c],a.o(t,n)&&t[n]&&t[n][0](),t[n]=0},(o=this.webpackChunk_tsparticles_plugin_blend=this.webpackChunk_tsparticles_plugin_blend||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};async function f(e){e.checkVersion("4.0.0-beta.0"),await e.register(async e=>{let{BlendPlugin:t}=await a.e(884).then(a.bind(a,884));e.addPlugin(new t)})}return a.r(d),a.d(d,{loadBlendPlugin:()=>f}),d})());
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,e=>(()=>{"use strict";var t,r,n,o={303(t){t.exports=e}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,a),r.exports}a.m=o,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,r)=>(a.f[r](e,t),t),[])),a.u=e=>""+e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l={},a.l=(e,t,r,n)=>{if(l[e])return void l[e].push(t);if(void 0!==r)for(var o,i,s=document.getElementsByTagName("script"),p=0;p<s.length;p++){var c=s[p];if(c.getAttribute("src")==e||c.getAttribute("data-webpack")=="@tsparticles/plugin-blend:"+r){o=c;break}}o||(i=!0,(o=document.createElement("script")).charset="utf-8",a.nc&&o.setAttribute("nonce",a.nc),o.setAttribute("data-webpack","@tsparticles/plugin-blend:"+r),o.src=e),l[e]=[t];var u=(t,r)=>{o.onerror=o.onload=null,clearTimeout(d);var n=l[e];if(delete l[e],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),i&&document.head.appendChild(o)},a.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(s=a.g.location+"");var l,s,p=a.g.document;if(!s&&p&&(p.currentScript&&"SCRIPT"===p.currentScript.tagName.toUpperCase()&&(s=p.currentScript.src),!s)){var c=p.getElementsByTagName("script");if(c.length)for(var u=c.length-1;u>-1&&(!s||!/^http(s?):/.test(s));)s=c[u--].src}if(!s)throw Error("Automatic publicPath is not supported in this browser");a.p=s=s.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={313:0},a.f.j=(e,r)=>{var n=a.o(t,e)?t[e]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise((r,o)=>n=t[e]=[r,o]);r.push(n[2]=o);var i=a.p+a.u(e),l=Error();a.l(i,r=>{if(a.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;l.message="Loading chunk "+e+` failed.
2
+ (`+o+": "+i+")",l.name="ChunkLoadError",l.type=o,l.request=i,n[1](l)}},"chunk-"+e,e)}},r=(e,r)=>{var n,o,[i,l,s]=r,p=0;if(i.some(e=>0!==t[e])){for(n in l)a.o(l,n)&&(a.m[n]=l[n]);s&&s(a)}for(e&&e(r);p<i.length;p++)o=i[p],a.o(t,o)&&t[o]&&t[o][0](),t[o]=0},(n=this.webpackChunk_tsparticles_plugin_blend=this.webpackChunk_tsparticles_plugin_blend||[]).forEach(r.bind(null,0)),n.push=r.bind(null,n.push.bind(n));var d={};async function f(e){e.checkVersion("4.0.0-beta.2"),await e.pluginManager.register(async e=>{let{BlendPlugin:t}=await a.e(978).then(a.bind(a,978));e.pluginManager.addPlugin(new t)})}return a.r(d),a.d(d,{loadBlendPlugin:()=>f}),a(303),d})());
@@ -1,11 +1,11 @@
1
1
  import type { BlendContainer, BlendParticle } from "./types.js";
2
- import { type IContainerPlugin } from "@tsparticles/engine";
2
+ import { type CanvasContextType, type IContainerPlugin } from "@tsparticles/engine";
3
3
  export declare class BlendPluginInstance implements IContainerPlugin {
4
4
  private readonly _container;
5
5
  private _defaultCompositeValue?;
6
6
  constructor(container: BlendContainer);
7
- drawParticleCleanup(context: CanvasRenderingContext2D, particle: BlendParticle): void;
8
- drawParticleSetup(context: CanvasRenderingContext2D, particle: BlendParticle): void;
9
- drawSettingsCleanup(context: CanvasRenderingContext2D): void;
10
- drawSettingsSetup(context: CanvasRenderingContext2D): void;
7
+ drawParticleCleanup(context: CanvasContextType, particle: BlendParticle): void;
8
+ drawParticleSetup(context: CanvasContextType, particle: BlendParticle): void;
9
+ drawSettingsCleanup(context: CanvasContextType): void;
10
+ drawSettingsSetup(context: CanvasContextType): void;
11
11
  }
@@ -1,73 +0,0 @@
1
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
- if (k2 === undefined) k2 = k;
3
- var desc = Object.getOwnPropertyDescriptor(m, k);
4
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
- desc = { enumerable: true, get: function() { return m[k]; } };
6
- }
7
- Object.defineProperty(o, k2, desc);
8
- }) : (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- o[k2] = m[k];
11
- }));
12
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
- Object.defineProperty(o, "default", { enumerable: true, value: v });
14
- }) : function(o, v) {
15
- o["default"] = v;
16
- });
17
- var __importStar = (this && this.__importStar) || (function () {
18
- var ownKeys = function(o) {
19
- ownKeys = Object.getOwnPropertyNames || function (o) {
20
- var ar = [];
21
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
22
- return ar;
23
- };
24
- return ownKeys(o);
25
- };
26
- return function (mod) {
27
- if (mod && mod.__esModule) return mod;
28
- var result = {};
29
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
30
- __setModuleDefault(result, mod);
31
- return result;
32
- };
33
- })();
34
- (function (factory) {
35
- if (typeof module === "object" && typeof module.exports === "object") {
36
- var v = factory(require, exports);
37
- if (v !== undefined) module.exports = v;
38
- }
39
- else if (typeof define === "function" && define.amd) {
40
- define(["require", "exports", "./Options/Classes/Blend.js"], factory);
41
- }
42
- })(function (require, exports) {
43
- "use strict";
44
- var __syncRequire = typeof module === "object" && typeof module.exports === "object";
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.BlendPlugin = void 0;
47
- const Blend_js_1 = require("./Options/Classes/Blend.js");
48
- class BlendPlugin {
49
- id = "blend";
50
- async getPlugin(container) {
51
- const { BlendPluginInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./BlendPluginInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./BlendPluginInstance.js"], resolve_1, reject_1); }).then(__importStar));
52
- return new BlendPluginInstance(container);
53
- }
54
- loadOptions(_container, options, source) {
55
- if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
56
- return;
57
- }
58
- let blendOptions = options.blend;
59
- if (!blendOptions?.load) {
60
- options.blend = blendOptions = new Blend_js_1.Blend();
61
- }
62
- blendOptions.load(source?.blend);
63
- }
64
- loadParticlesOptions(_container, options, source) {
65
- options.blend ??= new Blend_js_1.Blend();
66
- options.blend.load(source?.blend);
67
- }
68
- needsPlugin(options) {
69
- return !!options?.blend?.enable || !!options?.particles?.blend?.enable;
70
- }
71
- }
72
- exports.BlendPlugin = BlendPlugin;
73
- });
@@ -1,47 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.BlendPluginInstance = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- class BlendPluginInstance {
15
- _container;
16
- _defaultCompositeValue;
17
- constructor(container) {
18
- this._container = container;
19
- }
20
- drawParticleCleanup(context, particle) {
21
- if (!particle.options.blend?.enable) {
22
- return;
23
- }
24
- context.globalCompositeOperation = particle.originalBlendMode ?? engine_1.defaultCompositeValue;
25
- particle.originalBlendMode = undefined;
26
- }
27
- drawParticleSetup(context, particle) {
28
- if (!particle.options.blend?.enable) {
29
- return;
30
- }
31
- particle.originalBlendMode = context.globalCompositeOperation;
32
- context.globalCompositeOperation = particle.options.blend.mode;
33
- }
34
- drawSettingsCleanup(context) {
35
- if (!this._defaultCompositeValue) {
36
- return;
37
- }
38
- context.globalCompositeOperation = this._defaultCompositeValue;
39
- }
40
- drawSettingsSetup(context) {
41
- const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
42
- this._defaultCompositeValue = previousComposite;
43
- context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
44
- }
45
- }
46
- exports.BlendPluginInstance = BlendPluginInstance;
47
- });
@@ -1,34 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Blend = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- class Blend {
15
- enable;
16
- mode;
17
- constructor() {
18
- this.mode = "destination-out";
19
- this.enable = false;
20
- }
21
- load(data) {
22
- if ((0, engine_1.isNull)(data)) {
23
- return;
24
- }
25
- if (data.mode !== undefined) {
26
- this.mode = data.mode;
27
- }
28
- if (data.enable !== undefined) {
29
- this.enable = data.enable;
30
- }
31
- }
32
- }
33
- exports.Blend = Blend;
34
- });
@@ -1,12 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- });
package/umd/index.js DELETED
@@ -1,54 +0,0 @@
1
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
- if (k2 === undefined) k2 = k;
3
- var desc = Object.getOwnPropertyDescriptor(m, k);
4
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
- desc = { enumerable: true, get: function() { return m[k]; } };
6
- }
7
- Object.defineProperty(o, k2, desc);
8
- }) : (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- o[k2] = m[k];
11
- }));
12
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
- Object.defineProperty(o, "default", { enumerable: true, value: v });
14
- }) : function(o, v) {
15
- o["default"] = v;
16
- });
17
- var __importStar = (this && this.__importStar) || (function () {
18
- var ownKeys = function(o) {
19
- ownKeys = Object.getOwnPropertyNames || function (o) {
20
- var ar = [];
21
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
22
- return ar;
23
- };
24
- return ownKeys(o);
25
- };
26
- return function (mod) {
27
- if (mod && mod.__esModule) return mod;
28
- var result = {};
29
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
30
- __setModuleDefault(result, mod);
31
- return result;
32
- };
33
- })();
34
- (function (factory) {
35
- if (typeof module === "object" && typeof module.exports === "object") {
36
- var v = factory(require, exports);
37
- if (v !== undefined) module.exports = v;
38
- }
39
- else if (typeof define === "function" && define.amd) {
40
- define(["require", "exports"], factory);
41
- }
42
- })(function (require, exports) {
43
- "use strict";
44
- var __syncRequire = typeof module === "object" && typeof module.exports === "object";
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.loadBlendPlugin = loadBlendPlugin;
47
- async function loadBlendPlugin(engine) {
48
- engine.checkVersion("4.0.0-beta.0");
49
- await engine.register(async (e) => {
50
- const { BlendPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./BlendPlugin.js"))) : new Promise((resolve_1, reject_1) => { require(["./BlendPlugin.js"], resolve_1, reject_1); }).then(__importStar));
51
- e.addPlugin(new BlendPlugin());
52
- });
53
- }
54
- });
package/umd/types.js DELETED
@@ -1,12 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- });