@tsparticles/plugin-export-image 3.9.1 → 4.0.0-alpha.0

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
- * v3.9.1
7
+ * v4.0.0-alpha.0
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -28,35 +28,15 @@ return /******/ (() => { // webpackBootstrap
28
28
  /******/ "use strict";
29
29
  /******/ var __webpack_modules__ = ({
30
30
 
31
- /***/ "./dist/browser/ExportImageInstance.js":
32
- /*!*********************************************!*\
33
- !*** ./dist/browser/ExportImageInstance.js ***!
34
- \*********************************************/
35
- /***/ ((__unused_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 */ ExportImageInstance: () => (/* binding */ ExportImageInstance)\n/* harmony export */ });\nclass ExportImageInstance {\n constructor(container, engine) {\n this._exportImage = async data => {\n const element = this._container.canvas.element;\n if (!element) {\n return;\n }\n return new Promise(resolve => {\n element.toBlob(blob => {\n if (!blob) {\n resolve(undefined);\n return;\n }\n resolve(blob);\n }, data.type ?? \"image/png\", data.quality);\n });\n };\n this._container = container;\n this._engine = engine;\n }\n async export(type, data) {\n const res = {\n supported: false\n };\n switch (type) {\n case \"image\":\n res.supported = true;\n res.blob = await this._exportImage(data);\n break;\n }\n return res;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-export-image/./dist/browser/ExportImageInstance.js?\n}");
38
-
39
- /***/ }),
40
-
41
- /***/ "./dist/browser/ExportImagePlugin.js":
42
- /*!*******************************************!*\
43
- !*** ./dist/browser/ExportImagePlugin.js ***!
44
- \*******************************************/
45
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
46
-
47
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ExportImagePlugin: () => (/* binding */ ExportImagePlugin)\n/* harmony export */ });\n/* harmony import */ var _ExportImageInstance_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExportImageInstance.js */ \"./dist/browser/ExportImageInstance.js\");\n\nclass ExportImagePlugin {\n constructor(engine) {\n this.id = \"export-image\";\n this._engine = engine;\n }\n getPlugin(container) {\n return Promise.resolve(new _ExportImageInstance_js__WEBPACK_IMPORTED_MODULE_0__.ExportImageInstance(container, this._engine));\n }\n loadOptions() {}\n needsPlugin() {\n return true;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-export-image/./dist/browser/ExportImagePlugin.js?\n}");
48
-
49
- /***/ }),
50
-
51
- /***/ "./dist/browser/index.js":
31
+ /***/ "./dist/browser/index.js"
52
32
  /*!*******************************!*\
53
33
  !*** ./dist/browser/index.js ***!
54
34
  \*******************************/
55
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
35
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
56
36
 
57
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadExportImagePlugin: () => (/* binding */ loadExportImagePlugin)\n/* harmony export */ });\n/* harmony import */ var _ExportImagePlugin_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExportImagePlugin.js */ \"./dist/browser/ExportImagePlugin.js\");\n\nasync function loadExportImagePlugin(engine, refresh = true) {\n engine.checkVersion(\"3.9.1\");\n await engine.addPlugin(new _ExportImagePlugin_js__WEBPACK_IMPORTED_MODULE_0__.ExportImagePlugin(engine), refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-export-image/./dist/browser/index.js?\n}");
37
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadExportImagePlugin: () => (/* binding */ loadExportImagePlugin)\n/* harmony export */ });\nfunction loadExportImagePlugin(engine) {\n engine.checkVersion(\"4.0.0-alpha.0\");\n engine.register(async e => {\n const {\n ExportImagePlugin\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_ExportImagePlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./ExportImagePlugin.js */ \"./dist/browser/ExportImagePlugin.js\"));\n e.addPlugin(new ExportImagePlugin());\n });\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-export-image/./dist/browser/index.js?\n}");
58
38
 
59
- /***/ })
39
+ /***/ }
60
40
 
61
41
  /******/ });
62
42
  /************************************************************************/
@@ -70,6 +50,12 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
70
50
  /******/ if (cachedModule !== undefined) {
71
51
  /******/ return cachedModule.exports;
72
52
  /******/ }
