@tsparticles/plugin-export-image 3.9.1 → 4.0.0-alpha.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/82.min.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 82.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_plugin_export_image=this.webpackChunk_tsparticles_plugin_export_image||[]).push([[82],{82(e,t,i){i.d(t,{ExportImagePlugin:()=>n});class s{constructor(e){this._exportImage=async e=>{const t=this._container.canvas.element;if(t)return new Promise((i=>{t.toBlob((e=>{i(e||void 0)}),e.type??"image/png",e.quality)}))},this._container=e}async export(e,t){const i={supported:!1};if("image"===e)i.supported=!0,i.blob=await this._exportImage(t);return i}}class n{constructor(){this.id="export-image"}getPlugin(e){return Promise.resolve(new s(e))}loadOptions(){}needsPlugin(){return!0}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Export Image Plugin v4.0.0-alpha.1 by Matteo Bruni */
@@ -1,5 +1,5 @@
1
1
  export class ExportImageInstance {
2
- constructor(container, engine) {
2
+ constructor(container) {
3
3
  this._exportImage = async (data) => {
4
4
  const element = this._container.canvas.element;
5
5
  if (!element) {
@@ -16,7 +16,6 @@ export class ExportImageInstance {
16
16
  });
17
17
  };
18
18
  this._container = container;
19
- this._engine = engine;
20
19
  }
21
20
  async export(type, data) {
22
21
  const res = {
@@ -1,11 +1,10 @@
1
1
  import { ExportImageInstance } from "./ExportImageInstance.js";
2
2
  export class ExportImagePlugin {
3
- constructor(engine) {
3
+ constructor() {
4
4
  this.id = "export-image";
5
- this._engine = engine;
6
5
  }
7
6
  getPlugin(container) {
8
- return Promise.resolve(new ExportImageInstance(container, this._engine));
7
+ return Promise.resolve(new ExportImageInstance(container));
9
8
  }
10
9
  loadOptions() {
11
10
  }
package/browser/index.js CHANGED
@@ -1,5 +1,7 @@
1
- import { ExportImagePlugin } from "./ExportImagePlugin.js";
2
- export async function loadExportImagePlugin(engine, refresh = true) {
3
- engine.checkVersion("3.9.1");
4
- await engine.addPlugin(new ExportImagePlugin(engine), refresh);
1
+ export function loadExportImagePlugin(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(async (e) => {
4
+ const { ExportImagePlugin } = await import("./ExportImagePlugin.js");
5
+ e.addPlugin(new ExportImagePlugin());
6
+ });
5
7
  }
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExportImageInstance = void 0;
4
- class ExportImageInstance {
5
- constructor(container, engine) {
1
+ export class ExportImageInstance {
2
+ constructor(container) {
6
3
  this._exportImage = async (data) => {
7
4
  const element = this._container.canvas.element;
8
5
  if (!element) {
@@ -19,7 +16,6 @@ class ExportImageInstance {
19
16
  });
20
17
  };
21
18
  this._container = container;
22
- this._engine = engine;
23
19
  }
24
20
  async export(type, data) {
25
21
  const res = {
@@ -34,4 +30,3 @@ class ExportImageInstance {
34
30
  return res;
35
31
  }
36
32
  }
37
- exports.ExportImageInstance = ExportImageInstance;
@@ -1,14 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExportImagePlugin = void 0;
4
- const ExportImageInstance_js_1 = require("./ExportImageInstance.js");
5
- class ExportImagePlugin {
6
- constructor(engine) {
1
+ import { ExportImageInstance } from "./ExportImageInstance.js";
2
+ export class ExportImagePlugin {
3
+ constructor() {
7
4
  this.id = "export-image";
8
- this._engine = engine;
9
5
  }
10
6
  getPlugin(container) {
11
- return Promise.resolve(new ExportImageInstance_js_1.ExportImageInstance(container, this._engine));
7
+ return Promise.resolve(new ExportImageInstance(container));
12
8
  }
13
9
  loadOptions() {
14
10
  }
@@ -16,4 +12,3 @@ class ExportImagePlugin {
16
12
  return true;
17
13
  }
18
14
  }
19
- exports.ExportImagePlugin = ExportImagePlugin;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/cjs/index.js CHANGED
@@ -1,8 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadExportImagePlugin = loadExportImagePlugin;
4
- const ExportImagePlugin_js_1 = require("./ExportImagePlugin.js");
5
- async function loadExportImagePlugin(engine, refresh = true) {
6
- engine.checkVersion("3.9.1");
7
- await engine.addPlugin(new ExportImagePlugin_js_1.ExportImagePlugin(engine), refresh);
1
+ export function loadExportImagePlugin(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(async (e) => {
4
+ const { ExportImagePlugin } = await import("./ExportImagePlugin.js");
5
+ e.addPlugin(new ExportImagePlugin());
6
+ });
8
7
  }
@@ -0,0 +1,40 @@
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.1
8
+ */
9
+ "use strict";
10
+ /*
11
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
+ * This devtool is neither made for production nor for readable output files.
13
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
14
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
+ * or disable the default devtool with "devtool: false".
16
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
+ */
18
+ (this["webpackChunk_tsparticles_plugin_export_image"] = this["webpackChunk_tsparticles_plugin_export_image"] || []).push([["dist_browser_ExportImagePlugin_js"],{
19
+
20
+ /***/ "./dist/browser/ExportImageInstance.js"
21
+ /*!*********************************************!*\
22
+ !*** ./dist/browser/ExportImageInstance.js ***!
23
+ \*********************************************/
24
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
+
26
+ 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) {\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 }\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}");
27
+
28
+ /***/ },
29
+
30
+ /***/ "./dist/browser/ExportImagePlugin.js"
31
+ /*!*******************************************!*\
32
+ !*** ./dist/browser/ExportImagePlugin.js ***!
33
+ \*******************************************/
34
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
+
36
+ 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() {\n this.id = \"export-image\";\n }\n getPlugin(container) {\n return Promise.resolve(new _ExportImageInstance_js__WEBPACK_IMPORTED_MODULE_0__.ExportImageInstance(container));\n }\n loadOptions() {}\n needsPlugin() {\n return true;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-export-image/./dist/browser/ExportImagePlugin.js?\n}");
37
+
38
+ /***/ }
39
+
40
+ }]);
@@ -1,5 +1,5 @@
1
1
  export class ExportImageInstance {
2
- constructor(container, engine) {
2
+ constructor(container) {
3
3
  this._exportImage = async (data) => {
4
4
  const element = this._container.canvas.element;
5
5
  if (!element) {
@@ -16,7 +16,6 @@ export class ExportImageInstance {
16
16
  });
17
17
  };
18
18
  this._container = container;
19
- this._engine = engine;
20
19
  }
21
20
  async export(type, data) {
22
21
  const res = {
@@ -1,11 +1,10 @@
1
1
  import { ExportImageInstance } from "./ExportImageInstance.js";
2
2
  export class ExportImagePlugin {
3
- constructor(engine) {
3
+ constructor() {
4
4
  this.id = "export-image";
5
- this._engine = engine;
6
5
  }
7
6
  getPlugin(container) {
8
- return Promise.resolve(new ExportImageInstance(container, this._engine));
7
+ return Promise.resolve(new ExportImageInstance(container));
9
8
  }
10
9
  loadOptions() {
11
10
  }
package/esm/index.js CHANGED
@@ -1,5 +1,7 @@
1
- import { ExportImagePlugin } from "./ExportImagePlugin.js";
2
- export async function loadExportImagePlugin(engine, refresh = true) {
3
- engine.checkVersion("3.9.1");
4
- await engine.addPlugin(new ExportImagePlugin(engine), refresh);
1
+ export function loadExportImagePlugin(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(async (e) => {
4
+ const { ExportImagePlugin } = await import("./ExportImagePlugin.js");
5
+ e.addPlugin(new ExportImagePlugin());
6
+ });
5
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/plugin-export-image",
3
- "version": "3.9.1",
3
+ "version": "4.0.0-alpha.1",
4
4
  "description": "tsParticles export image plugin",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -100,9 +100,10 @@
100
100
  "./package.json": "./package.json"
101
101
  },
102
102
  "dependencies": {
103
- "@tsparticles/engine": "3.9.1"
103
+ "@tsparticles/engine": "4.0.0-alpha.1"
104
104
  },
105
105
  "publishConfig": {
106
106
  "access": "public"
107
- }
107
+ },
108
+ "type": "module"
108
109
  }