@tsparticles/shape-path 3.9.0 → 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.0
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,55 +28,25 @@ return /******/ (() => { // webpackBootstrap
28
28
  /******/ "use strict";
29
29
  /******/ var __webpack_modules__ = ({
30
30
 
31
- /***/ "./dist/browser/PathDrawer.js":
32
- /*!************************************!*\
33
- !*** ./dist/browser/PathDrawer.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 */ PathDrawer: () => (/* binding */ PathDrawer)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\nclass PathDrawer {\n constructor() {\n this.validTypes = [\"path\"];\n }\n draw(data) {\n const {\n context,\n particle,\n radius\n } = data;\n if (!particle.pathData) {\n return;\n }\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawPath)(context, radius, particle.pathData);\n }\n particleInit(container, particle) {\n const shape = particle.shapeData;\n if (!shape) {\n return;\n }\n particle.pathData = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, shape);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-path/./dist/browser/PathDrawer.js?\n}");
38
-
39
- /***/ }),
40
-
41
- /***/ "./dist/browser/SegmentType.js":
42
- /*!*************************************!*\
43
- !*** ./dist/browser/SegmentType.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 */ SegmentType: () => (/* binding */ SegmentType)\n/* harmony export */ });\nvar SegmentType;\n(function (SegmentType) {\n SegmentType[\"line\"] = \"line\";\n SegmentType[\"bezier\"] = \"bezier\";\n SegmentType[\"quadratic\"] = \"quadratic\";\n SegmentType[\"arc\"] = \"arc\";\n SegmentType[\"ellipse\"] = \"ellipse\";\n})(SegmentType || (SegmentType = {}));\n\n//# sourceURL=webpack://@tsparticles/shape-path/./dist/browser/SegmentType.js?\n}");
48
-
49
- /***/ }),
50
-
51
- /***/ "./dist/browser/Utils.js":
52
- /*!*******************************!*\
53
- !*** ./dist/browser/Utils.js ***!
54
- \*******************************/
55
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
56
-
57
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawPath: () => (/* binding */ drawPath)\n/* harmony export */ });\n/* harmony import */ var _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SegmentType.js */ \"./dist/browser/SegmentType.js\");\n\nfunction drawPath(ctx, radius, path) {\n const firstIndex = 0,\n firstSegment = path.segments[firstIndex],\n firstValue = firstSegment.values[firstIndex];\n ctx.moveTo(firstValue.x * radius, firstValue.y * radius);\n for (const segment of path.segments) {\n const value = segment.values[firstIndex],\n index2 = 1,\n index3 = 2,\n index4 = 3;\n switch (segment.type) {\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.line:\n ctx.lineTo(value.x * radius, value.y * radius);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier:\n ctx.bezierCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius, segment.values[index4].x * radius, segment.values[index4].y * radius);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.quadratic:\n ctx.quadraticCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.arc:\n ctx.arc(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index3].x, segment.values[index3].y);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.ellipse:\n ctx.ellipse(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x, segment.values[index4].x, segment.values[index4].y);\n }\n }\n if (!path.half) {\n return;\n }\n const lengthOffset = 1,\n minLength = 0;\n for (let i = path.segments.length - lengthOffset; i >= minLength; i--) {\n const segment = path.segments[i],\n value = segment.values[firstIndex],\n index2 = 1,\n index3 = 2;\n switch (segment.type) {\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.line:\n ctx.lineTo(value.x * -radius, value.y * radius);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.bezier:\n ctx.bezierCurveTo(-segment.values[index3].x * radius, segment.values[index3].y * radius, -segment.values[index2].x * radius, segment.values[index2].y * radius, value.x * radius, value.y * radius);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.quadratic:\n ctx.quadraticCurveTo(-segment.values[index2].x * radius, segment.values[index2].y * radius, -segment.values[index3].x * radius, segment.values[index3].y * radius);\n break;\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.arc:\n case _SegmentType_js__WEBPACK_IMPORTED_MODULE_0__.SegmentType.ellipse:\n default:\n break;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-path/./dist/browser/Utils.js?\n}");
58
-
59
- /***/ }),
60
-
61
- /***/ "./dist/browser/index.js":
31
+ /***/ "./dist/browser/index.js"
62
32
  /*!*******************************!*\
63
33
  !*** ./dist/browser/index.js ***!
64
34
  \*******************************/