53
+ /******/ // Check if module exists (development only)
54
+ /******/ if (__webpack_modules__[moduleId] === undefined) {
55
+ /******/ var e = new Error("Cannot find module '" + moduleId + "'");
56
+ /******/ e.code = 'MODULE_NOT_FOUND';
57
+ /******/ throw e;
58
+ /******/ }
73
59
  /******/ // Create a new module (and put it into the cache)
74
60
  /******/ var module = __webpack_module_cache__[moduleId] = {
75
61
  /******/ // no module.id needed
@@ -84,6 +70,9 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
84
70
  /******/ return module.exports;
85
71
  /******/ }
86
72
  /******/
73
+ /******/ // expose the modules object (__webpack_modules__)
74
+ /******/ __webpack_require__.m = __webpack_modules__;
75
+ /******/
87
76
  /************************************************************************/
88
77
  /******/ /* webpack/runtime/define property getters */
89
78
  /******/ (() => {
@@ -97,11 +86,90 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
97
86
  /******/ };
98
87
  /******/ })();
99
88
  /******/
89
+ /******/ /* webpack/runtime/ensure chunk */
90
+ /******/ (() => {
91
+ /******/ __webpack_require__.f = {};
92
+ /******/ // This file contains only the entry chunk.
93
+ /******/ // The chunk loading function for additional chunks
94
+ /******/ __webpack_require__.e = (chunkId) => {
95
+ /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
96
+ /******/ __webpack_require__.f[key](chunkId, promises);
97
+ /******/ return promises;
98
+ /******/ }, []));
99
+ /******/ };
100
+ /******/ })();
101
+ /******/
102
+ /******/ /* webpack/runtime/get javascript chunk filename */
103
+ /******/ (() => {
104
+ /******/ // This function allow to reference async chunks
105
+ /******/ __webpack_require__.u = (chunkId) => {
106
+ /******/ // return url for filenames based on template
107
+ /******/ return "" + chunkId + ".js";
108
+ /******/ };
109
+ /******/ })();
110
+ /******/
111
+ /******/ /* webpack/runtime/global */
112
+ /******/ (() => {
113
+ /******/ __webpack_require__.g = (function() {
114
+ /******/ if (typeof globalThis === 'object') return globalThis;
115
+ /******/ try {
116
+ /******/ return this || new Function('return this')();
117
+ /******/ } catch (e) {
118
+ /******/ if (typeof window === 'object') return window;
119
+ /******/ }
120
+ /******/ })();
121
+ /******/ })();
122
+ /******/
100
123
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
101
124
  /******/ (() => {
102
125
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
103
126
  /******/ })();
104
127
  /******/
128
+ /******/ /* webpack/runtime/load script */
129
+ /******/ (() => {
130
+ /******/ var inProgress = {};
131
+ /******/ var dataWebpackPrefix = "@tsparticles/plugin-export-image:";
132
+ /******/ // loadScript function to load a script via script tag
133
+ /******/ __webpack_require__.l = (url, done, key, chunkId) => {
134
+ /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
135
+ /******/ var script, needAttach;
136
+ /******/ if(key !== undefined) {
137
+ /******/ var scripts = document.getElementsByTagName("script");
138
+ /******/ for(var i = 0; i < scripts.length; i++) {
139
+ /******/ var s = scripts[i];
140
+ /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
141
+ /******/ }
142
+ /******/ }
143
+ /******/ if(!script) {
144
+ /******/ needAttach = true;
145
+ /******/ script = document.createElement('script');
146
+ /******/
147
+ /******/ script.charset = 'utf-8';
148
+ /******/ if (__webpack_require__.nc) {
149
+ /******/ script.setAttribute("nonce", __webpack_require__.nc);
150
+ /******/ }
151
+ /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
152
+ /******/
153
+ /******/ script.src = url;
154
+ /******/ }
155
+ /******/ inProgress[url] = [done];
156
+ /******/ var onScriptComplete = (prev, event) => {
157
+ /******/ // avoid mem leaks in IE.
158
+ /******/ script.onerror = script.onload = null;
159
+ /******/ clearTimeout(timeout);
160
+ /******/ var doneFns = inProgress[url];
161
+ /******/ delete inProgress[url];
162
+ /******/ script.parentNode && script.parentNode.removeChild(script);
163
+ /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
164
+ /******/ if(prev) return prev(event);
165
+ /******/ }
166
+ /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
167
+ /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
168
+ /******/ script.onload = onScriptComplete.bind(null, script.onload);
169
+ /******/ needAttach && document.head.appendChild(script);
170
+ /******/ };
171
+ /******/ })();
172
+ /******/
105
173
  /******/ /* webpack/runtime/make namespace object */
