@tsparticles/plugin-blend 4.0.0-alpha.8

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.
Files changed (46) hide show
  1. package/647.min.js +2 -0
  2. package/647.min.js.LICENSE.txt +1 -0
  3. package/707.min.js +2 -0
  4. package/707.min.js.LICENSE.txt +1 -0
  5. package/LICENSE +21 -0
  6. package/README.md +74 -0
  7. package/browser/BlendPlugin.js +27 -0
  8. package/browser/BlendPluginInstance.js +27 -0
  9. package/browser/Options/Classes/Blend.js +18 -0
  10. package/browser/Options/Interfaces/IBlend.js +1 -0
  11. package/browser/index.js +7 -0
  12. package/browser/package.json +1 -0
  13. package/browser/types.js +1 -0
  14. package/cjs/BlendPlugin.js +27 -0
  15. package/cjs/BlendPluginInstance.js +27 -0
  16. package/cjs/Options/Classes/Blend.js +18 -0
  17. package/cjs/Options/Interfaces/IBlend.js +1 -0
  18. package/cjs/index.js +7 -0
  19. package/cjs/package.json +1 -0
  20. package/cjs/types.js +1 -0
  21. package/dist_browser_BlendPluginInstance_js.js +30 -0
  22. package/dist_browser_BlendPlugin_js.js +40 -0
  23. package/esm/BlendPlugin.js +27 -0
  24. package/esm/BlendPluginInstance.js +27 -0
  25. package/esm/Options/Classes/Blend.js +18 -0
  26. package/esm/Options/Interfaces/IBlend.js +1 -0
  27. package/esm/index.js +7 -0
  28. package/esm/package.json +1 -0
  29. package/esm/types.js +1 -0
  30. package/package.json +95 -0
  31. package/report.html +40 -0
  32. package/tsparticles.plugin.blend.js +305 -0
  33. package/tsparticles.plugin.blend.min.js +2 -0
  34. package/tsparticles.plugin.blend.min.js.LICENSE.txt +1 -0
  35. package/types/BlendPlugin.d.ts +10 -0
  36. package/types/BlendPluginInstance.d.ts +11 -0
  37. package/types/Options/Classes/Blend.d.ts +8 -0
  38. package/types/Options/Interfaces/IBlend.d.ts +4 -0
  39. package/types/index.d.ts +2 -0
  40. package/types/types.d.ts +24 -0
  41. package/umd/BlendPlugin.js +75 -0
  42. package/umd/BlendPluginInstance.js +41 -0
  43. package/umd/Options/Classes/Blend.js +32 -0
  44. package/umd/Options/Interfaces/IBlend.js +12 -0
  45. package/umd/index.js +54 -0
  46. package/umd/types.js +12 -0