65
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
35
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
66
36
 
67
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadPathShape: () => (/* binding */ loadPathShape)\n/* harmony export */ });\n/* harmony import */ var _PathDrawer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PathDrawer.js */ \"./dist/browser/PathDrawer.js\");\n\nasync function loadPathShape(engine, refresh = true) {\n engine.checkVersion(\"3.9.0\");\n await engine.addShape(new _PathDrawer_js__WEBPACK_IMPORTED_MODULE_0__.PathDrawer(), refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/shape-path/./dist/browser/index.js?\n}");
37
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadPathShape: () => (/* binding */ loadPathShape)\n/* harmony export */ });\nfunction loadPathShape(engine) {\n engine.checkVersion(\"4.0.0-alpha.0\");\n engine.register(async e => {\n const {\n PathDrawer\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_PathDrawer_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./PathDrawer.js */ \"./dist/browser/PathDrawer.js\"));\n e.addShape(new PathDrawer());\n });\n}\n\n//# sourceURL=webpack://@tsparticles/shape-path/./dist/browser/index.js?\n}");
68
38
 
69
- /***/ }),
39
+ /***/ },
70
40
 
71
- /***/ "@tsparticles/engine":
41
+ /***/ "@tsparticles/engine"
72
42
  /*!*********************************************************************************************************************************!*\
73
43
  !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
74
44
  \*********************************************************************************************************************************/
75
- /***/ ((module) => {
45
+ (module) {
76
46
 
77
47
  module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
78
48
 
79
- /***/ })
49
+ /***/ }
80
50
 
81
51
  /******/ });
82
52
  /************************************************************************/
@@ -90,6 +60,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
90
60
  /******/ if (cachedModule !== undefined) {
91
61
  /******/ return cachedModule.exports;
92
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
+ /******/ }
93
69
  /******/ // Create a new module (and put it into the cache)
94
70
  /******/ var module = __webpack_module_cache__[moduleId] = {
95
71
  /******/ // no module.id needed
@@ -104,19 +80,10 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
104
80
  /******/ return module.exports;
105
81
  /******/ }
106
82
  /******/
107
- /************************************************************************/
108
- /******/ /* webpack/runtime/compat get default export */
109
- /******/ (() => {
110
- /******/ // getDefaultExport function for compatibility with non-harmony modules
111
- /******/ __webpack_require__.n = (module) => {
112
- /******/ var getter = module && module.__esModule ?
113
- /******/ () => (module['default']) :
114
- /******/ () => (module);
115
- /******/ __webpack_require__.d(getter, { a: getter });
116
- /******/ return getter;
117
- /******/ };
118
- /******/ })();
83
+ /******/ // expose the modules object (__webpack_modules__)
84
+ /******/ __webpack_require__.m = __webpack_modules__;
119
85
  /******/
86
+ /************************************************************************/
120
87
  /******/ /* webpack/runtime/define property getters */
121
88
  /******/ (() => {
122
89
  /******/ // define getter functions for harmony exports
@@ -129,11 +96,90 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
129
96
  /******/ };
130
97
  /******/ })();
131
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/global */
122
+ /******/ (() => {
123
+ /******/ __webpack_require__.g = (function() {
124
+ /******/ if (typeof globalThis === 'object') return globalThis;
125
+ /******/ try {
126
+ /******/ return this || new Function('return this')();
127
+ /******/ } catch (e) {
128
+ /******/ if (typeof window === 'object') return window;
129
+ /******/ }
130
+ /******/ })();
131
+ /******/ })();
132
+ /******/
132
133
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
133
134
  /******/ (() => {
134
135
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
135
136
  /******/ })();
136
137
  /******/