106
174
  /******/ (() => {
107
175
  /******/ // define __esModule on exports
@@ -113,6 +181,119 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
113
181
  /******/ };
114
182
  /******/ })();
115
183
  /******/
184
+ /******/ /* webpack/runtime/publicPath */
185
+ /******/ (() => {
186
+ /******/ var scriptUrl;
187
+ /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
188
+ /******/ var document = __webpack_require__.g.document;
189
+ /******/ if (!scriptUrl && document) {
190
+ /******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
191
+ /******/ scriptUrl = document.currentScript.src;
192
+ /******/ if (!scriptUrl) {
193
+ /******/ var scripts = document.getElementsByTagName("script");
194
+ /******/ if(scripts.length) {
195
+ /******/ var i = scripts.length - 1;
196
+ /******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
197
+ /******/ }
198
+ /******/ }
199
+ /******/ }
200
+ /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
201
+ /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
202
+ /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
203
+ /******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
204
+ /******/ __webpack_require__.p = scriptUrl;
205
+ /******/ })();
206
+ /******/
207
+ /******/ /* webpack/runtime/jsonp chunk loading */
208
+ /******/ (() => {
209
+ /******/ // no baseURI
210
+ /******/
211
+ /******/ // object to store loaded and loading chunks
212
+ /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
213
+ /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
214
+ /******/ var installedChunks = {
215
+ /******/ "tsparticles.plugin.export.image": 0
216
+ /******/ };
217
+ /******/
218
+ /******/ __webpack_require__.f.j = (chunkId, promises) => {
219
+ /******/ // JSONP chunk loading for javascript
220
+ /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
221
+ /******/ if(installedChunkData !== 0) { // 0 means "already installed".
222
+ /******/
223
+ /******/ // a Promise means "currently loading".
224
+ /******/ if(installedChunkData) {
225
+ /******/ promises.push(installedChunkData[2]);
226
+ /******/ } else {
227
+ /******/ if(true) { // all chunks have JS
228
+ /******/ // setup Promise in chunk cache
229
+ /******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
230
+ /******/ promises.push(installedChunkData[2] = promise);
231
+ /******/
232
+ /******/ // start chunk loading
233
+ /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
234
+ /******/ // create error before stack unwound to get useful stacktrace later
235
+ /******/ var error = new Error();
236
+ /******/ var loadingEnded = (event) => {
237
+ /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
238
+ /******/ installedChunkData = installedChunks[chunkId];
239
+ /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
240
+ /******/ if(installedChunkData) {
241
+ /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
242
+ /******/ var realSrc = event && event.target && event.target.src;
243
+ /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
244
+ /******/ error.name = 'ChunkLoadError';
245
+ /******/ error.type = errorType;
246
+ /******/ error.request = realSrc;
247
+ /******/ installedChunkData[1](error);
248
+ /******/ }
249
+ /******/ }
250
+ /******/ };
251
+ /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
252
+ /******/ }
253
+ /******/ }
254
+ /******/ }
255
+ /******/ };
256
+ /******/
257
+ /******/ // no prefetching
258
+ /******/
259
+ /******/ // no preloaded
260
+ /******/
261
+ /******/ // no HMR
262
+ /******/
263
+ /******/ // no HMR manifest
264
+ /******/
265
+ /******/ // no on chunks loaded
266
+ /******/
267
+ /******/ // install a JSONP callback for chunk loading
268
+ /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
269
+ /******/ var [chunkIds, moreModules, runtime] = data;
270
+ /******/ // add "moreModules" to the modules object,
271
+ /******/ // then flag all "chunkIds" as loaded and fire callback
272
+ /******/ var moduleId, chunkId, i = 0;
273
+ /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
274
+ /******/ for(moduleId in moreModules) {
275
+ /******/ if(__webpack_require__.o(moreModules, moduleId)) {
276
+ /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
277
+ /******/ }
278
+ /******/ }
279
+ /******/ if(runtime) var result = runtime(__webpack_require__);
280
+ /******/ }
281
+ /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
282
+ /******/ for(;i < chunkIds.length; i++) {
283
+ /******/ chunkId = chunkIds[i];
284
+ /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
285
+ /******/ installedChunks[chunkId][0]();
286
+ /******/ }
287
+ /******/ installedChunks[chunkId] = 0;
288
+ /******/ }
289
+ /******/
290
+ /******/ }
291
+ /******/
292
+ /******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_plugin_export_image"] = this["webpackChunk_tsparticles_plugin_export_image"] || [];
293
+ /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
294
+ /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
295
+ /******/ })();
296
+ /******/
116
297
  /************************************************************************/
