@tsparticles/plugin-export-json 3.0.0-beta.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.
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/browser/ExportJSONInstance.js +27 -0
- package/browser/index.js +18 -0
- package/cjs/ExportJSONInstance.js +31 -0
- package/cjs/index.js +22 -0
- package/esm/ExportJSONInstance.js +27 -0
- package/esm/index.js +18 -0
- package/package.json +96 -0
- package/report.html +39 -0
- package/tsparticles.plugin.export.json.js +114 -0
- package/tsparticles.plugin.export.json.min.js +2 -0
- package/tsparticles.plugin.export.json.min.js.LICENSE.txt +1 -0
- package/types/ExportJSONInstance.d.ts +8 -0
- package/types/index.d.ts +2 -0
- package/umd/ExportJSONInstance.js +41 -0
- package/umd/index.js +32 -0
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
* v3.0.0-beta.0
|
|
8
|
+
*/
|
|
9
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
11
|
+
module.exports = factory();
|
|
12
|
+
else if(typeof define === 'function' && define.amd)
|
|
13
|
+
define([], factory);
|
|
14
|
+
else {
|
|
15
|
+
var a = factory();
|
|
16
|
+
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
17
|
+
}
|
|
18
|
+
})(this, () => {
|
|
19
|
+
return /******/ (() => { // webpackBootstrap
|
|
20
|
+
/******/ "use strict";
|
|
21
|
+
/******/ // The require scope
|
|
22
|
+
/******/ var __webpack_require__ = {};
|
|
23
|
+
/******/
|
|
24
|
+
/************************************************************************/
|
|
25
|
+
/******/ /* webpack/runtime/define property getters */
|
|
26
|
+
/******/ (() => {
|
|
27
|
+
/******/ // define getter functions for harmony exports
|
|
28
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
29
|
+
/******/ for(var key in definition) {
|
|
30
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
31
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
32
|
+
/******/ }
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ };
|
|
35
|
+
/******/ })();
|
|
36
|
+
/******/
|
|
37
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
38
|
+
/******/ (() => {
|
|
39
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
40
|
+
/******/ })();
|
|
41
|
+
/******/
|
|
42
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
43
|
+
/******/ (() => {
|
|
44
|
+
/******/ // define __esModule on exports
|
|
45
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
46
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
47
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
48
|
+
/******/ }
|
|
49
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
50
|
+
/******/ };
|
|
51
|
+
/******/ })();
|
|
52
|
+
/******/
|
|
53
|
+
/************************************************************************/
|
|
54
|
+
var __webpack_exports__ = {};
|
|
55
|
+
// ESM COMPAT FLAG
|
|
56
|
+
__webpack_require__.r(__webpack_exports__);
|
|
57
|
+
|
|
58
|
+
// EXPORTS
|
|
59
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
60
|
+
loadExportJSONPlugin: () => (/* binding */ loadExportJSONPlugin)
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
;// CONCATENATED MODULE: ./dist/browser/ExportJSONInstance.js
|
|
64
|
+
class ExportJSONInstance {
|
|
65
|
+
constructor(container, engine) {
|
|
66
|
+
this._exportJSON = async () => {
|
|
67
|
+
const json = JSON.stringify(this._container.actualOptions, (key, value) => {
|
|
68
|
+
if (key.startsWith("_")) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
72
|
+
}, 2);
|
|
73
|
+
return new Blob([json], {
|
|
74
|
+
type: "application/json"
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
this._container = container;
|
|
78
|
+
this._engine = engine;
|
|
79
|
+
}
|
|
80
|
+
async export(type) {
|
|
81
|
+
const res = {
|
|
82
|
+
supported: false
|
|
83
|
+
};
|
|
84
|
+
switch (type) {
|
|
85
|
+
case "json":
|
|
86
|
+
res.supported = true;
|
|
87
|
+
res.blob = await this._exportJSON();
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
return res;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
94
|
+
|
|
95
|
+
class ExportJSONPlugin {
|
|
96
|
+
constructor(engine) {
|
|
97
|
+
this.id = "export-json";
|
|
98
|
+
this._engine = engine;
|
|
99
|
+
}
|
|
100
|
+
getPlugin(container) {
|
|
101
|
+
return new ExportJSONInstance(container, this._engine);
|
|
102
|
+
}
|
|
103
|
+
loadOptions() {}
|
|
104
|
+
needsPlugin() {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function loadExportJSONPlugin(engine, refresh = true) {
|
|
109
|
+
await engine.addPlugin(new ExportJSONPlugin(engine), refresh);
|
|
110
|
+
}
|
|
111
|
+
/******/ return __webpack_exports__;
|
|
112
|
+
/******/ })()
|
|
113
|
+
;
|
|
114
|
+
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see tsparticles.plugin.export.json.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,(()=>(()=>{"use strict";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,{loadExportJSONPlugin:()=>r});class o{constructor(e,t){this._exportJSON=async()=>{const e=JSON.stringify(this._container.actualOptions,((e,t)=>{if(!e.startsWith("_"))return t}),2);return new Blob([e],{type:"application/json"})},this._container=e,this._engine=t}async export(e){const t={supported:!1};if("json"===e)t.supported=!0,t.blob=await this._exportJSON();return t}}class n{constructor(e){this.id="export-json",this._engine=e}getPlugin(e){return new o(e,this._engine)}loadOptions(){}needsPlugin(){return!0}}async function r(e,t=!0){await e.addPlugin(new n(e),t)}return t})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles Export JSON Plugin v3.0.0-beta.0 by Matteo Bruni */
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Container, Engine, ExportResult, IContainerPlugin } from "@tsparticles/engine";
|
|
2
|
+
export declare class ExportJSONInstance implements IContainerPlugin {
|
|
3
|
+
private readonly _container;
|
|
4
|
+
private readonly _engine;
|
|
5
|
+
constructor(container: Container, engine: Engine);
|
|
6
|
+
export(type: string): Promise<ExportResult>;
|
|
7
|
+
private readonly _exportJSON;
|
|
8
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -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.ExportJSONInstance = void 0;
|
|
13
|
+
class ExportJSONInstance {
|
|
14
|
+
constructor(container, engine) {
|
|
15
|
+
this._exportJSON = async () => {
|
|
16
|
+
const json = JSON.stringify(this._container.actualOptions, (key, value) => {
|
|
17
|
+
if (key.startsWith("_")) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}, 2);
|
|
22
|
+
return new Blob([json], { type: "application/json" });
|
|
23
|
+
};
|
|
24
|
+
this._container = container;
|
|
25
|
+
this._engine = engine;
|
|
26
|
+
}
|
|
27
|
+
async export(type) {
|
|
28
|
+
const res = {
|
|
29
|
+
supported: false,
|
|
30
|
+
};
|
|
31
|
+
switch (type) {
|
|
32
|
+
case "json":
|
|
33
|
+
res.supported = true;
|
|
34
|
+
res.blob = await this._exportJSON();
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
return res;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.ExportJSONInstance = ExportJSONInstance;
|
|
41
|
+
});
|
package/umd/index.js
ADDED
|
@@ -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", "./ExportJSONInstance"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.loadExportJSONPlugin = void 0;
|
|
13
|
+
const ExportJSONInstance_1 = require("./ExportJSONInstance");
|
|
14
|
+
class ExportJSONPlugin {
|
|
15
|
+
constructor(engine) {
|
|
16
|
+
this.id = "export-json";
|
|
17
|
+
this._engine = engine;
|
|
18
|
+
}
|
|
19
|
+
getPlugin(container) {
|
|
20
|
+
return new ExportJSONInstance_1.ExportJSONInstance(container, this._engine);
|
|
21
|
+
}
|
|
22
|
+
loadOptions() {
|
|
23
|
+
}
|
|
24
|
+
needsPlugin() {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function loadExportJSONPlugin(engine, refresh = true) {
|
|
29
|
+
await engine.addPlugin(new ExportJSONPlugin(engine), refresh);
|
|
30
|
+
}
|
|
31
|
+
exports.loadExportJSONPlugin = loadExportJSONPlugin;
|
|
32
|
+
});
|