138
+ /******/ /* webpack/runtime/load script */
139
+ /******/ (() => {
140
+ /******/ var inProgress = {};
141
+ /******/ var dataWebpackPrefix = "@tsparticles/shape-path:";
142
+ /******/ // loadScript function to load a script via script tag
143
+ /******/ __webpack_require__.l = (url, done, key, chunkId) => {
144
+ /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
145
+ /******/ var script, needAttach;
146
+ /******/ if(key !== undefined) {
147
+ /******/ var scripts = document.getElementsByTagName("script");
148
+ /******/ for(var i = 0; i < scripts.length; i++) {
149
+ /******/ var s = scripts[i];
150
+ /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
151
+ /******/ }
152
+ /******/ }
153
+ /******/ if(!script) {
154
+ /******/ needAttach = true;
155
+ /******/ script = document.createElement('script');
156
+ /******/
157
+ /******/ script.charset = 'utf-8';
158
+ /******/ if (__webpack_require__.nc) {
159
+ /******/ script.setAttribute("nonce", __webpack_require__.nc);
160
+ /******/ }
161
+ /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
162
+ /******/
163
+ /******/ script.src = url;
164
+ /******/ }
165
+ /******/ inProgress[url] = [done];
166
+ /******/ var onScriptComplete = (prev, event) => {
167
+ /******/ // avoid mem leaks in IE.
168
+ /******/ script.onerror = script.onload = null;
169
+ /******/ clearTimeout(timeout);
170
+ /******/ var doneFns = inProgress[url];
171
+ /******/ delete inProgress[url];
172
+ /******/ script.parentNode && script.parentNode.removeChild(script);
173
+ /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
174
+ /******/ if(prev) return prev(event);
175
+ /******/ }
176
+ /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
177
+ /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
178
+ /******/ script.onload = onScriptComplete.bind(null, script.onload);
179
+ /******/ needAttach && document.head.appendChild(script);
180
+ /******/ };
181
+ /******/ })();
182
+ /******/
137
183
  /******/ /* webpack/runtime/make namespace object */
138
184
  /******/ (() => {
139
185
  /******/ // define __esModule on exports
@@ -145,6 +191,119 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
145
191
  /******/ };
146
192
  /******/ })();
147
193
  /******/
194
+ /******/ /* webpack/runtime/publicPath */
195
+ /******/ (() => {
196
+ /******/ var scriptUrl;
197
+ /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
198
+ /******/ var document = __webpack_require__.g.document;
199
+ /******/ if (!scriptUrl && document) {
200
+ /******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
201
+ /******/ scriptUrl = document.currentScript.src;
202
+ /******/ if (!scriptUrl) {
203
+ /******/ var scripts = document.getElementsByTagName("script");
204
+ /******/ if(scripts.length) {
205
+ /******/ var i = scripts.length - 1;
206
+ /******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
207
+ /******/ }
208
+ /******/ }
209
+ /******/ }
210
+ /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
211
+ /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
212
+ /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
213
+ /******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
214
+ /******/ __webpack_require__.p = scriptUrl;
215
+ /******/ })();
216
+ /******/
217
+ /******/ /* webpack/runtime/jsonp chunk loading */
218
+ /******/ (() => {
219
+ /******/ // no baseURI
220
+ /******/
221
+ /******/ // object to store loaded and loading chunks
222
+ /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
223
+ /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
224
+ /******/ var installedChunks = {
225
+ /******/ "tsparticles.shape.path": 0
226
+ /******/ };
227
+ /******/
228
+ /******/ __webpack_require__.f.j = (chunkId, promises) => {
229
+ /******/ // JSONP chunk loading for javascript
230
+ /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
231
+ /******/ if(installedChunkData !== 0) { // 0 means "already installed".
232
+ /******/
233
+ /******/ // a Promise means "currently loading".
234
+ /******/ if(installedChunkData) {
235
+ /******/ promises.push(installedChunkData[2]);
236
+ /******/ } else {
237
+ /******/ if(true) { // all chunks have JS
238
+ /******/ // setup Promise in chunk cache
239
+ /******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
240
+ /******/ promises.push(installedChunkData[2] = promise);
241
+ /******/
242
+ /******/ // start chunk loading
243
+ /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
244
+ /******/ // create error before stack unwound to get useful stacktrace later
245
+ /******/ var error = new Error();
246
+ /******/ var loadingEnded = (event) => {
247
+ /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
248
+ /******/ installedChunkData = installedChunks[chunkId];
249
+ /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
250
+ /******/ if(installedChunkData) {
251
+ /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
252
+ /******/ var realSrc = event && event.target && event.target.src;
253
+ /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
254
+ /******/ error.name = 'ChunkLoadError';
255
+ /******/ error.type = errorType;
256
+ /******/ error.request = realSrc;
257
+ /******/ installedChunkData[1](error);
258
+ /******/ }
259
+ /******/ }
260
+ /******/ };
261
+ /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
262
+ /******/ }
263
+ /******/ }
264
+ /******/ }
265
+ /******/ };
266
+ /******/
267
+ /******/ // no prefetching
268
+ /******/
269
+ /******/ // no preloaded
270
+ /******/
271
+ /******/ // no HMR
272
+ /******/
273
+ /******/ // no HMR manifest
274
+ /******/
275
+ /******/ // no on chunks loaded
276
+ /******/
277
+ /******/ // install a JSONP callback for chunk loading
278
+ /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
279
+ /******/ var [chunkIds, moreModules, runtime] = data;
280
+ /******/ // add "moreModules" to the modules object,
281
+ /******/ // then flag all "chunkIds" as loaded and fire callback
282
+ /******/ var moduleId, chunkId, i = 0;
283
+ /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
284
+ /******/ for(moduleId in moreModules) {
285
+ /******/ if(__webpack_require__.o(moreModules, moduleId)) {
286
+ /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
287
+ /******/ }
288
+ /******/ }
289
+ /******/ if(runtime) var result = runtime(__webpack_require__);
290
+ /******/ }
291
+ /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
292
+ /******/ for(;i < chunkIds.length; i++) {
293
+ /******/ chunkId = chunkIds[i];
294
+ /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
295
+ /******/ installedChunks[chunkId][0]();
296
+ /******/ }
297
+ /******/ installedChunks[chunkId] = 0;
298
+ /******/ }
299
+ /******/
300
+ /******/ }
301
+ /******/
302
+ /******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_shape_path"] = this["webpackChunk_tsparticles_shape_path"] || [];
303
+ /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
304
+ /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
305
+ /******/ })();
306
+ /******/
148
307
  /************************************************************************/