@@ -0,0 +1,305 @@
1
+ /*!
2
+ * Author : Matteo Bruni
3
+ * MIT license: https://opensource.org/licenses/MIT
4
+ * Demo / Generator : https://particles.js.org/
5
+ * GitHub : https://www.github.com/matteobruni/tsparticles
6
+ * How to use? : Check the GitHub README
7
+ * v4.0.0-alpha.8
8
+ */
9
+ /*
10
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
11
+ * This devtool is neither made for production nor for readable output files.
12
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
13
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
14
+ * or disable the default devtool with "devtool: false".
15
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
16
+ */
17
+ (function webpackUniversalModuleDefinition(root, factory) {
18
+ if(typeof exports === 'object' && typeof module === 'object')
19
+ module.exports = factory(require("@tsparticles/engine"));
20
+ else if(typeof define === 'function' && define.amd)
21
+ define(["@tsparticles/engine"], factory);
22
+ else {
23
+ var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
24
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
25
+ }
26
+ })(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
27
+ return /******/ (() => { // webpackBootstrap
28
+ /******/ "use strict";
29
+ /******/ var __webpack_modules__ = ({
30
+
31
+ /***/ "./dist/browser/index.js"
32
+ /*!*******************************!*\
33
+ !*** ./dist/browser/index.js ***!
34
+ \*******************************/
35
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
36
+
37
+ 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-alpha.8\");\n await engine.register(async e => {\n const {\n BlendPlugin\n } = 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//# sourceURL=webpack://@tsparticles/plugin-blend/./dist/browser/index.js?\n}");
38
+
39
+ /***/ },
40
+
41
+ /***/ "@tsparticles/engine"
42
+ /*!*********************************************************************************************************************************!*\
43
+ !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
44
+ \*********************************************************************************************************************************/
45
+ (module) {
46
+
47
+ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
48
+
49
+ /***/ }
50
+
51
+ /******/ });
52
+ /************************************************************************/
53
+ /******/ // The module cache
54
+ /******/ var __webpack_module_cache__ = {};
55
+ /******/
56
+ /******/ // The require function
57
+ /******/ function __webpack_require__(moduleId) {
58
+ /******/ // Check if module is in cache
59
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
60
+ /******/ if (cachedModule !== undefined) {
61
+ /******/ return cachedModule.exports;
62
+ /******/ }
63
+ /******/ // Check if module exists (development only)
64
+ /******/ if (__webpack_modules__[moduleId] === undefined) {
65
+ /******/ var e = new Error("Cannot find module '" + moduleId + "'");
66
+ /******/ e.code = 'MODULE_NOT_FOUND';
67
+ /******/ throw e;
68
+ /******/ }
69
+ /******/ // Create a new module (and put it into the cache)
70
+ /******/ var module = __webpack_module_cache__[moduleId] = {
71
+ /******/ // no module.id needed
72
+ /******/ // no module.loaded needed
73
+ /******/ exports: {}
74
+ /******/ };
75
+ /******/
76
+ /******/ // Execute the module function
77
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
78
+ /******/
79
+ /******/ // Return the exports of the module
80
+ /******/ return module.exports;
81
+ /******/ }
82
+ /******/
83
+ /******/ // expose the modules object (__webpack_modules__)
84
+ /******/ __webpack_require__.m = __webpack_modules__;
85
+ /******/
86
+ /************************************************************************/
87
+ /******/ /* webpack/runtime/define property getters */
88
+ /******/ (() => {
89
+ /******/ // define getter functions for harmony exports
90
+ /******/ __webpack_require__.d = (exports, definition) => {
91
+ /******/ for(var key in definition) {
92
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
93
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
94
+ /******/ }
95
+ /******/ }
96
+ /******/ };
97
+ /******/ })();
98
+ /******/
99
+ /******/ /* webpack/runtime/ensure chunk */
100
+ /******/ (() => {
101
+ /******/ __webpack_require__.f = {};
102
+ /******/ // This file contains only the entry chunk.
103
+ /******/ // The chunk loading function for additional chunks
104
+ /******/ __webpack_require__.e = (chunkId) => {
105
+ /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
106
+ /******/ __webpack_require__.f[key](chunkId, promises);
107
+ /******/ return promises;
108
+ /******/ }, []));
109
+ /******/ };
110
+ /******/ })();
111
+ /******/
112
+ /******/ /* webpack/runtime/get javascript chunk filename */
113
+ /******/ (() => {
114
+ /******/ // This function allow to reference async chunks
115
+ /******/ __webpack_require__.u = (chunkId) => {
116
+ /******/ // return url for filenames based on template
117
+ /******/ return "" + chunkId + ".js";
118
+ /******/ };
119
+ /******/ })();
120
+ /******/
121
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
122
+ /******/ (() => {
123
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
124
+ /******/ })();
125
+ /******/
126
+ /******/ /* webpack/runtime/load script */
127
+ /******/ (() => {
128
+ /******/ var inProgress = {};
129
+ /******/ var dataWebpackPrefix = "@tsparticles/plugin-blend:";
130
+ /******/ // loadScript function to load a script via script tag
131
+ /******/ __webpack_require__.l = (url, done, key, chunkId) => {
132
+ /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
133
+ /******/ var script, needAttach;
134
+ /******/ if(key !== undefined) {
135
+ /******/ var scripts = document.getElementsByTagName("script");
136
+ /******/ for(var i = 0; i < scripts.length; i++) {
137
+ /******/ var s = scripts[i];
138
+ /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
139
+ /******/ }
140
+ /******/ }
141
+ /******/ if(!script) {
142
+ /******/ needAttach = true;
143
+ /******/ script = document.createElement('script');
144
+ /******/
145
+ /******/ script.charset = 'utf-8';
146
+ /******/ if (__webpack_require__.nc) {
147
+ /******/ script.setAttribute("nonce", __webpack_require__.nc);
148
+ /******/ }
149
+ /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
150
+ /******/
151
+ /******/ script.src = url;
152
+ /******/ }
153
+ /******/ inProgress[url] = [done];
154
+ /******/ var onScriptComplete = (prev, event) => {
155
+ /******/ // avoid mem leaks in IE.
156
+ /******/ script.onerror = script.onload = null;
157
+ /******/ clearTimeout(timeout);
158
+ /******/ var doneFns = inProgress[url];
159
+ /******/ delete inProgress[url];
160
+ /******/ script.parentNode && script.parentNode.removeChild(script);
161
+ /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
162
+ /******/ if(prev) return prev(event);
163
+ /******/ }
164
+ /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
165
+ /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
166
+ /******/ script.onload = onScriptComplete.bind(null, script.onload);
167
+ /******/ needAttach && document.head.appendChild(script);
168
+ /******/ };
169
+ /******/ })();
170
+ /******/
171
+ /******/ /* webpack/runtime/make namespace object */
172
+ /******/ (() => {
173
+ /******/ // define __esModule on exports
174
+ /******/ __webpack_require__.r = (exports) => {
175
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
176
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
177
+ /******/ }
178
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
179
+ /******/ };
180
+ /******/ })();
181
+ /******/
182
+ /******/ /* webpack/runtime/publicPath */
183
+ /******/ (() => {
184
+ /******/ var scriptUrl;
185
+ /******/ if (globalThis.importScripts) scriptUrl = globalThis.location + "";
186
+ /******/ var document = globalThis.document;
187
+ /******/ if (!scriptUrl && document) {
188
+ /******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
189
+ /******/ scriptUrl = document.currentScript.src;
190
+ /******/ if (!scriptUrl) {
191
+ /******/ var scripts = document.getElementsByTagName("script");
192
+ /******/ if(scripts.length) {
193
+ /******/ var i = scripts.length - 1;
194
+ /******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
195
+ /******/ }
196
+ /******/ }
197
+ /******/ }
198
+ /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
199
+ /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
200
+ /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
201
+ /******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
202
+ /******/ __webpack_require__.p = scriptUrl;
203
+ /******/ })();
204
+ /******/
205
+ /******/ /* webpack/runtime/jsonp chunk loading */
206
+ /******/ (() => {
207
+ /******/ // no baseURI
208
+ /******/
209
+ /******/ // object to store loaded and loading chunks
210
+ /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
211
+ /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
212
+ /******/ var installedChunks = {
213
+ /******/ "tsparticles.plugin.blend": 0
214
+ /******/ };
215
+ /******/
216
+ /******/ __webpack_require__.f.j = (chunkId, promises) => {
217
+ /******/ // JSONP chunk loading for javascript
218
+ /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
219
+ /******/ if(installedChunkData !== 0) { // 0 means "already installed".
220
+ /******/
221
+ /******/ // a Promise means "currently loading".
222
+ /******/ if(installedChunkData) {
223
+ /******/ promises.push(installedChunkData[2]);
224
+ /******/ } else {
225
+ /******/ if(true) { // all chunks have JS
226
+ /******/ // setup Promise in chunk cache
227
+ /******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
228
+ /******/ promises.push(installedChunkData[2] = promise);
229
+ /******/
230
+ /******/ // start chunk loading
231
+ /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
232
+ /******/ // create error before stack unwound to get useful stacktrace later
233
+ /******/ var error = new Error();
234
+ /******/ var loadingEnded = (event) => {
235
+ /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
236
+ /******/ installedChunkData = installedChunks[chunkId];
237
+ /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
238
+ /******/ if(installedChunkData) {
239
+ /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
240
+ /******/ var realSrc = event && event.target && event.target.src;
241
+ /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
242
+ /******/ error.name = 'ChunkLoadError';
243
+ /******/ error.type = errorType;
244
+ /******/ error.request = realSrc;
245
+ /******/ installedChunkData[1](error);
246
+ /******/ }
247
+ /******/ }
248
+ /******/ };
249
+ /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
250
+ /******/ }
251
+ /******/ }
252
+ /******/ }
253
+ /******/ };
254
+ /******/
255
+ /******/ // no prefetching
256
+ /******/
257
+ /******/ // no preloaded
258
+ /******/
259
+ /******/ // no HMR
260
+ /******/
261
+ /******/ // no HMR manifest
262
+ /******/
263
+ /******/ // no on chunks loaded
264
+ /******/
265
+ /******/ // install a JSONP callback for chunk loading
266
+ /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
267
+ /******/ var [chunkIds, moreModules, runtime] = data;
268
+ /******/ // add "moreModules" to the modules object,
269
+ /******/ // then flag all "chunkIds" as loaded and fire callback
270
+ /******/ var moduleId, chunkId, i = 0;
271
+ /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
272
+ /******/ for(moduleId in moreModules) {
273
+ /******/ if(__webpack_require__.o(moreModules, moduleId)) {
274
+ /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
275
+ /******/ }
276
+ /******/ }
277
+ /******/ if(runtime) var result = runtime(__webpack_require__);
278
+ /******/ }
279
+ /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
280
+ /******/ for(;i < chunkIds.length; i++) {
281
+ /******/ chunkId = chunkIds[i];
282
+ /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
283
+ /******/ installedChunks[chunkId][0]();
284
+ /******/ }
285
+ /******/ installedChunks[chunkId] = 0;
286
+ /******/ }
287
+ /******/
288
+ /******/ }
289
+ /******/
290
+ /******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_plugin_blend"] = this["webpackChunk_tsparticles_plugin_blend"] || [];
291
+ /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
292
+ /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
293
+ /******/ })();
294
+ /******/
295
+ /************************************************************************/
296
+ /******/
297
+ /******/ // startup
298
+ /******/ // Load entry module and return exports
299
+ /******/ // This entry module can't be inlined because the eval devtool is used.
300
+ /******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
301
+ /******/
302
+ /******/ return __webpack_exports__;
303
+ /******/ })()
304
+ ;
305
+ });
@@ -0,0 +1,2 @@
1
+ /*! For license information please see tsparticles.plugin.blend.min.js.LICENSE.txt */
2
+ !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=>(()=>{var t,r,o={303(t){t.exports=e}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.m=o,i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,r)=>(i.f[r](e,t),t)),[])),i.u=e=>e+".min.js",i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/plugin-blend:",i.l=(e,o,n,a)=>{if(t[e])t[e].push(o);else{var l,s;if(void 0!==n)for(var p=document.getElementsByTagName("script"),c=0;c<p.length;c++){var u=p[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+n){l=u;break}}l||(s=!0,(l=document.createElement("script")).charset="utf-8",i.nc&&l.setAttribute("nonce",i.nc),l.setAttribute("data-webpack",r+n),l.src=e),t[e]=[o];var d=(r,o)=>{l.onerror=l.onload=null,clearTimeout(f);var n=t[e];if(delete t[e],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach((e=>e(o))),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),s&&document.head.appendChild(l)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var t=globalThis.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{var e={313:0};i.f.j=(t,r)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise(((r,n)=>o=e[t]=[r,n]));r.push(o[2]=n);var a=i.p+i.u(t),l=new Error;i.l(a,(r=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;l.message="Loading chunk "+t+" failed.\n("+n+": "+a+")",l.name="ChunkLoadError",l.type=n,l.request=a,o[1](l)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,n,[a,l,s]=r,p=0;if(a.some((t=>0!==e[t]))){for(o in l)i.o(l,o)&&(i.m[o]=l[o]);if(s)s(i)}for(t&&t(r);p<a.length;p++)n=a[p],i.o(e,n)&&e[n]&&e[n][0](),e[n]=0},r=this.webpackChunk_tsparticles_plugin_blend=this.webpackChunk_tsparticles_plugin_blend||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};async function l(e){e.checkVersion("4.0.0-alpha.8"),await e.register((async e=>{const{BlendPlugin:t}=await i.e(647).then(i.bind(i,647));e.addPlugin(new t)}))}return i.r(a),i.d(a,{loadBlendPlugin:()=>l}),a})()));
@@ -0,0 +1 @@
1
+ /*! tsParticles Blend Plugin v4.0.0-alpha.8 by Matteo Bruni */
@@ -0,0 +1,10 @@
1
+ import type { BlendOptions, BlendParticlesOptions, IBlendOptions, IBlendParticlesOptions } from "./types.js";
2
+ import type { Container, IContainerPlugin, IPlugin, RecursivePartial } from "@tsparticles/engine";
3
+ export declare class BlendPlugin implements IPlugin {
4
+ readonly id: string;
5
+ constructor();
6
+ getPlugin(container: Container): Promise<IContainerPlugin>;
7
+ loadOptions(_container: Container, options: BlendOptions, source?: RecursivePartial<IBlendOptions>): void;
8
+ loadParticlesOptions(_container: Container, options: BlendParticlesOptions, source?: RecursivePartial<IBlendParticlesOptions>): void;
9
+ needsPlugin(options?: RecursivePartial<IBlendOptions>): boolean;
10
+ }
@@ -0,0 +1,11 @@
1
+ import type { BlendContainer, BlendParticle } from "./types.js";
2
+ import { type IContainerPlugin } from "@tsparticles/engine";
3
+ export declare class BlendPluginInstance implements IContainerPlugin {
4
+ private readonly _container;
5
+ private _defaultCompositeValue?;
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;
11
+ }
@@ -0,0 +1,8 @@
1
+ import { type IOptionLoader, type RecursivePartial } from "@tsparticles/engine";
2
+ import type { IBlend } from "../Interfaces/IBlend.js";
3
+ export declare class Blend implements IBlend, IOptionLoader<IBlend> {
4
+ enable: boolean;
5
+ mode: GlobalCompositeOperation;
6
+ constructor();
7
+ load(data?: RecursivePartial<IBlend>): void;
8
+ }
@@ -0,0 +1,4 @@
1
+ export interface IBlend {
2
+ enable: boolean;
3
+ mode: GlobalCompositeOperation;
4
+ }
@@ -0,0 +1,2 @@
1
+ import { type Engine } from "@tsparticles/engine";
2
+ export declare function loadBlendPlugin(engine: Engine): Promise<void>;
@@ -0,0 +1,24 @@
1
+ import type { Container, IOptions, IParticlesOptions, Options, Particle, ParticlesOptions } from "@tsparticles/engine";
2
+ import type { Blend } from "./Options/Classes/Blend.js";
3
+ import type { IBlend } from "./Options/Interfaces/IBlend.js";
4
+ export type IBlendParticlesOptions = IParticlesOptions & {
5
+ blend?: IBlend;
6
+ };
7
+ export type BlendParticlesOptions = ParticlesOptions & {
8
+ blend?: Blend;
9
+ };
10
+ export type IBlendOptions = IOptions & {
11
+ blend?: IBlend;
12
+ particles: IBlendParticlesOptions;
13
+ };
14
+ export type BlendOptions = Options & {
15
+ blend?: Blend;
16
+ particles: BlendParticlesOptions;
17
+ };
18
+ export type BlendContainer = Container & {
19
+ actualOptions: BlendOptions;
20
+ };
21
+ export type BlendParticle = Particle & {
22
+ options: BlendParticlesOptions;
23
+ originalBlendMode?: GlobalCompositeOperation;
24
+ };
@@ -0,0 +1,75 @@
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
+ constructor() {
50
+ this.id = "blend";
51
+ }
52
+ async getPlugin(container) {
53
+ 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));
54
+ return new BlendPluginInstance(container);
55
+ }
56
+ loadOptions(_container, options, source) {
57
+ if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
58
+ return;
59
+ }
60
+ let blendOptions = options.blend;
61
+ if (!blendOptions?.load) {
62
+ options.blend = blendOptions = new Blend_js_1.Blend();
63
+ }
64
+ blendOptions.load(source?.blend);
65
+ }
66
+ loadParticlesOptions(_container, options, source) {
67
+ options.blend ??= new Blend_js_1.Blend();
68
+ options.blend.load(source?.blend);
69
+ }
70
+ needsPlugin(options) {
71
+ return !!options?.blend?.enable || !!options?.particles?.blend?.enable;
72
+ }
73
+ }
74
+ exports.BlendPlugin = BlendPlugin;
75
+ });
@@ -0,0 +1,41 @@
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
+ exports.BlendPluginInstance = void 0;
13
+ class BlendPluginInstance {
14
+ constructor(container) {
15
+ this._container = container;
16
+ }
17
+ drawParticleCleanup(context, particle) {
18
+ context.globalCompositeOperation = particle.originalBlendMode ?? "source-over";
19
+ particle.originalBlendMode = undefined;
20
+ }
21
+ drawParticleSetup(context, particle) {
22
+ if (!particle.options.blend?.enable) {
23
+ return;
24
+ }
25
+ particle.originalBlendMode = context.globalCompositeOperation;
26
+ context.globalCompositeOperation = particle.options.blend.mode;
27
+ }
28
+ drawSettingsCleanup(context) {
29
+ if (!this._defaultCompositeValue) {
30
+ return;
31
+ }
32
+ context.globalCompositeOperation = this._defaultCompositeValue;
33
+ }
34
+ drawSettingsSetup(context) {
35
+ const previousComposite = context.globalCompositeOperation, blend = this._container.actualOptions.blend;
36
+ this._defaultCompositeValue = previousComposite;
37
+ context.globalCompositeOperation = blend?.enable ? blend.mode : previousComposite;
38
+ }
39
+ }
40
+ exports.BlendPluginInstance = BlendPluginInstance;
41
+ });
@@ -0,0 +1,32 @@
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
+ constructor() {
16
+ this.mode = "destination-out";
17
+ this.enable = false;
18
+ }
19
+ load(data) {
20
+ if ((0, engine_1.isNull)(data)) {
21
+ return;
22
+ }
23
+ if (data.mode !== undefined) {
24
+ this.mode = data.mode;
25
+ }
26
+ if (data.enable !== undefined) {
27
+ this.enable = data.enable;
28
+ }
29
+ }
30
+ }
31
+ exports.Blend = Blend;
32
+ });
@@ -0,0 +1,12 @@
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 ADDED
@@ -0,0 +1,54 @@
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-alpha.8");
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 ADDED
@@ -0,0 +1,12 @@
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
+ });