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

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/434.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_plugin_export_image=this.webpackChunk_tsparticles_plugin_export_image||[]).push([[434],{434(e,t,i){i.d(t,{ExportImagePlugin:()=>n});class n{id="export-image";async getPlugin(e){let{ExportImagePluginInstance:t}=await i.e(713).then(i.bind(i,713));return new t(e)}loadOptions(){}needsPlugin(){return!0}}}}]);
package/713.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_plugin_export_image=this.webpackChunk_tsparticles_plugin_export_image||[]).push([[713],{713(t,e,a){a.d(e,{ExportImagePluginInstance:()=>i});class i{_container;constructor(t){this._container=t}async export(t,e){let a={supported:!1};return"image"===t&&(a.supported=!0,a.blob=await this._exportImage(e)),a}_exportImage=async t=>{let e=this._container.canvas.element;if(e)return new Promise(a=>{e.toBlob(t=>{t?a(t):a(void 0)},t.type??"image/png",t.quality)})}}}}]);
@@ -1,10 +1,8 @@
1
- import { ExportImageInstance } from "./ExportImageInstance.js";
2
1
  export class ExportImagePlugin {
3
- constructor() {
4
- this.id = "export-image";
5
- }
6
- getPlugin(container) {
7
- return Promise.resolve(new ExportImageInstance(container));
2
+ id = "export-image";
3
+ async getPlugin(container) {
4
+ const { ExportImagePluginInstance } = await import("./ExportImagePluginInstance.js");
5
+ return new ExportImagePluginInstance(container);
8
6
  }
9
7
  loadOptions() {
10
8
  }
@@ -0,0 +1,33 @@
1
+ export class ExportImagePluginInstance {
2
+ _container;
3
+ constructor(container) {
4
+ this._container = container;
5
+ }
6
+ async export(type, data) {
7
+ const res = {
8
+ supported: false,
9
+ };
10
+ switch (type) {
11
+ case "image":
12
+ res.supported = true;
13
+ res.blob = await this._exportImage(data);
14
+ break;
15
+ }
16
+ return res;
17
+ }
18
+ _exportImage = async (data) => {
19
+ const element = this._container.canvas.element;
20
+ if (!element) {
21
+ return;
22
+ }
23
+ return new Promise(resolve => {
24
+ element.toBlob(blob => {
25
+ if (!blob) {
26
+ resolve(undefined);
27
+ return;
28
+ }
29
+ resolve(blob);
30
+ }, data.type ?? "image/png", data.quality);
31
+ });
32
+ };
33
+ }
package/browser/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export function loadExportImagePlugin(engine) {
2
- engine.checkVersion("4.0.0-alpha.0");
3
- engine.register(async (e) => {
1
+ export async function loadExportImagePlugin(engine) {
2
+ engine.checkVersion("4.0.0-alpha.14");
3
+ await engine.register(async (e) => {
4
4
  const { ExportImagePlugin } = await import("./ExportImagePlugin.js");
5
5
  e.addPlugin(new ExportImagePlugin());
6
6
  });
@@ -1,10 +1,8 @@
1
- import { ExportImageInstance } from "./ExportImageInstance.js";
2
1
  export class ExportImagePlugin {
3
- constructor() {
4
- this.id = "export-image";
5
- }
6
- getPlugin(container) {
7
- return Promise.resolve(new ExportImageInstance(container));
2
+ id = "export-image";
3
+ async getPlugin(container) {
4
+ const { ExportImagePluginInstance } = await import("./ExportImagePluginInstance.js");
5
+ return new ExportImagePluginInstance(container);
8
6
  }
9
7
  loadOptions() {
10
8
  }
@@ -0,0 +1,33 @@
1
+ export class ExportImagePluginInstance {
2
+ _container;
3
+ constructor(container) {
4
+ this._container = container;
5
+ }
6
+ async export(type, data) {
7
+ const res = {
8
+ supported: false,
9
+ };
10
+ switch (type) {
11
+ case "image":
12
+ res.supported = true;
13
+ res.blob = await this._exportImage(data);
14
+ break;
15
+ }
16
+ return res;
17
+ }
18
+ _exportImage = async (data) => {
19
+ const element = this._container.canvas.element;
20
+ if (!element) {
21
+ return;
22
+ }
23
+ return new Promise(resolve => {
24
+ element.toBlob(blob => {
25
+ if (!blob) {
26
+ resolve(undefined);
27
+ return;
28
+ }
29
+ resolve(blob);
30
+ }, data.type ?? "image/png", data.quality);
31
+ });
32
+ };
33
+ }
package/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export function loadExportImagePlugin(engine) {
2
- engine.checkVersion("4.0.0-alpha.0");
3
- engine.register(async (e) => {
1
+ export async function loadExportImagePlugin(engine) {
2
+ engine.checkVersion("4.0.0-alpha.14");
3
+ await engine.register(async (e) => {
4
4
  const { ExportImagePlugin } = await import("./ExportImagePlugin.js");
5
5
  e.addPlugin(new ExportImagePlugin());
6
6
  });
@@ -0,0 +1,30 @@
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.14
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_ExportImagePluginInstance_js"],{
19
+
20
+ /***/ "./dist/browser/ExportImagePluginInstance.js"
21
+ /*!***************************************************!*\
22
+ !*** ./dist/browser/ExportImagePluginInstance.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 */ ExportImagePluginInstance: () => (/* binding */ ExportImagePluginInstance)\n/* harmony export */ });\nclass ExportImagePluginInstance {\n _container;\n constructor(container){\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 _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}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-export-image/./dist/browser/ExportImagePluginInstance.js?\n}");
27
+
28
+ /***/ }
29
+
30
+ }]);
@@ -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.0
7
+ * v4.0.0-alpha.14
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -17,23 +17,13 @@
17
17
  */
18
18
  (this["webpackChunk_tsparticles_plugin_export_image"] = this["webpackChunk_tsparticles_plugin_export_image"] || []).push([["dist_browser_ExportImagePlugin_js"],{
19
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
20
  /***/ "./dist/browser/ExportImagePlugin.js"
31
21
  /*!*******************************************!*\
32
22
  !*** ./dist/browser/ExportImagePlugin.js ***!
33
23
  \*******************************************/
34
24
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
25
 
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}");
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ExportImagePlugin: () => (/* binding */ ExportImagePlugin)\n/* harmony export */ });\nclass ExportImagePlugin {\n id = \"export-image\";\n async getPlugin(container) {\n const { ExportImagePluginInstance } = await __webpack_require__.e(/*! import() */ \"dist_browser_ExportImagePluginInstance_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./ExportImagePluginInstance.js */ \"./dist/browser/ExportImagePluginInstance.js\"));\n return new ExportImagePluginInstance(container);\n }\n loadOptions() {}\n needsPlugin() {\n return true;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-export-image/./dist/browser/ExportImagePlugin.js?\n}");
37
27
 
38
28
  /***/ }
39
29
 
@@ -1,10 +1,8 @@
1
- import { ExportImageInstance } from "./ExportImageInstance.js";
2
1
  export class ExportImagePlugin {
3
- constructor() {
4
- this.id = "export-image";
5
- }
6
- getPlugin(container) {
7
- return Promise.resolve(new ExportImageInstance(container));
2
+ id = "export-image";
3
+ async getPlugin(container) {
4
+ const { ExportImagePluginInstance } = await import("./ExportImagePluginInstance.js");
5
+ return new ExportImagePluginInstance(container);
8
6
  }
9
7
  loadOptions() {
10
8
  }
@@ -0,0 +1,33 @@
1
+ export class ExportImagePluginInstance {
2
+ _container;
3
+ constructor(container) {
4
+ this._container = container;
5
+ }
6
+ async export(type, data) {
7
+ const res = {
8
+ supported: false,
9
+ };
10
+ switch (type) {
11
+ case "image":
12
+ res.supported = true;
13
+ res.blob = await this._exportImage(data);
14
+ break;
15
+ }
16
+ return res;
17
+ }
18
+ _exportImage = async (data) => {
19
+ const element = this._container.canvas.element;
20
+ if (!element) {
21
+ return;
22
+ }
23
+ return new Promise(resolve => {
24
+ element.toBlob(blob => {
25
+ if (!blob) {
26
+ resolve(undefined);
27
+ return;
28
+ }
29
+ resolve(blob);
30
+ }, data.type ?? "image/png", data.quality);
31
+ });
32
+ };
33
+ }
package/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export function loadExportImagePlugin(engine) {
2
- engine.checkVersion("4.0.0-alpha.0");
3
- engine.register(async (e) => {
1
+ export async function loadExportImagePlugin(engine) {
2
+ engine.checkVersion("4.0.0-alpha.14");
3
+ await engine.register(async (e) => {
4
4
  const { ExportImagePlugin } = await import("./ExportImagePlugin.js");
5
5
  e.addPlugin(new ExportImagePlugin());
6
6
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/plugin-export-image",
3
- "version": "4.0.0-alpha.0",
3
+ "version": "4.0.0-alpha.14",
4
4
  "description": "tsParticles export image plugin",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -100,7 +100,7 @@
100
100
  "./package.json": "./package.json"
101
101
  },
102
102
  "dependencies": {
103
- "@tsparticles/engine": "4.0.0-alpha.0"
103
+ "@tsparticles/engine": "4.0.0-alpha.14"
104
104
  },
105
105
  "publishConfig": {
106
106
  "access": "public"