149
308
  /******/
150
309
  /******/ // startup
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.shape.path.min.js.LICENSE.txt */
2
- !function(e,a){if("object"==typeof exports&&"object"==typeof module)module.exports=a(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],a);else{var t="object"==typeof exports?a(require("@tsparticles/engine")):a(e.window);for(var s in t)("object"==typeof exports?exports:e)[s]=t[s]}}(this,(e=>(()=>{var a={303:a=>{a.exports=e}},t={};function s(e){var r=t[e];if(void 0!==r)return r.exports;var l=t[e]={exports:{}};return a[e](l,l.exports,s),l.exports}s.d=(e,a)=>{for(var t in a)s.o(a,t)&&!s.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:a[t]})},s.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};s.r(r),s.d(r,{loadPathShape:()=>n});var l,o=s(303);!function(e){e.line="line",e.bezier="bezier",e.quadratic="quadratic",e.arc="arc",e.ellipse="ellipse"}(l||(l={}));class i{constructor(){this.validTypes=["path"]}draw(e){const{context:a,particle:t,radius:s}=e;t.pathData&&function(e,a,t){const s=t.segments[0].values[0];e.moveTo(s.x*a,s.y*a);for(const s of t.segments){const t=s.values[0],r=1,o=2,i=3;switch(s.type){case l.line:e.lineTo(t.x*a,t.y*a);break;case l.bezier:e.bezierCurveTo(s.values[r].x*a,s.values[r].y*a,s.values[o].x*a,s.values[o].y*a,s.values[i].x*a,s.values[i].y*a);break;case l.quadratic:e.quadraticCurveTo(s.values[r].x*a,s.values[r].y*a,s.values[o].x*a,s.values[o].y*a);break;case l.arc:e.arc(t.x*a,t.y*a,s.values[r].x*a,s.values[o].x,s.values[o].y);break;case l.ellipse:e.ellipse(t.x*a,t.y*a,s.values[r].x*a,s.values[r].y*a,s.values[o].x,s.values[i].x,s.values[i].y)}}if(!t.half)return;for(let s=t.segments.length-1;s>=0;s--){const r=t.segments[s],o=r.values[0],i=1,n=2;switch(r.type){case l.line:e.lineTo(o.x*-a,o.y*a);break;case l.bezier:e.bezierCurveTo(-r.values[n].x*a,r.values[n].y*a,-r.values[i].x*a,r.values[i].y*a,o.x*a,o.y*a);break;case l.quadratic:e.quadraticCurveTo(-r.values[i].x*a,r.values[i].y*a,-r.values[n].x*a,r.values[n].y*a);case l.arc:case l.ellipse:}}}(a,s,t.pathData)}particleInit(e,a){const t=a.shapeData;t&&(a.pathData=(0,o.deepExtend)({},t))}}async function n(e,a=!0){e.checkVersion("3.9.0"),await e.addShape(new i,a)}return r})()));
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 a(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,a),r.exports}a.m=o,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((t,r)=>(a.f[r](e,t),t)),[])),a.u=e=>e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/shape-path:",a.l=(e,o,n,i)=>{if(t[e])t[e].push(o);else{var s,p;if(void 0!==n)for(var c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var u=c[l];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+n){s=u;break}}s||(p=!0,(s=document.createElement("script")).charset="utf-8",a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",r+n),s.src=e),t[e]=[o];var d=(r,o)=>{s.onerror=s.onload=null,clearTimeout(f);var n=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),n&&n.forEach((e=>e(o))),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),p&&document.head.appendChild(s)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.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(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={381:0};a.f.j=(t,r)=>{var o=a.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 i=a.p+a.u(t),s=new Error;a.l(i,(r=>{if(a.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+n+": "+i+")",s.name="ChunkLoadError",s.type=n,s.request=i,o[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,n,[i,s,p]=r,c=0;if(i.some((t=>0!==e[t]))){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);if(p)p(a)}for(t&&t(r);c<i.length;c++)n=i[c],a.o(e,n)&&e[n]&&e[n][0](),e[n]=0},r=this.webpackChunk_tsparticles_shape_path=this.webpackChunk_tsparticles_shape_path||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};function s(e){e.checkVersion("4.0.0-alpha.0"),e.register((async e=>{const{PathDrawer:t}=await a.e(237).then(a.bind(a,237));e.addShape(new t)}))}return a.r(i),a.d(i,{loadPathShape:()=>s}),i})()));
@@ -1 +1 @@
1
- /*! tsParticles Path Shape v3.9.0 by Matteo Bruni */
1
+ /*! tsParticles Path Shape v4.0.0-alpha.0 by Matteo Bruni */
@@ -3,5 +3,5 @@ import type { PathParticle } from "./PathParticle.js";
3
3
  export declare class PathDrawer implements IShapeDrawer<PathParticle> {
4
4
  readonly validTypes: readonly ["path"];
5
5
  draw(data: IShapeDrawData<PathParticle>): void;
6
- particleInit(container: Container, particle: PathParticle): void;
6
+ particleInit(_container: Container, particle: PathParticle): void;
7
7
  }