117
298
  /******/
118
299
  /******/ // startup
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.plugin.export.image.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,(()=>(()=>{var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{loadExportImagePlugin:()=>r});class o{constructor(e,t){this._exportImage=async e=>{const t=this._container.canvas.element;if(t)return new Promise((o=>{t.toBlob((e=>{o(e||void 0)}),e.type??"image/png",e.quality)}))},this._container=e,this._engine=t}async export(e,t){const o={supported:!1};if("image"===e)o.supported=!0,o.blob=await this._exportImage(t);return o}}class n{constructor(e){this.id="export-image",this._engine=e}getPlugin(e){return Promise.resolve(new o(e,this._engine))}loadOptions(){}needsPlugin(){return!0}}async function r(e,t=!0){e.checkVersion("3.9.1"),await e.addPlugin(new n(e),t)}return t})()));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(()=>(()=>{var e,t,r={},o={};function n(e){var t=o[e];if(void 0!==t)return t.exports;var i=o[e]={exports:{}};return r[e](i,i.exports,n),i.exports}n.m=r,n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((t,r)=>(n.f[r](e,t),t)),[])),n.u=e=>e+".min.js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="@tsparticles/plugin-export-image:",n.l=(r,o,i,a)=>{if(e[r])e[r].push(o);else{var l,p;if(void 0!==i)for(var s=document.getElementsByTagName("script"),c=0;c<s.length;c++){var u=s[c];if(u.getAttribute("src")==r||u.getAttribute("data-webpack")==t+i){l=u;break}}l||(p=!0,(l=document.createElement("script")).charset="utf-8",n.nc&&l.setAttribute("nonce",n.nc),l.setAttribute("data-webpack",t+i),l.src=r),e[r]=[o];var d=(t,o)=>{l.onerror=l.onload=null,clearTimeout(f);var n=e[r];if(delete e[r],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach((e=>e(o))),t)return t(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),p&&document.head.appendChild(l)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.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(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={843:0};n.f.j=(t,r)=>{var o=n.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var i=new Promise(((r,n)=>o=e[t]=[r,n]));r.push(o[2]=i);var a=n.p+n.u(t),l=new Error;n.l(a,(r=>{if(n.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;l.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",l.name="ChunkLoadError",l.type=i,l.request=a,o[1](l)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,i,[a,l,p]=r,s=0;if(a.some((t=>0!==e[t]))){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(p)p(n)}for(t&&t(r);s<a.length;s++)i=a[s],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunk_tsparticles_plugin_export_image=this.webpackChunk_tsparticles_plugin_export_image||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};function a(e){e.checkVersion("4.0.0-alpha.0"),e.register((async e=>{const{ExportImagePlugin:t}=await n.e(82).then(n.bind(n,82));e.addPlugin(new t)}))}return n.r(i),n.d(i,{loadExportImagePlugin:()=>a}),i})()));
@@ -1 +1 @@
1
- /*! tsParticles Export Image Plugin v3.9.1 by Matteo Bruni */
1
+ /*! tsParticles Export Image Plugin v4.0.0-alpha.0 by Matteo Bruni */
@@ -1,8 +1,7 @@
1
- import type { Container, Engine, ExportResult, IContainerPlugin } from "@tsparticles/engine";
1
+ import type { Container, ExportResult, IContainerPlugin } from "@tsparticles/engine";
2
2
  export declare class ExportImageInstance implements IContainerPlugin {
3
3
  private readonly _container;
4
- private readonly _engine;
5
- constructor(container: Container, engine: Engine);
4
+ constructor(container: Container);
6
5
  export(type: string, data: Record<string, unknown>): Promise<ExportResult>;
7
6
  private readonly _exportImage;
8
7
  }