package/types/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import { type Engine } from "@tsparticles/engine";
2
- export declare function loadPathShape(engine: Engine, refresh?: boolean): Promise<void>;
2
+ export declare function loadPathShape(engine: Engine): void;
package/umd/PathDrawer.js CHANGED
@@ -23,7 +23,7 @@
23
23
  }
24
24
  (0, Utils_js_1.drawPath)(context, radius, particle.pathData);
25
25
  }
26
- particleInit(container, particle) {
26
+ particleInit(_container, particle) {
27
27
  const shape = particle.shapeData;
28
28
  if (!shape) {
29
29
  return;
package/umd/Utils.js CHANGED
@@ -12,25 +12,48 @@
12
12
  exports.drawPath = drawPath;
13
13
  const SegmentType_js_1 = require("./SegmentType.js");
14
14
  function drawPath(ctx, radius, path) {
15
- const firstIndex = 0, firstSegment = path.segments[firstIndex], firstValue = firstSegment.values[firstIndex];
15
+ const firstIndex = 0, firstSegment = path.segments[firstIndex];
16
+ if (!firstSegment) {
17
+ return;
18
+ }
19
+ const firstValue = firstSegment.values[firstIndex];
20
+ if (!firstValue) {
21
+ return;
22
+ }
16
23
  ctx.moveTo(firstValue.x * radius, firstValue.y * radius);
17
24
  for (const segment of path.segments) {
18
25
  const value = segment.values[firstIndex], index2 = 1, index3 = 2, index4 = 3;
26
+ if (!value) {
27
+ continue;
28
+ }
29
+ const segmentValue2 = segment.values[index2], segmentValue3 = segment.values[index3], segmentValue4 = segment.values[index4];
19
30
  switch (segment.type) {
20
31
  case SegmentType_js_1.SegmentType.line:
21
32
  ctx.lineTo(value.x * radius, value.y * radius);
22
33
  break;
23
34
  case SegmentType_js_1.SegmentType.bezier:
24
- ctx.bezierCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius, segment.values[index4].x * radius, segment.values[index4].y * radius);
35
+ if (!segmentValue2 || !segmentValue3 || !segmentValue4) {
36
+ break;
37
+ }
38
+ ctx.bezierCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius, segmentValue4.x * radius, segmentValue4.y * radius);
25
39
  break;
26
40
  case SegmentType_js_1.SegmentType.quadratic:
27
- ctx.quadraticCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius);
41
+ if (!segmentValue2 || !segmentValue3) {
42
+ break;
43
+ }
44
+ ctx.quadraticCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius);
28
45
  break;
29
46
  case SegmentType_js_1.SegmentType.arc:
30
- ctx.arc(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index3].x, segment.values[index3].y);
47
+ if (!segmentValue2 || !segmentValue3) {
48
+ break;
49
+ }
50
+ ctx.arc(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue3.x, segmentValue3.y);
31
51
  break;
32
52
  case SegmentType_js_1.SegmentType.ellipse:
33
- ctx.ellipse(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x, segment.values[index4].x, segment.values[index4].y);
53
+ if (!segmentValue2 || !segmentValue3 || !segmentValue4) {
54
+ break;
55
+ }
56
+ ctx.ellipse(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x, segmentValue4.x, segmentValue4.y);
34
57
  }
35
58
  }
36
59
  if (!path.half) {
@@ -38,16 +61,29 @@
38
61
  }
39
62
  const lengthOffset = 1, minLength = 0;
40
63
  for (let i = path.segments.length - lengthOffset; i >= minLength; i--) {
41
- const segment = path.segments[i], value = segment.values[firstIndex], index2 = 1, index3 = 2;
64
+ const segment = path.segments[i];
65
+ if (!segment) {
66
+ continue;
67
+ }
68
+ const value = segment.values[firstIndex], index2 = 1, index3 = 2, segmentValue2 = segment.values[index2], segmentValue3 = segment.values[index3];
42
69
  switch (segment.type) {
43
70
  case SegmentType_js_1.SegmentType.line:
71
+ if (!value) {
72
+ break;
73
+ }
44
74
  ctx.lineTo(value.x * -radius, value.y * radius);
45
75
  break;
46
76
  case SegmentType_js_1.SegmentType.bezier:
47
- ctx.bezierCurveTo(-segment.values[index3].x * radius, segment.values[index3].y * radius, -segment.values[index2].x * radius, segment.values[index2].y * radius, value.x * radius, value.y * radius);
77
+ if (!value || !segmentValue2 || !segmentValue3) {
78
+ break;
79
+ }
80
+ ctx.bezierCurveTo(-segmentValue3.x * radius, segmentValue3.y * radius, -segmentValue2.x * radius, segmentValue2.y * radius, value.x * radius, value.y * radius);
48
81
  break;
49
82
  case SegmentType_js_1.SegmentType.quadratic:
50
- ctx.quadraticCurveTo(-segment.values[index2].x * radius, segment.values[index2].y * radius, -segment.values[index3].x * radius, segment.values[index3].y * radius);
83
+ if (!segmentValue2 || !segmentValue3) {
84
+ break;
85
+ }
86
+ ctx.quadraticCurveTo(-segmentValue2.x * radius, segmentValue2.y * radius, -segmentValue3.x * radius, segmentValue3.y * radius);
51
87
  break;
52
88
  case SegmentType_js_1.SegmentType.arc:
53
89
  case SegmentType_js_1.SegmentType.ellipse:
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", "./PathDrawer.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.loadPathShape = loadPathShape;
13
- const PathDrawer_js_1 = require("./PathDrawer.js");
14
- async function loadPathShape(engine, refresh = true) {
15
- engine.checkVersion("3.9.0");
16
- await engine.addShape(new PathDrawer_js_1.PathDrawer(), refresh);
47
+ function loadPathShape(engine) {
48
+ engine.checkVersion("4.0.0-alpha.0");
49
+ engine.register(async (e) => {
50
+ const { PathDrawer } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./PathDrawer.js"))) : new Promise((resolve_1, reject_1) => { require(["./PathDrawer.js"], resolve_1, reject_1); }).then(__importStar));
51
+ e.addShape(new PathDrawer());
52
+ });
17
53
  }
18
54
  });