@@ -1,9 +1,8 @@
1
- import type { Container, Engine, IPlugin } from "@tsparticles/engine";
1
+ import type { Container, IPlugin } from "@tsparticles/engine";
2
2
  import { ExportImageInstance } from "./ExportImageInstance.js";
3
3
  export declare class ExportImagePlugin implements IPlugin {
4
4
  readonly id: string;
5
- private readonly _engine;
6
- constructor(engine: Engine);
5
+ constructor();
7
6
  getPlugin(container: Container): Promise<ExportImageInstance>;
8
7
  loadOptions(): void;
9
8
  needsPlugin(): boolean;
package/types/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import { type Engine } from "@tsparticles/engine";
2
- export declare function loadExportImagePlugin(engine: Engine, refresh?: boolean): Promise<void>;
2
+ export declare function loadExportImagePlugin(engine: Engine): void;
@@ -11,7 +11,7 @@
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ExportImageInstance = void 0;
13
13
  class ExportImageInstance {
14
- constructor(container, engine) {
14
+ constructor(container) {
15
15
  this._exportImage = async (data) => {
16
16
  const element = this._container.canvas.element;
17
17
  if (!element) {
@@ -28,7 +28,6 @@
28
28
  });
29
29
  };
30
30
  this._container = container;
31
- this._engine = engine;
32
31
  }
33
32
  async export(type, data) {
34
33
  const res = {
@@ -12,12 +12,11 @@
12
12
  exports.ExportImagePlugin = void 0;
13
13
  const ExportImageInstance_js_1 = require("./ExportImageInstance.js");
14
14
  class ExportImagePlugin {
15
- constructor(engine) {
15
+ constructor() {
16
16
  this.id = "export-image";
17
- this._engine = engine;
18
17
  }
19
18
  getPlugin(container) {
20
- return Promise.resolve(new ExportImageInstance_js_1.ExportImageInstance(container, this._engine));
19
+ return Promise.resolve(new ExportImageInstance_js_1.ExportImageInstance(container));
21
20
  }
22
21
  loadOptions() {
23
22
  }
package/umd/index.js CHANGED
@@ -1,18 +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
+ })();
1
34
  (function (factory) {
2
35
  if (typeof module === "object" && typeof module.exports === "object") {
3
36
  var v = factory(require, exports);
4
37
  if (v !== undefined) module.exports = v;
5
38
  }
6
39
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./ExportImagePlugin.js"], factory);
40
+ define(["require", "exports"], factory);
8
41
  }
9
42
  })(function (require, exports) {
10
43
  "use strict";
44
+ var __syncRequire = typeof module === "object" && typeof module.exports === "object";
11
45
  Object.defineProperty(exports, "__esModule", { value: true });
12
46
  exports.loadExportImagePlugin = loadExportImagePlugin;
13
- const ExportImagePlugin_js_1 = require("./ExportImagePlugin.js");
14
- async function loadExportImagePlugin(engine, refresh = true) {
15
- engine.checkVersion("3.9.1");
16
- await engine.addPlugin(new ExportImagePlugin_js_1.ExportImagePlugin(engine), refresh);
47
+ function loadExportImagePlugin(engine) {
48
+ engine.checkVersion("4.0.0-alpha.0");
49
+ engine.register(async (e) => {
50
+ const { ExportImagePlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./ExportImagePlugin.js"))) : new Promise((resolve_1, reject_1) => { require(["./ExportImagePlugin.js"], resolve_1, reject_1); }).then(__importStar));
51
+ e.addPlugin(new ExportImagePlugin());
52
+ });
17
53
  }
18
54
  });